MythTV  0.28pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
AudioOutputBase Class Referenceabstract

#include <audiooutputbase.h>

Inheritance diagram for AudioOutputBase:
Inheritance graph
[legend]
Collaboration diagram for AudioOutputBase:
Collaboration graph
[legend]

Public Member Functions

const char * quality_string (int q)
 
 AudioOutputBase (const AudioSettings &settings)
 
virtual ~AudioOutputBase ()
 Destructor. More...
 
AudioOutputSettingsGetOutputSettingsCleaned (bool digital=true)
 Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3, DTS, E-AC3 and TrueHD) More...
 
AudioOutputSettingsGetOutputSettingsUsers (bool digital=false)
 Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3, DTS, E-AC3 and TrueHD) as well as the user settings. More...
 
virtual void Reconfigure (const AudioSettings &settings)
 (Re)Configure AudioOutputBase More...
 
virtual void SetEffDsp (int dsprate)
 Set the effective DSP rate. More...
 
virtual void SetStretchFactor (float factor)
 Set the timestretch factor. More...
 
virtual float GetStretchFactor (void) const
 Get the timetretch factor. More...
 
virtual int GetChannels (void) const
 
virtual AudioFormat GetFormat (void) const
 
virtual int GetBytesPerFrame (void) const
 
virtual bool CanPassthrough (int samplerate, int channels, int codec, int profile) const
 Test if we can output digital audio and if sample rate is supported. More...
 
virtual bool CanDownmix (void) const
 
virtual bool IsUpmixing (void)
 Source is currently being upmixed. More...
 
virtual bool ToggleUpmix (void)
 Toggle between stereo and upmixed 5.1 if the source material is stereo. More...
 
virtual bool CanUpmix (void)
 Upmixing of the current source is available if requested. More...
 
virtual bool CanProcess (AudioFormat fmt)
 CanProcess argument: AudioFormat return true if class can handle AudioFormat All AudioOutput derivative must be able to handle S16. More...
 
virtual uint32_t CanProcess (void)
 CanProcess return bitmask of all AudioFormat handled All AudioOutput derivative must be able to handle S16. More...
 
virtual void Reset (void)
 Reset the audiobuffer, timecode and mythmusic visualisation. More...
 
void SetSWVolume (int new_volume, bool save)
 Set the volume for software volume control. More...
 
int GetSWVolume (void)
 Get the volume for software volume control. More...
 
virtual bool AddFrames (void *buffer, int frames, int64_t timecode)
 Add frames to the audiobuffer and perform any required processing. More...
 
virtual bool AddData (void *buffer, int len, int64_t timecode, int frames)
 Add data to the audiobuffer and perform any required processing. More...
 
virtual bool NeedDecodingBeforePassthrough () const
 NeedDecodingBeforePassthrough: returns true if AudioOutput class can determine the length in millisecond of native audio frames bitstreamed passed to AddData. More...
 
virtual int64_t LengthLastData (void) const
 LengthLastData: returns the length of the last data added in millisecond. More...
 
virtual void SetTimecode (int64_t timecode)
 Set the timecode of the samples most recently added to the audiobuffer. More...
 
virtual bool IsPaused (void) const
 
virtual void Pause (bool paused)
 
void PauseUntilBuffered (void)
 
virtual void Drain (void)
 Block until all available frames have been written to the device. More...
 
virtual int64_t GetAudiotime (void)
 Calculate the timecode of the samples that are about to become audible. More...
 
virtual int64_t GetAudioBufferedTime (void)
 Get the difference in timecode between the samples that are about to become audible and the samples most recently added to the audiobuffer, i.e. More...
 
virtual void Status (void)
 Report status via an OutputEvent. More...
 
virtual void SetSourceBitrate (int rate)
 Set the bitrate of the source material, reported in periodic OutputEvents. More...
 
virtual void GetBufferStatus (uint &fill, uint &total)
 Fill in the number of bytes in the audiobuffer and the total size of the audiobuffer. More...
 
virtual void bufferOutputData (bool y)
 
virtual int readOutputData (unsigned char *read_buffer, int max_length)
 
- Public Member Functions inherited from MThread
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (unsigned long time=ULONG_MAX)
 Wait for the MThread to exit, with a maximum timeout. More...
 

Static Public Attributes

static const uint kAudioSRCInputSize = 16384
 
static const uint kAudioRingBufferSize = 3072000u
 Audio Buffer Size – should be divisible by 32,24,16,12,10,8,6,4,2.. More...
 
- Static Public Attributes inherited from MThread
static const int kDefaultStartTimeout
 

Protected Types

