MythTV
master
|
#include <audioplayer.h>
Signals | |
void | AudioPlayerStateChanged (MythAudioPlayerState State) |
Public Member Functions | |
AudioPlayer (MythPlayer *parent, bool muted) | |
~AudioPlayer () override | |
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 | 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) |
std::chrono::milliseconds | 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 mstate) |
MuteState | IncrMuteState (void) |
void | AddAudioData (char *buffer, int len, std::chrono::milliseconds timecode, int frames) |
bool | NeedDecodingBeforePassthrough (void) |
std::chrono::milliseconds | LengthLastData (void) |
bool | GetBufferStatus (uint &fill, uint &total) |
bool | IsBufferAlmostFull (void) |
std::chrono::milliseconds | GetAudioBufferedTime (void) |
AudioOutput * | GetAudioOutput (void) const |
Return internal AudioOutput object. More... | |
Private Member Functions | |
void | AddVisuals (void) |
void | RemoveVisuals (void) |
void | ResetVisuals (void) |
Private Attributes | |
MythPlayer * | m_parent {nullptr} |
AudioOutput * | m_audioOutput {nullptr} |
MythAudioPlayerState | m_state { } |
float | m_stretchFactor {1.0F} |
QRecursiveMutex | m_lock |
bool | m_mutedOnCreation {false} |
QString | m_mainDevice |
QString | m_passthruDevice |
bool | m_noAudioIn {false} |
bool | m_noAudioOut {true} |
bool | m_controlsVolume {true} |
std::vector< MythTV::Visual * > | m_visuals |
Definition at line 26 of file audioplayer.h.
AudioPlayer::AudioPlayer | ( | MythPlayer * | parent, |
bool | muted | ||
) |
Definition at line 13 of file audioplayer.cpp.
|
override |
Definition at line 20 of file audioplayer.cpp.
|
signal |
void AudioPlayer::addVisual | ( | MythTV::Visual * | vis | ) |
Definition at line 26 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::SetupAudioGraph(), and VideoVisual::VideoVisual().
void AudioPlayer::removeVisual | ( | MythTV::Visual * | vis | ) |
Definition at line 40 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ClearAudioGraph(), and VideoVisual::~VideoVisual().
void AudioPlayer::Reset | ( | void | ) |
Definition at line 84 of file audioplayer.cpp.
Referenced by MythPlayerAVSync::AVSync(), MythPlayer::ClearAfterSeek(), MythPlayer::PrebufferEnoughFrames(), MythDVDDecoder::ReadPacket(), and MythPlayerAudioUI::ResetAudio().
void AudioPlayer::DeleteOutput | ( | void | ) |
Definition at line 93 of file audioplayer.cpp.
Referenced by MythPlayer::AudioEnd(), SetAudioOutput(), MythPlayerUI::StartPlaying(), and ~AudioPlayer().
QString AudioPlayer::ReinitAudio | ( | void | ) |
Definition at line 105 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ReinitAudio(), AvFormatDecoder::ScanStreams(), and AvFormatDecoder::SetupAudioStream().
void AudioPlayer::SetAudioOutput | ( | AudioOutput * | ao | ) |
Definition at line 205 of file audioplayer.cpp.
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 227 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::SetupAudioOutput().
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 247 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ScanStreams(), and AvFormatDecoder::SetupAudioStream().
void AudioPlayer::SetEffDsp | ( | int | dsprate | ) |
Definition at line 263 of file audioplayer.cpp.
void AudioPlayer::CheckFormat | ( | void | ) |
Definition at line 173 of file audioplayer.cpp.
Referenced by MythPlayer::OpenFile().
|
inline |
Definition at line 54 of file audioplayer.h.
|
inline |
Definition at line 55 of file audioplayer.h.
Referenced by MythPlayerVisualiserUI::AutoVisualise(), MythPlayerAVSync::AVSync(), AvFormatDecoder::GetFrame(), AvFormatDecoder::ProcessAudioPacket(), AvFormatDecoder::RemoveAudioStreams(), and AvFormatDecoder::ScanStreams().
|
inline |
Definition at line 56 of file audioplayer.h.
Referenced by MythPlayerAudioUI::ChangeMuteState(), MythPlayer::ChangeSpeed(), MythPlayer::DecoderLoop(), MythPlayerAudioUI::EnableUpmix(), MythPlayer::ForceSetupAudioStream(), AvFormatDecoder::ProcessAudioPacket(), MythPlayer::SetDisablePassThrough(), and MythPlayer::syncWithAudioStretch().
|
inline |
Definition at line 57 of file audioplayer.h.
Referenced by MythPlayerAudioUI::ChangeMuteState().
Definition at line 179 of file audioplayer.cpp.
Referenced by MythPlayerAVSync::AVSync(), MythPlayer::Pause(), MythPlayer::Play(), MythPlayer::PrebufferEnoughFrames(), MythPlayerAVSync::ResetAVSyncForLiveTV(), and MythPlayerAVSync::SetAVSyncMusicChoice().
bool AudioPlayer::IsPaused | ( | void | ) |
Definition at line 189 of file audioplayer.cpp.
Referenced by MythPlayerUI::EventLoop(), and MythPlayer::PrebufferEnoughFrames().
void AudioPlayer::PauseAudioUntilBuffered | ( | void | ) |
Definition at line 197 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::PauseAudioUntilBuffered().
|
inline |
Definition at line 62 of file audioplayer.h.
Referenced by MythPlayerUI::GetCodecDescription(), and Transcode::TranscodeFile().
|
inline |
Definition at line 63 of file audioplayer.h.
Referenced by MythPlayerUI::GetCodecDescription().
|
inline |
Definition at line 64 of file audioplayer.h.
Referenced by MythPlayerUI::GetPlaybackData(), and MythPlayerAudioUI::SetupAudioGraph().
uint AudioPlayer::GetVolume | ( | void | ) |
Definition at line 215 of file audioplayer.cpp.
Referenced by AdjustVolume(), MythPlayerAudioUI::ChangeVolume(), and SetVolume().
uint AudioPlayer::AdjustVolume | ( | int | change | ) |
Definition at line 318 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeVolume().
uint AudioPlayer::SetVolume | ( | int | newvolume | ) |
Definition at line 327 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeVolume().
|
inline |
Definition at line 68 of file audioplayer.h.
Referenced by MythPlayerUI::EventLoop(), MythPlayer::IsNearEnd(), MythPlayer::SetFrameRate(), MythPlayer::SetVideoParams(), MythPlayerUI::StartPlaying(), MythPlayer::syncWithAudioStretch(), and MythPlayer::UpdateFFRewSkip().
void AudioPlayer::SetStretchFactor | ( | float | factor | ) |
Definition at line 370 of file audioplayer.cpp.
Referenced by MythPlayer::ChangeSpeed(), ReinitAudio(), and MythPlayerAudioUI::SetupAudioOutput().
bool AudioPlayer::IsUpmixing | ( | void | ) |
Definition at line 344 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::EnableUpmix(), and EnableUpmix().
Definition at line 352 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::EnableUpmix().
bool AudioPlayer::CanUpmix | ( | void | ) |
Definition at line 362 of file audioplayer.cpp.
bool AudioPlayer::CanPassthrough | ( | int | samplerate, |
int | channels, | ||
AVCodecID | codec, | ||
int | profile | ||
) |
Definition at line 431 of file audioplayer.cpp.
Referenced by AvFormatDecoder::DoPassThrough().
bool AudioPlayer::CanDownmix | ( | void | ) |
Definition at line 439 of file audioplayer.cpp.
Referenced by AvFormatDecoder::DecoderWillDownmix().
bool AudioPlayer::CanAC3 | ( | void | ) |
Definition at line 392 of file audioplayer.cpp.
bool AudioPlayer::CanDTS | ( | void | ) |
Definition at line 397 of file audioplayer.cpp.
bool AudioPlayer::CanEAC3 | ( | void | ) |
Definition at line 402 of file audioplayer.cpp.
bool AudioPlayer::CanTrueHD | ( | void | ) |
Definition at line 407 of file audioplayer.cpp.
bool AudioPlayer::CanDTSHD | ( | void | ) |
Definition at line 412 of file audioplayer.cpp.
Referenced by AvFormatDecoder::AutoSelectAudioTrack(), and AvFormatDecoder::DoPassThrough().
uint AudioPlayer::GetMaxChannels | ( | void | ) |
Definition at line 417 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket(), and AvFormatDecoder::SetupAudioStream().
int AudioPlayer::GetMaxHDRate | ( | void | ) |
Definition at line 424 of file audioplayer.cpp.
std::chrono::milliseconds AudioPlayer::GetAudioTime | ( | void | ) |
Definition at line 336 of file audioplayer.cpp.
Referenced by MythPlayerAVSync::AVSync(), and VideoVisual::GetNode().
|
inline |
Definition at line 83 of file audioplayer.h.
Referenced by AvFormatDecoder::ProcessAudioPacket().
bool AudioPlayer::CanProcess | ( | AudioFormat | fmt | ) |
Definition at line 514 of file audioplayer.cpp.
uint32_t AudioPlayer::CanProcess | ( | void | ) |
Definition at line 521 of file audioplayer.cpp.
Referenced by SetAudioParams().
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 538 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
|
inline |
Definition at line 90 of file audioplayer.h.
Referenced by MythPlayerAudioUI::ChangeMuteState(), and SetMuted().
Definition at line 271 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeMuteState().
MuteState AudioPlayer::GetMuteState | ( | void | ) |
Definition at line 310 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeMuteState(), and IncrMuteState().
Definition at line 295 of file audioplayer.cpp.
Referenced by IncrMuteState(), ReinitAudio(), and SetMuted().
MuteState AudioPlayer::IncrMuteState | ( | void | ) |
Definition at line 303 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeMuteState().
void AudioPlayer::AddAudioData | ( | char * | buffer, |
int | len, | ||
std::chrono::milliseconds | timecode, | ||
int | frames | ||
) |
Definition at line 450 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
bool AudioPlayer::NeedDecodingBeforePassthrough | ( | void | ) |
Definition at line 471 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
std::chrono::milliseconds AudioPlayer::LengthLastData | ( | void | ) |
Definition at line 478 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
Definition at line 485 of file audioplayer.cpp.
Referenced by IsBufferAlmostFull().
bool AudioPlayer::IsBufferAlmostFull | ( | void | ) |
Definition at line 494 of file audioplayer.cpp.
Referenced by MythPlayer::DecoderGetFrame(), AvFormatDecoder::GetFrame(), MythPlayer::PrebufferEnoughFrames(), and AvFormatDecoder::ProcessAudioPacket().
std::chrono::milliseconds AudioPlayer::GetAudioBufferedTime | ( | void | ) |
Definition at line 508 of file audioplayer.cpp.
Referenced by IsBufferAlmostFull().
|
inline |
Return internal AudioOutput object.
Definition at line 106 of file audioplayer.h.
Referenced by MythPlayerUI::EventLoop(), and AvFormatDecoder::SetupAudioStream().
|
private |
Definition at line 54 of file audioplayer.cpp.
Referenced by ReinitAudio(), and SetAudioOutput().
|
private |
Definition at line 64 of file audioplayer.cpp.
Referenced by DeleteOutput().
|
private |
Definition at line 74 of file audioplayer.cpp.
Referenced by ReinitAudio(), and SetAudioParams().
|
private |
Definition at line 114 of file audioplayer.h.
Referenced by AddAudioData(), and ReinitAudio().
|
private |
Definition at line 115 of file audioplayer.h.
Referenced by AddAudioData(), addVisual(), AddVisuals(), AdjustVolume(), CanAC3(), CanDownmix(), CanDTS(), CanDTSHD(), CanEAC3(), CanPassthrough(), CanProcess(), CanTrueHD(), CanUpmix(), DecodeAudio(), DeleteOutput(), EnableUpmix(), GetAudioBufferedTime(), GetAudioTime(), GetBufferStatus(), GetMaxChannels(), GetMaxHDRate(), GetMuteState(), GetVolume(), IncrMuteState(), IsPaused(), IsUpmixing(), LengthLastData(), NeedDecodingBeforePassthrough(), Pause(), PauseAudioUntilBuffered(), ReinitAudio(), removeVisual(), RemoveVisuals(), Reset(), ResetVisuals(), SetAudioOutput(), SetEffDsp(), SetMuted(), SetMuteState(), SetStretchFactor(), and SetVolume().
|
private |
Definition at line 116 of file audioplayer.h.
Referenced by CheckFormat(), ReinitAudio(), SetAudioInfo(), and SetAudioParams().
|
private |
Definition at line 117 of file audioplayer.h.
Referenced by ReinitAudio(), and SetStretchFactor().
|
private |
Definition at line 121 of file audioplayer.h.
Referenced by addVisual(), AddVisuals(), AdjustVolume(), CanUpmix(), DeleteOutput(), EnableUpmix(), GetAudioTime(), GetMuteState(), GetVolume(), IsPaused(), IsUpmixing(), Pause(), PauseAudioUntilBuffered(), ReinitAudio(), removeVisual(), RemoveVisuals(), Reset(), ResetVisuals(), SetAudioOutput(), SetEffDsp(), SetMuted(), SetMuteState(), SetStretchFactor(), and SetVolume().
Definition at line 123 of file audioplayer.h.
Referenced by ReinitAudio().
|
private |
Definition at line 124 of file audioplayer.h.
Referenced by ReinitAudio(), and SetAudioInfo().
|
private |
Definition at line 125 of file audioplayer.h.
Referenced by ReinitAudio(), and SetAudioInfo().
Definition at line 126 of file audioplayer.h.
Referenced by CheckFormat(), and ReinitAudio().
Definition at line 127 of file audioplayer.h.
Referenced by AddAudioData(), AdjustVolume(), CheckFormat(), DeleteOutput(), GetAudioTime(), GetBufferStatus(), GetMuteState(), GetVolume(), IncrMuteState(), IsPaused(), Pause(), PauseAudioUntilBuffered(), ReinitAudio(), SetEffDsp(), SetMuted(), SetMuteState(), and SetVolume().
Definition at line 128 of file audioplayer.h.
Referenced by AudioPlayer(), and ReinitAudio().
|
private |
Definition at line 129 of file audioplayer.h.
Referenced by addVisual(), AddVisuals(), removeVisual(), RemoveVisuals(), ResetVisuals(), and ~AudioPlayer().