AVIAACDecoder.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include "../in_avi/svc_avidecoder.h"
  3. #include "../in_avi/ifc_aviaudiodecoder.h"
  4. #include "incs/mp4AudioDecIfc.h"
  5. // {4033D2BF-F217-4e8e-877B-2269CD04CA52}
  6. static const GUID avi_aac_guid =
  7. { 0x4033d2bf, 0xf217, 0x4e8e, { 0x87, 0x7b, 0x22, 0x69, 0xcd, 0x4, 0xca, 0x52 } };
  8. class AVIDecoder : public svc_avidecoder
  9. {
  10. public:
  11. static const char *getServiceName() { return "AAC AVI Decoder"; }
  12. static GUID getServiceGuid() { return avi_aac_guid; }
  13. int CreateAudioDecoder(const nsavi::AVIH *avi_header, const nsavi::STRH *stream_header, const nsavi::STRF *stream_format, const nsavi::STRD *stream_data, unsigned int preferred_bits, unsigned int max_channels, bool floating_point, ifc_aviaudiodecoder **decoder);
  14. protected:
  15. RECVS_DISPATCH;
  16. };
  17. class AVIAACDecoder : public ifc_aviaudiodecoder
  18. {
  19. public:
  20. AVIAACDecoder(mp4AudioDecoderHandle decoder, CAccessUnitPtr access_unit, CCompositionUnitPtr composition_unit, unsigned int bps, bool floating_point);
  21. static AVIAACDecoder *Create(const nsavi::audio_format *stream_format, unsigned int preferred_bits, unsigned int max_channels, bool floating_point);
  22. protected:
  23. RECVS_DISPATCH;
  24. private:
  25. /* ifc_aviaudiodecoder implementation */
  26. int OutputFrameSize(size_t *frame_size);
  27. int GetOutputProperties(unsigned int *sampleRate, unsigned int *channels, unsigned int *bitsPerSample, bool *isFloat);
  28. int DecodeChunk(uint16_t type, void **inputBuffer, size_t *inputBufferBytes, void *outputBuffer, size_t *outputBufferBytes);
  29. void Flush();
  30. void Close();
  31. /* data */
  32. mp4AudioDecoderHandle decoder;
  33. CCompositionUnitPtr composition_unit; /* output */
  34. CAccessUnitPtr access_unit; /* input */
  35. unsigned int bps;
  36. bool floating_point;
  37. };