enum  { QUALITY_DISABLED = -1, QUALITY_LOW = 0, QUALITY_MEDIUM = 1, QUALITY_HIGH = 2 }
 

Protected Member Functions

void InitSettings (const AudioSettings &settings)
 
virtual bool OpenDevice (void)=0
 
virtual void CloseDevice (void)=0
 
virtual void WriteAudio (uchar *aubuf, int size)=0
 
virtual int GetBufferedOnSoundcard (void) const =0
 Return the size in bytes of frames currently in the audio buffer adjusted with the audio playback latency. More...
 
virtual AudioOutputSettingsGetOutputSettings (bool digital)
 
void KillAudio (void)
 Kill the output thread and cleanup. More...
 
virtual bool StartOutputThread (void)
 
virtual void StopOutputThread (void)
 
int GetAudioData (uchar *buffer, int buf_size, bool fill_buffer, volatile uint *local_raud=NULL)
 Copy frames from the audiobuffer into the buffer provided. More...
 
void OutputAudioLoop (void)
 Run in the output thread, write frames to the output device as they become available and there's space in the device buffer to write them. More...
 
virtual void run ()
 Main routine for the output thread. More...
 
int CheckFreeSpace (int &frames)
 Check that there's enough space in the audiobuffer to write the provided number of frames. More...
 
int audiolen ()
 Get the number of bytes in the audiobuffer. More...
 
int audiofree ()
 Get the free space in the audiobuffer in bytes. More...
 
int audioready ()
 Get the scaled number of bytes in the audiobuffer, i.e. More...
 
void SetStretchFactorLocked (float factor)
 Set the timestretch factor. More...
 
int GetBaseAudBufTimeCode () const
 
- Protected Member Functions inherited from AudioOutput
void Error (const QString &msg)
 
void SilentError (const QString &msg)
 
void Warn (const QString &msg)
 
void ClearError (void)
 
void ClearWarning (void)
 
- Protected Member Functions inherited from VolumeBase
virtual int GetVolumeChannel (int channel) const =0
 
virtual void SetVolumeChannel (int channel, int volume)=0
 
void UpdateVolume (void)
 
void SyncVolume (void)
 
void SetChannels (int new_channels)
 
- Protected Member Functions inherited from OutputListeners
void error (const QString &e)
 
void dispatchVisual (uchar *b, unsigned long b_len, unsigned long written, int chan, int prec)
 
void prepareVisuals ()
 
- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 

Protected Attributes

int channels
 
int codec
 
int bytes_per_frame
 
int output_bytes_per_frame
 
AudioFormat format
 
AudioFormat output_format
 
int samplerate
 
int effdsp
 
int fragment_size
 
long soundcard_buffer_size
 
QString main_device
 
QString passthru_device
 
bool m_discretedigital
 
bool passthru
 
bool enc
 
bool reenc
 
float stretchfactor
 
int eff_stretchfactor
 
AudioOutputSource source
 
bool killaudio
 
bool pauseaudio
 
bool actually_paused
 
bool was_paused
 
bool unpause_when_ready
 
bool set_initial_vol
 
bool buffer_output_data_for_use
 
int configured_channels
 
int max_channels
 
int src_quality
 
- Protected Attributes inherited from AudioOutput
QString lastError
 
QString lastWarn
 
bool pulsewassuspended
 
- Protected Attributes inherited from VolumeBase
bool internal_vol
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread
 
QRunnable * m_runnable
 
bool m_prolog_executed
 
bool m_epilog_executed
 

Private Member Functions

bool SetupPassthrough (int codec, int codec_profile, int &samplerate_tmp, int &channels_tmp)
 
AudioOutputSettingsOutputSettings (bool digital=true)
 
int CopyWithUpmix (char *buffer, int frames, uint &org_waud)
 Copy frames into the audiobuffer, upmixing en route if necessary. More...
 
void SetAudiotime (int frames, int64_t timecode)
 Set the timecode of the top of the ringbuffer Exclude all other processing elements as they dont vary between AddData calls. More...
 

Private Attributes

AudioOutputSettingsoutput_settingsraw
 
AudioOutputSettingsoutput_settings
 
AudioOutputSettingsoutput_settingsdigitalraw
 
AudioOutputSettingsoutput_settingsdigital
 
bool need_resampler
 
SRC_STATE * src_ctx
 
soundtouch::SoundTouchpSoundStretch
 
AudioOutputDigitalEncoderencoder
 
FreeSurroundupmixer
 
int source_channels
 
int source_samplerate
 
int source_bytes_per_frame
 
bool upmix_default
 
bool needs_upmix
 
bool needs_downmix
 
int surround_mode
 
