Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
ActiveAE::CActiveAEStream Class Reference

#include <ActiveAEStream.h>

Inheritance diagram for ActiveAE::CActiveAEStream:
IAEStream

Public Member Functions

unsigned int GetSpace () override
 
unsigned int AddData (const uint8_t *const *data, unsigned int offset, unsigned int frames, ExtData *extData) override
 
double GetDelay () override
 
CAESyncInfo GetSyncInfo () override
 
bool IsBuffering () override
 
double GetCacheTime () override
 
double GetCacheTotal () override
 
double GetMaxDelay () override
 
void Pause () override
 
void Resume () override
 
void Drain (bool wait) override
 
bool IsDraining () override
 
bool IsDrained () override
 
void Flush () override
 
float GetVolume () override
 
float GetReplayGain () override
 
float GetAmplification () override
 
void SetVolume (float volume) override
 
void SetReplayGain (float factor) override
 
void SetAmplification (float amplify) override
 
void SetFFmpegInfo (int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type) override
 
unsigned int GetFrameSize () const override
 
unsigned int GetChannelCount () const override
 
unsigned int GetSampleRate () const override
 
enum AEDataFormat GetDataFormat () const override
 
double GetResampleRatio () override
 
void SetResampleRatio (double ratio) override
 
void SetResampleMode (int mode) override
 
void RegisterAudioCallback (IAudioCallback *pCallback) override
 
void UnRegisterAudioCallback () override
 
void FadeVolume (float from, float to, unsigned int time) override
 
bool IsFading () override
 
void RegisterSlave (IAEStream *stream) override
 

Protected Member Functions

 CActiveAEStream (AEAudioFormat *format, unsigned int streamid, CActiveAE *ae)
 
 ~CActiveAEStream () override=default
 
void FadingFinished ()
 
void IncFreeBuffers ()
 
void DecFreeBuffers ()
 
void ResetFreeBuffers ()
 
void InitRemapper ()
 
void RemapBuffer ()
 
double CalcResampleRatio (double error)
 
std::chrono::milliseconds GetErrorInterval ()
 
- Protected Member Functions inherited from IAEStream
 IAEStream ()=default
 
virtual ~IAEStream ()=default
 

Protected Attributes

CActiveAEm_activeAE
 
unsigned int m_id
 
AEAudioFormat m_format
 
float m_streamVolume
 
float m_streamRgain
 
float m_streamAmplify
 
double m_streamResampleRatio
 
int m_streamResampleMode
 
unsigned int m_streamSpace
 
bool m_streamDraining
 
bool m_streamDrained
 
bool m_streamFading
 
int m_streamFreeBuffers
 
bool m_streamIsBuffering
 
bool m_streamIsFlushed
 
IAEStreamm_streamSlave
 
CCriticalSection m_streamLock
 
CCriticalSection m_statsLock
 
int m_leftoverBytes
 
CSampleBufferm_currentBuffer
 
std::unique_ptr< CSoundPacketm_remapBuffer
 
std::unique_ptr< IAEResamplem_remapper
 
double m_lastPts
 
double m_lastPtsJump
 
std::chrono::milliseconds m_errorInterval {1000}
 
std::unique_ptr< CActiveAEBufferPoolm_inputBuffers
 
std::unique_ptr< CActiveAEStreamBuffersm_processingBuffers
 
std::deque< CSampleBuffer * > m_processingSamples
 
std::unique_ptr< CActiveAEDataProtocolm_streamPort
 
CEvent m_inMsgEvent
 
bool m_drain
 
bool m_paused
 
bool m_started
 
CAELimiter m_limiter
 
float m_volume
 
float m_rgain
 
float m_amplify
 
float m_bufferedTime
 
int m_fadingSamples
 
float m_fadingBase
 
float m_fadingTarget
 
int m_fadingTime
 
int m_profile
 
int m_resampleMode
 
double m_resampleIntegral
 
double m_clockSpeed
 
enum AVMatrixEncoding m_matrixEncoding
 
enum AVAudioServiceType m_audioServiceType
 
bool m_forceResampler
 
IAEClockCallbackm_pClock
 
CSyncError m_syncError
 
double m_lastSyncError
 
CAESyncInfo::AESyncState m_syncState
 

Friends

class CActiveAE
 
class CEngineStats
 

Constructor & Destructor Documentation

◆ CActiveAEStream()

CActiveAEStream::CActiveAEStream ( AEAudioFormat * format,
unsigned int streamid,
CActiveAE * ae )
protected

◆ ~CActiveAEStream()

ActiveAE::CActiveAEStream::~CActiveAEStream ( )
overrideprotecteddefault

Member Function Documentation

◆ AddData()

