h264_mp4_decoder.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "../Plugins/Input/in_mp4/mpeg4video.h"
  3. #include "MFTDecoder.h"
  4. #include <vector>
  5. // {F13CB206-E8F2-4353-B8B9-587D02CB701C}
  6. static const GUID mp4_h264_guid =
  7. { 0xf13cb206, 0xe8f2, 0x4353, { 0xb8, 0xb9, 0x58, 0x7d, 0x2, 0xcb, 0x70, 0x1c } };
  8. class H264MP4Decoder : public MP4VideoDecoder
  9. {
  10. public:
  11. static const char *getServiceName() { return "H.264 MP4 Decoder"; }
  12. static GUID getServiceGuid() { return mp4_h264_guid; }
  13. H264MP4Decoder();
  14. ~H264MP4Decoder();
  15. private:
  16. /* mpeg4video interface */
  17. int Open(MP4FileHandle mp4_file, MP4TrackId mp4_track);
  18. int GetOutputFormat(int *x, int *y, int *color_format, double *aspect_ratio);
  19. int DecodeSample(const void *inputBuffer, size_t inputBufferBytes, MP4Timestamp timestamp);
  20. void Flush();
  21. void Close();
  22. int CanHandleCodec(const char *codecName);
  23. int GetPicture(void **data, void **decoder_data, MP4Timestamp *timestamp);
  24. void FreePicture(void *data, void *decoder_data);
  25. void HurryUp(int state);
  26. MFTDecoder decoder;
  27. uint32_t nalu_size_bytes;
  28. UINT width, height;
  29. MP4FileHandle mp4_file;
  30. MP4TrackId mp4_track;
  31. std::vector<nullsoft_h264_frame_data> buffered_frames;
  32. protected:
  33. RECVS_DISPATCH;
  34. };