VorbisDecoder.h 836 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <stdint.h> // for uint8_t, uint32_t, int16_t
  3. #include "BaseCodec.h" // for BaseCodec
  4. #include "ivorbiscodec.h" // for vorbis_comment, vorbis_dsp_state, vorbis_info
  5. #include "ogg.h" // for ogg_packet
  6. namespace bell {
  7. class AudioContainer;
  8. class VorbisDecoder : public BaseCodec {
  9. private:
  10. vorbis_info* vi = nullptr;
  11. vorbis_comment* vc = nullptr;
  12. vorbis_dsp_state* vd = nullptr;
  13. ogg_packet op = {};
  14. int16_t* pcmData;
  15. public:
  16. VorbisDecoder();
  17. ~VorbisDecoder();
  18. bool setup(uint32_t sampleRate, uint8_t channelCount,
  19. uint8_t bitDepth) override;
  20. uint8_t* decode(uint8_t* inData, uint32_t& inLen, uint32_t& outLen) override;
  21. bool setup(AudioContainer* container) override;
  22. private:
  23. void setPacket(uint8_t* inData, uint32_t inLen) const;
  24. };
  25. } // namespace bell