decklink.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. speaker_layout channelFormat = SPEAKERS_STEREO;
  21. void SaveSettings();
  22. static void DevicesChanged(void *param, DeckLinkDevice *device,
  23. bool added);
  24. public:
  25. DeckLink(obs_source_t *source, DeckLinkDeviceDiscovery *discovery);
  26. virtual ~DeckLink(void);
  27. DeckLinkDevice *GetDevice() const;
  28. long long GetActiveModeId(void) const;
  29. obs_source_t *GetSource(void) const;
  30. inline BMDPixelFormat GetPixelFormat() const {return pixelFormat;}
  31. inline void SetPixelFormat(BMDPixelFormat format)
  32. {
  33. pixelFormat = format;
  34. }
  35. inline speaker_layout GetChannelFormat() const {return channelFormat;}
  36. inline void SetChannelFormat(speaker_layout format)
  37. {
  38. channelFormat = format;
  39. }
  40. bool Activate(DeckLinkDevice *device, long long modeId);
  41. void Deactivate();
  42. };