h264_flv_decoder.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "../Plugins/Input/in_flv/svc_flvdecoder.h"
  3. #include "../Plugins/Input/in_flv/FLVVideoHeader.h"
  4. #include "../Plugins/Input/in_flv/ifc_flvvideodecoder.h"
  5. #include "MFTDecoder.h"
  6. #include <vector>
  7. // {7BBC5D47-7E96-4e27-85DB-FF4190428CD0}
  8. static const GUID flv_h264_guid =
  9. { 0x7bbc5d47, 0x7e96, 0x4e27, { 0x85, 0xdb, 0xff, 0x41, 0x90, 0x42, 0x8c, 0xd0 } };
  10. class FLVDecoderCreator : public svc_flvdecoder
  11. {
  12. public:
  13. static const char *getServiceName() { return "H.264 FLV Decoder"; }
  14. static GUID getServiceGuid() { return flv_h264_guid; }
  15. int CreateVideoDecoder(int format_type, int width, int height, ifc_flvvideodecoder **decoder);
  16. int HandlesVideo(int format_type);
  17. protected:
  18. RECVS_DISPATCH;
  19. };
  20. class FLVH264 : public ifc_flvvideodecoder
  21. {
  22. public:
  23. FLVH264(MFTDecoder *decoder);
  24. ~FLVH264();
  25. int GetOutputFormat(int *x, int *y, int *color_format);
  26. int DecodeSample(const void *inputBuffer, size_t inputBufferBytes, int32_t timestamp);
  27. void Flush();
  28. void Close();
  29. int GetPicture(void **data, void **decoder_data, uint64_t *timestamp);
  30. void FreePicture(void *data, void *decoder_data);
  31. int Ready();
  32. private:
  33. MFTDecoder *decoder;
  34. int sequence_headers_parsed;
  35. uint32_t nalu_size_bytes;
  36. std::vector<nullsoft_h264_frame_data> buffered_frames;
  37. protected:
  38. RECVS_DISPATCH;
  39. };