|
vdr-plugin-softhddevice-drm-gles 1.4.0
|
cAudioDecoder - Audio decoder class More...
#include <codec_audio.h>

Public Member Functions | |
| cAudioDecoder (cSoftHdAudio *) | |
| Audio decoder class constructor. More... | |
| virtual | ~cAudioDecoder (void) |
| Audio decoder class destructor. More... | |
| void | Open (AVCodecID, AVCodecParameters *=nullptr, AVRational={ .num=1,.den=90000 }) |
| Open and initiate the audio decoder. More... | |
| void | Close (void) |
| Close the audio decoder. More... | |
| void | Decode (const AVPacket *) |
| Decode an audio packet. More... | |
| void | FlushBuffers (void) |
| Flush the audio decoder. More... | |
| void | SetPassthrough (int) |
| Set audio pass-through mask. More... | |
| AVCodecID | GetCodecId () const |
Private Member Functions | |
| int | DecodePassthrough (const AVPacket *, AVFrame *) |
| Passthrough audio data. More... | |
| int | UpdateFormat (void) |
| Handle audio format changes. More... | |
Private Attributes | |
| cSoftHdAudio * | m_pAudio |
| audio module More... | |
| AVCodecContext * | m_pAudioCtx |
| ffmpeg audio codec context More... | |
| AVCodecID | m_codecId = AV_CODEC_ID_NONE |
| current codec id More... | |
| AVFrame * | m_pFrame |
| decoded ffmpeg audio frame More... | |
| int64_t | m_lastPts |
| last seen PTS More... | |
| int | m_passthroughMask |
| passthrough mask to be set More... | |
| int | m_currentPassthrough |
| current passthrough mask More... | |
| int | m_currentSampleRate |
| current sample rate More... | |
| int | m_currentNumChannels |
| current number of channels More... | |
| int | m_currentHwSampleRate |
| current hw sample rate More... | |
| int | m_currentHwNumChannels |
| current number of hw channels More... | |
| uint16_t | m_spdifOutput [MAX_FRAME_SIZE *2] |
| SPDIF output buffer. More... | |
| int | m_spdifIndex |
| index into SPDIF output buffer More... | |
| int | m_spdifRepeatCount |
| SPDIF repeat counter. More... | |
cAudioDecoder - Audio decoder class
Definition at line 74 of file codec_audio.h.
| cAudioDecoder::cAudioDecoder | ( | cSoftHdAudio * | audio | ) |
Audio decoder class constructor.
| audio | audio module |
Definition at line 48 of file codec_audio.cpp.
References AV_NOPTS_VALUE, CODEC_AC3, CODEC_DTS, CODEC_EAC3, CODEC_PCM, cSoftHdAudio::GetPassthrough(), L_CODEC, LOGDEBUG2, LOGFATAL, m_lastPts, m_passthroughMask, m_pAudio, m_pAudioCtx, and m_pFrame.
|
virtual |
Audio decoder class destructor.
Definition at line 67 of file codec_audio.cpp.
| void cAudioDecoder::Close | ( | void | ) |
Close the audio decoder.
Definition at line 126 of file codec_audio.cpp.
References AV_NOPTS_VALUE, L_CODEC, LOGDEBUG2, m_codecId, m_lastPts, and m_pAudioCtx.
Referenced by cSoftHdDevice::PlayAudio(), and ~cAudioDecoder().
| void cAudioDecoder::Decode | ( | const AVPacket * | avpkt | ) |
Decode an audio packet.
| avpkt | audio packet to decode |
Definition at line 355 of file codec_audio.cpp.
References AV_NOPTS_VALUE, DecodePassthrough(), cSoftHdAudio::Filter(), LOGERROR, m_currentHwNumChannels, m_currentHwSampleRate, m_currentNumChannels, m_currentPassthrough, m_currentSampleRate, m_lastPts, m_passthroughMask, m_pAudio, m_pAudioCtx, m_pFrame, and UpdateFormat().
Referenced by cSoftHdDevice::PlayAudio(), and cSoftHdDevice::PlayAudioPkts().
|
private |
Passthrough audio data.
Build spdif headers depending on the codec and send the data to the audio device. Currently supported: AC3, EAC3, DTS
| avpkt | undecoded audio packet |
| frame | decoded audio frame |
Definition at line 151 of file codec_audio.cpp.
References AC3_FRAME_SIZE, CODEC_AC3, CODEC_DTS, CODEC_EAC3, DTS1_FRAME_SIZE, DTS2_FRAME_SIZE, DTS3_FRAME_SIZE, DTS_PREAMBLE_16BE_1, DTS_PREAMBLE_16BE_2, EAC3_FRAME_SIZE, cSoftHdAudio::Enqueue(), IEC61937_AC3, IEC61937_DTS1, IEC61937_DTS2, IEC61937_DTS3, IEC61937_EAC3, IEC61937_NULL, IEC61937_PREAMBLE1, IEC61937_PREAMBLE2, LOGERROR, m_currentHwSampleRate, m_passthroughMask, m_pAudio, m_pAudioCtx, m_spdifIndex, m_spdifOutput, m_spdifRepeatCount, and cSoftHdAudio::SetTimebase().
Referenced by Decode().
| void cAudioDecoder::FlushBuffers | ( | void | ) |
Flush the audio decoder.
Definition at line 416 of file codec_audio.cpp.
References AV_NOPTS_VALUE, L_CODEC, LOGDEBUG2, m_codecId, m_lastPts, and m_pAudioCtx.
Referenced by cSoftHdDevice::ClearAudio().
|
inline |
Definition at line 83 of file codec_audio.h.
References m_codecId.
Referenced by cSoftHdDevice::PlayAudio().
| void cAudioDecoder::Open | ( | AVCodecID | codecId, |
| AVCodecParameters * | par = nullptr, |
||
| AVRational | timebase = { .num = 1, .den = 90000 } |
||
| ) |
Open and initiate the audio decoder.
| codecId | audio codec id |
| par | audio codec parameters |
| timebase | timebase |
Definition at line 81 of file codec_audio.cpp.
References L_CODEC, LOGDEBUG2, LOGERROR, LOGFATAL, m_codecId, m_currentHwNumChannels, m_currentHwSampleRate, m_currentNumChannels, m_currentPassthrough, m_currentSampleRate, m_passthroughMask, and m_pAudioCtx.
Referenced by cSoftHdDevice::PlayAudio(), and cSoftHdDevice::SetAudioCodec().
| void cAudioDecoder::SetPassthrough | ( | int | mask | ) |
Set audio pass-through mask.
| mask | codec to enable (PCM, AC-3, E-AC-3, DTS) |
Definition at line 431 of file codec_audio.cpp.
References CODEC_AC3, CODEC_DTS, CODEC_EAC3, CODEC_PCM, L_CODEC, LOGDEBUG2, and m_passthroughMask.
Referenced by cSoftHdDevice::SetPassthrough().
|
private |
Handle audio format changes.
Setup audio, if format changed
Definition at line 300 of file codec_audio.cpp.
References CODEC_AC3, CODEC_DTS, CODEC_EAC3, CODEC_PCM, L_SOUND, LOGDEBUG2, LOGERROR, m_currentHwNumChannels, m_currentHwSampleRate, m_currentNumChannels, m_currentPassthrough, m_currentSampleRate, m_passthroughMask, m_pAudio, m_pAudioCtx, m_spdifIndex, m_spdifRepeatCount, and cSoftHdAudio::Setup().
Referenced by Decode().
|
private |
current codec id
Definition at line 88 of file codec_audio.h.
Referenced by Close(), FlushBuffers(), GetCodecId(), and Open().
|
private |
current number of hw channels
Definition at line 96 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
current hw sample rate
Definition at line 95 of file codec_audio.h.
Referenced by Decode(), DecodePassthrough(), Open(), and UpdateFormat().
|
private |
current number of channels
Definition at line 94 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
current passthrough mask
Definition at line 92 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
current sample rate
Definition at line 93 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
last seen PTS
Definition at line 90 of file codec_audio.h.
Referenced by cAudioDecoder(), Close(), Decode(), and FlushBuffers().
|
private |
passthrough mask to be set
Definition at line 91 of file codec_audio.h.
Referenced by cAudioDecoder(), Decode(), DecodePassthrough(), Open(), SetPassthrough(), and UpdateFormat().
|
private |
audio module
Definition at line 86 of file codec_audio.h.
Referenced by cAudioDecoder(), Decode(), DecodePassthrough(), and UpdateFormat().
|
private |
ffmpeg audio codec context
Definition at line 87 of file codec_audio.h.
Referenced by cAudioDecoder(), Close(), Decode(), DecodePassthrough(), FlushBuffers(), Open(), and UpdateFormat().
|
private |
decoded ffmpeg audio frame
Definition at line 89 of file codec_audio.h.
Referenced by cAudioDecoder(), Decode(), and ~cAudioDecoder().
|
private |
index into SPDIF output buffer
Definition at line 98 of file codec_audio.h.
Referenced by DecodePassthrough(), and UpdateFormat().
|
private |
SPDIF output buffer.
Definition at line 97 of file codec_audio.h.
Referenced by DecodePassthrough().
|
private |
SPDIF repeat counter.
Definition at line 99 of file codec_audio.h.
Referenced by DecodePassthrough(), and UpdateFormat().