decklink.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include "platform.hpp"
  3. #include <obs-module.h>
  4. #include <map>
  5. #include <vector>
  6. #include <mutex>
  7. class DeckLinkDeviceDiscovery;
  8. class DeckLinkDeviceInstance;
  9. class DeckLinkDevice;
  10. class DeckLinkDeviceMode;
  11. class DeckLink {
  12. protected:
  13. ComPtr<DeckLinkDeviceInstance> instance;
  14. DeckLinkDeviceDiscovery *discovery;
  15. bool isCapturing = false;
  16. obs_source_t *source;
  17. volatile long activateRefs = 0;
  18. std::recursive_mutex deviceMutex;
  19. BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
  20. video_colorspace colorSpace = VIDEO_CS_DEFAULT;
  21. video_range_type colorRange = VIDEO_RANGE_DEFAULT;
  22. speaker_layout channelFormat = SPEAKERS_STEREO;
  23. void SaveSettings();
  24. static void DevicesChanged(void *param, DeckLinkDevice *device,
  25. bool added);
  26. public:
  27. DeckLink(obs_source_t *source, DeckLinkDeviceDiscovery *discovery);
  28. virtual ~DeckLink(void);
  29. DeckLinkDevice *GetDevice() const;
  30. long long GetActiveModeId(void) const;
  31. obs_source_t *GetSource(void) const;
  32. inline BMDPixelFormat GetPixelFormat() const {return pixelFormat;}
  33. inline void SetPixelFormat(BMDPixelFormat format)
  34. {
  35. pixelFormat = format;
  36. }
  37. inline video_colorspace GetColorSpace() const {return colorSpace;}
  38. inline void SetColorSpace(video_colorspace format)
  39. {
  40. colorSpace = format;
  41. }
  42. inline video_range_type GetColorRange() const {return colorRange;}
  43. inline void SetColorRange(video_range_type format)
  44. {
  45. colorRange = format;
  46. }
  47. inline speaker_layout GetChannelFormat() const {return channelFormat;}
  48. inline void SetChannelFormat(speaker_layout format)
  49. {
  50. channelFormat = format;
  51. }
  52. bool Activate(DeckLinkDevice *device, long long modeId);
  53. void Deactivate();
  54. bool buffering = false;
  55. };