OBSVideoFrame.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include "platform.hpp"
  3. #include "obs.hpp"
  4. class OBSVideoFrame : public IDeckLinkMutableVideoFrame {
  5. private:
  6. BMDFrameFlags flags;
  7. BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
  8. long width;
  9. long height;
  10. long rowBytes;
  11. unsigned char *data;
  12. public:
  13. OBSVideoFrame(long width, long height, BMDPixelFormat pixelFormat);
  14. HRESULT STDMETHODCALLTYPE SetFlags(BMDFrameFlags newFlags) override;
  15. HRESULT STDMETHODCALLTYPE SetTimecode(
  16. BMDTimecodeFormat format, IDeckLinkTimecode *timecode) override;
  17. HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents(
  18. BMDTimecodeFormat format, uint8_t hours, uint8_t minutes,
  19. uint8_t seconds, uint8_t frames,
  20. BMDTimecodeFlags flags) override;
  21. HRESULT
  22. STDMETHODCALLTYPE
  23. SetAncillaryData(IDeckLinkVideoFrameAncillary *ancillary) override;
  24. HRESULT STDMETHODCALLTYPE
  25. SetTimecodeUserBits(BMDTimecodeFormat format,
  26. BMDTimecodeUserBits userBits) override;
  27. long STDMETHODCALLTYPE GetWidth() override;
  28. long STDMETHODCALLTYPE GetHeight() override;
  29. long STDMETHODCALLTYPE GetRowBytes() override;
  30. BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat() override;
  31. BMDFrameFlags STDMETHODCALLTYPE GetFlags() override;
  32. HRESULT STDMETHODCALLTYPE GetBytes(void **buffer) override;
  33. //Dummy implementations of remaining virtual methods
  34. virtual HRESULT STDMETHODCALLTYPE
  35. GetTimecode(/* in */ BMDTimecodeFormat format,
  36. /* out */ IDeckLinkTimecode **timecode) override
  37. {
  38. UNUSED_PARAMETER(format);
  39. UNUSED_PARAMETER(timecode);
  40. return E_NOINTERFACE;
  41. };
  42. virtual HRESULT STDMETHODCALLTYPE GetAncillaryData(
  43. /* out */ IDeckLinkVideoFrameAncillary **ancillary) override
  44. {
  45. UNUSED_PARAMETER(ancillary);
  46. return E_NOINTERFACE;
  47. };
  48. // IUnknown interface (dummy implementation)
  49. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid,
  50. LPVOID *ppv) override
  51. {
  52. UNUSED_PARAMETER(iid);
  53. UNUSED_PARAMETER(ppv);
  54. return E_NOINTERFACE;
  55. }
  56. virtual ULONG STDMETHODCALLTYPE AddRef() override { return 1; }
  57. virtual ULONG STDMETHODCALLTYPE Release() override { return 1; }
  58. };