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

#include <audioplayer.h>

Collaboration diagram for AudioPlayer:
Collaboration graph
[legend]

Public Member Functions

 AudioPlayer (MythPlayer *parent, bool muted)
 
 ~AudioPlayer ()
 
void addVisual (MythTV::Visual *vis)
 
void removeVisual (MythTV::Visual *vis)
 
void Reset (void)
 
void DeleteOutput (void)
 
QString ReinitAudio (void)
 
void SetAudioOutput (AudioOutput *ao)
 
void SetAudioInfo (const QString &main_device, const QString &passthru_device, uint samplerate, int codec_profile=-1)
 Set audio output device parameters. More...
 
void SetAudioParams (AudioFormat format, int orig_channels, int channels, AVCodecID codec, int samplerate, bool passthru, int codec_profile=-1)
 Set audio output parameters. More...
 
void SetEffDsp (int dsprate)
 
void CheckFormat (void)
 
void SetNoAudio (void)
 
bool HasAudioIn (void) const
 
bool HasAudioOut (void) const
 
bool ControlsVolume (void) const
 
bool Pause (bool pause)
 
bool IsPaused (void)
 
void PauseAudioUntilBuffered (void)
 
AVCodecID GetCodec (void) const
 
int GetNumChannels (void) const
 
int GetOrigChannels (void) const
 
int GetSampleRate (void) const
 
uint GetVolume (void)
 
uint AdjustVolume (int change)
 
uint SetVolume (int newvolume)
 
float GetStretchFactor (void) const
 
void SetStretchFactor (float factor)
 
bool IsUpmixing (void)
 
bool EnableUpmix (bool enable, bool toggle=false)
 
bool CanUpmix (void)
 
bool CanPassthrough (int samplerate, int channels, AVCodecID codec, int profile)
 
bool CanDownmix (void)
 
bool CanAC3 (void)
 
bool CanDTS (void)
 
bool CanEAC3 (void)
 
bool CanTrueHD (void)
 
bool CanDTSHD (void)
 
uint GetMaxChannels (void)
 
int GetMaxHDRate (void)
 
int64_t GetAudioTime (void)
 
AudioFormat GetFormat (void) const
 
bool CanProcess (AudioFormat fmt)
 
uint32_t CanProcess (void)
 
int DecodeAudio (AVCodecContext *ctx, uint8_t *buffer, int &data_size, const AVPacket *pkt)
 DecodeAudio Utility routine. More...
 
bool IsMuted (void)
 
bool SetMuted (bool mute)
 
MuteState GetMuteState (void)
 
MuteState SetMuteState (MuteState)
 
MuteState IncrMuteState (void)
 
void AddAudioData (char *buffer, int len, int64_t timecode, int frames)
 
bool NeedDecodingBeforePassthrough (void)
 
int64_t LengthLastData (void)
 
bool GetBufferStatus (uint &fill, uint &total)
 
bool IsBufferAlmostFull (void)
 
int64_t GetAudioBufferedTime (void)
 
AudioOutputGetAudioOutput (void) const
 Return internal AudioOutput object. More...
 

Private Member Functions

 Q_DECLARE_TR_FUNCTIONS (AudioPlayer)
 
void AddVisuals (void)
 
void RemoveVisuals (void)
 
void ResetVisuals (void)
 

Private Attributes

MythPlayerm_parent {nullptr}
 
AudioOutputm_audioOutput {nullptr}
 
int m_channels {-1}
 
int m_orig_channels {-1}
 
AVCodecID m_codec {AV_CODEC_ID_NONE}
 
AudioFormat m_format {FORMAT_NONE}
 
int m_samplerate {44100}
 
int m_codec_profile {0}
 
float m_stretchfactor {1.0F}
 
bool m_passthru {false}
 
QMutex m_lock {QMutex::Recursive}
 
bool m_muted_on_creation
 
QString m_main_device
 
QString m_passthru_device
 
bool m_no_audio_in {false}
 
bool m_no_audio_out {true}
 
bool m_controls_volume {true}
 
vector< MythTV::Visual * > m_visuals
 

Detailed Description

Definition at line 26 of file audioplayer.h.

Constructor & Destructor Documentation

◆ AudioPlayer()

AudioPlayer::AudioPlayer ( MythPlayer parent,
bool  muted 
)

Definition at line 12 of file audioplayer.cpp.

◆ ~AudioPlayer()

AudioPlayer::~AudioPlayer ( )

Definition at line 19 of file audioplayer.cpp.

Member Function Documentation

◆ Q_DECLARE_TR_FUNCTIONS()

AudioPlayer::Q_DECLARE_TR_FUNCTIONS ( AudioPlayer  )
private

◆ addVisual()

void AudioPlayer::addVisual ( MythTV::Visual vis)

