1
0

NSVAACDecoder.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include "../nsv/dec_if.h"
  3. #include "incs/mp4AudioDecIfc.h"
  4. #include <bfc/platform/types.h>
  5. #include "ADTSHeader.h"
  6. #include "../nsv/svc_nsvFactory.h"
  7. // {55632E28-8171-4670-AE5D-CF714900C62E}
  8. static const GUID NSV_AAC_GUID =
  9. { 0x55632e28, 0x8171, 0x4670, { 0xae, 0x5d, 0xcf, 0x71, 0x49, 0x0, 0xc6, 0x2e } };
  10. class NSVDecoder : public svc_nsvFactory
  11. {
  12. public:
  13. static const char *getServiceName() { return "AAC NSV Decoder"; }
  14. static GUID getServiceGuid() { return NSV_AAC_GUID; }
  15. IAudioDecoder *CreateAudioDecoder(FOURCC format, IAudioOutput **output);
  16. protected:
  17. RECVS_DISPATCH;
  18. };
  19. class NSVAACDecoder : public IAudioDecoder
  20. {
  21. public:
  22. static NSVAACDecoder *CreateDecoder();
  23. NSVAACDecoder();
  24. ~NSVAACDecoder();
  25. void Initialize(CAccessUnitPtr access_unit);
  26. int decode(void *in, int in_len, void *out, int *out_len, unsigned int out_fmt[8]);
  27. void flush();
  28. bool OK();
  29. private:
  30. void FillOutputFormat(unsigned int out_fmt[8]);
  31. void CopyToOutput(void *out, int *out_len);
  32. private:
  33. /* data */
  34. mp4AudioDecoderHandle decoder;
  35. CCompositionUnitPtr composition_unit; /* output */
  36. CAccessUnitPtr access_unit; /* input */
  37. int in_position;
  38. int out_left;
  39. size_t source_position;
  40. // unsigned char pcm_buf[65536*2];
  41. // int pcm_buf_used;
  42. // int readpos;
  43. // unsigned int cbvalid;
  44. };