avi_h264_decoder.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "../Plugins/Input/in_avi/ifc_avivideodecoder.h"
  3. #include "../Plugins/Input/in_avi/svc_avidecoder.h"
  4. #include "MFTDecoder.h"
  5. #include <vector>
  6. // {AFA1BB51-F41B-4522-9251-25A8DF923DBE}
  7. static const GUID avi_h264_guid =
  8. { 0xafa1bb51, 0xf41b, 0x4522, { 0x92, 0x51, 0x25, 0xa8, 0xdf, 0x92, 0x3d, 0xbe } };
  9. class AVIDecoderCreator : public svc_avidecoder
  10. {
  11. public:
  12. static const char *getServiceName() { return "H.264 AVI Decoder"; }
  13. static GUID getServiceGuid() { return avi_h264_guid; }
  14. int CreateVideoDecoder(const nsavi::AVIH *avi_header, const nsavi::STRH *stream_header, const nsavi::STRF *stream_format, const nsavi::STRD *stream_data, ifc_avivideodecoder **decoder);
  15. protected:
  16. RECVS_DISPATCH;
  17. };
  18. class AVIH264 : public ifc_avivideodecoder
  19. {
  20. public:
  21. AVIH264(MFTDecoder *ctx, const nsavi::STRH *stream_header);
  22. ~AVIH264();
  23. int GetOutputProperties(int *x, int *y, int *color_format, double *aspect_ratio, int *flip);
  24. int DecodeChunk(uint16_t type, const void *inputBuffer, size_t inputBufferBytes);
  25. void Flush();
  26. void Close();
  27. int GetPicture(void **data, void **decoder_data);
  28. void FreePicture(void *data, void *decoder_data);
  29. void EndOfStream();
  30. void HurryUp(int state);
  31. private:
  32. MFTDecoder *decoder;
  33. const nsavi::STRH *stream_header;
  34. std::vector<nullsoft_h264_frame_data> buffered_frames;
  35. protected:
  36. RECVS_DISPATCH;
  37. };