OBSVideoFrame.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #include "OBSVideoFrame.h"
  2. OBSVideoFrame::OBSVideoFrame(long width, long height,
  3. BMDPixelFormat pixelFormat)
  4. {
  5. int bpp = 2;
  6. this->width = width;
  7. this->height = height;
  8. this->rowBytes = width * bpp;
  9. this->data = new unsigned char[width * height * bpp + 1];
  10. this->pixelFormat = pixelFormat;
  11. }
  12. HRESULT OBSVideoFrame::SetFlags(BMDFrameFlags newFlags)
  13. {
  14. flags = newFlags;
  15. return S_OK;
  16. }
  17. HRESULT OBSVideoFrame::SetTimecode(BMDTimecodeFormat format,
  18. IDeckLinkTimecode *timecode)
  19. {
  20. UNUSED_PARAMETER(format);
  21. UNUSED_PARAMETER(timecode);
  22. return 0;
  23. }
  24. HRESULT
  25. OBSVideoFrame::SetTimecodeFromComponents(BMDTimecodeFormat format,
  26. uint8_t hours, uint8_t minutes,
  27. uint8_t seconds, uint8_t frames,
  28. BMDTimecodeFlags flags)
  29. {
  30. UNUSED_PARAMETER(format);
  31. UNUSED_PARAMETER(hours);
  32. UNUSED_PARAMETER(minutes);
  33. UNUSED_PARAMETER(seconds);
  34. UNUSED_PARAMETER(frames);
  35. UNUSED_PARAMETER(flags);
  36. return 0;
  37. }
  38. HRESULT OBSVideoFrame::SetAncillaryData(IDeckLinkVideoFrameAncillary *ancillary)
  39. {
  40. UNUSED_PARAMETER(ancillary);
  41. return 0;
  42. }
  43. HRESULT OBSVideoFrame::SetTimecodeUserBits(BMDTimecodeFormat format,
  44. BMDTimecodeUserBits userBits)
  45. {
  46. UNUSED_PARAMETER(format);
  47. UNUSED_PARAMETER(userBits);
  48. return 0;
  49. }
  50. long OBSVideoFrame::GetWidth()
  51. {
  52. return width;
  53. }
  54. long OBSVideoFrame::GetHeight()
  55. {
  56. return height;
  57. }
  58. long OBSVideoFrame::GetRowBytes()
  59. {
  60. return rowBytes;
  61. }
  62. BMDPixelFormat OBSVideoFrame::GetPixelFormat()
  63. {
  64. return pixelFormat;
  65. }
  66. BMDFrameFlags OBSVideoFrame::GetFlags()
  67. {
  68. return flags;
  69. }
  70. HRESULT OBSVideoFrame::GetBytes(void **buffer)
  71. {
  72. *buffer = this->data;
  73. return S_OK;
  74. }