1
0

MP4AACDecoder.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "../in_mp4/mpeg4audio.h"
  3. #include "incs/mp4AudioDecIfc.h"
  4. // {654B5212-018E-45f6-88CF-75862C85D99A}
  5. static const GUID mp4_aac_guid = { 0x654b5212, 0x18e, 0x45f6, { 0x88, 0xcf, 0x75, 0x86, 0x2c, 0x85, 0xd9, 0x9a } };
  6. class MP4AACDecoder : public MP4AudioDecoder
  7. {
  8. public:
  9. static const char *getServiceName() { return "AAC MP4 Decoder"; }
  10. static GUID getServiceGuid() { return mp4_aac_guid; }
  11. MP4AACDecoder();
  12. int Open();
  13. int OpenEx(size_t bits, size_t maxChannels, bool useFloat);
  14. void Close();
  15. int GetCurrentBitrate(unsigned int *bitrate);
  16. int AudioSpecificConfiguration(void *buffer, size_t buffer_size); // reads ASC block from mp4 file
  17. void Flush();
  18. int GetOutputProperties(unsigned int *sampleRate, unsigned int *channels, unsigned int *bitsPerSample);
  19. int GetOutputPropertiesEx(unsigned int *sampleRate, unsigned int *channels, unsigned int *bitsPerSample, bool *useFloat);
  20. int DecodeSample(void *inputBuffer, size_t inputBufferBytes, void *outputBuffer, size_t *outputBufferBytes);
  21. int OutputFrameSize(size_t *frameSize);
  22. int CanHandleCodec(const char *codecName);
  23. int CanHandleType(uint8_t type);
  24. int CanHandleMPEG4Type(uint8_t type);
  25. int SetGain(float _gain) { gain=_gain; return MP4_SUCCESS; }
  26. private:
  27. mp4AudioDecoderHandle decoder;
  28. CCompositionUnitPtr composition_unit; /* output */
  29. CAccessUnitPtr access_unit; /* input */
  30. size_t preDelay;
  31. unsigned int bitsPerSample;
  32. size_t maxChannels;
  33. bool isFloat;
  34. float gain;
  35. protected:
  36. RECVS_DISPATCH;
  37. };