1 /* -LICENSE-START-
2 ** Copyright (c) 2016 Blackmagic Design
3 **
4 ** Permission is hereby granted, free of charge, to any person or organization
5 ** obtaining a copy of the software and accompanying documentation covered by
6 ** this license (the "Software") to use, reproduce, display, distribute,
7 ** execute, and transmit the Software, and to prepare derivative works of the
8 ** Software, and to permit third-parties to whom the Software is furnished to
9 ** do so, all subject to the following:
10 **
11 ** The copyright notices in the Software and this entire statement, including
12 ** the above license grant, this restriction and the following disclaimer,
13 ** must be included in all copies of the Software, in whole or in part, and
14 ** all derivative works of the Software, unless such copies or derivative
15 ** works are solely in the form of machine-executable object code generated by
16 ** a source language processor.
17 **
18 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
21 ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
22 ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
23 ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 ** DEALINGS IN THE SOFTWARE.
25 ** -LICENSE-END-
26 */
27 
28 #ifndef BMD_DECKLINKAPI_H
29 #define BMD_DECKLINKAPI_H
30 
31 
32 #ifndef BMD_CONST
33     #if defined(_MSC_VER)
34         #define BMD_CONST __declspec(selectany) static const
35     #else
36         #define BMD_CONST static const
37     #endif
38 #endif
39 
40 /* DeckLink API */
41 
42 #include <CoreFoundation/CoreFoundation.h>
43 #include <CoreFoundation/CFPlugInCOM.h>
44 #include <stdint.h>
45 
46 #include "DeckLinkAPITypes.h"
47 #include "DeckLinkAPIModes.h"
48 #include "DeckLinkAPIDiscovery.h"
49 #include "DeckLinkAPIConfiguration.h"
50 #include "DeckLinkAPIDeckControl.h"
51 
52 #include "DeckLinkAPIStreaming.h"
53 
54 #define BLACKMAGIC_DECKLINK_API_MAGIC	1
55 
56 // Type Declarations
57 
58 
59 // Interface ID Declarations
60 
61 BMD_CONST REFIID IID_IDeckLinkVideoOutputCallback                 = /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ {0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE};
62 BMD_CONST REFIID IID_IDeckLinkInputCallback                       = /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ {0xDD,0x04,0xE5,0xEC,0x74,0x15,0x42,0xAB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A};
63 BMD_CONST REFIID IID_IDeckLinkEncoderInputCallback                = /* ACF13E61-F4A0-4974-A6A7-59AFF6268B31 */ {0xAC,0xF1,0x3E,0x61,0xF4,0xA0,0x49,0x74,0xA6,0xA7,0x59,0xAF,0xF6,0x26,0x8B,0x31};
64 BMD_CONST REFIID IID_IDeckLinkMemoryAllocator                     = /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ {0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8};
65 BMD_CONST REFIID IID_IDeckLinkAudioOutputCallback                 = /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ {0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6};
66 BMD_CONST REFIID IID_IDeckLinkIterator                            = /* 50FB36CD-3063-4B73-BDBB-958087F2D8BA */ {0x50,0xFB,0x36,0xCD,0x30,0x63,0x4B,0x73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA};
67 BMD_CONST REFIID IID_IDeckLinkAPIInformation                      = /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ {0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4};
68 BMD_CONST REFIID IID_IDeckLinkOutput                              = /* CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564 */ {0xCC,0x5C,0x8A,0x6E,0x3F,0x2F,0x4B,0x3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64};
69 BMD_CONST REFIID IID_IDeckLinkInput                               = /* AF22762B-DFAC-4846-AA79-FA8883560995 */ {0xAF,0x22,0x76,0x2B,0xDF,0xAC,0x48,0x46,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95};
70 BMD_CONST REFIID IID_IDeckLinkEncoderInput                        = /* 270587DA-6B7D-42E7-A1F0-6D853F581185 */ {0x27,0x05,0x87,0xDA,0x6B,0x7D,0x42,0xE7,0xA1,0xF0,0x6D,0x85,0x3F,0x58,0x11,0x85};
71 BMD_CONST REFIID IID_IDeckLinkVideoFrame                          = /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ {0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17};
72 BMD_CONST REFIID IID_IDeckLinkMutableVideoFrame                   = /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ {0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90};
73 BMD_CONST REFIID IID_IDeckLinkVideoFrame3DExtensions              = /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ {0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7};
74 BMD_CONST REFIID IID_IDeckLinkVideoFrameMetadataExtensions        = /* D5973DC9-6432-46D0-8F0B-2496F8A1238F */ {0xD5,0x97,0x3D,0xC9,0x64,0x32,0x46,0xD0,0x8F,0x0B,0x24,0x96,0xF8,0xA1,0x23,0x8F};
75 BMD_CONST REFIID IID_IDeckLinkVideoInputFrame                     = /* 05CFE374-537C-4094-9A57-680525118F44 */ {0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44};
76 BMD_CONST REFIID IID_IDeckLinkVideoFrameAncillary                 = /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ {0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04};
77 BMD_CONST REFIID IID_IDeckLinkEncoderPacket                       = /* B693F36C-316E-4AF1-B6C2-F389A4BCA620 */ {0xB6,0x93,0xF3,0x6C,0x31,0x6E,0x4A,0xF1,0xB6,0xC2,0xF3,0x89,0xA4,0xBC,0xA6,0x20};
78 BMD_CONST REFIID IID_IDeckLinkEncoderVideoPacket                  = /* 4E7FD944-E8C7-4EAC-B8C0-7B77F80F5AE0 */ {0x4E,0x7F,0xD9,0x44,0xE8,0xC7,0x4E,0xAC,0xB8,0xC0,0x7B,0x77,0xF8,0x0F,0x5A,0xE0};
79 BMD_CONST REFIID IID_IDeckLinkEncoderAudioPacket                  = /* 49E8EDC8-693B-4E14-8EF6-12C658F5A07A */ {0x49,0xE8,0xED,0xC8,0x69,0x3B,0x4E,0x14,0x8E,0xF6,0x12,0xC6,0x58,0xF5,0xA0,0x7A};
80 BMD_CONST REFIID IID_IDeckLinkH265NALPacket                       = /* 639C8E0B-68D5-4BDE-A6D4-95F3AEAFF2E7 */ {0x63,0x9C,0x8E,0x0B,0x68,0xD5,0x4B,0xDE,0xA6,0xD4,0x95,0xF3,0xAE,0xAF,0xF2,0xE7};
81 BMD_CONST REFIID IID_IDeckLinkAudioInputPacket                    = /* E43D5870-2894-11DE-8C30-0800200C9A66 */ {0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66};
82 BMD_CONST REFIID IID_IDeckLinkScreenPreviewCallback               = /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ {0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38};
83 BMD_CONST REFIID IID_IDeckLinkCocoaScreenPreviewCallback          = /* D174152F-8F96-4C07-83A5-DD5F5AF0A2AA */ {0xD1,0x74,0x15,0x2F,0x8F,0x96,0x4C,0x07,0x83,0xA5,0xDD,0x5F,0x5A,0xF0,0xA2,0xAA};
84 BMD_CONST REFIID IID_IDeckLinkGLScreenPreviewHelper               = /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ {0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F};
85 BMD_CONST REFIID IID_IDeckLinkNotificationCallback                = /* B002A1EC-070D-4288-8289-BD5D36E5FF0D */ {0xB0,0x02,0xA1,0xEC,0x07,0x0D,0x42,0x88,0x82,0x89,0xBD,0x5D,0x36,0xE5,0xFF,0x0D};
86 BMD_CONST REFIID IID_IDeckLinkNotification                        = /* 0A1FB207-E215-441B-9B19-6FA1575946C5 */ {0x0A,0x1F,0xB2,0x07,0xE2,0x15,0x44,0x1B,0x9B,0x19,0x6F,0xA1,0x57,0x59,0x46,0xC5};
87 BMD_CONST REFIID IID_IDeckLinkAttributes                          = /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ {0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4};
88 BMD_CONST REFIID IID_IDeckLinkStatus                              = /* 5F558200-4028-49BC-BEAC-DB3FA4A96E46 */ {0x5F,0x55,0x82,0x00,0x40,0x28,0x49,0xBC,0xBE,0xAC,0xDB,0x3F,0xA4,0xA9,0x6E,0x46};
89 BMD_CONST REFIID IID_IDeckLinkKeyer                               = /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ {0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3};
90 BMD_CONST REFIID IID_IDeckLinkVideoConversion                     = /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ {0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A};
91 BMD_CONST REFIID IID_IDeckLinkDeviceNotificationCallback          = /* 4997053B-0ADF-4CC8-AC70-7A50C4BE728F */ {0x49,0x97,0x05,0x3B,0x0A,0xDF,0x4C,0xC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F};
92 BMD_CONST REFIID IID_IDeckLinkDiscovery                           = /* CDBF631C-BC76-45FA-B44D-C55059BC6101 */ {0xCD,0xBF,0x63,0x1C,0xBC,0x76,0x45,0xFA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01};
93 
94 /* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */
95 
96 typedef uint32_t BMDVideoOutputFlags;
97 enum _BMDVideoOutputFlags {
98     bmdVideoOutputFlagDefault                                    = 0,
99     bmdVideoOutputVANC                                           = 1 << 0,
100     bmdVideoOutputVITC                                           = 1 << 1,
101     bmdVideoOutputRP188                                          = 1 << 2,
102     bmdVideoOutputDualStream3D                                   = 1 << 4
103 };
104 
105 /* Enum BMDPacketType - Type of packet */
106 
107 typedef uint32_t BMDPacketType;
108 enum _BMDPacketType {
109     bmdPacketTypeStreamInterruptedMarker                         = 'sint',	// A packet of this type marks the time when a video stream was interrupted, for example by a disconnected cable
110     bmdPacketTypeStreamData                                      = 'sdat'	// Regular stream data
111 };
112 
113 /* Enum BMDFrameFlags - Frame flags */
114 
115 typedef uint32_t BMDFrameFlags;
116 enum _BMDFrameFlags {
117     bmdFrameFlagDefault                                          = 0,
118     bmdFrameFlagFlipVertical                                     = 1 << 0,
119     bmdFrameContainsHDRMetadata                                  = 1 << 1,
120 
121     /* Flags that are applicable only to instances of IDeckLinkVideoInputFrame */
122 
123     bmdFrameHasNoInputSource                                     = 1 << 31
124 };
125 
126 /* Enum BMDVideoInputFlags - Flags applicable to video input */
127 
128 typedef uint32_t BMDVideoInputFlags;
129 enum _BMDVideoInputFlags {
130     bmdVideoInputFlagDefault                                     = 0,
131     bmdVideoInputEnableFormatDetection                           = 1 << 0,
132     bmdVideoInputDualStream3D                                    = 1 << 1
133 };
134 
135 /* Enum BMDVideoInputFormatChangedEvents - Bitmask passed to the VideoInputFormatChanged notification to identify the properties of the input signal that have changed */
136 
137 typedef uint32_t BMDVideoInputFormatChangedEvents;
138 enum _BMDVideoInputFormatChangedEvents {
139     bmdVideoInputDisplayModeChanged                              = 1 << 0,
140     bmdVideoInputFieldDominanceChanged                           = 1 << 1,
141     bmdVideoInputColorspaceChanged                               = 1 << 2
142 };
143 
144 /* Enum BMDDetectedVideoInputFormatFlags - Flags passed to the VideoInputFormatChanged notification to describe the detected video input signal */
145 
146 typedef uint32_t BMDDetectedVideoInputFormatFlags;
147 enum _BMDDetectedVideoInputFormatFlags {
148     bmdDetectedVideoInputYCbCr422                                = 1 << 0,
149     bmdDetectedVideoInputRGB444                                  = 1 << 1,
150     bmdDetectedVideoInputDualStream3D                            = 1 << 2
151 };
152 
153 /* Enum BMDDeckLinkCapturePassthroughMode - Enumerates whether the video output is electrically connected to the video input or if the clean switching mode is enabled */
154 
155 typedef uint32_t BMDDeckLinkCapturePassthroughMode;
156 enum _BMDDeckLinkCapturePassthroughMode {
157     bmdDeckLinkCapturePassthroughModeDisabled                    = 'pdis',
158     bmdDeckLinkCapturePassthroughModeDirect                      = 'pdir',
159     bmdDeckLinkCapturePassthroughModeCleanSwitch                 = 'pcln'
160 };
161 
162 /* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */
163 
164 typedef uint32_t BMDOutputFrameCompletionResult;
165 enum _BMDOutputFrameCompletionResult {
166     bmdOutputFrameCompleted,
167     bmdOutputFrameDisplayedLate,
168     bmdOutputFrameDropped,
169     bmdOutputFrameFlushed
170 };
171 
172 /* Enum BMDReferenceStatus - GenLock input status */
173 
174 typedef uint32_t BMDReferenceStatus;
175 enum _BMDReferenceStatus {
176     bmdReferenceNotSupportedByHardware                           = 1 << 0,
177     bmdReferenceLocked                                           = 1 << 1
178 };
179 
180 /* Enum BMDAudioFormat - Audio Format */
181 
182 typedef uint32_t BMDAudioFormat;
183 enum _BMDAudioFormat {
184     bmdAudioFormatPCM                                            = 'lpcm'	// Linear signed PCM samples
185 };
186 
187 /* Enum BMDAudioSampleRate - Audio sample rates supported for output/input */
188 
189 typedef uint32_t BMDAudioSampleRate;
190 enum _BMDAudioSampleRate {
191     bmdAudioSampleRate48kHz                                      = 48000
192 };
193 
194 /* Enum BMDAudioSampleType - Audio sample sizes supported for output/input */
195 
196 typedef uint32_t BMDAudioSampleType;
197 enum _BMDAudioSampleType {
198     bmdAudioSampleType16bitInteger                               = 16,
199     bmdAudioSampleType32bitInteger                               = 32
200 };
201 
202 /* Enum BMDAudioOutputStreamType - Audio output stream type */
203 
204 typedef uint32_t BMDAudioOutputStreamType;
205 enum _BMDAudioOutputStreamType {
206     bmdAudioOutputStreamContinuous,
207     bmdAudioOutputStreamContinuousDontResample,
208     bmdAudioOutputStreamTimestamped
209 };
210 
211 /* Enum BMDDisplayModeSupport - Output mode supported flags */
212 
213 typedef uint32_t BMDDisplayModeSupport;
214 enum _BMDDisplayModeSupport {
215     bmdDisplayModeNotSupported                                   = 0,
216     bmdDisplayModeSupported,
217     bmdDisplayModeSupportedWithConversion
218 };
219 
220 /* Enum BMDTimecodeFormat - Timecode formats for frame metadata */
221 
222 typedef uint32_t BMDTimecodeFormat;
223 enum _BMDTimecodeFormat {
224     bmdTimecodeRP188VITC1                                        = 'rpv1',	// RP188 timecode where DBB1 equals VITC1 (line 9)
225     bmdTimecodeRP188VITC2                                        = 'rp12',	// RP188 timecode where DBB1 equals VITC2 (line 9 for progressive or line 571 for interlaced/PsF)
226     bmdTimecodeRP188LTC                                          = 'rplt',	// RP188 timecode where DBB1 equals LTC (line 10)
227     bmdTimecodeRP188Any                                          = 'rp18',	// For capture: return the first valid timecode in {VITC1, LTC ,VITC2} - For playback: set the timecode as VITC1
228     bmdTimecodeVITC                                              = 'vitc',
229     bmdTimecodeVITCField2                                        = 'vit2',
230     bmdTimecodeSerial                                            = 'seri'
231 };
232 
233 /* Enum BMDAnalogVideoFlags - Analog video display flags */
234 
235 typedef uint32_t BMDAnalogVideoFlags;
236 enum _BMDAnalogVideoFlags {
237     bmdAnalogVideoFlagCompositeSetup75                           = 1 << 0,
238     bmdAnalogVideoFlagComponentBetacamLevels                     = 1 << 1
239 };
240 
241 /* Enum BMDAudioOutputAnalogAESSwitch - Audio output Analog/AESEBU switch */
242 
243 typedef uint32_t BMDAudioOutputAnalogAESSwitch;
244 enum _BMDAudioOutputAnalogAESSwitch {
245     bmdAudioOutputSwitchAESEBU                                   = 'aes ',
246     bmdAudioOutputSwitchAnalog                                   = 'anlg'
247 };
248 
249 /* Enum BMDVideoOutputConversionMode - Video/audio conversion mode */
250 
251 typedef uint32_t BMDVideoOutputConversionMode;
252 enum _BMDVideoOutputConversionMode {
253     bmdNoVideoOutputConversion                                   = 'none',
254     bmdVideoOutputLetterboxDownconversion                        = 'ltbx',
255     bmdVideoOutputAnamorphicDownconversion                       = 'amph',
256     bmdVideoOutputHD720toHD1080Conversion                        = '720c',
257     bmdVideoOutputHardwareLetterboxDownconversion                = 'HWlb',
258     bmdVideoOutputHardwareAnamorphicDownconversion               = 'HWam',
259     bmdVideoOutputHardwareCenterCutDownconversion                = 'HWcc',
260     bmdVideoOutputHardware720p1080pCrossconversion               = 'xcap',
261     bmdVideoOutputHardwareAnamorphic720pUpconversion             = 'ua7p',
262     bmdVideoOutputHardwareAnamorphic1080iUpconversion            = 'ua1i',
263     bmdVideoOutputHardwareAnamorphic149To720pUpconversion        = 'u47p',
264     bmdVideoOutputHardwareAnamorphic149To1080iUpconversion       = 'u41i',
265     bmdVideoOutputHardwarePillarbox720pUpconversion              = 'up7p',
266     bmdVideoOutputHardwarePillarbox1080iUpconversion             = 'up1i'
267 };
268 
269 /* Enum BMDVideoInputConversionMode - Video input conversion mode */
270 
271 typedef uint32_t BMDVideoInputConversionMode;
272 enum _BMDVideoInputConversionMode {
273     bmdNoVideoInputConversion                                    = 'none',
274     bmdVideoInputLetterboxDownconversionFromHD1080               = '10lb',
275     bmdVideoInputAnamorphicDownconversionFromHD1080              = '10am',
276     bmdVideoInputLetterboxDownconversionFromHD720                = '72lb',
277     bmdVideoInputAnamorphicDownconversionFromHD720               = '72am',
278     bmdVideoInputLetterboxUpconversion                           = 'lbup',
279     bmdVideoInputAnamorphicUpconversion                          = 'amup'
280 };
281 
282 /* Enum BMDVideo3DPackingFormat - Video 3D packing format */
283 
284 typedef uint32_t BMDVideo3DPackingFormat;
285 enum _BMDVideo3DPackingFormat {
286     bmdVideo3DPackingSidebySideHalf                              = 'sbsh',
287     bmdVideo3DPackingLinebyLine                                  = 'lbyl',
288     bmdVideo3DPackingTopAndBottom                                = 'tabo',
289     bmdVideo3DPackingFramePacking                                = 'frpk',
290     bmdVideo3DPackingLeftOnly                                    = 'left',
291     bmdVideo3DPackingRightOnly                                   = 'righ'
292 };
293 
294 /* Enum BMDIdleVideoOutputOperation - Video output operation when not playing video */
295 
296 typedef uint32_t BMDIdleVideoOutputOperation;
297 enum _BMDIdleVideoOutputOperation {
298     bmdIdleVideoOutputBlack                                      = 'blac',
299     bmdIdleVideoOutputLastFrame                                  = 'lafa'
300 };
301 
302 /* Enum BMDVideoEncoderFrameCodingMode - Video frame coding mode */
303 
304 typedef uint32_t BMDVideoEncoderFrameCodingMode;
305 enum _BMDVideoEncoderFrameCodingMode {
306     bmdVideoEncoderFrameCodingModeInter                          = 'inte',
307     bmdVideoEncoderFrameCodingModeIntra                          = 'intr'
308 };
309 
310 /* Enum BMDDNxHRLevel - DNxHR Levels */
311 
312 typedef uint32_t BMDDNxHRLevel;
313 enum _BMDDNxHRLevel {
314     bmdDNxHRLevelSQ                                              = 'dnsq',
315     bmdDNxHRLevelLB                                              = 'dnlb',
316     bmdDNxHRLevelHQ                                              = 'dnhq',
317     bmdDNxHRLevelHQX                                             = 'dhqx',
318     bmdDNxHRLevel444                                             = 'd444'
319 };
320 
321 /* Enum BMDLinkConfiguration - Video link configuration */
322 
323 typedef uint32_t BMDLinkConfiguration;
324 enum _BMDLinkConfiguration {
325     bmdLinkConfigurationSingleLink                               = 'lcsl',
326     bmdLinkConfigurationDualLink                                 = 'lcdl',
327     bmdLinkConfigurationQuadLink                                 = 'lcql'
328 };
329 
330 /* Enum BMDDeviceInterface - Device interface type */
331 
332 typedef uint32_t BMDDeviceInterface;
333 enum _BMDDeviceInterface {
334     bmdDeviceInterfacePCI                                        = 'pci ',
335     bmdDeviceInterfaceUSB                                        = 'usb ',
336     bmdDeviceInterfaceThunderbolt                                = 'thun'
337 };
338 
339 /* Enum BMDDeckLinkFrameMetadataID - DeckLink Frame Metadata ID */
340 
341 typedef uint32_t BMDDeckLinkFrameMetadataID;
342 enum _BMDDeckLinkFrameMetadataID {
343     bmdDeckLinkFrameMetadataHDRElectroOpticalTransferFunc        = 'eotf',	// EOTF in range 0-7 as per CEA 861.3
344     bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedX              = 'hdrx',	// Red display primaries in range 0.0 - 1.0
345     bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedY              = 'hdry',	// Red display primaries in range 0.0 - 1.0
346     bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenX            = 'hdgx',	// Green display primaries in range 0.0 - 1.0
347     bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenY            = 'hdgy',	// Green display primaries in range 0.0 - 1.0
348     bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueX             = 'hdbx',	// Blue display primaries in range 0.0 - 1.0
349     bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueY             = 'hdby',	// Blue display primaries in range 0.0 - 1.0
350     bmdDeckLinkFrameMetadataHDRWhitePointX                       = 'hdwx',	// White point in range 0.0 - 1.0
351     bmdDeckLinkFrameMetadataHDRWhitePointY                       = 'hdwy',	// White point in range 0.0 - 1.0
352     bmdDeckLinkFrameMetadataHDRMaxDisplayMasteringLuminance      = 'hdml',	// Max display mastering luminance in range 1 cd/m2 - 65535 cd/m2
353     bmdDeckLinkFrameMetadataHDRMinDisplayMasteringLuminance      = 'hmil',	// Min display mastering luminance in range 0.0001 cd/m2 - 6.5535 cd/m2
354     bmdDeckLinkFrameMetadataHDRMaximumContentLightLevel          = 'mcll',	// Maximum Content Light Level in range 1 cd/m2 - 65535 cd/m2
355     bmdDeckLinkFrameMetadataHDRMaximumFrameAverageLightLevel     = 'fall'	// Maximum Frame Average Light Level in range 1 cd/m2 - 65535 cd/m2
356 };
357 
358 /* Enum BMDDuplexMode - Duplex for configurable ports */
359 
360 typedef uint32_t BMDDuplexMode;
361 enum _BMDDuplexMode {
362     bmdDuplexModeFull                                            = 'fdup',
363     bmdDuplexModeHalf                                            = 'hdup'
364 };
365 
366 /* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */
367 
368 typedef uint32_t BMDDeckLinkAttributeID;
369 enum _BMDDeckLinkAttributeID {
370 
371     /* Flags */
372 
373     BMDDeckLinkSupportsInternalKeying                            = 'keyi',
374     BMDDeckLinkSupportsExternalKeying                            = 'keye',
375     BMDDeckLinkSupportsHDKeying                                  = 'keyh',
376     BMDDeckLinkSupportsInputFormatDetection                      = 'infd',
377     BMDDeckLinkHasReferenceInput                                 = 'hrin',
378     BMDDeckLinkHasSerialPort                                     = 'hspt',
379     BMDDeckLinkHasAnalogVideoOutputGain                          = 'avog',
380     BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain               = 'ovog',
381     BMDDeckLinkHasVideoInputAntiAliasingFilter                   = 'aafl',
382     BMDDeckLinkHasBypass                                         = 'byps',
383     BMDDeckLinkSupportsClockTimingAdjustment                     = 'ctad',
384     BMDDeckLinkSupportsFullDuplex                                = 'fdup',
385     BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset       = 'frin',
386     BMDDeckLinkSupportsSMPTELevelAOutput                         = 'lvla',
387     BMDDeckLinkSupportsDualLinkSDI                               = 'sdls',
388     BMDDeckLinkSupportsQuadLinkSDI                               = 'sqls',
389     BMDDeckLinkSupportsIdleOutput                                = 'idou',
390     BMDDeckLinkHasLTCTimecodeInput                               = 'hltc',
391     BMDDeckLinkSupportsDuplexModeConfiguration                   = 'dupx',
392     BMDDeckLinkSupportsHDRMetadata                               = 'hdrm',
393 
394     /* Integers */
395 
396     BMDDeckLinkMaximumAudioChannels                              = 'mach',
397     BMDDeckLinkMaximumAnalogAudioChannels                        = 'aach',
398     BMDDeckLinkNumberOfSubDevices                                = 'nsbd',
399     BMDDeckLinkSubDeviceIndex                                    = 'subi',
400     BMDDeckLinkPersistentID                                      = 'peid',
401     BMDDeckLinkDeviceGroupID                                     = 'dgid',
402     BMDDeckLinkTopologicalID                                     = 'toid',
403     BMDDeckLinkVideoOutputConnections                            = 'vocn',
404     BMDDeckLinkVideoInputConnections                             = 'vicn',
405     BMDDeckLinkAudioOutputConnections                            = 'aocn',
406     BMDDeckLinkAudioInputConnections                             = 'aicn',
407     BMDDeckLinkVideoIOSupport                                    = 'vios',	// Returns a BMDVideoIOSupport bit field
408     BMDDeckLinkDeckControlConnections                            = 'dccn',
409     BMDDeckLinkDeviceInterface                                   = 'dbus',	// Returns a BMDDeviceInterface
410     BMDDeckLinkAudioInputRCAChannelCount                         = 'airc',
411     BMDDeckLinkAudioInputXLRChannelCount                         = 'aixc',
412     BMDDeckLinkAudioOutputRCAChannelCount                        = 'aorc',
413     BMDDeckLinkAudioOutputXLRChannelCount                        = 'aoxc',
414     BMDDeckLinkPairedDevicePersistentID                          = 'ppid',
415 
416     /* Floats */
417 
418     BMDDeckLinkVideoInputGainMinimum                             = 'vigm',
419     BMDDeckLinkVideoInputGainMaximum                             = 'vigx',
420     BMDDeckLinkVideoOutputGainMinimum                            = 'vogm',
421     BMDDeckLinkVideoOutputGainMaximum                            = 'vogx',
422     BMDDeckLinkMicrophoneInputGainMinimum                        = 'migm',
423     BMDDeckLinkMicrophoneInputGainMaximum                        = 'migx',
424 
425     /* Strings */
426 
427     BMDDeckLinkSerialPortDeviceName                              = 'slpn',
428     BMDDeckLinkVendorName                                        = 'vndr',
429     BMDDeckLinkDisplayName                                       = 'dspn',
430     BMDDeckLinkModelName                                         = 'mdln',
431     BMDDeckLinkDeviceHandle                                      = 'devh'
432 };
433 
434 /* Enum BMDDeckLinkAPIInformationID - DeckLinkAPI information ID */
435 
436 typedef uint32_t BMDDeckLinkAPIInformationID;
437 enum _BMDDeckLinkAPIInformationID {
438     BMDDeckLinkAPIVersion                                        = 'vers'
439 };
440 
441 /* Enum BMDDeckLinkStatusID - DeckLink Status ID */
442 
443 typedef uint32_t BMDDeckLinkStatusID;
444 enum _BMDDeckLinkStatusID {
445 
446     /* Integers */
447 
448     bmdDeckLinkStatusDetectedVideoInputMode                      = 'dvim',
449     bmdDeckLinkStatusDetectedVideoInputFlags                     = 'dvif',
450     bmdDeckLinkStatusCurrentVideoInputMode                       = 'cvim',
451     bmdDeckLinkStatusCurrentVideoInputPixelFormat                = 'cvip',
452     bmdDeckLinkStatusCurrentVideoInputFlags                      = 'cvif',
453     bmdDeckLinkStatusCurrentVideoOutputMode                      = 'cvom',
454     bmdDeckLinkStatusCurrentVideoOutputFlags                     = 'cvof',
455     bmdDeckLinkStatusPCIExpressLinkWidth                         = 'pwid',
456     bmdDeckLinkStatusPCIExpressLinkSpeed                         = 'plnk',
457     bmdDeckLinkStatusLastVideoOutputPixelFormat                  = 'opix',
458     bmdDeckLinkStatusReferenceSignalMode                         = 'refm',
459     bmdDeckLinkStatusReferenceSignalFlags                        = 'reff',
460     bmdDeckLinkStatusDuplexMode                                  = 'dupx',
461     bmdDeckLinkStatusBusy                                        = 'busy',
462 
463     /* Flags */
464 
465     bmdDeckLinkStatusVideoInputSignalLocked                      = 'visl',
466     bmdDeckLinkStatusReferenceSignalLocked                       = 'refl'
467 };
468 
469 /* Enum BMDDeckLinkVideoStatusFlags -  */
470 
471 typedef uint32_t BMDDeckLinkVideoStatusFlags;
472 enum _BMDDeckLinkVideoStatusFlags {
473     bmdDeckLinkVideoStatusPsF                                    = 1 << 0,
474     bmdDeckLinkVideoStatusDualStream3D                           = 1 << 1
475 };
476 
477 /* Enum BMDDuplexStatus - Duplex status of the device */
478 
479 typedef uint32_t BMDDuplexStatus;
480 enum _BMDDuplexStatus {
481     bmdDuplexStatusFullDuplex                                    = 'fdup',
482     bmdDuplexStatusHalfDuplex                                    = 'hdup',
483     bmdDuplexStatusSimplex                                       = 'splx',
484     bmdDuplexStatusInactive                                      = 'inac'
485 };
486 
487 /* Enum BMDDeviceBusyState - Current device busy state */
488 
489 typedef uint32_t BMDDeviceBusyState;
490 enum _BMDDeviceBusyState {
491     bmdDeviceCaptureBusy                                         = 1 << 0,
492     bmdDevicePlaybackBusy                                        = 1 << 1,
493     bmdDeviceSerialPortBusy                                      = 1 << 2
494 };
495 
496 /* Enum BMDVideoIOSupport - Device video input/output support */
497 
498 typedef uint32_t BMDVideoIOSupport;
499 enum _BMDVideoIOSupport {
500     bmdDeviceSupportsCapture                                     = 1 << 0,
501     bmdDeviceSupportsPlayback                                    = 1 << 1
502 };
503 
504 /* Enum BMD3DPreviewFormat - Linked Frame preview format */
505 
506 typedef uint32_t BMD3DPreviewFormat;
507 enum _BMD3DPreviewFormat {
508     bmd3DPreviewFormatDefault                                    = 'defa',
509     bmd3DPreviewFormatLeftOnly                                   = 'left',
510     bmd3DPreviewFormatRightOnly                                  = 'righ',
511     bmd3DPreviewFormatSideBySide                                 = 'side',
512     bmd3DPreviewFormatTopBottom                                  = 'topb'
513 };
514 
515 /* Enum BMDNotifications - Events that can be subscribed through IDeckLinkNotification */
516 
517 typedef uint32_t BMDNotifications;
518 enum _BMDNotifications {
519     bmdPreferencesChanged                                        = 'pref',
520     bmdStatusChanged                                             = 'stat'
521 };
522 
523 #if defined(__cplusplus)
524 
525 // Forward Declarations
526 
527 class IDeckLinkVideoOutputCallback;
528 class IDeckLinkInputCallback;
529 class IDeckLinkEncoderInputCallback;
530 class IDeckLinkMemoryAllocator;
531 class IDeckLinkAudioOutputCallback;
532 class IDeckLinkIterator;
533 class IDeckLinkAPIInformation;
534 class IDeckLinkOutput;
535 class IDeckLinkInput;
536 class IDeckLinkEncoderInput;
537 class IDeckLinkVideoFrame;
538 class IDeckLinkMutableVideoFrame;
539 class IDeckLinkVideoFrame3DExtensions;
540 class IDeckLinkVideoFrameMetadataExtensions;
541 class IDeckLinkVideoInputFrame;
542 class IDeckLinkVideoFrameAncillary;
543 class IDeckLinkEncoderPacket;
544 class IDeckLinkEncoderVideoPacket;
545 class IDeckLinkEncoderAudioPacket;
546 class IDeckLinkH265NALPacket;
547 class IDeckLinkAudioInputPacket;
548 class IDeckLinkScreenPreviewCallback;
549 class IDeckLinkCocoaScreenPreviewCallback;
550 class IDeckLinkGLScreenPreviewHelper;
551 class IDeckLinkNotificationCallback;
552 class IDeckLinkNotification;
553 class IDeckLinkAttributes;
554 class IDeckLinkStatus;
555 class IDeckLinkKeyer;
556 class IDeckLinkVideoConversion;
557 class IDeckLinkDeviceNotificationCallback;
558 class IDeckLinkDiscovery;
559 
560 /* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */
561 
562 class IDeckLinkVideoOutputCallback : public IUnknown
563 {
564 public:
565     virtual HRESULT ScheduledFrameCompleted (/* in */ IDeckLinkVideoFrame *completedFrame, /* in */ BMDOutputFrameCompletionResult result) = 0;
566     virtual HRESULT ScheduledPlaybackHasStopped (void) = 0;
567 
568 protected:
~IDeckLinkVideoOutputCallback()569     virtual ~IDeckLinkVideoOutputCallback () {} // call Release method to drop reference count
570 };
571 
572 /* Interface IDeckLinkInputCallback - Frame arrival callback. */
573 
574 class IDeckLinkInputCallback : public IUnknown
575 {
576 public:
577     virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;
578     virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0;
579 
580 protected:
~IDeckLinkInputCallback()581     virtual ~IDeckLinkInputCallback () {} // call Release method to drop reference count
582 };
583 
584 /* Interface IDeckLinkEncoderInputCallback - Frame arrival callback. */
585 
586 class IDeckLinkEncoderInputCallback : public IUnknown
587 {
588 public:
589     virtual HRESULT VideoInputSignalChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;
590     virtual HRESULT VideoPacketArrived (/* in */ IDeckLinkEncoderVideoPacket* videoPacket) = 0;
591     virtual HRESULT AudioPacketArrived (/* in */ IDeckLinkEncoderAudioPacket* audioPacket) = 0;
592 
593 protected:
~IDeckLinkEncoderInputCallback()594     virtual ~IDeckLinkEncoderInputCallback () {} // call Release method to drop reference count
595 };
596 
597 /* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */
598 
599 class IDeckLinkMemoryAllocator : public IUnknown
600 {
601 public:
602     virtual HRESULT AllocateBuffer (/* in */ uint32_t bufferSize, /* out */ void **allocatedBuffer) = 0;
603     virtual HRESULT ReleaseBuffer (/* in */ void *buffer) = 0;
604 
605     virtual HRESULT Commit (void) = 0;
606     virtual HRESULT Decommit (void) = 0;
607 };
608 
609 /* Interface IDeckLinkAudioOutputCallback - Optional callback to allow audio samples to be pulled as required. */
610 
611 class IDeckLinkAudioOutputCallback : public IUnknown
612 {
613 public:
614     virtual HRESULT RenderAudioSamples (/* in */ bool preroll) = 0;
615 };
616 
617 /* Interface IDeckLinkIterator - enumerates installed DeckLink hardware */
618 
619 class IDeckLinkIterator : public IUnknown
620 {
621 public:
622     virtual HRESULT Next (/* out */ IDeckLink **deckLinkInstance) = 0;
623 };
624 
625 /* Interface IDeckLinkAPIInformation - DeckLinkAPI attribute interface */
626 
627 class IDeckLinkAPIInformation : public IUnknown
628 {
629 public:
630     virtual HRESULT GetFlag (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ bool *value) = 0;
631     virtual HRESULT GetInt (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ int64_t *value) = 0;
632     virtual HRESULT GetFloat (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ double *value) = 0;
633     virtual HRESULT GetString (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ CFStringRef *value) = 0;
634 
635 protected:
~IDeckLinkAPIInformation()636     virtual ~IDeckLinkAPIInformation () {} // call Release method to drop reference count
637 };
638 
639 /* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */
640 
641 class IDeckLinkOutput : public IUnknown
642 {
643 public:
644     virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoOutputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0;
645     virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0;
646 
647     virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
648 
649     /* Video Output */
650 
651     virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0;
652     virtual HRESULT DisableVideoOutput (void) = 0;
653 
654     virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
655     virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame **outFrame) = 0;
656     virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;
657 
658     virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame *theFrame) = 0;
659     virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0;
660     virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0;
661     virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0;
662 
663     /* Audio Output */
664 
665     virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0;
666     virtual HRESULT DisableAudioOutput (void) = 0;
667 
668     virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0;
669 
670     virtual HRESULT BeginAudioPreroll (void) = 0;
671     virtual HRESULT EndAudioPreroll (void) = 0;
672     virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0;
673 
674     virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0;
675     virtual HRESULT FlushBufferedAudioSamples (void) = 0;
676 
677     virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0;
678 
679     /* Output Control */
680 
681     virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0;
682     virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0;
683     virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0;
684     virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0;
685     virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus *referenceStatus) = 0;
686 
687     /* Hardware Timing */
688 
689     virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
690     virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *frameCompletionTimestamp) = 0;
691 
692 protected:
~IDeckLinkOutput()693     virtual ~IDeckLinkOutput () {} // call Release method to drop reference count
694 };
695 
696 /* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */
697 
698 class IDeckLinkInput : public IUnknown
699 {
700 public:
701     virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0;
702     virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0;
703 
704     virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
705 
706     /* Video Input */
707 
708     virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0;
709     virtual HRESULT DisableVideoInput (void) = 0;
710     virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0;
711     virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
712 
713     /* Audio Input */
714 
715     virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0;
716     virtual HRESULT DisableAudioInput (void) = 0;
717     virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0;
718 
719     /* Input Control */
720 
721     virtual HRESULT StartStreams (void) = 0;
722     virtual HRESULT StopStreams (void) = 0;
723     virtual HRESULT PauseStreams (void) = 0;
724     virtual HRESULT FlushStreams (void) = 0;
725     virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback *theCallback) = 0;
726 
727     /* Hardware Timing */
728 
729     virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
730 
731 protected:
~IDeckLinkInput()732     virtual ~IDeckLinkInput () {} // call Release method to drop reference count
733 };
734 
735 /* Interface IDeckLinkEncoderInput - Created by QueryInterface from IDeckLink. */
736 
737 class IDeckLinkEncoderInput : public IUnknown
738 {
739 public:
740     virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0;
741     virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0;
742 
743     /* Video Input */
744 
745     virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0;
746     virtual HRESULT DisableVideoInput (void) = 0;
747     virtual HRESULT GetAvailablePacketsCount (/* out */ uint32_t *availablePacketsCount) = 0;
748     virtual HRESULT SetMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
749 
750     /* Audio Input */
751 
752     virtual HRESULT EnableAudioInput (/* in */ BMDAudioFormat audioFormat, /* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0;
753     virtual HRESULT DisableAudioInput (void) = 0;
754     virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0;
755 
756     /* Input Control */
757 
758     virtual HRESULT StartStreams (void) = 0;
759     virtual HRESULT StopStreams (void) = 0;
760     virtual HRESULT PauseStreams (void) = 0;
761     virtual HRESULT FlushStreams (void) = 0;
762     virtual HRESULT SetCallback (/* in */ IDeckLinkEncoderInputCallback *theCallback) = 0;
763 
764     /* Hardware Timing */
765 
766     virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
767 
768 protected:
~IDeckLinkEncoderInput()769     virtual ~IDeckLinkEncoderInput () {} // call Release method to drop reference count
770 };
771 
772 /* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */
773 
774 class IDeckLinkVideoFrame : public IUnknown
775 {
776 public:
777     virtual long GetWidth (void) = 0;
778     virtual long GetHeight (void) = 0;
779     virtual long GetRowBytes (void) = 0;
780     virtual BMDPixelFormat GetPixelFormat (void) = 0;
781     virtual BMDFrameFlags GetFlags (void) = 0;
782     virtual HRESULT GetBytes (/* out */ void **buffer) = 0;
783 
784     virtual HRESULT GetTimecode (/* in */ BMDTimecodeFormat format, /* out */ IDeckLinkTimecode **timecode) = 0;
785     virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0;
786 
787 protected:
~IDeckLinkVideoFrame()788     virtual ~IDeckLinkVideoFrame () {} // call Release method to drop reference count
789 };
790 
791 /* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */
792 
793 class IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame
794 {
795 public:
796     virtual HRESULT SetFlags (/* in */ BMDFrameFlags newFlags) = 0;
797 
798     virtual HRESULT SetTimecode (/* in */ BMDTimecodeFormat format, /* in */ IDeckLinkTimecode *timecode) = 0;
799     virtual HRESULT SetTimecodeFromComponents (/* in */ BMDTimecodeFormat format, /* in */ uint8_t hours, /* in */ uint8_t minutes, /* in */ uint8_t seconds, /* in */ uint8_t frames, /* in */ BMDTimecodeFlags flags) = 0;
800     virtual HRESULT SetAncillaryData (/* in */ IDeckLinkVideoFrameAncillary *ancillary) = 0;
801     virtual HRESULT SetTimecodeUserBits (/* in */ BMDTimecodeFormat format, /* in */ BMDTimecodeUserBits userBits) = 0;
802 
803 protected:
~IDeckLinkMutableVideoFrame()804     virtual ~IDeckLinkMutableVideoFrame () {} // call Release method to drop reference count
805 };
806 
807 /* Interface IDeckLinkVideoFrame3DExtensions - Optional interface implemented on IDeckLinkVideoFrame to support 3D frames */
808 
809 class IDeckLinkVideoFrame3DExtensions : public IUnknown
810 {
811 public:
812     virtual BMDVideo3DPackingFormat Get3DPackingFormat (void) = 0;
813     virtual HRESULT GetFrameForRightEye (/* out */ IDeckLinkVideoFrame* *rightEyeFrame) = 0;
814 
815 protected:
~IDeckLinkVideoFrame3DExtensions()816     virtual ~IDeckLinkVideoFrame3DExtensions () {} // call Release method to drop reference count
817 };
818 
819 /* Interface IDeckLinkVideoFrameMetadataExtensions - Optional interface implemented on IDeckLinkVideoFrame to support frame metadata such as HDMI HDR information */
820 
821 class IDeckLinkVideoFrameMetadataExtensions : public IUnknown
822 {
823 public:
824     virtual HRESULT GetInt (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ int64_t *value) = 0;
825     virtual HRESULT GetFloat (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ double *value) = 0;
826     virtual HRESULT GetFlag (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ bool* value) = 0;
827     virtual HRESULT GetString (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ CFStringRef *value) = 0;
828 
829 protected:
~IDeckLinkVideoFrameMetadataExtensions()830     virtual ~IDeckLinkVideoFrameMetadataExtensions () {} // call Release method to drop reference count
831 };
832 
833 /* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */
834 
835 class IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame
836 {
837 public:
838     virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, /* in */ BMDTimeScale timeScale) = 0;
839     virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0;
840 
841 protected:
~IDeckLinkVideoInputFrame()842     virtual ~IDeckLinkVideoInputFrame () {} // call Release method to drop reference count
843 };
844 
845 /* Interface IDeckLinkVideoFrameAncillary - Obtained through QueryInterface() on an IDeckLinkVideoFrame object. */
846 
847 class IDeckLinkVideoFrameAncillary : public IUnknown
848 {
849 public:
850 
851     virtual HRESULT GetBufferForVerticalBlankingLine (/* in */ uint32_t lineNumber, /* out */ void **buffer) = 0;
852     virtual BMDPixelFormat GetPixelFormat (void) = 0;
853     virtual BMDDisplayMode GetDisplayMode (void) = 0;
854 
855 protected:
~IDeckLinkVideoFrameAncillary()856     virtual ~IDeckLinkVideoFrameAncillary () {} // call Release method to drop reference count
857 };
858 
859 /* Interface IDeckLinkEncoderPacket - Interface to encapsulate an encoded packet. */
860 
861 class IDeckLinkEncoderPacket : public IUnknown
862 {
863 public:
864     virtual HRESULT GetBytes (/* out */ void **buffer) = 0;
865     virtual long GetSize (void) = 0;
866     virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* in */ BMDTimeScale timeScale) = 0;
867     virtual BMDPacketType GetPacketType (void) = 0;
868 
869 protected:
~IDeckLinkEncoderPacket()870     virtual ~IDeckLinkEncoderPacket () {} // call Release method to drop reference count
871 };
872 
873 /* Interface IDeckLinkEncoderVideoPacket - Provided by the IDeckLinkEncoderInput video packet arrival callback. */
874 
875 class IDeckLinkEncoderVideoPacket : public IDeckLinkEncoderPacket
876 {
877 public:
878     virtual BMDPixelFormat GetPixelFormat (void) = 0;
879     virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0;
880 
881     virtual HRESULT GetTimecode (/* in */ BMDTimecodeFormat format, /* out */ IDeckLinkTimecode **timecode) = 0;
882 
883 protected:
~IDeckLinkEncoderVideoPacket()884     virtual ~IDeckLinkEncoderVideoPacket () {} // call Release method to drop reference count
885 };
886 
887 /* Interface IDeckLinkEncoderAudioPacket - Provided by the IDeckLinkEncoderInput audio packet arrival callback. */
888 
889 class IDeckLinkEncoderAudioPacket : public IDeckLinkEncoderPacket
890 {
891 public:
892     virtual BMDAudioFormat GetAudioFormat (void) = 0;
893 
894 protected:
~IDeckLinkEncoderAudioPacket()895     virtual ~IDeckLinkEncoderAudioPacket () {} // call Release method to drop reference count
896 };
897 
898 /* Interface IDeckLinkH265NALPacket - Obtained through QueryInterface() on an IDeckLinkEncoderVideoPacket object */
899 
900 class IDeckLinkH265NALPacket : public IDeckLinkEncoderVideoPacket
901 {
902 public:
903     virtual HRESULT GetUnitType (/* out */ uint8_t *unitType) = 0;
904     virtual HRESULT GetBytesNoPrefix (/* out */ void **buffer) = 0;
905     virtual long GetSizeNoPrefix (void) = 0;
906 
907 protected:
~IDeckLinkH265NALPacket()908     virtual ~IDeckLinkH265NALPacket () {} // call Release method to drop reference count
909 };
910 
911 /* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */
912 
913 class IDeckLinkAudioInputPacket : public IUnknown
914 {
915 public:
916     virtual long GetSampleFrameCount (void) = 0;
917     virtual HRESULT GetBytes (/* out */ void **buffer) = 0;
918     virtual HRESULT GetPacketTime (/* out */ BMDTimeValue *packetTime, /* in */ BMDTimeScale timeScale) = 0;
919 
920 protected:
~IDeckLinkAudioInputPacket()921     virtual ~IDeckLinkAudioInputPacket () {} // call Release method to drop reference count
922 };
923 
924 /* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */
925 
926 class IDeckLinkScreenPreviewCallback : public IUnknown
927 {
928 public:
929     virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0;
930 
931 protected:
~IDeckLinkScreenPreviewCallback()932     virtual ~IDeckLinkScreenPreviewCallback () {} // call Release method to drop reference count
933 };
934 
935 /* Interface IDeckLinkCocoaScreenPreviewCallback - Screen preview callback for Cocoa-based applications */
936 
937 class IDeckLinkCocoaScreenPreviewCallback : public IDeckLinkScreenPreviewCallback
938 {
939 public:
940 
941 protected:
~IDeckLinkCocoaScreenPreviewCallback()942     virtual ~IDeckLinkCocoaScreenPreviewCallback () {} // call Release method to drop reference count
943 };
944 
945 /* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */
946 
947 class IDeckLinkGLScreenPreviewHelper : public IUnknown
948 {
949 public:
950 
951     /* Methods must be called with OpenGL context set */
952 
953     virtual HRESULT InitializeGL (void) = 0;
954     virtual HRESULT PaintGL (void) = 0;
955     virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0;
956     virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0;
957 
958 protected:
~IDeckLinkGLScreenPreviewHelper()959     virtual ~IDeckLinkGLScreenPreviewHelper () {} // call Release method to drop reference count
960 };
961 
962 /* Interface IDeckLinkNotificationCallback - DeckLink Notification Callback Interface */
963 
964 class IDeckLinkNotificationCallback : public IUnknown
965 {
966 public:
967     virtual HRESULT Notify (/* in */ BMDNotifications topic, /* in */ uint64_t param1, /* in */ uint64_t param2) = 0;
968 };
969 
970 /* Interface IDeckLinkNotification - DeckLink Notification interface */
971 
972 class IDeckLinkNotification : public IUnknown
973 {
974 public:
975     virtual HRESULT Subscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0;
976     virtual HRESULT Unsubscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0;
977 };
978 
979 /* Interface IDeckLinkAttributes - DeckLink Attribute interface */
980 
981 class IDeckLinkAttributes : public IUnknown
982 {
983 public:
984     virtual HRESULT GetFlag (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ bool *value) = 0;
985     virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t *value) = 0;
986     virtual HRESULT GetFloat (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ double *value) = 0;
987     virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ CFStringRef *value) = 0;
988 
989 protected:
~IDeckLinkAttributes()990     virtual ~IDeckLinkAttributes () {} // call Release method to drop reference count
991 };
992 
993 /* Interface IDeckLinkStatus - DeckLink Status interface */
994 
995 class IDeckLinkStatus : public IUnknown
996 {
997 public:
998     virtual HRESULT GetFlag (/* in */ BMDDeckLinkStatusID statusID, /* out */ bool *value) = 0;
999     virtual HRESULT GetInt (/* in */ BMDDeckLinkStatusID statusID, /* out */ int64_t *value) = 0;
1000     virtual HRESULT GetFloat (/* in */ BMDDeckLinkStatusID statusID, /* out */ double *value) = 0;
1001     virtual HRESULT GetString (/* in */ BMDDeckLinkStatusID statusID, /* out */ CFStringRef *value) = 0;
1002     virtual HRESULT GetBytes (/* in */ BMDDeckLinkStatusID statusID, /* out */ void *buffer, /* in, out */ uint32_t *bufferSize) = 0;
1003 
1004 protected:
~IDeckLinkStatus()1005     virtual ~IDeckLinkStatus () {} // call Release method to drop reference count
1006 };
1007 
1008 /* Interface IDeckLinkKeyer - DeckLink Keyer interface */
1009 
1010 class IDeckLinkKeyer : public IUnknown
1011 {
1012 public:
1013     virtual HRESULT Enable (/* in */ bool isExternal) = 0;
1014     virtual HRESULT SetLevel (/* in */ uint8_t level) = 0;
1015     virtual HRESULT RampUp (/* in */ uint32_t numberOfFrames) = 0;
1016     virtual HRESULT RampDown (/* in */ uint32_t numberOfFrames) = 0;
1017     virtual HRESULT Disable (void) = 0;
1018 
1019 protected:
~IDeckLinkKeyer()1020     virtual ~IDeckLinkKeyer () {} // call Release method to drop reference count
1021 };
1022 
1023 /* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */
1024 
1025 class IDeckLinkVideoConversion : public IUnknown
1026 {
1027 public:
1028     virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame* srcFrame, /* in */ IDeckLinkVideoFrame* dstFrame) = 0;
1029 
1030 protected:
~IDeckLinkVideoConversion()1031     virtual ~IDeckLinkVideoConversion () {} // call Release method to drop reference count
1032 };
1033 
1034 /* Interface IDeckLinkDeviceNotificationCallback - DeckLink device arrival/removal notification callbacks */
1035 
1036 class IDeckLinkDeviceNotificationCallback : public IUnknown
1037 {
1038 public:
1039     virtual HRESULT DeckLinkDeviceArrived (/* in */ IDeckLink* deckLinkDevice) = 0;
1040     virtual HRESULT DeckLinkDeviceRemoved (/* in */ IDeckLink* deckLinkDevice) = 0;
1041 
1042 protected:
~IDeckLinkDeviceNotificationCallback()1043     virtual ~IDeckLinkDeviceNotificationCallback () {} // call Release method to drop reference count
1044 };
1045 
1046 /* Interface IDeckLinkDiscovery - DeckLink device discovery */
1047 
1048 class IDeckLinkDiscovery : public IUnknown
1049 {
1050 public:
1051     virtual HRESULT InstallDeviceNotifications (/* in */ IDeckLinkDeviceNotificationCallback* deviceNotificationCallback) = 0;
1052     virtual HRESULT UninstallDeviceNotifications (void) = 0;
1053 
1054 protected:
~IDeckLinkDiscovery()1055     virtual ~IDeckLinkDiscovery () {} // call Release method to drop reference count
1056 };
1057 
1058 /* Functions */
1059 
1060 extern "C" {
1061 
1062     IDeckLinkIterator* CreateDeckLinkIteratorInstance (void);
1063     IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void);
1064     IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void);
1065     IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void);
1066     IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview (void* /* (NSView*) */ parentView);
1067     IDeckLinkVideoConversion* CreateVideoConversionInstance (void);
1068 
1069 }
1070 
1071 
1072 #endif      // defined(__cplusplus)
1073 #endif /* defined(BMD_DECKLINKAPI_H) */
1074