1
0

mkv_theora_decoder.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "../Plugins/Input/in_mkv/ifc_mkvvideodecoder.h"
  3. #include "../Plugins/Input/in_mkv/svc_mkvdecoder.h"
  4. #include <theora/theoradec.h>
  5. #include "../Winamp/wa_ipc.h" // for YV12_PLANES
  6. // {96E5EC72-FE8A-4e9f-B964-D16DA34D2FC9}
  7. static const GUID mkv_theora_guid =
  8. { 0x96e5ec72, 0xfe8a, 0x4e9f, { 0xb9, 0x64, 0xd1, 0x6d, 0xa3, 0x4d, 0x2f, 0xc9 } };
  9. class MKVDecoder : public svc_mkvdecoder
  10. {
  11. public:
  12. static const char *getServiceName() { return "Theora MKV Decoder"; }
  13. static GUID getServiceGuid() { return mkv_theora_guid; }
  14. int CreateVideoDecoder(const char *codec_id, const nsmkv::TrackEntryData *track_entry_data, const nsmkv::VideoData *video_data, ifc_mkvvideodecoder **decoder);
  15. protected:
  16. RECVS_DISPATCH;
  17. };
  18. class MKVTheora : public ifc_mkvvideodecoder
  19. {
  20. public:
  21. friend class MKVDecoder;
  22. MKVTheora(const nsmkv::VideoData *video_data);
  23. int GetOutputProperties(int *x, int *y, int *color_format, double *aspect_ratio);
  24. int DecodeBlock(const void *inputBuffer, size_t inputBufferBytes, uint64_t timestamp);
  25. void Flush();
  26. int GetPicture(void **data, void **decoder_data, uint64_t *timestamp);
  27. void FreePicture(void *data, void *decoder_data);
  28. void HurryUp(int state);
  29. void Close();
  30. private:
  31. th_info info;
  32. th_comment comment;
  33. th_setup_info *setup;
  34. th_dec_ctx *decoder;
  35. ogg_int64_t packet_number;
  36. const nsmkv::VideoData *video_data;
  37. bool frame_ready;
  38. uint64_t last_timestamp;
  39. YV12_PLANES planes;
  40. bool flushing;
  41. protected:
  42. RECVS_DISPATCH;
  43. };