Twitch SDK (Internal)
iaudioencoder.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
13 
14 namespace ttv
15 {
16  namespace broadcast
17  {
18  class IFrameWriter;
19  class IAudioEncoder;
20  class AudioFrame;
21  struct AudioParams;
22  }
23 }
24 
25 
30 {
31  AudioParams();
32 
33  uint32_t numInputAudioLayers; // The number of audio capturers that will be submitting audio to the mixer.
34  uint32_t numChannels; // The number of audio channels.
35  uint32_t encodedSampleRate; // The samples per second that should come out of the audio encoder.
36 };
37 
38 
46 {
47 public:
48  IAudioEncoder();
49  virtual ~IAudioEncoder();
50 
51 public:
52  virtual TTV_ErrorCode SetFrameWriter(const std::shared_ptr<IFrameWriter>& frameWriter) = 0;
53  virtual TTV_ErrorCode GetAudioEncodingFormat(AudioFormat& result) = 0;
57  virtual std::string GetName() const = 0;
58  virtual TTV_ErrorCode Initialize() = 0;
59  virtual TTV_ErrorCode Start(uint32_t streamIndex, const AudioParams& audioParams) = 0;
64  virtual TTV_ErrorCode GetNumInputSamplesPerEncodeFrame(uint32_t& result) = 0;
65  virtual TTV_ErrorCode Stop() = 0;
66  virtual TTV_ErrorCode Shutdown() = 0;
67 
71  virtual TTV_ErrorCode SubmitFrame(const std::shared_ptr<AudioFrame>& audioFrame) = 0;
75  template <typename T> bool SupportsReceiverProtocol() const { return SupportsReceiverProtocol(T::GetReceiverTypeId()); }
79  virtual bool SupportsReceiverProtocol(IAudioFrameReceiver::ReceiverTypeId typeId) const = 0;
83  virtual std::shared_ptr<IAudioFrameReceiver> GetReceiverImplementation(IAudioFrameReceiver::ReceiverTypeId typeId) = 0;
84 };
uint32_t numInputAudioLayers
Definition: iaudioencoder.h:33
uint32_t encodedSampleRate
Definition: iaudioencoder.h:35
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
Definition: iaudioencoder.h:29
uint32_t numChannels
Definition: iaudioencoder.h:34
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
bool SupportsReceiverProtocol() const
Definition: iaudioencoder.h:75
size_t ReceiverTypeId
Definition: iaudioframereceiver.h:28
Definition: iaudioencoder.h:45
AudioFormat
Definition: broadcasttypes.h:166