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 <mythtranscode/audioreencodebuffer.h>

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

Public Member Functions

 AudioReencodeBuffer (AudioFormat audio_format, int audio_channels, bool passthru)
 
 ~AudioReencodeBuffer () override
 
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, std::chrono::milliseconds timecode) override
 Add frames to the audiobuffer for playback. More...
 
bool AddData (void *buffer, int len, std::chrono::milliseconds timecode, int frames) override
 Add data to the audiobuffer for playback. More...
 
AudioBufferGetData (std::chrono::milliseconds time)
 
long long GetSamples (std::chrono::milliseconds time)
 
void SetTimecode (std::chrono::milliseconds timecode) override
 
bool IsPaused (void) const override
 
void Pause (bool paused) override
 
void PauseUntilBuffered (void) override
 
void Drain (void) override
 
std::chrono::milliseconds GetAudiotime (void) override
 
int GetVolumeChannel (int) const override
 
void SetVolumeChannel (int, int) override
 
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 *, size_t) 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 std::chrono::milliseconds LengthLastData (void) const
 
virtual std::chrono::milliseconds 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) const
 
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
 
 ~OutputListeners () override=default
 
bool hasVisual (void)
 
void addVisual (MythTV::Visual *v)
 
void removeVisual (MythTV::Visual *v)
 
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 {-1}
 
int m_bytes_per_frame {-1}
 
int m_eff_audiorate {-1}
 
std::chrono::milliseconds m_last_audiotime {0ms}
 
bool m_passthru {false}
 
int m_audioFrameSize {0}
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from AudioOutput
using ADCVect = QVector< AudioDeviceConfig >
 
- Static Public Member Functions inherited from AudioOutput
static void Cleanup (void)
 
static ADCVectGetOutputList (void)
 
static AudioDeviceConfigGetAudioDeviceConfig (QString &name, const 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 kMaxSizeBuffer = 384000
 kMaxSizeBuffer 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, std::chrono::milliseconds timecode, 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 m_internalVol {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 64 of file audioreencodebuffer.cpp.

◆ ~AudioReencodeBuffer()

AudioReencodeBuffer::~AudioReencodeBuffer ( )
override

Definition at line 73 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 82 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 96 of file audioreencodebuffer.cpp.

◆ Reset()

void AudioReencodeBuffer::Reset ( void  )
overridevirtual

Implements AudioOutput.

Definition at line 101 of file audioreencodebuffer.cpp.

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

◆ AddFrames()

bool AudioReencodeBuffer::AddFrames ( void *  buffer,
int  frames,
std::chrono::milliseconds  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 121 of file audioreencodebuffer.cpp.

◆ AddData()

bool AudioReencodeBuffer::AddData ( void *  buffer,
int  len,
std::chrono::milliseconds  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 137 of file audioreencodebuffer.cpp.

Referenced by AddFrames().

◆ GetData()

AudioBuffer * AudioReencodeBuffer::GetData ( std::chrono::milliseconds  time)

Definition at line 202 of file audioreencodebuffer.cpp.

Referenced by Transcode::TranscodeFile().

◆ GetSamples()

long long AudioReencodeBuffer::GetSamples ( std::chrono::milliseconds  time)

Definition at line 220 of file audioreencodebuffer.cpp.

Referenced by Transcode::TranscodeFile().

◆ SetTimecode()

void AudioReencodeBuffer::SetTimecode ( std::chrono::milliseconds  timecode)
overridevirtual

Implements AudioOutput.

Definition at line 238 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()

std::chrono::milliseconds 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.

◆ GetCurrentVolume()

uint AudioReencodeBuffer::GetCurrentVolume ( void  ) const
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 54 of file audioreencodebuffer.h.

◆ SetCurrentVolume()

void AudioReencodeBuffer::SetCurrentVolume ( int  )
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 55 of file audioreencodebuffer.h.

◆ AdjustCurrentVolume()

void AudioReencodeBuffer::AdjustCurrentVolume ( int  )
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 56 of file audioreencodebuffer.h.

◆ SetMute()

virtual void AudioReencodeBuffer::SetMute ( bool  )
inlinevirtual

Definition at line 57 of file audioreencodebuffer.h.

◆ ToggleMute()

void AudioReencodeBuffer::ToggleMute ( void  )
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 58 of file audioreencodebuffer.h.

◆ GetMuteState()

MuteState AudioReencodeBuffer::GetMuteState ( void  ) const
inlineoverridevirtual

Reimplemented from VolumeBase.

Definition at line 59 of file audioreencodebuffer.h.

◆ IterateMutedChannels()

virtual MuteState AudioReencodeBuffer::IterateMutedChannels ( void  )
inlinevirtual

Definition at line 60 of file audioreencodebuffer.h.

◆ SetSWVolume()

void AudioReencodeBuffer::SetSWVolume ( int  ,
bool   
)
inlineoverridevirtual

Implements VolumeBase.

Definition at line 61 of file audioreencodebuffer.h.

◆ GetSWVolume()

int AudioReencodeBuffer::GetSWVolume ( void  )
inlineoverridevirtual

Implements VolumeBase.

Definition at line 62 of file audioreencodebuffer.h.

◆ CanPassthrough()

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

Reimplemented from AudioOutput.

Definition at line 63 of file audioreencodebuffer.h.

◆ bufferOutputData()

void AudioReencodeBuffer::bufferOutputData ( bool  )
inlineoverridevirtual

Implements AudioOutput.

Definition at line 67 of file audioreencodebuffer.h.

◆ readOutputData()

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

Implements AudioOutput.

Definition at line 68 of file audioreencodebuffer.h.

Member Data Documentation

◆ m_channels

int AudioReencodeBuffer::m_channels {-1}

Definition at line 71 of file audioreencodebuffer.h.

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

◆ m_bytes_per_frame

int AudioReencodeBuffer::m_bytes_per_frame {-1}

Definition at line 72 of file audioreencodebuffer.h.

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

◆ m_eff_audiorate

int AudioReencodeBuffer::m_eff_audiorate {-1}

Definition at line 73 of file audioreencodebuffer.h.

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

◆ m_last_audiotime

std::chrono::milliseconds AudioReencodeBuffer::m_last_audiotime {0ms}

Definition at line 74 of file audioreencodebuffer.h.

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

◆ m_passthru

bool AudioReencodeBuffer::m_passthru {false}

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 {false}
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: