From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/aacdec/MKVAACDecoder.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Src/aacdec/MKVAACDecoder.h (limited to 'Src/aacdec/MKVAACDecoder.h') diff --git a/Src/aacdec/MKVAACDecoder.h b/Src/aacdec/MKVAACDecoder.h new file mode 100644 index 00000000..b4d5f904 --- /dev/null +++ b/Src/aacdec/MKVAACDecoder.h @@ -0,0 +1,48 @@ +#pragma once +#include "../in_mkv/ifc_mkvaudiodecoder.h" +#include "incs/mp4AudioDecIfc.h" +#include "../nsmkv/Tracks.h" +#include "../in_mkv/svc_mkvdecoder.h" + +// {7405C1CE-6CD6-4975-B22B-8DBABAA64C44} +static const GUID AACMKVGUID = +{ 0x7405c1ce, 0x6cd6, 0x4975, { 0xb2, 0x2b, 0x8d, 0xba, 0xba, 0xa6, 0x4c, 0x44 } }; + + +class MKVDecoder : public svc_mkvdecoder +{ +public: + static const char *getServiceName() { return "AAC MKV Decoder"; } + static GUID getServiceGuid() { return AACMKVGUID; } + int CreateAudioDecoder(const char *codec_id, const nsmkv::TrackEntryData *track_entry_data, const nsmkv::AudioData *audio_data, unsigned int preferred_bits, unsigned int preferred_channels, bool floating_point, ifc_mkvaudiodecoder **decoder); +protected: + RECVS_DISPATCH; +}; + +class MKVAACDecoder : public ifc_mkvaudiodecoder +{ +public: + static MKVAACDecoder *Create(const nsmkv::TrackEntryData *track_entry_data, const nsmkv::AudioData *audio_data, unsigned int preferred_bits, unsigned int max_channels, bool floating_point); + +protected: + RECVS_DISPATCH; +private: + /* ifc_mkvaudiodecoder implementation */ + int OutputFrameSize(size_t *frame_size); + int GetOutputProperties(unsigned int *sampleRate, unsigned int *channels, unsigned int *bitsPerSample, bool *isFloat); + int DecodeBlock(void *inputBuffer, size_t inputBufferBytes, void *outputBuffer, size_t *outputBufferBytes); + void Flush(); + void Close(); + +private: + MKVAACDecoder(mp4AudioDecoderHandle decoder, CAccessUnitPtr access_unit, CCompositionUnitPtr composition_unit, unsigned int bps, bool floating_point); + + /* internal implementation */ + + /* data */ + mp4AudioDecoderHandle decoder; + CCompositionUnitPtr composition_unit; /* output */ + CAccessUnitPtr access_unit; /* input */ + unsigned int bps; + bool floating_point; + }; \ No newline at end of file -- cgit