MP4AACDecoder.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "../Plugins/Input/in_mp4/mpeg4audio.h"
  3. #include "MFTDecoder.h"
  4. // {3C0B6E1B-0C21-4716-B8D6-C7665CBC90E9}
  5. static const GUID mp4_aac_guid =
  6. { 0x3c0b6e1b, 0xc21, 0x4716, { 0xb8, 0xd6, 0xc7, 0x66, 0x5c, 0xbc, 0x90, 0xe9 } };
  7. class MP4AACDecoder : public MP4AudioDecoder
  8. {
  9. public:
  10. static const char *getServiceName() { return "MFT AAC MP4 Decoder"; }
  11. static GUID getServiceGuid() { return mp4_aac_guid; }
  12. MP4AACDecoder();
  13. ~MP4AACDecoder();
  14. int OpenMP4(MP4FileHandle mp4_file, MP4TrackId mp4_track, size_t output_bits, size_t maxChannels, bool useFloat);
  15. void Close();
  16. int GetCurrentBitrate(unsigned int *bitrate);
  17. int AudioSpecificConfiguration(void *buffer, size_t buffer_size); // reads ASC block from mp4 file
  18. void Flush();
  19. int GetOutputProperties(unsigned int *sampleRate, unsigned int *channels, unsigned int *_bitsPerSample);
  20. int GetOutputPropertiesEx(unsigned int *sampleRate, unsigned int *channels, unsigned int *bitsPerSample, bool *useFloat);
  21. int DecodeSample(void *inputBuffer, size_t inputBufferBytes, void *outputBuffer, size_t *outputBufferBytes);
  22. int OutputFrameSize(size_t *frameSize);
  23. int CanHandleCodec(const char *codecName);
  24. int CanHandleType(uint8_t type);
  25. int CanHandleMPEG4Type(uint8_t type);
  26. int SetGain(float _gain) { gain=_gain; return MP4_SUCCESS; }
  27. void EndOfStream();
  28. private:
  29. MFTDecoder decoder;
  30. unsigned int bitsPerSample;
  31. bool isFloat;
  32. float gain;
  33. unsigned int channels;
  34. protected:
  35. RECVS_DISPATCH;
  36. };