-
Notifications
You must be signed in to change notification settings - Fork 10
/
CaptureDelegate.h
80 lines (57 loc) · 2.73 KB
/
CaptureDelegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef __CaptureDelegate__
#define __CaptureDelegate__
#include "DeckLinkAPI.h"
#include "RefReleaser.hpp"
#include "util.h"
class CaptureDelegate : public IDeckLinkInputCallback
{
public:
CaptureDelegate(IDeckLink* deckLink, IDeckLinkInput* deckLinkInput);
virtual HRESULT QueryInterface(UNUSED REFIID iid, UNUSED LPVOID *ppv) { return E_NOINTERFACE; }
virtual ULONG AddRef();
virtual ULONG Release();
virtual HRESULT VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
virtual HRESULT VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
virtual void Start();
virtual void Stop();
virtual bool GetSignalDetected() { return m_hasSignal; }
virtual std::string GetDetectedMode() { return m_detectedMode; }
virtual BMDPixelFormat GetPixelFormat() { return m_pixelFormat; }
virtual BMDVideoConnection GetActiveConnection() { return m_activeConnection; }
virtual void SelectNextConnection();
virtual IDeckLinkVideoInputFrame* GetLastFrame() { return m_lastFrame; }
private:
ULONG m_refCount;
IDeckLinkDisplayMode* queryFirstDisplayMode();
IDeckLinkConfiguration* queryConfigurationInterface();
IDeckLinkAttributes* queryAttributesInterface();
int64_t queryInputConnections();
BMDVideoConnection querySelectedConnection();
void setDuplexToHalfDuplexModeIfSupported();
void setDuplexToHalfDuplexMode(IDeckLink *deckLink);
private:
static const BMDPixelFormat PIXEL_FORMAT = bmdFormat10BitYUV;
static const BMDVideoInputFlags VIDEO_INPUT_FLAGS = bmdVideoInputEnableFormatDetection;
static const BMDAudioSampleRate AUDIO_SAMPLE_RATE = bmdAudioSampleRate48kHz;
static const int AUDIO_SAMPLE_DEPTH = 16;
static const int AUDIO_CHANNELS = 16;
private:
IDeckLink* m_deckLinkParent;
RefReleaser<IDeckLink> m_deckLinkParentReleaser;
IDeckLinkConfiguration* m_deckLinkParentDeviceConfiguration;
RefReleaser<IDeckLinkConfiguration> m_deckLinkParentDeviceConfigurationReleaser;
IDeckLink* m_deckLink;
IDeckLinkInput* m_deckLinkInput;
IDeckLinkAttributes* m_deckLinkAttributes;
RefReleaser<IDeckLinkAttributes> m_deckLinkAttributesReleaser;
IDeckLinkConfiguration* m_deckLinkConfiguration;
RefReleaser<IDeckLinkConfiguration> m_deckLinkConfigurationReleaser;
IDeckLinkVideoInputFrame* m_lastFrame;
RefReleaser<IDeckLinkVideoInputFrame> m_lastFrameReleaser;
int64_t m_decklinkConnections;
bool m_hasSignal;
std::string m_detectedMode;
BMDPixelFormat m_pixelFormat;
BMDVideoConnection m_activeConnection;
};
#endif