MythTV  master
Public Member Functions | Public Attributes | Private Attributes | List of all members
AudioReencodeBuffer Class Reference

This class is to act as a fake audio output device to store the data for reencoding. More...

#include <audioreencodebuffer.h>

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

Public Member Functions

 AudioReencodeBuffer (AudioFormat audio_format, int audio_channels, bool passthru)
 
 ~AudioReencodeBuffer ()
 
void Reconfigure (const AudioSettings &settings) override
 reconfigure sound out for new params More...
 
void SetEffDsp (int dsprate) override
 
void Reset (void) override
 
bool AddFrames (void *buffer, int frames, int64_t timecode) override
 Add frames to the audiobuffer for playback. More...
 
bool AddData (void *buffer, int len, int64_t timecode, int frames) override
 Add data to the audiobuffer for playback. More...
 
AudioBufferGetData (long long time)
 
long long GetSamples (long long time)
 
void SetTimecode (int64_t timecode) override
 
bool IsPaused (void) const override
 
void Pause (bool paused) override
 
void PauseUntilBuffered (void) override
 
void Drain (void) override
 
int64_t GetAudiotime (void) override
 
int GetVolumeChannel (int) const override
 
void SetVolumeChannel (int, int) override
 
void SetVolumeAll (int)
 
uint GetCurrentVolume (void) const override
 
void SetCurrentVolume (int) override
 
void AdjustCurrentVolume (int) override
 
virtual void SetMute (bool)
 
void ToggleMute (void) override
 
MuteState GetMuteState (void) const override
 
virtual MuteState IterateMutedChannels (void)
 
void SetSWVolume (int, bool) override
 
int GetSWVolume (void) override
 
bool CanPassthrough (int, int, AVCodecID, int) const override
 
void bufferOutputData (bool) override
 
int readOutputData (unsigned char *, int) override
 
- Public Member Functions inherited from AudioOutput
 AudioOutput ()=default
 
 ~AudioOutput () override
 
virtual void SetStretchFactor (float factor)
 
virtual float GetStretchFactor (void) const
 
virtual int GetChannels (void) const
 
virtual AudioFormat GetFormat (void) const
 
virtual int GetBytesPerFrame (void) const
 
virtual AudioOutputSettingsGetOutputSettingsCleaned (bool digital=true)
 
virtual AudioOutputSettingsGetOutputSettingsUsers (bool digital=true)
 
virtual bool CanDownmix (void) const
 
virtual bool NeedDecodingBeforePassthrough (void) const
 
virtual int64_t LengthLastData (void) const
 
virtual int64_t GetAudioBufferedTime (void)
 report amount of audio buffered in milliseconds. More...
 
virtual void SetSourceBitrate (int)
 
QString GetError (void) const
 
QString GetWarning (void) const
 
virtual void GetBufferStatus (uint &fill, uint &total)
 
virtual bool IsUpmixing (void)
 
virtual bool ToggleUpmix (void)
 
virtual bool CanUpmix (void)
 
bool PulseStatus (void)
 
virtual bool CanProcess (AudioFormat fmt)
 
virtual uint32_t CanProcess (void)
 
virtual int DecodeAudio (AVCodecContext *ctx, uint8_t *buffer, int &data_size, const AVPacket *pkt)
 Utility routine. More...
 
- Public Member Functions inherited from VolumeBase
 VolumeBase ()
 
virtual ~VolumeBase ()=default
 
void SWVolume (bool set)
 
bool SWVolume (void) const
 
virtual MuteState SetMuteState (MuteState)
 
- Public Member Functions inherited from OutputListeners
 OutputListeners ()=default
 
virtual ~OutputListeners ()=default
 
bool hasVisual (void)
 
void addVisual (MythTV::Visual *)
 
void removeVisual (MythTV::Visual *)
 
QMutex * mutex ()
 
void setBufferSize (unsigned int sz)
 
unsigned int bufferSize () const
 
