MKVAACDecoder.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "../Plugins/Input/in_mkv/ifc_mkvaudiodecoder.h"
  3. #include "MFTDecoder.h"
  4. #include "../nsmkv/Tracks.h"
  5. #include "../Plugins/Input/in_mkv/svc_mkvdecoder.h"
  6. // {437C68FA-2972-4ede-A157-CBD371E5E263}
  7. static const GUID AACMKVGUID =
  8. { 0x437c68fa, 0x2972, 0x4ede, { 0xa1, 0x57, 0xcb, 0xd3, 0x71, 0xe5, 0xe2, 0x63 } };
  9. class MKVDecoder : public svc_mkvdecoder
  10. {
  11. public:
  12. static const char *getServiceName() { return "MFT 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. void EndOfStream(); // no more input, output anything you have buffered
  32. private:
  33. MKVAACDecoder(unsigned int bps, bool floating_point);
  34. /* internal implementation */
  35. /* data */
  36. MFTDecoder decoder;
  37. unsigned int bps;
  38. bool floating_point;
  39. };