|
vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
|
cAudioDecoder - Audio decoder class More...
#include <codec_audio.h>
Public Member Functions | |
| cAudioDecoder (cSoftHdAudio *) | |
| Audio decoder class constructor. | |
| ~cAudioDecoder (void) | |
| Audio decoder class destructor. | |
| void | Open (AVCodecID, AVCodecParameters *=nullptr, AVRational={ .num=1,.den=90000 }) |
| Open and initiate the audio decoder. | |
| void | Close (void) |
| Close the audio decoder. | |
| void | Decode (const AVPacket *) |
| Decode an audio packet. | |
| void | FlushBuffers (void) |
| Flush the audio decoder. | |
| void | SetPassthrough (int) |
| Set audio pass-through mask. | |
| AVCodecID | GetCodecId () const |
Private Member Functions | |
| int | DecodePassthrough (const AVPacket *, AVFrame *) |
| Passthrough audio data. | |
| int | UpdateFormat (void) |
| Handle audio format changes. | |
Private Attributes | |
| cSoftHdAudio * | m_pAudio |
| audio module | |
| AVCodecContext * | m_pAudioCtx = nullptr |
| ffmpeg audio codec context | |
| AVCodecID | m_codecId = AV_CODEC_ID_NONE |
| current codec id | |
| AVFrame * | m_pFrame |
| decoded ffmpeg audio frame | |
| int64_t | m_lastPts = AV_NOPTS_VALUE |
| last seen PTS | |
| int | m_passthroughMask |
| passthrough mask to be set | |
| int | m_currentPassthrough |
| current passthrough mask | |
| int | m_currentSampleRate |
| current sample rate | |
| int | m_currentNumChannels |
| current number of channels | |
| int | m_currentHwSampleRate |
| current hw sample rate | |
| int | m_currentHwNumChannels |
| current number of hw channels | |
| uint16_t | m_spdifOutput [MAX_FRAME_SIZE *2] |
| SPDIF output buffer. | |
| int | m_spdifIndex |
| index into SPDIF output buffer | |
| int | m_spdifRepeatCount |
| SPDIF repeat counter. | |
cAudioDecoder - Audio decoder class
Definition at line 76 of file codec_audio.h.
| cAudioDecoder::cAudioDecoder | ( | cSoftHdAudio * | audio | ) |
Audio decoder class constructor.
| audio | audio module |
Definition at line 46 of file codec_audio.cpp.
References L_CODEC, LOGDEBUG2, LOGFATAL, m_passthroughMask, and m_pFrame.
| cAudioDecoder::~cAudioDecoder | ( | void | ) |
Audio decoder class destructor.
Definition at line 59 of file codec_audio.cpp.
| void cAudioDecoder::Close | ( | void | ) |
Close the audio decoder.
Definition at line 118 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 338 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 143 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 399 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 85 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 73 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 (AC-3, E-AC-3, DTS) |
Definition at line 414 of file codec_audio.cpp.
References CODEC_AC3, CODEC_DTS, CODEC_EAC3, L_CODEC, LOGDEBUG2, and m_passthroughMask.
Referenced by cSoftHdDevice::SetPassthrough().
|
private |
Handle audio format changes.
Setup audio, if format changed
Definition at line 284 of file codec_audio.cpp.
References CODEC_AC3, CODEC_DTS, CODEC_EAC3, 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 90 of file codec_audio.h.
Referenced by Close(), FlushBuffers(), GetCodecId(), and Open().
|
private |
current number of hw channels
Definition at line 98 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
current hw sample rate
Definition at line 97 of file codec_audio.h.
Referenced by Decode(), DecodePassthrough(), Open(), and UpdateFormat().
|
private |
current number of channels
Definition at line 96 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
current passthrough mask
Definition at line 94 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
current sample rate
Definition at line 95 of file codec_audio.h.
Referenced by Decode(), Open(), and UpdateFormat().
|
private |
last seen PTS
Definition at line 92 of file codec_audio.h.
Referenced by Close(), Decode(), and FlushBuffers().
|
private |
passthrough mask to be set
Definition at line 93 of file codec_audio.h.
Referenced by cAudioDecoder(), Decode(), DecodePassthrough(), Open(), SetPassthrough(), and UpdateFormat().
|
private |
audio module
Definition at line 88 of file codec_audio.h.
Referenced by Decode(), DecodePassthrough(), and UpdateFormat().
|
private |
ffmpeg audio codec context
Definition at line 89 of file codec_audio.h.
Referenced by Close(), Decode(), DecodePassthrough(), FlushBuffers(), Open(), and UpdateFormat().
|
private |
decoded ffmpeg audio frame
Definition at line 91 of file codec_audio.h.
Referenced by cAudioDecoder(), Decode(), and ~cAudioDecoder().
|
private |
index into SPDIF output buffer
Definition at line 100 of file codec_audio.h.
Referenced by DecodePassthrough(), and UpdateFormat().
|
private |
SPDIF output buffer.
Definition at line 99 of file codec_audio.h.
Referenced by DecodePassthrough().
|
private |
SPDIF repeat counter.
Definition at line 101 of file codec_audio.h.
Referenced by DecodePassthrough(), and UpdateFormat().