24#include <libavcodec/avcodec.h>
25#include <libavformat/avformat.h>
157#if LIBAVFORMAT_VERSION_MAJOR >= 61
163 auto &
output = *
static_cast<std::vector<uint8_t> *
>(
opaque);
201 stream->codecpar->codec_id = codecId;
258 pkt.stream_index = 0;
Audio Interface Header File.
AVFormatContext * m_spdifFmtCtx
spdif muxer context
bool ShouldTryPassthrough(void)
Test, if passthrough audio should be tried.
AVCodecContext * m_pAudioCtx
ffmpeg audio codec context
int m_currentHwSampleRate
current hw sample rate
void FlushBuffers(void)
Flush the audio decoder buffers.
int m_currentHwNumChannels
current number of hw channels
void Decode(const AVPacket *)
Forward an audio packet either to the decoder or passthrough.
AVFrame * m_pFrame
decoded ffmpeg audio frame
int m_currentPassthroughMask
current passthrough mask
void CloseSpdifMuxer(void)
Close the spdif muxer and free the resources.
int m_passthroughMask
passthrough mask to be set
AVCodecID m_codecId
current codec id
static int SpdifWriteCallback(void *, uint8_t *, int)
Callback for the spdif muxer.
int Passthrough(const AVPacket *)
Passthrough audio data.
void DecodePCM(const AVPacket *)
Decode an audio packet.
cAudioDecoder(cSoftHdAudio *)
Create a new audio decoder for the given audio context.
int CheckUpdateFormat(bool)
Handle audio format changes and setup audio, if format changed.
void SetPassthroughMask(int)
Set audio pass-through mask.
bool OpenSpdifMuxer(AVCodecID, int)
Open the spdif muxer.
static constexpr int AUDIO_PASSTHROUGH_NUM_CHANNELS
fixed passthrough channel number
std::vector< uint8_t > m_spdifOutputBuf
spdif muxer output
std::mutex m_mutex
decoder mutex
int64_t m_lastPts
last seen PTS
int m_currentSampleRate
current sample rate
static constexpr int AUDIO_PASSTHROUGH_RATE_HZ
fixed passthrough sample rate
cSoftHdAudio * m_pAudio
audio module
int m_currentNumChannels
current number of channels
const std::vector< uint8_t > & BuildIEC61937(const AVPacket *)
Prepend an IEC61937 header to the raw audio data by sending the avpkt to the spdif muxer.
std::array< uint8_t, 32768 > m_spdifIoBuffer
spdif I/O buffer
void Open(AVCodecID, AVCodecParameters *=nullptr, AVRational={ .num=1,.den=90000 })
Open and initiate the audio decoder.
void Close(void)
Close the audio decoder.
void Filter(AVFrame *, AVCodecContext *)
Send audio frame to filter and enqueue it.
void SetTimebase(AVRational timebase)
int Setup(AVRational, int, int, bool)
Alsa setup wrapper.
void EnqueueSpdif(const uint16_t *, int, int64_t pts)
Enqueue prepared spdif bursts in audio output queue.
static std::string GetPassthroughMaskString(int mask)
Build a passthrough mask logging string.
Audio Decoder Header File.
@ CODEC_EAC3
E-AC-3 bit mask.
@ CODEC_AC3
AC-3 bit mask.
#define LOGDEBUG2
log to LOG_DEBUG and add a prefix
#define LOGERROR
log to LOG_ERR
#define LOGFATAL
log to LOG_ERR and abort