xbmc
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ActiveAE::CActiveAEStream Class Reference
Inheritance diagram for ActiveAE::CActiveAEStream:
Inheritance graph
[legend]
Collaboration diagram for ActiveAE::CActiveAEStream:
Collaboration graph
[legend]

Public Member Functions

unsigned int GetSpace () override
 Returns the amount of space available in the stream. More...
 
unsigned int AddData (const uint8_t *const *data, unsigned int offset, unsigned int frames, ExtData *extData) override
 Add planar or interleaved PCM data to the stream. More...
 
double GetDelay () override
 Returns the time in seconds that it will take for the next added packet to be heard from the speakers. More...
 
CAESyncInfo GetSyncInfo () override
 Returns info about audio to clock synchronization. More...
 
bool IsBuffering () override
 Returns if the stream is buffering. More...
 
double GetCacheTime () override
 Returns the time in seconds of the stream's cached audio samples. More...
 
double GetCacheTotal () override
 Returns the total time in seconds of the cache. More...
 
double GetMaxDelay () override
 Returns the total time in seconds of maximum delay. More...
 
void Pause () override
 Pauses the stream playback.
 
void Resume () override
 Resumes the stream after pausing.
 
void Drain (bool wait) override
 Start draining the stream. More...
 
bool IsDraining () override
 Returns true if the is stream draining.
 
bool IsDrained () override
 Returns true if the is stream has finished draining.
 
void Flush () override
 Flush all buffers dropping the audio data.
 
float GetVolume () override
 Return the stream's current volume level. More...
 
float GetReplayGain () override
 Returns the stream's current replay gain factor. More...
 
float GetAmplification () override
 Gets the stream's volume amplification in linear units. More...
 
void SetVolume (float volume) override
 Set the stream's volume level. More...
 
void SetReplayGain (float factor) override
 Sets the stream's replay gain factor, this is used by formats such as MP3 that have attenuation information in their streams. More...
 
void SetAmplification (float amplify) override
 Sets the stream's volume amplification in linear units. More...
 
void SetFFmpegInfo (int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type) override
 Sets the stream ffmpeg information if present. More...
 
unsigned int GetFrameSize () const override
 Returns the size of one audio frame in bytes (channelCount * resolution) More...
 
unsigned int GetChannelCount () const override
 Returns the number of channels the stream is configured to accept. More...
 
unsigned int GetSampleRate () const override
 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() More...
 
enum AEDataFormat GetDataFormat () const override
 Return the data format the stream has been configured with. More...
 
double GetResampleRatio () override
 Return the resample ratio. More...
 
void SetResampleRatio (double ratio) override
 Sets the resample ratio. More...
 
void SetResampleMode (int mode) override
 Sets the resamplling on/ff.
 
void RegisterAudioCallback (IAudioCallback *pCallback) override
 Registers the audio callback to call with each block of data, this is used by Audio Visualizations. More...
 
void UnRegisterAudioCallback () override
 Unregisters the current audio callback.
 
void FadeVolume (float from, float to, unsigned int time) override
 Fade the volume level over the specified time. More...
 
bool IsFading () override
 Returns if a fade is still running. More...
 
void RegisterSlave (IAEStream *stream) override
 Slave a stream to resume when this stream has drained.
 

Protected Member Functions

 CActiveAEStream (AEAudioFormat *format, unsigned int streamid, CActiveAE *ae)
 
void FadingFinished ()
 
void IncFreeBuffers ()
 
void DecFreeBuffers ()
 
void ResetFreeBuffers ()
 
void InitRemapper ()
 
void RemapBuffer ()
 
double CalcResampleRatio (double error)
 
std::chrono::milliseconds GetErrorInterval ()
 

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
 
uint8_t * m_leftoverBuffer
 
int m_leftoverBytes
 
CSampleBufferm_currentBuffer
 
CSoundPacketm_remapBuffer
 
std::unique_ptr< IAEResamplem_remapper
 
double m_lastPts
 
double m_lastPtsJump
 
std::chrono::milliseconds m_errorInterval {1000}
 
std::unique_ptr< CActiveAEBufferPoolm_inputBuffers
 
CActiveAEStreamBuffersm_processingBuffers
 
std::deque< CSampleBuffer * > m_processingSamples
 
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
 

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.

◆ 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.

◆ 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.

◆ 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.

◆ IsBuffering()

bool CActiveAEStream::IsBuffering ( )
overridevirtual

Returns if the stream is buffering.

Returns
True if the stream is buffering

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.

◆ 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.

◆ 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.

◆ 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.


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