1
0

MKVAACDecoder.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "../in_mkv/ifc_mkvaudiodecoder.h"
  3. #include "incs/mp4AudioDecIfc.h"
  4. #include "../nsmkv/Tracks.h"
  5. #include "../in_mkv/svc_mkvdecoder.h"
  6. // {7405C1CE-6CD6-4975-B22B-8DBABAA64C44}
  7. static const GUID AACMKVGUID =
  8. { 0x7405c1ce, 0x6cd6, 0x4975, { 0xb2, 0x2b, 0x8d, 0xba, 0xba, 0xa6, 0x4c, 0x44 } };
  9. class MKVDecoder : public svc_mkvdecoder
  10. {
  11. public:
  12. static const char *getServiceName() { return "AAC MKV Decoder"; }
  13. static GUID getServiceGuid() { return AACMKVGUID; }
  14. 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);
  15. protected:
  16. RECVS_DISPATCH;
  17. };
  18. class MKVAACDecoder : public ifc_mkvaudiodecoder
  19. {
  20. public:
  21. 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);
  22. protected:
  23. RECVS_DISPATCH;
  24. private:
  25. /* ifc_mkvaudiodecoder implementation */
  26. int OutputFrameSize(size_t *frame_size);
  27. int GetOutputProperties(unsigned int *sampleRate, unsigned int *channels, unsigned int *bitsPerSample, bool *isFloat);
  28. int DecodeBlock(void *inputBuffer, size_t inputBufferBytes, void *outputBuffer, size_t *outputBufferBytes);
  29. void Flush();
  30. void Close();
  31. private:
  32. MKVAACDecoder(mp4AudioDecoderHandle decoder, CAccessUnitPtr access_unit, CCompositionUnitPtr composition_unit, unsigned int bps, bool floating_point);
  33. /* internal implementation */
  34. /* data */
  35. mp4AudioDecoderHandle decoder;
  36. CCompositionUnitPtr composition_unit; /* output */
  37. CAccessUnitPtr access_unit; /* input */
  38. unsigned int bps;
  39. bool floating_point;
  40. };