vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
codec_audio.h
Go to the documentation of this file.
1
21#ifndef __CODEC_AUDIO_H
22#define __CODEC_AUDIO_H
23
24#include <cstdint>
25
26extern "C" {
27#include <libavcodec/avcodec.h>
28}
29
35#define CODEC_AC3 0x04
36#define CODEC_EAC3 0x08
37#define CODEC_DTS 0x10
38
53
54#define IEC61937_PREAMBLE1 0xF872
55#define IEC61937_PREAMBLE2 0x4E1F
56#define DTS_PREAMBLE_16BE_1 0x7FFE
57#define DTS_PREAMBLE_16BE_2 0x8001
58
62#define DTS1_FRAME_SIZE 512
63#define DTS2_FRAME_SIZE 1024
64#define DTS3_FRAME_SIZE 2048
65#define AC3_FRAME_SIZE 1536
66#define EAC3_FRAME_SIZE 6144
67#define TRUEHD_FRAME_SIZE 15360
68
69#define MAX_FRAME_SIZE EAC3_FRAME_SIZE
70
71class cSoftHdAudio;
72
77public:
79 ~cAudioDecoder(void);
80 void Open(AVCodecID, AVCodecParameters * = nullptr, AVRational = { .num = 1, .den = 90000 });
81 void Close(void);
82 void Decode(const AVPacket *);
83 void FlushBuffers(void);
84 void SetPassthrough(int);
85 AVCodecID GetCodecId() const { return m_codecId; };
86
87private:
89 AVCodecContext *m_pAudioCtx = nullptr;
90 AVCodecID m_codecId = AV_CODEC_ID_NONE;
91 AVFrame *m_pFrame;
102
103 int DecodePassthrough(const AVPacket *, AVFrame *);
104 int UpdateFormat(void);
105};
106
107#endif
cAudioDecoder - Audio decoder class
Definition codec_audio.h:76
int DecodePassthrough(const AVPacket *, AVFrame *)
Passthrough audio data.
uint16_t m_spdifOutput[MAX_FRAME_SIZE *2]
SPDIF output buffer.
Definition codec_audio.h:99
int UpdateFormat(void)
Handle audio format changes.
AVCodecContext * m_pAudioCtx
ffmpeg audio codec context
Definition codec_audio.h:89
~cAudioDecoder(void)
Audio decoder class destructor.
int m_currentHwSampleRate
current hw sample rate
Definition codec_audio.h:97
void FlushBuffers(void)
Flush the audio decoder.
int m_currentHwNumChannels
current number of hw channels
Definition codec_audio.h:98
void Decode(const AVPacket *)
Decode an audio packet.
AVFrame * m_pFrame
decoded ffmpeg audio frame
Definition codec_audio.h:91
int m_spdifIndex
index into SPDIF output buffer
int m_passthroughMask
passthrough mask to be set
Definition codec_audio.h:93
AVCodecID m_codecId
current codec id
Definition codec_audio.h:90
int m_currentPassthrough
current passthrough mask
Definition codec_audio.h:94
AVCodecID GetCodecId() const
Definition codec_audio.h:85
int m_spdifRepeatCount
SPDIF repeat counter.
int64_t m_lastPts
last seen PTS
Definition codec_audio.h:92
int m_currentSampleRate
current sample rate
Definition codec_audio.h:95
cSoftHdAudio * m_pAudio
audio module
Definition codec_audio.h:88
void SetPassthrough(int)
Set audio pass-through mask.
int m_currentNumChannels
current number of channels
Definition codec_audio.h:96
void Open(AVCodecID, AVCodecParameters *=nullptr, AVRational={ .num=1,.den=90000 })
Open and initiate the audio decoder.
void Close(void)
Close the audio decoder.
cSoftHdAudio - Audio class
Definition audio.h:51
IEC61937
IEC Data type enumeration.
Definition codec_audio.h:43
@ IEC61937_TRUEHD
TrueHD data (not used)
Definition codec_audio.h:51
@ IEC61937_DTS3
DTS type III (2048 samples)
Definition codec_audio.h:49
@ IEC61937_DTS2
DTS type II (1024 samples)
Definition codec_audio.h:48
@ IEC61937_AC3
AC-3 data.
Definition codec_audio.h:45
@ IEC61937_NULL
no data
Definition codec_audio.h:44
@ IEC61937_DTSHD
DTS HD data (not used)
Definition codec_audio.h:50
@ IEC61937_EAC3
E-AC-3 data.
Definition codec_audio.h:46
@ IEC61937_DTS1
DTS type I (512 samples)
Definition codec_audio.h:47
#define MAX_FRAME_SIZE
Definition codec_audio.h:69
#define AV_NOPTS_VALUE
Definition misc.h:69