float old_stretchfactor
 
int volume
 
QString volumeControl
 
bool processing
 
int64_t frames_buffered
 
bool audio_thread_exists
 
QMutex audio_buflock
 Writes to the audiobuffer, reconfigures and audiobuffer resets can only take place while holding this lock. More...
 
QMutex avsync_lock
 must hold avsync_lock to read or write 'audiotime' and 'audiotime_updated' More...
 
int64_t audiotime
 timecode of audio leaving the soundcard (same units as timecodes) More...
 
volatile uint raud
 Audio circular buffer. More...
 
volatile uint waud
 
int64_t audbuf_timecode
 timecode of audio most recently placed into buffer More...
 
AsyncLooseLock reset_active
 
QMutex killAudioLock
 
long current_seconds
 
long source_bitrate
 
float * src_in
 
SRC_DATA src_data
 
uint memory_corruption_test0
 
float src_in_buf [kAudioSRCInputSize+16]
 
uint memory_corruption_test1
 
float * src_out
 
int kAudioSRCOutputSize
 
uint memory_corruption_test2
 
uchar audiobuffer [kAudioRingBufferSize]
 main audio buffer More...
 
uint memory_corruption_test3
 
uint m_configure_succeeded
 
int64_t m_length_last_data
 
SPDIFEncoderm_spdifenc
 
bool m_forcedprocessing
 
int m_previousbpf
 

Additional Inherited Members

- Static Public Member Functions inherited from VolumeBase
static MuteState NextMuteState (MuteState)
 
- Static Public Member Functions inherited from MThread
static void ThreadSetup (const QString &)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 
- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void sleep (unsigned long time)
 
static void msleep (unsigned long time)
 
static void usleep (unsigned long time)
 

Detailed Description

Definition at line 54 of file audiooutputbase.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
QUALITY_DISABLED 
QUALITY_LOW 
QUALITY_MEDIUM 
QUALITY_HIGH 

Definition at line 200 of file audiooutputbase.h.

Constructor & Destructor Documentation

AudioOutputBase::AudioOutputBase ( const AudioSettings settings)

Definition at line 47 of file audiooutputbase.cpp.

AudioOutputBase::~AudioOutputBase ( )
virtual

Destructor.

You must kill the output thread via KillAudio() prior to destruction

Definition at line 132 of file audiooutputbase.cpp.

Member Function Documentation

const char * AudioOutputBase::quality_string ( int  q)

Definition at line 35 of file audiooutputbase.cpp.

Referenced by AudioOutputBase(), and Reconfigure().

AudioOutputSettings * AudioOutputBase::GetOutputSettingsCleaned ( bool  digital = true)
virtual

Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3, DTS, E-AC3 and TrueHD)

Reimplemented from AudioOutput.

Definition at line 192 of file audiooutputbase.cpp.

Referenced by GetOutputSettingsUsers().

AudioOutputSettings * AudioOutputBase::GetOutputSettingsUsers ( bool  digital = false)
virtual

Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3, DTS, E-AC3 and TrueHD) as well as the user settings.

Reimplemented from AudioOutput.

Definition at line 222 of file audiooutputbase.cpp.

Referenced by InitSettings().

void AudioOutputBase::Reconfigure ( const AudioSettings orig_settings)
virtual
void AudioOutputBase::SetEffDsp ( int  dsprate)
virtual

Set the effective DSP rate.

Equal to 100 * samples per second NuppelVideo sets this every sync frame to achieve av sync

Implements AudioOutput.

Definition at line 984 of file audiooutputbase.cpp.

void AudioOutputBase::SetStretchFactor ( float  factor)
virtual

Set the timestretch factor.

Reimplemented from AudioOutput.

Definition at line 379 of file audiooutputbase.cpp.

float AudioOutputBase::GetStretchFactor ( void  ) const
virtual

Get the timetretch factor.

Reimplemented from AudioOutput.

Definition at line 388 of file audiooutputbase.cpp.

virtual int AudioOutputBase::GetChannels ( void  ) const
inlinevirtual

Reimplemented from AudioOutput.

Definition at line 73 of file audiooutputbase.h.

virtual AudioFormat AudioOutputBase::GetFormat ( void  ) const
inlinevirtual

Reimplemented from AudioOutput.

Definition at line 74 of file audiooutputbase.h.

virtual int AudioOutputBase::GetBytesPerFrame ( void  ) const
inlinevirtual

Reimplemented from AudioOutput.

Definition at line 75 of file audiooutputbase.h.

bool AudioOutputBase::CanPassthrough ( int  samplerate,
int  channels,
int  codec,
int  profile 
) const
virtual

