mkv_vorbis_decoder.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include "../in_mkv/ifc_mkvaudiodecoder.h"
  3. #include "../in_mkv/svc_mkvdecoder.h"
  4. #include <vorbis/codec.h>
  5. // {6058D315-2F08-4b2f-903E-4C2E6B5EFFA9}
  6. static const GUID mkv_vorbis_guid =
  7. { 0x6058d315, 0x2f08, 0x4b2f, { 0x90, 0x3e, 0x4c, 0x2e, 0x6b, 0x5e, 0xff, 0xa9 } };
  8. class MKVDecoderCreator : public svc_mkvdecoder
  9. {
  10. public:
  11. static const char *getServiceName() { return "Vorbis MKV Decoder"; }
  12. static GUID getServiceGuid() { return mkv_vorbis_guid; }
  13. int CreateAudioDecoder(const char *codec_id,
  14. const nsmkv::TrackEntryData *track_entry_data, const nsmkv::AudioData *audio_data,
  15. unsigned int preferred_bits, unsigned int max_channels, bool floating_point,
  16. ifc_mkvaudiodecoder **decoder);
  17. protected:
  18. RECVS_DISPATCH;
  19. };
  20. class MKVVorbis : public ifc_mkvaudiodecoder
  21. {
  22. public:
  23. MKVVorbis();
  24. int DecodeBlock(void *inputBuffer, size_t inputBufferBytes, void *outputBuffer, size_t *outputBufferBytes);
  25. int GetOutputProperties(unsigned int *sampleRate, unsigned int *channels, unsigned int *bitsPerSample, bool *isFloat);
  26. void Flush();
  27. void Close();
  28. //private:
  29. unsigned int bps;
  30. vorbis_info info;
  31. vorbis_dsp_state dsp;
  32. vorbis_block block;
  33. vorbis_comment comment;
  34. ogg_int64_t packet_number;
  35. protected:
  36. RECVS_DISPATCH;
  37. };