-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
DeckLinkCapture.h
74 lines (62 loc) · 2.18 KB
/
DeckLinkCapture.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
#ifndef DECKLINKCAPTURE_H
#define DECKLINKCAPTURE_H
#include "DeckLinkInputDevice.h"
#include "Image.h"
#include "VideoFrameData.h"
#include "Rational.h"
class Image;
class DeckLinkInputDevice;
class DeviceEvent : public QEvent {
public:
enum Operation {
Add,
Remove,
} op;
IDeckLink *decklink;
DeviceEvent(Operation op, IDeckLink *decklink)
: QEvent(QEvent::User)
, op(op)
, decklink(decklink)
{
}
~DeviceEvent() override = default;
};
class DeckLinkCaptureDelegate {
public:
virtual void addDevice(IDeckLink *decklink) = 0;
virtual void removeDevice(IDeckLink *decklink) = 0;
virtual void updateProfile(IDeckLinkProfile *newProfile) = 0;
virtual void changeDisplayMode(BMDDisplayMode dispmode, Rational const &fps) = 0;
// virtual void videoFrameArrived(AncillaryDataStruct const *ancillary_data, HDRMetadataStruct const *hdr_metadata, bool signal_valid) = 0;
virtual void haltStreams() = 0;
virtual void criticalError(QString const &title, QString const &message) = 0;
};
class DeckLinkCapture : public QObject {
Q_OBJECT
friend class DeckLinkInputDevice;
friend class ProfileCallback;
private:
struct Private;
Private *m;
static Image createImage(int w, int h, BMDPixelFormat pixel_format, uint8_t const *data, int size);
DeckLinkCaptureDelegate *delegate();
void addDevice(IDeckLink *decklink);
void removeDevice(IDeckLink* decklink);
void updateProfile(IDeckLinkProfile *newProfile);
void changeDisplayMode(BMDDisplayMode dispmode, Rational const &fps);
// void videoFrameArrived(AncillaryDataStruct const *ancillary_data, HDRMetadataStruct const *hdr_metadata, bool signal_valid);
void haltStreams();
void criticalError(QString const &title, QString const &message);
void clearCriticalError();
// BMDPixelFormat pixelFormat() const;
void setPixelFormat(BMDPixelFormat pixel_format);
protected:
void customEvent(QEvent *event) override;
public:
DeckLinkCapture(DeckLinkCaptureDelegate *delegate);
~DeckLinkCapture() override;
bool startCapture(DeckLinkInputDevice *selectedDevice_, BMDDisplayMode displayMode, BMDFieldDominance fieldDominance, bool applyDetectedInputMode, bool input_audio);
signals:
void newFrame(VideoFrameData const &frame);
};
#endif // DECKLINKCAPTURE_H