- Public Member Functions inherited from MythObservable
 MythObservable ()
 
virtual ~MythObservable ()
 
void addListener (QObject *listener)
 Add a listener to the observable. More...
 
void removeListener (QObject *listener)
 Remove a listener to the observable. More...
 
void dispatch (const MythEvent &event)
 Dispatch an event to all listeners. More...
 
bool hasListeners (void)
 

Public Attributes

int m_channels
 
int m_bytes_per_frame
 
int m_eff_audiorate
 
long long m_last_audiotime {0}
 
bool m_passthru
 
int m_audioFrameSize {0}
 

Private Attributes

bool m_initpassthru
 
QMutex m_bufferMutex
 
QList< AudioBuffer * > m_bufferList
 
AudioBufferm_saveBuffer {nullptr}
 

Additional Inherited Members

- Public Types inherited from AudioOutput
typedef QVector< AudioDeviceConfigADCVect
 
- Static Public Member Functions inherited from AudioOutput
static void Cleanup (void)
 
static ADCVectGetOutputList (void)
 
static AudioDeviceConfigGetAudioDeviceConfig (QString &name, QString &desc, bool willsuspendpa=false)
 
static AudioOutputOpenAudio (const QString &main_device, const QString &passthru_device, AudioFormat format, int channels, AVCodecID codec, int samplerate, AudioOutputSource source, bool set_initial_vol, bool passthru, int upmixer_startup=0, AudioOutputSettings *custom=nullptr)
 
static AudioOutputOpenAudio (AudioSettings &settings, bool willsuspendpa=true)
 
static AudioOutputOpenAudio (const QString &main_device, const QString &passthru_device=QString(), bool willsuspendpa=true)
 
- Static Public Member Functions inherited from VolumeBase
static MuteState NextMuteState (MuteState)
 
- Static Public Attributes inherited from AudioOutput
static const int MAX_SIZE_BUFFER = 384000
 MAX_SIZE_BUFFER is the maximum size of a buffer to be used with DecodeAudio. More...
 
- 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 Attributes inherited from AudioOutput
QString m_lastError
 
QString m_lastWarn
 
bool m_pulsewassuspended {false}
 
AVFramem_frame {nullptr}
 
- Protected Attributes inherited from VolumeBase
bool internal_vol {false}
 
- Protected Attributes inherited from MythObservable
QMutex * m_lock {nullptr}
 
QSet< QObject * > m_listeners
 

Detailed Description

This class is to act as a fake audio output device to store the data for reencoding.

Definition at line 31 of file audioreencodebuffer.h.

Constructor & Destructor Documentation

◆ AudioReencodeBuffer()

AudioReencodeBuffer::AudioReencodeBuffer ( AudioFormat  audio_format,
int  audio_channels,
bool  passthru 
)

Definition at line 65 of file audioreencodebuffer.cpp.

◆ ~AudioReencodeBuffer()

AudioReencodeBuffer::~AudioReencodeBuffer ( )

Definition at line 74 of file audioreencodebuffer.cpp.

Member Function Documentation

◆ Reconfigure()

void AudioReencodeBuffer::Reconfigure ( const AudioSettings settings)
overridevirtual

reconfigure sound out for new params

Implements AudioOutput.

Definition at line 83 of file audioreencodebuffer.cpp.

Referenced by AudioReencodeBuffer().

◆ SetEffDsp()

void AudioReencodeBuffer::SetEffDsp ( int  dsprate)
overridevirtual
Parameters
dsprateis in 100 * frames/second

Implements AudioOutput.

Definition at line 97 of file audioreencodebuffer.cpp.

◆ Reset()

void AudioReencodeBuffer::Reset ( void  )
overridevirtual

Implements AudioOutput.

Definition at line 102 of file audioreencodebuffer.cpp.

Referenced by AudioReencodeBuffer(), and ~AudioReencodeBuffer().

◆ AddFrames()

