13#ifndef __CODEC_AUDIO_H
14#define __CODEC_AUDIO_H
22#include <libavcodec/avcodec.h>
23#include <libavformat/avformat.h>
94#if LIBAVFORMAT_VERSION_MAJOR >= 61
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.
AVCodecID GetCodecId() const
void DecodePCM(const AVPacket *)
Decode an audio packet.
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.
PassthroughMask
Bits used for the passthrough mask.
@ CODEC_EAC3
E-AC-3 bit mask.
@ CODEC_AC3
AC-3 bit mask.