Definition at line 25 of file audioplayer.cpp.

Referenced by MythPlayer::EnableEdit(), and VideoVisual::VideoVisual().

◆ removeVisual()

void AudioPlayer::removeVisual ( MythTV::Visual vis)

Definition at line 39 of file audioplayer.cpp.

Referenced by MythPlayer::DisableEdit(), and VideoVisual::~VideoVisual().

◆ Reset()

void AudioPlayer::Reset ( void  )

◆ DeleteOutput()

void AudioPlayer::DeleteOutput ( void  )

◆ ReinitAudio()

QString AudioPlayer::ReinitAudio ( void  )

◆ SetAudioOutput()

void AudioPlayer::SetAudioOutput ( AudioOutput ao)

Definition at line 209 of file audioplayer.cpp.

Referenced by Transcode::TranscodeFile().

◆ SetAudioInfo()

void AudioPlayer::SetAudioInfo ( const QString &  main_device,
const QString &  passthru_device,
uint  samplerate,
int  codec_profile = -1 
)

Set audio output device parameters.

codec_profile is currently only used for DTS

Definition at line 231 of file audioplayer.cpp.

Referenced by PlayerContext::CreatePlayer(), and VideoPerformanceTest::Test().

◆ SetAudioParams()

void AudioPlayer::SetAudioParams ( AudioFormat  format,
int  orig_channels,
int  channels,
AVCodecID  codec,
int  samplerate,
bool  passthru,
int  codec_profile = -1 
)

Set audio output parameters.

codec_profile is currently only used for DTS

Definition at line 250 of file audioplayer.cpp.

Referenced by NuppelDecoder::OpenFile(), AvFormatDecoder::ScanStreams(), and AvFormatDecoder::SetupAudioStream().

◆ SetEffDsp()

void AudioPlayer::SetEffDsp ( int  dsprate)

Definition at line 266 of file audioplayer.cpp.

Referenced by NuppelDecoder::GetFrame(), and NuppelDecoder::OpenFile().

◆ CheckFormat()

void AudioPlayer::CheckFormat ( void  )

Definition at line 177 of file audioplayer.cpp.

Referenced by MythPlayer::OpenFile().

◆ SetNoAudio()

void AudioPlayer::SetNoAudio ( void  )
inline

Definition at line 51 of file audioplayer.h.

Referenced by PlayerContext::CreatePlayer(), and VideoPerformanceTest::Test().

◆ HasAudioIn()

bool AudioPlayer::HasAudioIn ( void  ) const
inline

◆ HasAudioOut()

bool AudioPlayer::HasAudioOut ( void  ) const
inline

◆ ControlsVolume()

bool AudioPlayer::ControlsVolume ( void  ) const
inline

Definition at line 54 of file audioplayer.h.

Referenced by TV::GetStatus().

◆ Pause()

bool AudioPlayer::Pause ( bool  pause)

◆ IsPaused()

bool AudioPlayer::IsPaused ( void  )

Definition at line 193 of file audioplayer.cpp.

Referenced by MythPlayer::EventLoop().

◆ PauseAudioUntilBuffered()

void AudioPlayer::PauseAudioUntilBuffered ( void  )

Definition at line 201 of file audioplayer.cpp.

Referenced by TV::PauseAudioUntilBuffered().

◆ GetCodec()

AVCodecID AudioPlayer::GetCodec ( void  ) const
inline

Definition at line 59 of file audioplayer.h.

Referenced by MythPlayer::GetCodecDescription(), and Transcode::TranscodeFile().

◆ GetNumChannels()

int AudioPlayer::GetNumChannels ( void  ) const
inline

Definition at line 60 of file audioplayer.h.

Referenced by VideoVisual::CanVisualise().

◆ GetOrigChannels()

int AudioPlayer::GetOrigChannels ( void  ) const
inline

Definition at line 61 of file audioplayer.h.

Referenced by MythPlayer::GetCodecDescription().

◆ GetSampleRate()

int AudioPlayer::GetSampleRate ( void  ) const
inline

Definition at line 62 of file audioplayer.h.

Referenced by MythPlayer::EnableEdit(), and MythPlayer::GetPlaybackData().

◆ GetVolume()

uint AudioPlayer::GetVolume ( void  )

Definition at line 219 of file audioplayer.cpp.

Referenced by AdjustVolume(), and SetVolume().

◆ AdjustVolume()

uint AudioPlayer::AdjustVolume ( int  change)

Definition at line 321 of file audioplayer.cpp.

◆ SetVolume()

uint AudioPlayer::SetVolume ( int  newvolume)

Definition at line 330 of file audioplayer.cpp.

◆ GetStretchFactor()

float AudioPlayer::GetStretchFactor ( void  ) const
inline

