obs-studio/plugins/decklink/decklink-device-instance.hpp
Brian S. Stephan ec9d2b42c4 decklink: detect BMDPixelFormat in instance constructor
cleaning up my previous commit a bit. we can just keep the
appropriate BMDPixelFormat as a data member and keep StartCapture() a
bit clearer.

this might also be helpful if (when?) the detection code needs to be
more robust or configurable
2015-09-15 22:48:00 -05:00

48 lines
1.5 KiB
C++

#pragma once
#include "decklink-device.hpp"
class DeckLinkDeviceInstance : public IDeckLinkInputCallback {
protected:
struct obs_source_frame currentFrame;
struct obs_source_audio currentPacket;
DeckLink *decklink = nullptr;
DeckLinkDevice *device = nullptr;
DeckLinkDeviceMode *mode = nullptr;
BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
ComPtr<IDeckLinkInput> input;
volatile long refCount = 1;
void HandleAudioPacket(IDeckLinkAudioInputPacket *audioPacket,
const uint64_t timestamp);
void HandleVideoFrame(IDeckLinkVideoInputFrame *videoFrame,
const uint64_t timestamp);
public:
DeckLinkDeviceInstance(DeckLink *decklink, DeckLinkDevice *device);
virtual ~DeckLinkDeviceInstance();
inline DeckLinkDevice *GetDevice() const {return device;}
inline long long GetActiveModeId() const
{
return mode ? mode->GetId() : 0;
}
inline DeckLinkDeviceMode *GetMode() const {return mode;}
bool StartCapture(DeckLinkDeviceMode *mode);
bool StopCapture(void);
HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(
IDeckLinkVideoInputFrame *videoFrame,
IDeckLinkAudioInputPacket *audioPacket);
HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(
BMDVideoInputFormatChangedEvents events,
IDeckLinkDisplayMode *newMode,
BMDDetectedVideoInputFormatFlags detectedSignalFlags);
ULONG STDMETHODCALLTYPE AddRef(void);
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv);
ULONG STDMETHODCALLTYPE Release(void);
};