Test if we can output digital audio and if sample rate is supported.

Reimplemented from AudioOutput.

Definition at line 247 of file audiooutputbase.cpp.

virtual bool AudioOutputBase::CanDownmix ( void  ) const
inlinevirtual

Reimplemented from AudioOutput.

Definition at line 79 of file audiooutputbase.h.

bool AudioOutputBase::IsUpmixing ( void  )
virtual

Source is currently being upmixed.

Reimplemented from AudioOutput.

Definition at line 396 of file audiooutputbase.cpp.

Referenced by ToggleUpmix().

bool AudioOutputBase::ToggleUpmix ( void  )
virtual

Toggle between stereo and upmixed 5.1 if the source material is stereo.

Reimplemented from AudioOutput.

Definition at line 404 of file audiooutputbase.cpp.

bool AudioOutputBase::CanUpmix ( void  )
virtual

Upmixing of the current source is available if requested.

Reimplemented from AudioOutput.

Definition at line 421 of file audiooutputbase.cpp.

virtual bool AudioOutputBase::CanProcess ( AudioFormat  fmt)
inlinevirtual

CanProcess argument: AudioFormat return true if class can handle AudioFormat All AudioOutput derivative must be able to handle S16.

Reimplemented from AudioOutput.

Definition at line 83 of file audiooutputbase.h.

virtual uint32_t AudioOutputBase::CanProcess ( void  )
inlinevirtual

CanProcess return bitmask of all AudioFormat handled All AudioOutput derivative must be able to handle S16.

Reimplemented from AudioOutput.

Definition at line 84 of file audiooutputbase.h.

void AudioOutputBase::Reset ( void  )
virtual

Reset the audiobuffer, timecode and mythmusic visualisation.

Implements AudioOutput.

Reimplemented in AudioOutputNULL.

Definition at line 936 of file audiooutputbase.cpp.

Referenced by PauseUntilBuffered(), and AudioOutputNULL::Reset().

void AudioOutputBase::SetSWVolume ( int  new_volume,
bool  save 
)
virtual

Set the volume for software volume control.

Implements VolumeBase.

Definition at line 1158 of file audiooutputbase.cpp.

int AudioOutputBase::GetSWVolume ( void  )
virtual

Get the volume for software volume control.

Implements VolumeBase.

Definition at line 1168 of file audiooutputbase.cpp.

bool AudioOutputBase::AddFrames ( void in_buffer,
int  in_frames,
int64_t  timecode 
)
virtual

Add frames to the audiobuffer and perform any required processing.

Returns false if there's not enough space right now

Implements AudioOutput.

Definition at line 1303 of file audiooutputbase.cpp.

bool AudioOutputBase::AddData ( void in_buffer,
int  in_len,
int64_t  timecode,
int  frames 
)
virtual

Add data to the audiobuffer and perform any required processing.

Returns false if there's not enough space right now

Implements AudioOutput.

Definition at line 1315 of file audiooutputbase.cpp.

Referenced by AddFrames().

virtual bool AudioOutputBase::NeedDecodingBeforePassthrough ( void  ) const
inlinevirtual

NeedDecodingBeforePassthrough: returns true if AudioOutput class can determine the length in millisecond of native audio frames bitstreamed passed to AddData.

If false, LengthLastData method must be implemented

Reimplemented from AudioOutput.

Definition at line 98 of file audiooutputbase.h.

virtual int64_t AudioOutputBase::LengthLastData ( void  ) const
inlinevirtual

LengthLastData: returns the length of the last data added in millisecond.

This function must be implemented if NeedDecodingBeforePassthrough returned false

Reimplemented from AudioOutput.

Definition at line 99 of file audiooutputbase.h.

void AudioOutputBase::SetTimecode ( int64_t  timecode)
virtual

Set the timecode of the samples most recently added to the audiobuffer.

Used by mythmusic for seeking since it doesn't provide timecodes to AddData()

Implements AudioOutput.

Definition at line 972 of file audiooutputbase.cpp.

virtual bool AudioOutputBase::IsPaused ( void  ) const
inlinevirtual

Implements AudioOutput.

Definition at line 102 of file audiooutputbase.h.

void AudioOutputBase::Pause ( bool  paused)
virtual

Implements AudioOutput.

Definition at line 915 of file audiooutputbase.cpp.

Referenced by AddData(), and PauseUntilBuffered().

void AudioOutputBase::PauseUntilBuffered ( void  )
virtual

Implements AudioOutput.

Definition at line 926 of file audiooutputbase.cpp.

void AudioOutputBase::Drain ( void  )
virtual

Block until all available frames have been written to the device.

Implements AudioOutput.

