decklink-device-instance.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "decklink-device.hpp"
  3. class DeckLinkDeviceInstance : public IDeckLinkInputCallback {
  4. protected:
  5. struct obs_source_frame currentFrame;
  6. struct obs_source_audio currentPacket;
  7. DeckLink *decklink = nullptr;
  8. DeckLinkDevice *device = nullptr;
  9. DeckLinkDeviceMode *mode = nullptr;
  10. ComPtr<IDeckLinkInput> input;
  11. volatile long refCount = 1;
  12. void HandleAudioPacket(IDeckLinkAudioInputPacket *audioPacket,
  13. const uint64_t timestamp);
  14. void HandleVideoFrame(IDeckLinkVideoInputFrame *videoFrame,
  15. const uint64_t timestamp);
  16. public:
  17. DeckLinkDeviceInstance(DeckLink *decklink, DeckLinkDevice *device);
  18. inline DeckLinkDevice *GetDevice() const {return device;}
  19. inline long long GetActiveModeId() const
  20. {
  21. return mode ? mode->GetId() : 0;
  22. }
  23. inline DeckLinkDeviceMode *GetMode() const {return mode;}
  24. bool StartCapture(DeckLinkDeviceMode *mode);
  25. bool StopCapture(void);
  26. HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(
  27. IDeckLinkVideoInputFrame *videoFrame,
  28. IDeckLinkAudioInputPacket *audioPacket);
  29. HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(
  30. BMDVideoInputFormatChangedEvents events,
  31. IDeckLinkDisplayMode *newMode,
  32. BMDDetectedVideoInputFormatFlags detectedSignalFlags);
  33. ULONG STDMETHODCALLTYPE AddRef(void);
  34. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv);
  35. ULONG STDMETHODCALLTYPE Release(void);
  36. };