Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Audio Engine Stream Class
Class that can be created by the addon in order to be able to transfer audiostream data processed on the addon to Kodi and output it audibly.
More...
Functions | |
kodi::audioengine::CAEStream::CAEStream (AudioEngineFormat &format, unsigned int options=0) | |
Constructs new class to a Kodi IAEStream in the format specified. | |
kodi::audioengine::CAEStream::~CAEStream () | |
Class destructor. | |
unsigned int | kodi::audioengine::CAEStream::GetSpace () |
Returns the amount of space available in the stream. | |
unsigned int | kodi::audioengine::CAEStream::AddData (uint8_t *const *data, unsigned int offset, unsigned int frames, double pts=0, bool hasDownmix=false, double centerMixLevel=1.0) |
Add planar or interleaved PCM data to the stream. | |
double | kodi::audioengine::CAEStream::GetDelay () |
Returns the time in seconds that it will take for the next added packet to be heard from the speakers. | |
bool | kodi::audioengine::CAEStream::IsBuffering () |
Returns if the stream is buffering. | |
double | kodi::audioengine::CAEStream::GetCacheTime () |
Returns the time in seconds of the stream's cached audio samples. Engine buffers excluded. | |
double | kodi::audioengine::CAEStream::GetCacheTotal () |
Returns the total time in seconds of the cache. | |
void | kodi::audioengine::CAEStream::Pause () |
Pauses the stream playback. | |
void | kodi::audioengine::CAEStream::Resume () |
Resumes the stream after pausing. | |
void | kodi::audioengine::CAEStream::Drain (bool wait=true) |
Start draining the stream. | |
bool | kodi::audioengine::CAEStream::IsDraining () |
Returns true if the is stream draining. | |
bool | kodi::audioengine::CAEStream::IsDrained () |
Returns true if the is stream has finished draining. | |
void | kodi::audioengine::CAEStream::Flush () |
Flush all buffers dropping the audio data. | |
float | kodi::audioengine::CAEStream::GetVolume () |
Return the stream's current volume level. | |
void | kodi::audioengine::CAEStream::SetVolume (float volume) |
Set the stream's volume level. | |
float | kodi::audioengine::CAEStream::GetAmplification () |
Gets the stream's volume amplification in linear units. | |
void | kodi::audioengine::CAEStream::SetAmplification (float amplify) |
Sets the stream's volume amplification in linear units. | |
unsigned int | kodi::audioengine::CAEStream::GetFrameSize () const |
Returns the size of one audio frame in bytes (channelCount * resolution). | |
unsigned int | kodi::audioengine::CAEStream::GetChannelCount () const |
Returns the number of channels the stream is configured to accept. | |
unsigned int | kodi::audioengine::CAEStream::GetSampleRate () const |
Returns the stream's sample rate, if the stream is using a dynamic sample rate, this value will NOT reflect any changes made by calls to SetResampleRatio(). | |
AudioEngineDataFormat | kodi::audioengine::CAEStream::GetDataFormat () const |
Return the data format the stream has been configured with. | |
double | kodi::audioengine::CAEStream::GetResampleRatio () |
Return the resample ratio. | |
void | kodi::audioengine::CAEStream::SetResampleRatio (double ratio) |
Sets the resample ratio. | |
Audio Engine Stream Class
Class that can be created by the addon in order to be able to transfer audiostream data processed on the addon to Kodi and output it audibly.
This can create individually several times and performed in different processes simultaneously.
It has the header #include <kodi/AudioEngine.h> be included to enjoy it.
|
inline |
Add planar or interleaved PCM data to the stream.
[in] | data | array of pointers to the planes |
[in] | offset | to frame in frames |
[in] | frames | number of frames |
[in] | pts | [opt] presentation timestamp, default is 0 |
[in] | hasDownmix | [opt] set true if downmix is present, default is false |
[in] | centerMixLevel | [opt] level to mix left and right to center default is 1.0 |
|
inline |
Constructs new class to a Kodi IAEStream in the format specified.
[in] | format | The data format the incoming audio will be in (e.g. AUDIOENGINE_FMT_S16LE) |
[in] | options | [opt] A bit field of stream options (see: enum AudioEngineStreamOptions) |
The following table contains values that can be set with class AudioEngineFormat :
Name | Type | Set call | Get call |
---|---|---|---|
Data format, see AudioEngineDataFormat for available types | enum | SetDataFormat | GetDataFormat |
Sample rate | unsigned int | SetSampleRate | GetSampleRate |
Encoded rate | unsigned int | SetEncodedRate | GetEncodedRate |
Channel layout, see AudioEngineChannel for available types | std::vector<enum AudioEngineChannel> | SetChannelLayout | GetChannelLayout |
Frames amount | unsigned int | SetFramesAmount | GetFramesAmount |
Frame size | unsigned int | SetFrameSize | GetFrameSize |
Further is CompareFormat included to compare this class with another.
**Bit options to pass (on Kodi by IAE::MakeStream
)**
enum AEStreamOptions | Value: | Description: |
---|---|---|
AUDIO_STREAM_FORCE_RESAMPLE | 1 << 0 | Force resample even if rates match |
AUDIO_STREAM_PAUSED | 1 << 1 | Create the stream paused |
AUDIO_STREAM_AUTOSTART | 1 << 2 | Autostart the stream when enough data is buffered |
Example:
Start draining the stream.
[in] | wait | [opt] Wait until drain is finished if set to true, otherwise it returns direct |
|
inline |
Flush all buffers dropping the audio data.
|
inline |
Gets the stream's volume amplification in linear units.
|
inline |
Returns the time in seconds of the stream's cached audio samples. Engine buffers excluded.
|
inline |
Returns the total time in seconds of the cache.
|
inline |
Returns the number of channels the stream is configured to accept.
|
inline |
Return the data format the stream has been configured with.
|
inline |
Returns the time in seconds that it will take for the next added packet to be heard from the speakers.
|
inline |
Returns the size of one audio frame in bytes (channelCount * resolution).
|
inline |
Return the resample ratio.
|
inline |
Returns the stream's sample rate, if the stream is using a dynamic sample rate, this value will NOT reflect any changes made by calls to SetResampleRatio().
|
inline |
Returns the amount of space available in the stream.
|
inline |
Return the stream's current volume level.
|
inline |
Returns if the stream is buffering.
|
inline |
Returns true if the is stream has finished draining.
|
inline |
Returns true if the is stream draining.
|
inline |
Pauses the stream playback.
|
inline |
Resumes the stream after pausing.
|
inline |
Sets the stream's volume amplification in linear units.
[in] | amplify | The volume amplification factor between 1.0 and 1000.0 |
|
inline |
Sets the resample ratio.
[in] | ratio | the new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate()) |
|
inline |
Set the stream's volume level.
[in] | volume | The new volume level between 0.0 and 1.0 |
|
inline |
Class destructor.