unsigned int CActiveAEStream::AddData ( const uint8_t *const * data,
unsigned int offset,
unsigned int frames,
ExtData * extData )
overridevirtual

Add planar or interleaved PCM data to the stream

Parameters
dataarray of pointers to the planes
offsetto frame in frames
framesnumber of frames
ptstimestamp
Returns
The number of frames consumed

Implements IAEStream.

◆ CalcResampleRatio()

double CActiveAEStream::CalcResampleRatio ( double error)
protected

◆ DecFreeBuffers()

void CActiveAEStream::DecFreeBuffers ( )
protected

◆ Drain()

void CActiveAEStream::Drain ( bool wait)
overridevirtual

Start draining the stream

Note
Once called AddData will not consume more data.

Implements IAEStream.

◆ FadeVolume()

void CActiveAEStream::FadeVolume ( float from,
float target,
unsigned int time )
overridevirtual

Fade the volume level over the specified time

Parameters
fromThe volume level to fade from (0.0f-1.0f) - See notes
targetThe volume level to fade to (0.0f-1.0f)
timeThe amount of time in milliseconds for the fade to occur
Note
The from parameter does not set the streams volume, it is only used to calculate the fade time properly

Reimplemented from IAEStream.

◆ FadingFinished()

void ActiveAE::CActiveAEStream::FadingFinished ( )
protected

◆ Flush()

void CActiveAEStream::Flush ( )
overridevirtual

Flush all buffers dropping the audio data

Implements IAEStream.

◆ GetAmplification()

float CActiveAEStream::GetAmplification ( )
overridevirtual

Gets the stream's volume amplification in linear units.

Returns
The volume amplification factor between 1.0 and 1000.0

Implements IAEStream.

◆ GetCacheTime()

double CActiveAEStream::GetCacheTime ( )
overridevirtual

Returns the time in seconds of the stream's cached audio samples. Engine buffers excluded.

Returns
seconds

Implements IAEStream.

◆ GetCacheTotal()

double CActiveAEStream::GetCacheTotal ( )
overridevirtual

Returns the total time in seconds of the cache

Returns
seconds

Implements IAEStream.

◆ GetChannelCount()

unsigned int CActiveAEStream::GetChannelCount ( ) const
overridevirtual

Returns the number of channels the stream is configured to accept

Returns
The channel count

Implements IAEStream.

◆ GetDataFormat()

enum AEDataFormat CActiveAEStream::GetDataFormat ( ) const
overridevirtual

Return the data format the stream has been configured with

Returns
The stream's data format (eg, AE_FMT_S16LE)

Implements IAEStream.

◆ GetDelay()

double CActiveAEStream::GetDelay ( )
overridevirtual

Returns the time in seconds that it will take for the next added packet to be heard from the speakers.

Returns
seconds

Implements IAEStream.

◆ GetErrorInterval()

std::chrono::milliseconds CActiveAEStream::GetErrorInterval ( )
protected

◆ GetFrameSize()

unsigned int CActiveAEStream::GetFrameSize ( ) const
overridevirtual

Returns the size of one audio frame in bytes (channelCount * resolution)

Returns
The size in bytes of one frame

Implements IAEStream.

◆ GetMaxDelay()

double CActiveAEStream::GetMaxDelay ( )
overridevirtual

Returns the total time in seconds of maximum delay

Returns
seconds

Implements IAEStream.

◆ GetReplayGain()

float CActiveAEStream::GetReplayGain ( )
overridevirtual

Returns the stream's current replay gain factor

Returns
The replay gain factor between 0.0 and 1.0

Implements IAEStream.

◆ GetResampleRatio()

double CActiveAEStream::GetResampleRatio ( )
overridevirtual

Return the resample ratio

Note
This will return an undefined value if the stream is not resampling
Returns
the current resample ratio or undefined if the stream is not resampling

Implements IAEStream.

◆ GetSampleRate()

unsigned int CActiveAEStream::GetSampleRate ( ) const
overridevirtual

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()

Returns
The stream's sample rate (eg, 48000)

Implements IAEStream.

◆ GetSpace()

unsigned int CActiveAEStream::GetSpace ( )
overridevirtual

Returns the amount of space available in the stream

Returns
The number of bytes AddData will consume

Implements IAEStream.

◆ GetSyncInfo()

CAESyncInfo CActiveAEStream::GetSyncInfo ( )
overridevirtual

Returns info about audio to clock synchronization

Returns
CAESyncInfo

Implements IAEStream.

◆ GetVolume()

float CActiveAEStream::GetVolume ( )
overridevirtual

Return the stream's current volume level

Returns
The volume level between 0.0 and 1.0

Implements IAEStream.

◆ IncFreeBuffers()

void CActiveAEStream::IncFreeBuffers ( )
protected

◆ InitRemapper()