Reimplemented in AudioOutputPulseAudio.

Definition at line 1814 of file audiooutputbase.cpp.

Referenced by AudioOutputPulseAudio::Drain().

int64_t AudioOutputBase::GetAudiotime ( void  )
virtual

Calculate the timecode of the samples that are about to become audible.

Implements AudioOutput.

Reimplemented in AudioOutputCA.

Definition at line 1030 of file audiooutputbase.cpp.

Referenced by GetAudioBufferedTime(), OutputAudioLoop(), SetAudiotime(), and Status().

int64_t AudioOutputBase::GetAudioBufferedTime ( void  )
virtual

Get the difference in timecode between the samples that are about to become audible and the samples most recently added to the audiobuffer, i.e.

the time in ms representing the sum total of buffered samples

Reimplemented from AudioOutput.

Definition at line 1146 of file audiooutputbase.cpp.

void AudioOutputBase::Status ( void  )
virtual

Report status via an OutputEvent.

Definition at line 1603 of file audiooutputbase.cpp.

Referenced by AudioOutputJACK::JackCallback(), and OutputAudioLoop().

void AudioOutputBase::SetSourceBitrate ( int  rate)
virtual

Set the bitrate of the source material, reported in periodic OutputEvents.

Reimplemented from AudioOutput.

Definition at line 306 of file audiooutputbase.cpp.

void AudioOutputBase::GetBufferStatus ( uint fill,
uint total 
)
virtual

Fill in the number of bytes in the audiobuffer and the total size of the audiobuffer.

Reimplemented from AudioOutput.

Definition at line 1627 of file audiooutputbase.cpp.

virtual void AudioOutputBase::bufferOutputData ( bool  y)
inlinevirtual

Implements AudioOutput.

Definition at line 120 of file audiooutputbase.h.

int AudioOutputBase::readOutputData ( unsigned char *  read_buffer,
int  max_length 
)
virtual

Implements AudioOutput.

Reimplemented in AudioOutputNULL.

Definition at line 1832 of file audiooutputbase.cpp.

void AudioOutputBase::InitSettings ( const AudioSettings settings)
protected
virtual bool AudioOutputBase::OpenDevice ( void  )
protectedpure virtual
virtual void AudioOutputBase::CloseDevice ( void  )
protectedpure virtual
virtual void AudioOutputBase::WriteAudio ( uchar *  aubuf,
int  size 
)
protectedpure virtual

Implemented in AudioOutputALSA.

Referenced by OutputAudioLoop().

virtual int AudioOutputBase::GetBufferedOnSoundcard ( void  ) const
protectedpure virtual

Return the size in bytes of frames currently in the audio buffer adjusted with the audio playback latency.

Implemented in AudioOutputCA, AudioOutputNULL, AudioOutputPulseAudio, AudioOutputJACK, AudioOutputALSA, AudioOutputDX, AudioOutputOSS, and AudioOutputWin.

Referenced by GetAudiotime().

virtual AudioOutputSettings* AudioOutputBase::GetOutputSettings ( bool  digital)
inlineprotectedvirtual
void AudioOutputBase::KillAudio ( void  )
protected
bool AudioOutputBase::StartOutputThread ( void  )
protectedvirtual

Reimplemented in AudioOutputCA, and AudioOutputJACK.

Definition at line 849 of file audiooutputbase.cpp.

Referenced by Reconfigure().

void AudioOutputBase::StopOutputThread ( void  )
protectedvirtual

Reimplemented in AudioOutputCA, and AudioOutputJACK.

Definition at line 861 of file audiooutputbase.cpp.

Referenced by KillAudio().

int AudioOutputBase::GetAudioData ( uchar *  buffer,
int  size,
bool  full_buffer,
volatile uint local_raud = NULL 
)
protected

Copy frames from the audiobuffer into the buffer provided.

If 'full_buffer' is true we copy either 'size' bytes (if available) or nothing. Otherwise, we'll copy less than 'size' bytes if that's all that's available. Returns the number of bytes copied.

Definition at line 1733 of file audiooutputbase.cpp.

Referenced by AudioOutputJACK::JackCallback(), OutputAudioLoop(), and AudioOutputCA::RenderAudio().

void AudioOutputBase::OutputAudioLoop ( void  )
protected

Run in the output thread, write frames to the output device as they become available and there's space in the device buffer to write them.

Definition at line 1638 of file audiooutputbase.cpp.

Referenced by run().

void AudioOutputBase::run ( void  )
protectedvirtual

Main routine for the output thread.

Reimplemented from MThread.

Definition at line 1823 of file audiooutputbase.cpp.

