OBSVideoFrame.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. OBSVideoFrame::~OBSVideoFrame()
  13. {
  14. delete this->data;
  15. }
  16. HRESULT OBSVideoFrame::SetFlags(BMDFrameFlags newFlags)
  17. {
  18. flags = newFlags;
  19. return S_OK;
  20. }
  21. HRESULT OBSVideoFrame::SetTimecode(BMDTimecodeFormat format,
  22. IDeckLinkTimecode *timecode)
  23. {
  24. UNUSED_PARAMETER(format);
  25. UNUSED_PARAMETER(timecode);
  26. return 0;
  27. }
  28. HRESULT
  29. OBSVideoFrame::SetTimecodeFromComponents(BMDTimecodeFormat format,
  30. uint8_t hours, uint8_t minutes,
  31. uint8_t seconds, uint8_t frames,
  32. BMDTimecodeFlags flags)
  33. {
  34. UNUSED_PARAMETER(format);
  35. UNUSED_PARAMETER(hours);
  36. UNUSED_PARAMETER(minutes);
  37. UNUSED_PARAMETER(seconds);
  38. UNUSED_PARAMETER(frames);
  39. UNUSED_PARAMETER(flags);
  40. return 0;
  41. }
  42. HRESULT OBSVideoFrame::SetAncillaryData(IDeckLinkVideoFrameAncillary *ancillary)
  43. {
  44. UNUSED_PARAMETER(ancillary);
  45. return 0;
  46. }
  47. HRESULT OBSVideoFrame::SetTimecodeUserBits(BMDTimecodeFormat format,
  48. BMDTimecodeUserBits userBits)
  49. {
  50. UNUSED_PARAMETER(format);
  51. UNUSED_PARAMETER(userBits);
  52. return 0;
  53. }
  54. long OBSVideoFrame::GetWidth()
  55. {
  56. return width;
  57. }
  58. long OBSVideoFrame::GetHeight()
  59. {
  60. return height;
  61. }
  62. long OBSVideoFrame::GetRowBytes()
  63. {
  64. return rowBytes;
  65. }
  66. BMDPixelFormat OBSVideoFrame::GetPixelFormat()
  67. {
  68. return pixelFormat;
  69. }
  70. BMDFrameFlags OBSVideoFrame::GetFlags()
  71. {
  72. return flags;
  73. }
  74. HRESULT OBSVideoFrame::GetBytes(void **buffer)
  75. {
  76. *buffer = this->data;
  77. return S_OK;
  78. }