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

Implements Core Audio (Mac OS X Hardware Abstraction Layer) output. More...

#include <audiooutputca.h>

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

Public Member Functions

 AudioOutputCA (const AudioSettings &settings)
 
virtual ~AudioOutputCA ()
 
AudioOutputSettingsGetOutputSettings (bool digital)
 
virtual int64_t GetAudiotime (void)
 Reimplement the base class's version of GetAudiotime() so that we don't use gettimeofday or Qt mutexes. More...
 
bool RenderAudio (unsigned char *aubuf, int size, unsigned long long timestamp)
 Object-oriented part of callback. More...
 
virtual int GetVolumeChannel (int channel) const
 
virtual void SetVolumeChannel (int channel, int volume)
 
void Debug (QString msg)
 
void Error (QString msg)
 
void Warn (QString msg)
 
- Public Member Functions inherited from AudioOutputBase
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 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 Member Functions

static QMap< QString, QString > * GetDevices (const char *type=NULL)
 

Protected Member Functions

virtual bool OpenDevice (void)
 
virtual void CloseDevice (void)
 
virtual void WriteAudio (unsigned char *aubuf, int size)
 
virtual int GetBufferedOnSoundcard (void) const
 Return the size in bytes of frames currently in the audio buffer adjusted with the audio playback latency. More...
 
virtual bool StartOutputThread (void)
 
virtual void StopOutputThread (void)
 
- Protected Member Functions inherited from AudioOutputBase
void InitSettings (const AudioSettings &settings)
 
virtual void WriteAudio (uchar *aubuf, int size)=0
 
void KillAudio (void)
 Kill the output thread and cleanup. More...
 
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
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...
 

Private Attributes

CoreAudioDatad
 
int bufferedBytes
 
long CA_audiotime_updated
 

Friends

class CoreAudioData
 

Additional Inherited Members

- Static Public Attributes inherited from AudioOutputBase
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...
 
- Protected Types inherited from AudioOutputBase
enum  { QUALITY_DISABLED = -1, QUALITY_LOW = 0, QUALITY_MEDIUM = 1, QUALITY_HIGH = 2 }
 
- 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)
 
- Protected Attributes inherited from AudioOutputBase
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
 

Detailed Description

Implements Core Audio (Mac OS X Hardware Abstraction Layer) output.

Definition at line 15 of file audiooutputca.h.

Constructor & Destructor Documentation

AudioOutputCA::AudioOutputCA ( const AudioSettings settings)

Definition at line 175 of file audiooutputca.cpp.

AudioOutputCA::~AudioOutputCA ( )
virtual

Definition at line 187 of file audiooutputca.cpp.

Member Function Documentation

AudioOutputSettings * AudioOutputCA::GetOutputSettings ( bool  digital)
virtual

Reimplemented from AudioOutputBase.

Definition at line 194 of file audiooutputca.cpp.

QMap< QString, QString > * AudioOutputCA::GetDevices ( const char *  type = NULL)
static

Definition at line 1693 of file audiooutputca.cpp.

Referenced by AudioOutput::GetOutputList().

int64_t AudioOutputCA::GetAudiotime ( void  )
virtual

Reimplement the base class's version of GetAudiotime() so that we don't use gettimeofday or Qt mutexes.

Reimplemented from AudioOutputBase.

Definition at line 400 of file audiooutputca.cpp.

bool AudioOutputCA::RenderAudio ( unsigned char *  aubuf,
int  size,
unsigned long long  timestamp 
)

Object-oriented part of callback.

Definition at line 346 of file audiooutputca.cpp.

Referenced by RenderCallbackAnalog(), and RenderCallbackSPDIF().

int AudioOutputCA::GetVolumeChannel ( int  channel) const
virtual

Implements VolumeBase.

Definition at line 438 of file audiooutputca.cpp.

void AudioOutputCA::SetVolumeChannel ( int  channel,
int  volume 
)
virtual

Implements VolumeBase.

Definition at line 452 of file audiooutputca.cpp.

void AudioOutputCA::Debug ( QString  msg)
inline

Definition at line 35 of file audiooutputca.h.

Referenced by GetOutputSettings(), and OpenDevice().

void AudioOutputCA::Error ( QString  msg)
inline

Definition at line 38 of file audiooutputca.h.

Referenced by OpenDevice().

void AudioOutputCA::Warn ( QString  msg)
inline

Definition at line 41 of file audiooutputca.h.

bool AudioOutputCA::OpenDevice ( void  )
protectedvirtual

Implements AudioOutputBase.

Definition at line 257 of file audiooutputca.cpp.

void AudioOutputCA::CloseDevice ( void  )
protectedvirtual

Implements AudioOutputBase.

Definition at line 306 of file audiooutputca.cpp.

void AudioOutputCA::WriteAudio ( unsigned char *  aubuf,
int  size 
)
protectedvirtual

Definition at line 385 of file audiooutputca.cpp.

int AudioOutputCA::GetBufferedOnSoundcard ( void  ) const
protectedvirtual

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

Implements AudioOutputBase.

Definition at line 392 of file audiooutputca.cpp.

Referenced by GetAudiotime().

virtual bool AudioOutputCA::StartOutputThread ( void  )
inlineprotectedvirtual

Reimplemented from AudioOutputBase.

Definition at line 52 of file audiooutputca.h.

virtual void AudioOutputCA::StopOutputThread ( void  )
inlineprotectedvirtual

Reimplemented from AudioOutputBase.

Definition at line 53 of file audiooutputca.h.

Friends And Related Function Documentation

friend class CoreAudioData
friend

Definition at line 58 of file audiooutputca.h.

Referenced by AudioOutputCA().

Member Data Documentation

CoreAudioData* AudioOutputCA::d
private
int AudioOutputCA::bufferedBytes
private

Definition at line 60 of file audiooutputca.h.

Referenced by GetBufferedOnSoundcard(), and RenderAudio().

long AudioOutputCA::CA_audiotime_updated
private

Definition at line 61 of file audiooutputca.h.


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