MFTDecoder.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <Mftransform.h>
  3. #include <bfc/platform/types.h>
  4. #include "../Winamp/wa_ipc.h"
  5. struct nullsoft_h264_frame_data
  6. {
  7. void *data;
  8. void *decoder_data;
  9. uint64_t local_timestamp;
  10. };
  11. class MFTDecoder
  12. {
  13. public:
  14. MFTDecoder();
  15. ~MFTDecoder();
  16. HRESULT Open();
  17. HRESULT Feed(const void *data, size_t data_size, uint64_t timestamp_hundred_nanos);
  18. HRESULT FeedRaw(const void *data, size_t data_size, uint64_t timestamp_hundred_nanos);
  19. HRESULT GetFrame(IMFMediaBuffer **output_buffer, uint64_t *hundrednanos);
  20. HRESULT GetFrame(YV12_PLANES **data, void **decoder_data, uint64_t *mft_timestamp);
  21. HRESULT FreeFrame(YV12_PLANES *data, void *decoder_data);
  22. HRESULT GetOutputFormat(UINT *width, UINT *height, bool *flip, double *aspect);
  23. HRESULT Flush();
  24. HRESULT Drain();
  25. HRESULT GetVideoDisplayArea(IMFMediaType* pType, MFVideoArea* pArea);
  26. IMFTransform *decoder;
  27. LONG stride;
  28. UINT32 width, height;
  29. private:
  30. MFVideoArea MakeArea(float x, float y, DWORD width, DWORD height);
  31. MFOffset MakeOffset(float v);
  32. };