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} |
vector< MythTV::Visual * > | m_visuals |
Definition at line 28 of file audioplayer.h.
AudioPlayer::AudioPlayer | ( | MythPlayer * | parent, |
bool | muted | ||
) |
Definition at line 12 of file audioplayer.cpp.
|
override |
Definition at line 19 of file audioplayer.cpp.
|
signal |
void AudioPlayer::addVisual | ( | MythTV::Visual * | vis | ) |
Definition at line 25 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::SetupAudioGraph(), and VideoVisual::VideoVisual().
void AudioPlayer::removeVisual | ( | MythTV::Visual * | vis | ) |
Definition at line 39 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ClearAudioGraph(), and VideoVisual::~VideoVisual().
void AudioPlayer::Reset | ( | void | ) |
Definition at line 83 of file audioplayer.cpp.
Referenced by MythPlayerAVSync::AVSync(), MythPlayer::ClearAfterSeek(), MythPlayer::PrebufferEnoughFrames(), MythDVDDecoder::ReadPacket(), and MythPlayerAudioUI::ResetAudio().
void AudioPlayer::DeleteOutput | ( | void | ) |
Definition at line 92 of file audioplayer.cpp.
Referenced by MythPlayer::AudioEnd(), SetAudioOutput(), MythPlayerUI::StartPlaying(), and ~AudioPlayer().
QString AudioPlayer::ReinitAudio | ( | void | ) |
Definition at line 104 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ReinitAudio(), AvFormatDecoder::ScanStreams(), and AvFormatDecoder::SetupAudioStream().
void AudioPlayer::SetAudioOutput | ( | AudioOutput * | ao | ) |
Definition at line 204 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 226 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 246 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ScanStreams(), and AvFormatDecoder::SetupAudioStream().
void AudioPlayer::SetEffDsp | ( | int | dsprate | ) |
Definition at line 262 of file audioplayer.cpp.
void AudioPlayer::CheckFormat | ( | void | ) |
Definition at line 172 of file audioplayer.cpp.
Referenced by MythPlayer::OpenFile().
|
inline |
Definition at line 56 of file audioplayer.h.
|
inline |
Definition at line 57 of file audioplayer.h.
Referenced by MythPlayerVisualiserUI::AutoVisualise(), MythPlayerAVSync::AVSync(), AvFormatDecoder::GetFrame(), AvFormatDecoder::ProcessAudioPacket(), AvFormatDecoder::RemoveAudioStreams(), and AvFormatDecoder::ScanStreams().
|
inline |
Definition at line 58 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 59 of file audioplayer.h.
Referenced by MythPlayerAudioUI::ChangeMuteState().
Definition at line 178 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 188 of file audioplayer.cpp.
Referenced by MythPlayerUI::EventLoop().
void AudioPlayer::PauseAudioUntilBuffered | ( | void | ) |
Definition at line 196 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::PauseAudioUntilBuffered().
|
inline |
Definition at line 64 of file audioplayer.h.
Referenced by MythPlayerUI::GetCodecDescription(), and Transcode::TranscodeFile().
|
inline |
Definition at line 65 of file audioplayer.h.
Referenced by MythPlayerUI::GetCodecDescription().
|
inline |
Definition at line 66 of file audioplayer.h.
Referenced by MythPlayerUI::GetPlaybackData(), and MythPlayerAudioUI::SetupAudioGraph().
uint AudioPlayer::GetVolume | ( | void | ) |
Definition at line 214 of file audioplayer.cpp.
Referenced by AdjustVolume(), MythPlayerAudioUI::ChangeVolume(), and SetVolume().
uint AudioPlayer::AdjustVolume | ( | int | change | ) |
Definition at line 317 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeVolume().
uint AudioPlayer::SetVolume | ( | int | newvolume | ) |
Definition at line 326 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeVolume().
|
inline |
Definition at line 70 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 369 of file audioplayer.cpp.
Referenced by MythPlayer::ChangeSpeed(), ReinitAudio(), and MythPlayerAudioUI::SetupAudioOutput().
bool AudioPlayer::IsUpmixing | ( | void | ) |
Definition at line 343 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::EnableUpmix(), and EnableUpmix().
Definition at line 351 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::EnableUpmix().
bool AudioPlayer::CanUpmix | ( | void | ) |
Definition at line 361 of file audioplayer.cpp.
bool AudioPlayer::CanPassthrough | ( | int | samplerate, |
int | channels, | ||
AVCodecID | codec, | ||
int | profile | ||
) |
Definition at line 430 of file audioplayer.cpp.
Referenced by AvFormatDecoder::DoPassThrough().
bool AudioPlayer::CanDownmix | ( | void | ) |
Definition at line 438 of file audioplayer.cpp.
Referenced by AvFormatDecoder::DecoderWillDownmix().
bool AudioPlayer::CanAC3 | ( | void | ) |
Definition at line 391 of file audioplayer.cpp.
bool AudioPlayer::CanDTS | ( | void | ) |
Definition at line 396 of file audioplayer.cpp.
bool AudioPlayer::CanEAC3 | ( | void | ) |
Definition at line 401 of file audioplayer.cpp.
bool AudioPlayer::CanTrueHD | ( | void | ) |
Definition at line 406 of file audioplayer.cpp.
bool AudioPlayer::CanDTSHD | ( | void | ) |
Definition at line 411 of file audioplayer.cpp.
Referenced by AvFormatDecoder::AutoSelectAudioTrack(), and AvFormatDecoder::DoPassThrough().
uint AudioPlayer::GetMaxChannels | ( | void | ) |
Definition at line 416 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket(), and AvFormatDecoder::SetupAudioStream().
int AudioPlayer::GetMaxHDRate | ( | void | ) |
Definition at line 423 of file audioplayer.cpp.
std::chrono::milliseconds AudioPlayer::GetAudioTime | ( | void | ) |
Definition at line 335 of file audioplayer.cpp.
Referenced by MythPlayerAVSync::AVSync(), and VideoVisual::GetNode().
|
inline |
Definition at line 85 of file audioplayer.h.
Referenced by AvFormatDecoder::ProcessAudioPacket().
bool AudioPlayer::CanProcess | ( | AudioFormat | fmt | ) |
Definition at line 513 of file audioplayer.cpp.
uint32_t AudioPlayer::CanProcess | ( | void | ) |
Definition at line 520 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 537 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
|
inline |
Definition at line 92 of file audioplayer.h.
Referenced by MythPlayerAudioUI::ChangeMuteState(), and SetMuted().
Definition at line 270 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeMuteState().
MuteState AudioPlayer::GetMuteState | ( | void | ) |
Definition at line 309 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeMuteState(), and IncrMuteState().
Definition at line 294 of file audioplayer.cpp.
Referenced by IncrMuteState(), ReinitAudio(), and SetMuted().
MuteState AudioPlayer::IncrMuteState | ( | void | ) |
Definition at line 302 of file audioplayer.cpp.
Referenced by MythPlayerAudioUI::ChangeMuteState().
void AudioPlayer::AddAudioData | ( | char * | buffer, |
int | len, | ||
std::chrono::milliseconds | timecode, | ||
int | frames | ||
) |
Definition at line 449 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
bool AudioPlayer::NeedDecodingBeforePassthrough | ( | void | ) |
Definition at line 470 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
std::chrono::milliseconds AudioPlayer::LengthLastData | ( | void | ) |
Definition at line 477 of file audioplayer.cpp.
Referenced by AvFormatDecoder::ProcessAudioPacket().
Definition at line 484 of file audioplayer.cpp.
Referenced by IsBufferAlmostFull().
bool AudioPlayer::IsBufferAlmostFull | ( | void | ) |
Definition at line 493 of file audioplayer.cpp.
Referenced by MythPlayer::DecoderGetFrame(), AvFormatDecoder::GetFrame(), MythPlayer::PrebufferEnoughFrames(), and AvFormatDecoder::ProcessAudioPacket().
std::chrono::milliseconds AudioPlayer::GetAudioBufferedTime | ( | void | ) |
Definition at line 507 of file audioplayer.cpp.
Referenced by IsBufferAlmostFull().
|
inline |
Return internal AudioOutput object.
Definition at line 108 of file audioplayer.h.
Referenced by MythPlayerUI::EventLoop(), and AvFormatDecoder::SetupAudioStream().
|
private |
Definition at line 53 of file audioplayer.cpp.
Referenced by ReinitAudio(), and SetAudioOutput().
|
private |
Definition at line 63 of file audioplayer.cpp.
Referenced by DeleteOutput().
|
private |
Definition at line 73 of file audioplayer.cpp.
Referenced by ReinitAudio(), and SetAudioParams().
|
private |
Definition at line 116 of file audioplayer.h.
Referenced by AddAudioData(), and ReinitAudio().
|
private |
Definition at line 117 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 118 of file audioplayer.h.
Referenced by CheckFormat(), ReinitAudio(), SetAudioInfo(), and SetAudioParams().
|
private |
Definition at line 119 of file audioplayer.h.
Referenced by ReinitAudio(), and SetStretchFactor().
|
private |
Definition at line 123 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 125 of file audioplayer.h.
Referenced by ReinitAudio().
|
private |
Definition at line 126 of file audioplayer.h.
Referenced by ReinitAudio(), and SetAudioInfo().
|
private |
Definition at line 127 of file audioplayer.h.
Referenced by ReinitAudio(), and SetAudioInfo().
Definition at line 128 of file audioplayer.h.
Referenced by CheckFormat(), and ReinitAudio().
Definition at line 129 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 130 of file audioplayer.h.
Referenced by AudioPlayer(), and ReinitAudio().
|
private |
Definition at line 131 of file audioplayer.h.
Referenced by addVisual(), AddVisuals(), removeVisual(), RemoveVisuals(), ResetVisuals(), and ~AudioPlayer().