mkv_vp8x_decoder.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #define VPX_CODEC_DISABLE_COMPAT 1
  3. #include <vpx/vpx_decoder.h>
  4. #include <vpx/vp8dx.h>
  5. #include "../Plugins/Input/in_mkv/svc_mkvdecoder.h"
  6. #include "../Plugins/Input/in_mkv/ifc_mkvvideodecoder.h"
  7. #include "../Winamp/wa_ipc.h"
  8. // {23D36C12-E1DF-461b-9616-969C73BD2785}
  9. static const GUID mkv_vp8_guid =
  10. { 0x23d36c12, 0xe1df, 0x461b, { 0x96, 0x16, 0x96, 0x9c, 0x73, 0xbd, 0x27, 0x85 } };
  11. class MKVDecoder : public svc_mkvdecoder
  12. {
  13. public:
  14. static const char *getServiceName() { return "VP8 MKV Decoder"; }
  15. static GUID getServiceGuid() { return mkv_vp8_guid; }
  16. int CreateVideoDecoder(const char *codec_id, const nsmkv::TrackEntryData *track_entry_data, const nsmkv::VideoData *video_data, ifc_mkvvideodecoder **decoder);
  17. protected:
  18. RECVS_DISPATCH;
  19. };
  20. class MKVVP8: public ifc_mkvvideodecoder
  21. {
  22. public:
  23. friend class MKVDecoder;
  24. MKVVP8(vpx_codec_ctx_t decoder, const nsmkv::VideoData *video_data);
  25. int GetOutputProperties(int *x, int *y, int *color_format, double *aspect_ratio);
  26. int DecodeBlock(const void *inputBuffer, size_t inputBufferBytes, uint64_t timestamp);
  27. void Flush();
  28. int GetPicture(void **data, void **decoder_data, uint64_t *timestamp);
  29. void FreePicture(void *data, void *decoder_data);
  30. void HurryUp(int state);
  31. void Close();
  32. private:
  33. vpx_codec_ctx_t decoder;
  34. const nsmkv::VideoData *video_data;
  35. vpx_codec_iter_t frame_iterator;
  36. YV12_PLANES planes;
  37. bool flushing;
  38. protected:
  39. RECVS_DISPATCH;
  40. };