◆ SetStretchFactor()

void AudioPlayer::SetStretchFactor ( float  factor)

◆ IsUpmixing()

bool AudioPlayer::IsUpmixing ( void  )

Definition at line 347 of file audioplayer.cpp.

Referenced by EnableUpmix(), and TV::PlaybackMenuInit().

◆ EnableUpmix()

bool AudioPlayer::EnableUpmix ( bool  enable,
bool  toggle = false 
)

Definition at line 355 of file audioplayer.cpp.

Referenced by TV::EnableUpmix().

◆ CanUpmix()

bool AudioPlayer::CanUpmix ( void  )

Definition at line 365 of file audioplayer.cpp.

Referenced by TV::PlaybackMenuInit().

◆ CanPassthrough()

bool AudioPlayer::CanPassthrough ( int  samplerate,
int  channels,
AVCodecID  codec,
int  profile 
)

Definition at line 434 of file audioplayer.cpp.

Referenced by AvFormatDecoder::DoPassThrough().

◆ CanDownmix()

bool AudioPlayer::CanDownmix ( void  )

Definition at line 442 of file audioplayer.cpp.

Referenced by AvFormatDecoder::DecoderWillDownmix().

◆ CanAC3()

bool AudioPlayer::CanAC3 ( void  )

Definition at line 395 of file audioplayer.cpp.

◆ CanDTS()

bool AudioPlayer::CanDTS ( void  )

Definition at line 400 of file audioplayer.cpp.

◆ CanEAC3()

bool AudioPlayer::CanEAC3 ( void  )

Definition at line 405 of file audioplayer.cpp.

◆ CanTrueHD()

bool AudioPlayer::CanTrueHD ( void  )

Definition at line 410 of file audioplayer.cpp.

◆ CanDTSHD()

bool AudioPlayer::CanDTSHD ( void  )

◆ GetMaxChannels()

uint AudioPlayer::GetMaxChannels ( void  )

◆ GetMaxHDRate()

int AudioPlayer::GetMaxHDRate ( void  )

Definition at line 427 of file audioplayer.cpp.

◆ GetAudioTime()

int64_t AudioPlayer::GetAudioTime ( void  )

◆ GetFormat()

AudioFormat AudioPlayer::GetFormat ( void  ) const
inline

Definition at line 81 of file audioplayer.h.

Referenced by AvFormatDecoder::ProcessAudioPacket().

◆ CanProcess() [1/2]

bool AudioPlayer::CanProcess ( AudioFormat  fmt)

Definition at line 516 of file audioplayer.cpp.

◆ CanProcess() [2/2]

uint32_t AudioPlayer::CanProcess ( void  )

Definition at line 523 of file audioplayer.cpp.

Referenced by SetAudioParams().

◆ DecodeAudio()

int AudioPlayer::DecodeAudio ( AVCodecContext *  ctx,
uint8_t *  buffer,
int &  data_size,
const AVPacket *  pkt 
)

DecodeAudio Utility routine.

Decode an audio packet, and compact it if data is planar Return negative error code if an error occurred during decoding or the number of bytes consumed from the input AVPacket data_size contains the size of decoded data copied into buffer data decoded will be S16 samples if class instance can't handle HD audio or S16 and above otherwise. No U8 PCM format can be returned

Definition at line 540 of file audioplayer.cpp.

Referenced by NuppelDecoder::GetFrame(), and AvFormatDecoder::ProcessAudioPacket().

◆ IsMuted()

bool AudioPlayer::IsMuted ( void  )
inline

Definition at line 88 of file audioplayer.h.

Referenced by SetMuted().

◆ SetMuted()

bool AudioPlayer::SetMuted ( bool  mute)

Definition at line 274 of file audioplayer.cpp.

◆ GetMuteState()

MuteState AudioPlayer::GetMuteState ( void  )

Definition at line 313 of file audioplayer.cpp.

Referenced by IncrMuteState().

◆ SetMuteState()

MuteState AudioPlayer::SetMuteState ( MuteState  mstate)

Definition at line 298 of file audioplayer.cpp.

Referenced by IncrMuteState(), ReinitAudio(), and SetMuted().

◆ IncrMuteState()

MuteState AudioPlayer::IncrMuteState ( void  )

Definition at line 306 of file audioplayer.cpp.

◆ AddAudioData()

void AudioPlayer::AddAudioData ( char *  buffer,
int  len,
int64_t  timecode,
int  frames 
)

◆ NeedDecodingBeforePassthrough()

bool AudioPlayer::NeedDecodingBeforePassthrough ( void  )

Definition at line 474 of file audioplayer.cpp.

Referenced by AvFormatDecoder::ProcessAudioPacket().

◆ LengthLastData()