int AudioOutputBase::CheckFreeSpace ( int frames)
protected

Check that there's enough space in the audiobuffer to write the provided number of frames.

If there is not enough space, set 'frames' to the number that will fit

Returns the number of bytes that the frames will take up

Definition at line 1181 of file audiooutputbase.cpp.

Referenced by AddData(), and CopyWithUpmix().

int AudioOutputBase::audiolen ( )
inlineprotected

Get the number of bytes in the audiobuffer.

Definition at line 993 of file audiooutputbase.cpp.

Referenced by audiofree(), and audioready().

int AudioOutputBase::audiofree ( )
protected

Get the free space in the audiobuffer in bytes.

Definition at line 1004 of file audiooutputbase.cpp.

Referenced by AddData(), CheckFreeSpace(), and GetBufferStatus().

int AudioOutputBase::audioready ( )
protected

Get the scaled number of bytes in the audiobuffer, i.e.

the number of samples * the output bytes per sample

This value can differ from that returned by audiolen if samples are being converted to floats and the output sample format is not 32 bits

Definition at line 1019 of file audiooutputbase.cpp.

Referenced by AddData(), Drain(), GetAudioData(), AudioOutputCA::GetAudiotime(), GetAudiotime(), and OutputAudioLoop().

void AudioOutputBase::SetStretchFactorLocked ( float  lstretchfactor)
protected

Set the timestretch factor.

You must hold the audio_buflock to call this safely

Definition at line 317 of file audiooutputbase.cpp.

Referenced by Reconfigure(), and SetStretchFactor().

int AudioOutputBase::GetBaseAudBufTimeCode ( ) const
inlineprotected

Definition at line 167 of file audiooutputbase.h.

Referenced by AudioOutputCA::GetAudiotime().

bool AudioOutputBase::SetupPassthrough ( int  codec,
int  codec_profile,
int samplerate_tmp,
int channels_tmp 
)
private

Definition at line 430 of file audiooutputbase.cpp.

Referenced by Reconfigure().

AudioOutputSettings * AudioOutputBase::OutputSettings ( bool  digital = true)
private

Definition at line 477 of file audiooutputbase.cpp.

Referenced by Reconfigure().

int AudioOutputBase::CopyWithUpmix ( char *  buffer,
int  frames,
uint org_waud 
)
private

Copy frames into the audiobuffer, upmixing en route if necessary.

Returns the number of frames written, which may be less than requested if the upmixer buffered some (or all) of them

Definition at line 1216 of file audiooutputbase.cpp.

Referenced by AddData().

void AudioOutputBase::SetAudiotime ( int  frames,
int64_t  timecode 
)
private

Set the timecode of the top of the ringbuffer Exclude all other processing elements as they dont vary between AddData calls.

Definition at line 1096 of file audiooutputbase.cpp.

Referenced by AddData().

Member Data Documentation

const uint AudioOutputBase::kAudioSRCInputSize = 16384
static

Definition at line 123 of file audiooutputbase.h.

Referenced by AddData(), and Reconfigure().

const uint AudioOutputBase::kAudioRingBufferSize = 3072000u
static

Audio Buffer Size – should be divisible by 32,24,16,12,10,8,6,4,2..

Definition at line 126 of file audiooutputbase.h.

Referenced by AddData(), audiofree(), audiolen(), CopyWithUpmix(), GetAudioData(), GetBufferStatus(), and Reset().

int AudioOutputBase::channels
protected
int AudioOutputBase::codec
protected

Definition at line 172 of file audiooutputbase.h.

Referenced by Reconfigure(), and ToggleUpmix().

int AudioOutputBase::bytes_per_frame
protected
int AudioOutputBase::output_bytes_per_frame
protected
AudioFormat AudioOutputBase::format
protected

Definition at line 175 of file audiooutputbase.h.

Referenced by AudioOutputOSS::OpenDevice(), and AudioOutputALSA::OpenDevice().

AudioFormat AudioOutputBase::output_format
protected
int AudioOutputBase::samplerate
protected
int AudioOutputBase::effdsp
protected
int AudioOutputBase::fragment_size
protected
long AudioOutputBase::soundcard_buffer_size
protected
QString AudioOutputBase::main_device
protected
QString AudioOutputBase::passthru_device
protected
bool AudioOutputBase::m_discretedigital
protected
bool AudioOutputBase::passthru
protected
bool AudioOutputBase::enc
protected
bool AudioOutputBase::reenc
protected

Definition at line 186 of file audiooutputbase.h.

Referenced by Reconfigure().

float AudioOutputBase::stretchfactor
protected
int AudioOutputBase::eff_stretchfactor
protected

Definition at line 189 of file audiooutputbase.h.

Referenced by GetAudiotime(), SetAudiotime(), and SetStretchFactorLocked().

AudioOutputSource AudioOutputBase::source
protected

Definition at line 190 of file audiooutputbase.h.

Referenced by Reconfigure().

bool AudioOutputBase::killaudio
protected
bool AudioOutputBase::pauseaudio
protected
bool AudioOutputBase::actually_paused
protected
bool AudioOutputBase::was_paused
protected
bool AudioOutputBase::unpause_when_ready
protected

Definition at line 194 of file audiooutputbase.h.

Referenced by AddData(), Pause(), PauseUntilBuffered(), and Reconfigure().

bool AudioOutputBase::set_initial_vol
protected
bool AudioOutputBase::buffer_output_data_for_use
protected
int AudioOutputBase::configured_channels
protected
int AudioOutputBase::max_channels
protected

Definition at line 199 of file audiooutputbase.h.

Referenced by CanPassthrough(), InitSettings(), Reconfigure(), and ToggleUpmix().

int AudioOutputBase::src_quality
protected

Definition at line 207 of file audiooutputbase.h.

Referenced by AudioOutputBase(), Reconfigure(), and AudioOutputALSA::SetParameters().

AudioOutputSettings* AudioOutputBase::output_settingsraw
private

Definition at line 215 of file audiooutputbase.h.

Referenced by GetOutputSettingsCleaned(), and ~AudioOutputBase().

AudioOutputSettings* AudioOutputBase::output_settings
private
AudioOutputSettings* AudioOutputBase::output_settingsdigitalraw
private

Definition at line 217 of file audiooutputbase.h.

Referenced by GetOutputSettingsCleaned(), and ~AudioOutputBase().

AudioOutputSettings* AudioOutputBase::output_settingsdigital
private
bool AudioOutputBase::need_resampler
private

Definition at line 219 of file audiooutputbase.h.

Referenced by AddData(), KillAudio(), and Reconfigure().

SRC_STATE* AudioOutputBase::src_ctx
private

Definition at line 220 of file audiooutputbase.h.

Referenced by AddData(), CheckFreeSpace(), KillAudio(), and Reconfigure().

soundtouch::SoundTouch* AudioOutputBase::pSoundStretch
private

Definition at line 221 of file audiooutputbase.h.

Referenced by AddData(), KillAudio(), Reset(), SetAudiotime(), and SetStretchFactorLocked().

AudioOutputDigitalEncoder* AudioOutputBase::encoder
private

Definition at line 222 of file audiooutputbase.h.

Referenced by AddData(), KillAudio(), Reconfigure(), Reset(), and SetAudiotime().

FreeSurround* AudioOutputBase::upmixer
private
int AudioOutputBase::source_channels
private
int AudioOutputBase::source_samplerate
private

Definition at line 226 of file audiooutputbase.h.

Referenced by AddData(), Reconfigure(), SetTimecode(), Status(), and ToggleUpmix().

int AudioOutputBase::source_bytes_per_frame
private

Definition at line 227 of file audiooutputbase.h.

Referenced by AddData(), AddFrames(), and Reconfigure().

bool AudioOutputBase::upmix_default
private

Definition at line 228 of file audiooutputbase.h.

Referenced by InitSettings(), Reconfigure(), and ToggleUpmix().

bool AudioOutputBase::needs_upmix
private
bool AudioOutputBase::needs_downmix
private

Definition at line 230 of file audiooutputbase.h.

Referenced by AddData(), Reconfigure(), and SetStretchFactorLocked().

int AudioOutputBase::surround_mode
private

Definition at line 231 of file audiooutputbase.h.

Referenced by Reconfigure().

float AudioOutputBase::old_stretchfactor
private

Definition at line 232 of file audiooutputbase.h.

Referenced by KillAudio(), and Reconfigure().

int AudioOutputBase::volume
private
QString AudioOutputBase::volumeControl
private

Definition at line 234 of file audiooutputbase.h.

Referenced by Reconfigure(), and SetSWVolume().

bool AudioOutputBase::processing
private
int64_t AudioOutputBase::frames_buffered
private

Definition at line 238 of file audiooutputbase.h.

Referenced by AddData(), Reconfigure(), Reset(), and SetTimecode().

bool AudioOutputBase::audio_thread_exists
private

Definition at line 240 of file audiooutputbase.h.

Referenced by StartOutputThread(), and StopOutputThread().

QMutex AudioOutputBase::audio_buflock
private

Writes to the audiobuffer, reconfigures and audiobuffer resets can only take place while holding this lock.

