ADTSAACDecoder.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "../in_mp3/adts.h"
  3. #include "incs/mp4AudioDecIfc.h"
  4. // {19450308-90D7-4E45-8A9D-DC71E67123E2}
  5. static const GUID adts_aac_guid =
  6. { 0x19450308, 0x90d7, 0x4e45, { 0x8a, 0x9d, 0xdc, 0x71, 0xe6, 0x71, 0x23, 0xe2 } };
  7. class ADTSAACDecoder : public adts
  8. {
  9. public:
  10. static const char *getServiceName() { return "AAC ADTS Decoder"; }
  11. static GUID getServiceGuid() { return adts_aac_guid; }
  12. ADTSAACDecoder();
  13. int Initialize(bool forceMono, bool reverse_stereo, bool allowSurround, int maxBits, bool allowRG, bool _useFloat, bool _useCRC);
  14. bool Open(ifc_mpeg_stream_reader *file);
  15. void Close();
  16. void GetOutputParameters(size_t *numBits, int *numChannels, int *sampleRate);
  17. void CalculateFrameSize(int *frameSize);
  18. void Flush(ifc_mpeg_stream_reader *file);
  19. size_t GetCurrentBitrate();
  20. size_t GetDecoderDelay();
  21. int Sync(ifc_mpeg_stream_reader *file, unsigned __int8 *output, size_t outputSize, size_t *outputWritten, size_t *bitrate);
  22. int Decode(ifc_mpeg_stream_reader *file, unsigned __int8 *output, size_t outputSize, size_t *outputWritten, size_t *bitrate, size_t *endCut);
  23. int GetLayer();
  24. void Release();
  25. private:
  26. int Internal_Decode(ifc_mpeg_stream_reader *file, const void *input, size_t input_length, unsigned __int8 *output, size_t outputSize, size_t *outputWritten, size_t *bitrate, size_t *endCut);
  27. mp4AudioDecoderHandle decoder;
  28. CCompositionUnitPtr composition_unit; /* output */
  29. CAccessUnitPtr access_unit; /* input */
  30. int bitsPerSample;
  31. unsigned int channels;
  32. float gain;
  33. bool allowRG;
  34. bool useFloat;
  35. size_t predelay;
  36. };