DecoderGlobals.h 908 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef BELL_DISABLE_CODECS
  2. #ifndef DECODER_GLOBALS_H
  3. #define DECODER_GLOBALS_H
  4. #define AAC_READBUF_SIZE (4 * AAC_MAINBUF_SIZE * AAC_MAX_NCHANS)
  5. #define MP3_READBUF_SIZE (2 * 1024);
  6. #include <stdio.h> // for NULL
  7. #include "aacdec.h" // for AACFreeDecoder, AACInitDecoder, HAACDecoder
  8. #include "mp3dec.h" // for MP3FreeDecoder, MP3InitDecoder, HMP3Decoder
  9. namespace bell {
  10. class DecodersInstance {
  11. public:
  12. DecodersInstance(){};
  13. ~DecodersInstance() {
  14. MP3FreeDecoder(mp3Decoder);
  15. AACFreeDecoder(aacDecoder);
  16. };
  17. HAACDecoder aacDecoder = NULL;
  18. HMP3Decoder mp3Decoder = NULL;
  19. void ensureAAC() {
  20. if (aacDecoder == NULL) {
  21. aacDecoder = AACInitDecoder();
  22. }
  23. }
  24. void ensureMP3() {
  25. if (mp3Decoder == NULL) {
  26. mp3Decoder = MP3InitDecoder();
  27. }
  28. }
  29. };
  30. extern bell::DecodersInstance* decodersInstance;
  31. void createDecoders();
  32. } // namespace bell
  33. #endif
  34. #endif