1
0

h264_mkv_decoder.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "../Plugins/Input/in_mkv/ifc_mkvvideodecoder.h"
  3. #include "../Plugins/Input/in_mkv/svc_mkvdecoder.h"
  4. #include "MFTDecoder.h"
  5. #include <vector>
  6. // {8CC583E7-46DC-4736-A7CA-1159A70ADCAE}
  7. static const GUID mkv_h264_guid =
  8. { 0x8cc583e7, 0x46dc, 0x4736, { 0xa7, 0xca, 0x11, 0x59, 0xa7, 0xa, 0xdc, 0xae } };
  9. class MKVDecoderCreator : public svc_mkvdecoder
  10. {
  11. public:
  12. static const char *getServiceName() { return "H.264 MKV Decoder"; }
  13. static GUID getServiceGuid() { return mkv_h264_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 MKVH264 : public ifc_mkvvideodecoder
  19. {
  20. public:
  21. MKVH264(MFTDecoder *ctx, uint8_t nalu_size_minus_one, const nsmkv::VideoData *video_data);
  22. ~MKVH264();
  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. void Close();
  27. int GetPicture(void **data, void **decoder_data, uint64_t *timestamp);
  28. void FreePicture(void *data, void *decoder_data);
  29. void EndOfStream();
  30. void HurryUp(int state);
  31. private:
  32. MFTDecoder *decoder;
  33. UINT width, height;
  34. uint8_t nalu_size;
  35. const nsmkv::VideoData *video_data;
  36. std::vector<nullsoft_h264_frame_data> buffered_frames;
  37. protected:
  38. RECVS_DISPATCH;
  39. };