OBSVideoFrame.h 2.1 KB

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