Definition at line 246 of file audiooutputbase.h.

Referenced by AddData(), KillAudio(), Reconfigure(), Reset(), and SetStretchFactor().

QMutex AudioOutputBase::avsync_lock
private

must hold avsync_lock to read or write 'audiotime' and 'audiotime_updated'

Definition at line 252 of file audiooutputbase.h.

Referenced by GetAudiotime(), Reconfigure(), and Reset().

int64_t AudioOutputBase::audiotime
private

timecode of audio leaving the soundcard (same units as timecodes)

Definition at line 257 of file audiooutputbase.h.

Referenced by GetAudiotime(), OutputAudioLoop(), Reconfigure(), Reset(), SetAudiotime(), and SetTimecode().

volatile uint AudioOutputBase::raud
private

Audio circular buffer.

Definition at line 262 of file audiooutputbase.h.

Referenced by audiolen(), GetAudioData(), OutputAudioLoop(), Reconfigure(), Reset(), and SetStretchFactorLocked().

volatile uint AudioOutputBase::waud
private

Definition at line 262 of file audiooutputbase.h.

Referenced by AddData(), audiolen(), Reconfigure(), Reset(), and SetStretchFactorLocked().

int64_t AudioOutputBase::audbuf_timecode
private

timecode of audio most recently placed into buffer

Definition at line 266 of file audiooutputbase.h.

Referenced by GetAudioBufferedTime(), AudioOutputCA::GetAudiotime(), GetAudiotime(), Reconfigure(), Reset(), SetAudiotime(), and SetTimecode().

AsyncLooseLock AudioOutputBase::reset_active
private

Definition at line 267 of file audiooutputbase.h.

Referenced by OutputAudioLoop(), Reconfigure(), Reset(), and SetStretchFactorLocked().

QMutex AudioOutputBase::killAudioLock
private

Definition at line 269 of file audiooutputbase.h.

Referenced by KillAudio().

long AudioOutputBase::current_seconds
private

Definition at line 271 of file audiooutputbase.h.

Referenced by Reconfigure(), Reset(), and Status().

long AudioOutputBase::source_bitrate
private

Definition at line 272 of file audiooutputbase.h.

Referenced by Reconfigure(), SetSourceBitrate(), and Status().

float* AudioOutputBase::src_in
private

Definition at line 274 of file audiooutputbase.h.

Referenced by AddData(), AudioOutputBase(), and Reconfigure().

SRC_DATA AudioOutputBase::src_data
private

Definition at line 277 of file audiooutputbase.h.

Referenced by AddData(), AudioOutputBase(), and Reconfigure().

uint AudioOutputBase::memory_corruption_test0
private

Definition at line 278 of file audiooutputbase.h.

Referenced by ~AudioOutputBase().

float AudioOutputBase::src_in_buf[kAudioSRCInputSize+16]
private

Definition at line 279 of file audiooutputbase.h.

Referenced by AudioOutputBase().

uint AudioOutputBase::memory_corruption_test1
private

Definition at line 280 of file audiooutputbase.h.

Referenced by ~AudioOutputBase().

float* AudioOutputBase::src_out
private

Definition at line 281 of file audiooutputbase.h.

Referenced by AddData(), Reconfigure(), and ~AudioOutputBase().

int AudioOutputBase::kAudioSRCOutputSize
private

Definition at line 282 of file audiooutputbase.h.

Referenced by Reconfigure(), and ~AudioOutputBase().

uint AudioOutputBase::memory_corruption_test2
private

Definition at line 283 of file audiooutputbase.h.

Referenced by ~AudioOutputBase().

uchar AudioOutputBase::audiobuffer[kAudioRingBufferSize]
private

main audio buffer

Definition at line 287 of file audiooutputbase.h.

Referenced by AudioOutputBase(), and Reset().

uint AudioOutputBase::memory_corruption_test3
private

Definition at line 288 of file audiooutputbase.h.

Referenced by ~AudioOutputBase().

uint AudioOutputBase::m_configure_succeeded
private
int64_t AudioOutputBase::m_length_last_data
private

Definition at line 290 of file audiooutputbase.h.

Referenced by AddData().

SPDIFEncoder* AudioOutputBase::m_spdifenc
private

Definition at line 293 of file audiooutputbase.h.

Referenced by AddData(), and SetupPassthrough().

bool AudioOutputBase::m_forcedprocessing
private

Definition at line 296 of file audiooutputbase.h.

Referenced by Reconfigure(), and SetStretchFactorLocked().

int AudioOutputBase::m_previousbpf
private

Definition at line 297 of file audiooutputbase.h.

Referenced by SetStretchFactorLocked().


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