int64_t AudioPlayer::LengthLastData ( void  )

Definition at line 481 of file audioplayer.cpp.

Referenced by AvFormatDecoder::ProcessAudioPacket().

◆ GetBufferStatus()

bool AudioPlayer::GetBufferStatus ( uint fill,
uint total 
)

Definition at line 488 of file audioplayer.cpp.

Referenced by IsBufferAlmostFull().

◆ IsBufferAlmostFull()

bool AudioPlayer::IsBufferAlmostFull ( void  )

◆ GetAudioBufferedTime()

int64_t AudioPlayer::GetAudioBufferedTime ( void  )

Definition at line 510 of file audioplayer.cpp.

Referenced by IsBufferAlmostFull().

◆ GetAudioOutput()

AudioOutput* AudioPlayer::GetAudioOutput ( void  ) const
inline

Return internal AudioOutput object.

Definition at line 104 of file audioplayer.h.

Referenced by MythPlayer::EventLoop(), and AvFormatDecoder::SetupAudioStream().

◆ AddVisuals()

void AudioPlayer::AddVisuals ( void  )
private

Definition at line 53 of file audioplayer.cpp.

Referenced by ReinitAudio(), and SetAudioOutput().

◆ RemoveVisuals()

void AudioPlayer::RemoveVisuals ( void  )
private

Definition at line 63 of file audioplayer.cpp.

Referenced by DeleteOutput().

◆ ResetVisuals()

void AudioPlayer::ResetVisuals ( void  )
private

Definition at line 73 of file audioplayer.cpp.

Referenced by ReinitAudio(), and SetAudioParams().

Member Data Documentation

◆ m_parent

MythPlayer* AudioPlayer::m_parent {nullptr}
private

Definition at line 112 of file audioplayer.h.

Referenced by AddAudioData(), and ReinitAudio().

◆ m_audioOutput

AudioOutput* AudioPlayer::m_audioOutput {nullptr}
private

◆ m_channels

int AudioPlayer::m_channels {-1}
private

Definition at line 114 of file audioplayer.h.

Referenced by ReinitAudio(), and SetAudioParams().

◆ m_orig_channels

int AudioPlayer::m_orig_channels {-1}
private

Definition at line 115 of file audioplayer.h.

Referenced by SetAudioParams().

◆ m_codec

AVCodecID AudioPlayer::m_codec {AV_CODEC_ID_NONE}
private

Definition at line 116 of file audioplayer.h.

Referenced by ReinitAudio(), and SetAudioParams().

◆ m_format

AudioFormat AudioPlayer::m_format {FORMAT_NONE}
private

Definition at line 117 of file audioplayer.h.

Referenced by CheckFormat(), ReinitAudio(), and SetAudioParams().

◆ m_samplerate

int AudioPlayer::m_samplerate {44100}
private

Definition at line 118 of file audioplayer.h.

Referenced by ReinitAudio(), SetAudioInfo(), and SetAudioParams().

◆ m_codec_profile

int AudioPlayer::m_codec_profile {0}
private

Definition at line 119 of file audioplayer.h.

Referenced by ReinitAudio(), SetAudioInfo(), and SetAudioParams().

◆ m_stretchfactor

float AudioPlayer::m_stretchfactor {1.0F}
private

Definition at line 120 of file audioplayer.h.

Referenced by ReinitAudio(), and SetStretchFactor().

◆ m_passthru

bool AudioPlayer::m_passthru {false}
private

Definition at line 121 of file audioplayer.h.

Referenced by ReinitAudio(), and SetAudioParams().

◆ m_lock

QMutex AudioPlayer::m_lock {QMutex::Recursive}
private

◆ m_muted_on_creation

bool AudioPlayer::m_muted_on_creation
private

Definition at line 123 of file audioplayer.h.

Referenced by ReinitAudio().

◆ m_main_device

QString AudioPlayer::m_main_device
private

Definition at line 124 of file audioplayer.h.

Referenced by ReinitAudio(), and SetAudioInfo().

◆ m_passthru_device

QString AudioPlayer::m_passthru_device
private

Definition at line 125 of file audioplayer.h.

Referenced by ReinitAudio(), and SetAudioInfo().

◆ m_no_audio_in

bool AudioPlayer::m_no_audio_in {false}
private

Definition at line 126 of file audioplayer.h.

Referenced by CheckFormat(), and ReinitAudio().

◆ m_no_audio_out

bool AudioPlayer::m_no_audio_out {true}
private

◆ m_controls_volume

bool AudioPlayer::m_controls_volume {true}
private

Definition at line 128 of file audioplayer.h.

Referenced by AudioPlayer(), and ReinitAudio().

◆ m_visuals

vector<MythTV::Visual*> AudioPlayer::m_visuals
private

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