bool AudioReencodeBuffer::AddFrames ( void *  buffer,
int  frames,
int64_t  timecode 
)
overridevirtual

Add frames to the audiobuffer for playback.

Parameters
[in]bufferpointer to audio data
[in]framesnumber of frames added.
[in]timecodetimecode of the first sample added (in msec)
Returns
false if there wasn't enough space in audio buffer to process all the data

Implements AudioOutput.

Definition at line 122 of file audioreencodebuffer.cpp.

◆ AddData()

bool AudioReencodeBuffer::AddData ( void *  buffer,
int  len,
int64_t  timecode,
int  frames 
)
overridevirtual

Add data to the audiobuffer for playback.

Parameters
[in]bufferpointer to audio data
[in]lenlength of audio data added
[in]timecodetimecode of the first sample added (in msec)
[in]framesnumber of frames added.
Returns
false if there wasn't enough space in audio buffer to process all the data

Implements AudioOutput.

Definition at line 138 of file audioreencodebuffer.cpp.

Referenced by AddFrames().

◆ GetData()

AudioBuffer * AudioReencodeBuffer::GetData ( long long  time)

Definition at line 203 of file audioreencodebuffer.cpp.

Referenced by Transcode::TranscodeFile().

◆ GetSamples()

long long AudioReencodeBuffer::GetSamples ( long long  time)

Definition at line 221 of file audioreencodebuffer.cpp.

Referenced by Transcode::TranscodeFile().

◆ SetTimecode()

void AudioReencodeBuffer::SetTimecode ( int64_t  timecode)
overridevirtual

Implements AudioOutput.

Definition at line 242 of file audioreencodebuffer.cpp.

◆ IsPaused()

bool AudioReencodeBuffer::IsPaused ( void  ) const
inlineoverridevirtual

Implements AudioOutput.

Definition at line 47 of file audioreencodebuffer.h.

◆ Pause()

void AudioReencodeBuffer::Pause ( bool  paused)
inlineoverridevirtual

Implements AudioOutput.

Definition at line 48 of file audioreencodebuffer.h.

◆ PauseUntilBuffered()

void AudioReencodeBuffer::PauseUntilBuffered ( void  )
inlineoverridevirtual

Implements AudioOutput.

Definition at line 49 of file audioreencodebuffer.h.

◆ Drain()

void AudioReencodeBuffer::Drain ( void  )
inlineoverridevirtual

Implements AudioOutput.

Definition at line 50 of file audioreencodebuffer.h.

◆ GetAudiotime()

int64_t AudioReencodeBuffer::GetAudiotime ( void  )
inlineoverridevirtual

Implements AudioOutput.

Definition at line 51 of file audioreencodebuffer.h.

◆ GetVolumeChannel()

int AudioReencodeBuffer::GetVolumeChannel ( int  ) const
inlineoverridevirtual

Implements VolumeBase.

Definition at line 52 of file audioreencodebuffer.h.

◆ SetVolumeChannel()

void AudioReencodeBuffer::SetVolumeChannel ( int  ,
int   
)
inlineoverridevirtual

Implements VolumeBase.

Definition at line 53 of file audioreencodebuffer.h.

◆ SetVolumeAll()

void AudioReencodeBuffer::SetVolumeAll ( int  )
inline

Definition at line 54 of file audioreencodebuffer.h.

◆ GetCurrentVolume()

uint AudioReencodeBuffer::GetCurrentVolume ( void  ) const
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 55 of file audioreencodebuffer.h.

◆ SetCurrentVolume()

void AudioReencodeBuffer::SetCurrentVolume ( int  )
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 56 of file audioreencodebuffer.h.

◆ AdjustCurrentVolume()

void AudioReencodeBuffer::AdjustCurrentVolume ( int  )
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 57 of file audioreencodebuffer.h.

◆ SetMute()

virtual void AudioReencodeBuffer::SetMute ( bool  )
inlinevirtual

Definition at line 58 of file audioreencodebuffer.h.