void CActiveAEStream::InitRemapper ( )
protected

◆ IsBuffering()

bool CActiveAEStream::IsBuffering ( )
overridevirtual

Returns if the stream is buffering

Returns
True if the stream is buffering

Implements IAEStream.

◆ IsDrained()

bool CActiveAEStream::IsDrained ( )
overridevirtual

Returns true if the is stream has finished draining

Implements IAEStream.

◆ IsDraining()

bool CActiveAEStream::IsDraining ( )
overridevirtual

Returns true if the is stream draining

Implements IAEStream.

◆ IsFading()

bool CActiveAEStream::IsFading ( )
overridevirtual

Returns if a fade is still running

Returns
true if a fade is in progress, otherwise false

Reimplemented from IAEStream.

◆ Pause()

void CActiveAEStream::Pause ( )
overridevirtual

Pauses the stream playback

Implements IAEStream.

◆ RegisterAudioCallback()

void CActiveAEStream::RegisterAudioCallback ( IAudioCallback * pCallback)
overridevirtual

Registers the audio callback to call with each block of data, this is used by Audio Visualizations

Warning
Currently the callbacks require stereo float data in blocks of 512 samples, any deviation from this may crash XBMC, or cause junk to be rendered
Parameters
pCallbackThe callback

Implements IAEStream.

◆ RegisterSlave()

void CActiveAEStream::RegisterSlave ( IAEStream * stream)
overridevirtual

Slave a stream to resume when this stream has drained

Implements IAEStream.

◆ RemapBuffer()

void CActiveAEStream::RemapBuffer ( )
protected

◆ ResetFreeBuffers()

void CActiveAEStream::ResetFreeBuffers ( )
protected

◆ Resume()

void CActiveAEStream::Resume ( )
overridevirtual

Resumes the stream after pausing

Implements IAEStream.

◆ SetAmplification()

void CActiveAEStream::SetAmplification ( float amplify)
overridevirtual

Sets the stream's volume amplification in linear units.

Parameters
Thevolume amplification factor between 1.0 and 1000.0

Implements IAEStream.

◆ SetFFmpegInfo()

void CActiveAEStream::SetFFmpegInfo ( int profile,
enum AVMatrixEncoding matrix_encoding,
enum AVAudioServiceType audio_service_type )
overridevirtual

Sets the stream ffmpeg information if present.

  • Parameters
    profile
    matrix_encoding
    audio_service_type

Implements IAEStream.

◆ SetReplayGain()

void CActiveAEStream::SetReplayGain ( float factor)
overridevirtual

Sets the stream's replay gain factor, this is used by formats such as MP3 that have attenuation information in their streams

Parameters
factorThe replay gain factor

Implements IAEStream.

◆ SetResampleMode()

void CActiveAEStream::SetResampleMode ( int mode)
overridevirtual

Sets the resamplling on/ff

Implements IAEStream.

◆ SetResampleRatio()

void CActiveAEStream::SetResampleRatio ( double ratio)
overridevirtual

Sets the resample ratio

Note
This function may return false if the stream is not resampling, if you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option
Parameters
ratiothe new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate())

Implements IAEStream.

◆ SetVolume()

void CActiveAEStream::SetVolume ( float volume)
overridevirtual

Set the stream's volume level

Parameters
volumeThe new volume level between 0.0 and 1.0

Implements IAEStream.

◆ UnRegisterAudioCallback()

void CActiveAEStream::UnRegisterAudioCallback ( )
overridevirtual

Unregisters the current audio callback

Implements IAEStream.

Friends And Related Symbol Documentation

◆ CActiveAE

friend class CActiveAE
friend

◆ CEngineStats

friend class CEngineStats
friend

Member Data Documentation

◆ m_activeAE

CActiveAE* ActiveAE::CActiveAEStream::m_activeAE
protected

◆ m_amplify

float ActiveAE::CActiveAEStream::m_amplify
protected

◆ m_audioServiceType

enum AVAudioServiceType ActiveAE::CActiveAEStream::m_audioServiceType
protected

◆ m_bufferedTime

float ActiveAE::CActiveAEStream::m_bufferedTime
protected

◆ m_clockSpeed

double ActiveAE::CActiveAEStream::m_clockSpeed
protected

◆ m_currentBuffer

CSampleBuffer* ActiveAE::CActiveAEStream::m_currentBuffer
protected

◆ m_drain

bool ActiveAE::CActiveAEStream::m_drain
protected

◆ m_errorInterval

std::chrono::milliseconds ActiveAE::CActiveAEStream::m_errorInterval {1000}
protected

◆ m_fadingBase

float ActiveAE::CActiveAEStream::m_fadingBase
protected

◆ m_fadingSamples

int ActiveAE::CActiveAEStream::m_fadingSamples
protected

