adts_mpg123.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef NULLSOFT_IN_MP3_ADTS_MPG123_H
  2. #define NULLSOFT_IN_MP3_ADTS_MPG123_H
  3. #include "../Plugins/Input/in_mp3/adts.h"
  4. #include "api__mp3-mpg123.h"
  5. #include <mpg123.h>
  6. // {4192FE3F-E843-445c-8D62-51BE5EE5E68C}
  7. static const GUID adts_mpg123_guid =
  8. { 0x4192fe3f, 0xe843, 0x445c, { 0x8d, 0x62, 0x51, 0xbe, 0x5e, 0xe5, 0xe6, 0x8c } };
  9. class ADTS_MPG123 : public adts
  10. {
  11. public:
  12. static const char *getServiceName() { return "MPG123 stream Decoder"; }
  13. static GUID getServiceGuid() { return adts_mpg123_guid; }
  14. ADTS_MPG123();
  15. ~ADTS_MPG123();
  16. int Initialize(bool forceMono, bool reverse_stereo, bool allowSurround, int maxBits, bool allowRG, bool _useFloat = false, bool _useCRC = false);
  17. bool Open(ifc_mpeg_stream_reader *file);
  18. void Close();
  19. void GetOutputParameters(size_t *numBits, int *numChannels, int *sampleRate);
  20. void CalculateFrameSize(int *frameSize);
  21. void Flush(ifc_mpeg_stream_reader *file);
  22. size_t GetCurrentBitrate();
  23. size_t GetDecoderDelay();
  24. int Sync(ifc_mpeg_stream_reader *file, unsigned __int8 *output, size_t outputSize, size_t *outputWritten, size_t *bitrate);
  25. int Decode(ifc_mpeg_stream_reader *file, unsigned __int8 *output, size_t outputSize, size_t *outputWritten, size_t *bitrate, size_t *endCut);
  26. int GetLayer();
  27. void Release();
  28. private:
  29. mpg123_handle *decoder;
  30. size_t bitsPerSample;
  31. double gain;
  32. bool allowRG;
  33. bool useFloat;
  34. int channels;
  35. int sampleRate;
  36. unsigned int decoderDelay;
  37. int _Read(ifc_mpeg_stream_reader *file);
  38. bool _UpdateProperties();
  39. float *decode_buffer;
  40. size_t decode_buffer_length;
  41. };
  42. #endif