◆ ToggleMute()

void AudioReencodeBuffer::ToggleMute ( void  )
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 59 of file audioreencodebuffer.h.

◆ GetMuteState()

MuteState AudioReencodeBuffer::GetMuteState ( void  ) const
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 60 of file audioreencodebuffer.h.

◆ IterateMutedChannels()

virtual MuteState AudioReencodeBuffer::IterateMutedChannels ( void  )
inlinevirtual

Definition at line 61 of file audioreencodebuffer.h.

◆ SetSWVolume()

void AudioReencodeBuffer::SetSWVolume ( int  ,
bool   
)
inlineoverridevirtual

Implements VolumeBase.

Definition at line 62 of file audioreencodebuffer.h.

◆ GetSWVolume()

int AudioReencodeBuffer::GetSWVolume ( void  )
inlineoverridevirtual

Implements VolumeBase.

Definition at line 63 of file audioreencodebuffer.h.

◆ CanPassthrough()

bool AudioReencodeBuffer::CanPassthrough ( int  ,
int  ,
AVCodecID  ,
int   
) const
inlineoverridevirtual

Reimplemented from AudioOutput.

Definition at line 64 of file audioreencodebuffer.h.

◆ bufferOutputData()

void AudioReencodeBuffer::bufferOutputData ( bool  )
inlineoverridevirtual

Implements AudioOutput.

Definition at line 68 of file audioreencodebuffer.h.

◆ readOutputData()

int AudioReencodeBuffer::readOutputData ( unsigned char *  ,
int   
)
inlineoverridevirtual

Implements AudioOutput.

Definition at line 69 of file audioreencodebuffer.h.

Member Data Documentation

◆ m_channels

int AudioReencodeBuffer::m_channels

Definition at line 71 of file audioreencodebuffer.h.

Referenced by Reconfigure(), and Transcode::TranscodeFile().

◆ m_bytes_per_frame

int AudioReencodeBuffer::m_bytes_per_frame

Definition at line 72 of file audioreencodebuffer.h.

Referenced by AddData(), AddFrames(), Reconfigure(), and Transcode::TranscodeFile().

◆ m_eff_audiorate

int AudioReencodeBuffer::m_eff_audiorate

Definition at line 73 of file audioreencodebuffer.h.

Referenced by AddData(), Reconfigure(), SetEffDsp(), and Transcode::TranscodeFile().

◆ m_last_audiotime

long long AudioReencodeBuffer::m_last_audiotime {0}

Definition at line 74 of file audioreencodebuffer.h.

Referenced by AddData(), GetAudiotime(), and SetTimecode().

◆ m_passthru

bool AudioReencodeBuffer::m_passthru

Definition at line 75 of file audioreencodebuffer.h.

Referenced by Reconfigure(), and Transcode::TranscodeFile().

◆ m_audioFrameSize

int AudioReencodeBuffer::m_audioFrameSize {0}

Definition at line 76 of file audioreencodebuffer.h.

Referenced by AddData(), and Transcode::TranscodeFile().

◆ m_initpassthru

bool AudioReencodeBuffer::m_initpassthru
private

Definition at line 79 of file audioreencodebuffer.h.

Referenced by CanPassthrough().

◆ m_bufferMutex

QMutex AudioReencodeBuffer::m_bufferMutex
private

Definition at line 80 of file audioreencodebuffer.h.

Referenced by AddData(), GetData(), GetSamples(), and Reset().

◆ m_bufferList

QList<AudioBuffer *> AudioReencodeBuffer::m_bufferList
private

Definition at line 81 of file audioreencodebuffer.h.

Referenced by AddData(), GetData(), GetSamples(), and Reset().

◆ m_saveBuffer

AudioBuffer* AudioReencodeBuffer::m_saveBuffer {nullptr}
private

Definition at line 82 of file audioreencodebuffer.h.

Referenced by AddData(), and ~AudioReencodeBuffer().


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