◆ m_fadingTarget

float ActiveAE::CActiveAEStream::m_fadingTarget
protected

◆ m_fadingTime

int ActiveAE::CActiveAEStream::m_fadingTime
protected

◆ m_forceResampler

bool ActiveAE::CActiveAEStream::m_forceResampler
protected

◆ m_format

AEAudioFormat ActiveAE::CActiveAEStream::m_format
protected

◆ m_id

unsigned int ActiveAE::CActiveAEStream::m_id
protected

◆ m_inMsgEvent

CEvent ActiveAE::CActiveAEStream::m_inMsgEvent
protected

◆ m_inputBuffers

std::unique_ptr<CActiveAEBufferPool> ActiveAE::CActiveAEStream::m_inputBuffers
protected

◆ m_lastPts

double ActiveAE::CActiveAEStream::m_lastPts
protected

◆ m_lastPtsJump

double ActiveAE::CActiveAEStream::m_lastPtsJump
protected

◆ m_lastSyncError

double ActiveAE::CActiveAEStream::m_lastSyncError
protected

◆ m_leftoverBytes

int ActiveAE::CActiveAEStream::m_leftoverBytes
protected

◆ m_limiter

CAELimiter ActiveAE::CActiveAEStream::m_limiter
protected

◆ m_matrixEncoding

enum AVMatrixEncoding ActiveAE::CActiveAEStream::m_matrixEncoding
protected

◆ m_paused

bool ActiveAE::CActiveAEStream::m_paused
protected

◆ m_pClock

IAEClockCallback* ActiveAE::CActiveAEStream::m_pClock
protected

◆ m_processingBuffers

std::unique_ptr<CActiveAEStreamBuffers> ActiveAE::CActiveAEStream::m_processingBuffers
protected

◆ m_processingSamples

std::deque<CSampleBuffer*> ActiveAE::CActiveAEStream::m_processingSamples
protected

◆ m_profile

int ActiveAE::CActiveAEStream::m_profile
protected

◆ m_remapBuffer

std::unique_ptr<CSoundPacket> ActiveAE::CActiveAEStream::m_remapBuffer
protected

◆ m_remapper

std::unique_ptr<IAEResample> ActiveAE::CActiveAEStream::m_remapper
protected

◆ m_resampleIntegral

double ActiveAE::CActiveAEStream::m_resampleIntegral
protected

◆ m_resampleMode

int ActiveAE::CActiveAEStream::m_resampleMode
protected

◆ m_rgain

float ActiveAE::CActiveAEStream::m_rgain
protected

◆ m_started

bool ActiveAE::CActiveAEStream::m_started
protected

◆ m_statsLock

CCriticalSection ActiveAE::CActiveAEStream::m_statsLock
protected

◆ m_streamAmplify

float ActiveAE::CActiveAEStream::m_streamAmplify
protected

◆ m_streamDrained

bool ActiveAE::CActiveAEStream::m_streamDrained
protected

◆ m_streamDraining

bool ActiveAE::CActiveAEStream::m_streamDraining
protected

◆ m_streamFading

bool ActiveAE::CActiveAEStream::m_streamFading
protected

◆ m_streamFreeBuffers

int ActiveAE::CActiveAEStream::m_streamFreeBuffers
protected

◆ m_streamIsBuffering

bool ActiveAE::CActiveAEStream::m_streamIsBuffering
protected

◆ m_streamIsFlushed

bool ActiveAE::CActiveAEStream::m_streamIsFlushed
protected

◆ m_streamLock

CCriticalSection ActiveAE::CActiveAEStream::m_streamLock
protected

◆ m_streamPort

std::unique_ptr<CActiveAEDataProtocol> ActiveAE::CActiveAEStream::m_streamPort
protected

◆ m_streamResampleMode

int ActiveAE::CActiveAEStream::m_streamResampleMode
protected

◆ m_streamResampleRatio

double ActiveAE::CActiveAEStream::m_streamResampleRatio
protected

◆ m_streamRgain

float ActiveAE::CActiveAEStream::m_streamRgain
protected

◆ m_streamSlave

IAEStream* ActiveAE::CActiveAEStream::m_streamSlave
protected

◆ m_streamSpace

unsigned int ActiveAE::CActiveAEStream::m_streamSpace
protected

◆ m_streamVolume

float ActiveAE::CActiveAEStream::m_streamVolume
protected

◆ m_syncError

CSyncError ActiveAE::CActiveAEStream::m_syncError
protected

◆ m_syncState

CAESyncInfo::AESyncState ActiveAE::CActiveAEStream::m_syncState
protected

◆ m_volume

float ActiveAE::CActiveAEStream::m_volume
protected

The documentation for this class was generated from the following files: