1 /* -LICENSE-START- 2 ** Copyright (c) 2014 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_IDeckLinkMemoryAllocator = /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ {0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8}; 64 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}; 65 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}; 66 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}; 67 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}; 68 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}; 69 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}; 70 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}; 71 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}; 72 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}; 73 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}; 74 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}; 75 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}; 76 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}; 77 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}; 78 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}; 79 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}; 80 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}; 81 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}; 82 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}; 83 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}; 84 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}; 85 86 /* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */ 87 88 typedef uint32_t BMDVideoOutputFlags; 89 enum _BMDVideoOutputFlags { 90 bmdVideoOutputFlagDefault = 0, 91 bmdVideoOutputVANC = 1 << 0, 92 bmdVideoOutputVITC = 1 << 1, 93 bmdVideoOutputRP188 = 1 << 2, 94 bmdVideoOutputDualStream3D = 1 << 4 95 }; 96 97 /* Enum BMDFrameFlags - Frame flags */ 98 99 typedef uint32_t BMDFrameFlags; 100 enum _BMDFrameFlags { 101 bmdFrameFlagDefault = 0, 102 bmdFrameFlagFlipVertical = 1 << 0, 103 104 /* Flags that are applicable only to instances of IDeckLinkVideoInputFrame */ 105 106 bmdFrameHasNoInputSource = 1 << 31 107 }; 108 109 /* Enum BMDVideoInputFlags - Flags applicable to video input */ 110 111 typedef uint32_t BMDVideoInputFlags; 112 enum _BMDVideoInputFlags { 113 bmdVideoInputFlagDefault = 0, 114 bmdVideoInputEnableFormatDetection = 1 << 0, 115 bmdVideoInputDualStream3D = 1 << 1 116 }; 117 118 /* Enum BMDVideoInputFormatChangedEvents - Bitmask passed to the VideoInputFormatChanged notification to identify the properties of the input signal that have changed */ 119 120 typedef uint32_t BMDVideoInputFormatChangedEvents; 121 enum _BMDVideoInputFormatChangedEvents { 122 bmdVideoInputDisplayModeChanged = 1 << 0, 123 bmdVideoInputFieldDominanceChanged = 1 << 1, 124 bmdVideoInputColorspaceChanged = 1 << 2 125 }; 126 127 /* Enum BMDDetectedVideoInputFormatFlags - Flags passed to the VideoInputFormatChanged notification to describe the detected video input signal */ 128 129 typedef uint32_t BMDDetectedVideoInputFormatFlags; 130 enum _BMDDetectedVideoInputFormatFlags { 131 bmdDetectedVideoInputYCbCr422 = 1 << 0, 132 bmdDetectedVideoInputRGB444 = 1 << 1 133 }; 134 135 /* Enum BMDDeckLinkCapturePassthroughMode - Enumerates whether the video output is electrically connected to the video input or if the clean switching mode is enabled */ 136 137 typedef uint32_t BMDDeckLinkCapturePassthroughMode; 138 enum _BMDDeckLinkCapturePassthroughMode { 139 bmdDeckLinkCapturePassthroughModeDirect = 'pdir', 140 bmdDeckLinkCapturePassthroughModeCleanSwitch = 'pcln' 141 }; 142 143 /* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */ 144 145 typedef uint32_t BMDOutputFrameCompletionResult; 146 enum _BMDOutputFrameCompletionResult { 147 bmdOutputFrameCompleted, 148 bmdOutputFrameDisplayedLate, 149 bmdOutputFrameDropped, 150 bmdOutputFrameFlushed 151 }; 152 153 /* Enum BMDReferenceStatus - GenLock input status */ 154 155 typedef uint32_t BMDReferenceStatus; 156 enum _BMDReferenceStatus { 157 bmdReferenceNotSupportedByHardware = 1 << 0, 158 bmdReferenceLocked = 1 << 1 159 }; 160 161 /* Enum BMDAudioSampleRate - Audio sample rates supported for output/input */ 162 163 typedef uint32_t BMDAudioSampleRate; 164 enum _BMDAudioSampleRate { 165 bmdAudioSampleRate48kHz = 48000 166 }; 167 168 /* Enum BMDAudioSampleType - Audio sample sizes supported for output/input */ 169 170 typedef uint32_t BMDAudioSampleType; 171 enum _BMDAudioSampleType { 172 bmdAudioSampleType16bitInteger = 16, 173 bmdAudioSampleType32bitInteger = 32 174 }; 175 176 /* Enum BMDAudioOutputStreamType - Audio output stream type */ 177 178 typedef uint32_t BMDAudioOutputStreamType; 179 enum _BMDAudioOutputStreamType { 180 bmdAudioOutputStreamContinuous, 181 bmdAudioOutputStreamContinuousDontResample, 182 bmdAudioOutputStreamTimestamped 183 }; 184 185 /* Enum BMDDisplayModeSupport - Output mode supported flags */ 186 187 typedef uint32_t BMDDisplayModeSupport; 188 enum _BMDDisplayModeSupport { 189 bmdDisplayModeNotSupported = 0, 190 bmdDisplayModeSupported, 191 bmdDisplayModeSupportedWithConversion 192 }; 193 194 /* Enum BMDTimecodeFormat - Timecode formats for frame metadata */ 195 196 typedef uint32_t BMDTimecodeFormat; 197 enum _BMDTimecodeFormat { 198 bmdTimecodeRP188VITC1 = 'rpv1', // RP188 timecode where DBB1 equals VITC1 (line 9) 199 bmdTimecodeRP188VITC2 = 'rp12', // RP188 timecode where DBB1 equals VITC2 (line 571) 200 bmdTimecodeRP188LTC = 'rplt', // RP188 timecode where DBB1 equals LTC (line 10) 201 bmdTimecodeRP188Any = 'rp18', // For capture: return the first valid timecode in {VITC1, LTC ,VITC2} - For playback: set the timecode as VITC1 202 bmdTimecodeVITC = 'vitc', 203 bmdTimecodeVITCField2 = 'vit2', 204 bmdTimecodeSerial = 'seri' 205 }; 206 207 /* Enum BMDAnalogVideoFlags - Analog video display flags */ 208 209 typedef uint32_t BMDAnalogVideoFlags; 210 enum _BMDAnalogVideoFlags { 211 bmdAnalogVideoFlagCompositeSetup75 = 1 << 0, 212 bmdAnalogVideoFlagComponentBetacamLevels = 1 << 1 213 }; 214 215 /* Enum BMDAudioConnection - Audio connection types */ 216 217 typedef uint32_t BMDAudioConnection; 218 enum _BMDAudioConnection { 219 bmdAudioConnectionEmbedded = 'embd', 220 bmdAudioConnectionAESEBU = 'aes ', 221 bmdAudioConnectionAnalog = 'anlg', 222 bmdAudioConnectionAnalogXLR = 'axlr', 223 bmdAudioConnectionAnalogRCA = 'arca' 224 }; 225 226 /* Enum BMDAudioOutputAnalogAESSwitch - Audio output Analog/AESEBU switch */ 227 228 typedef uint32_t BMDAudioOutputAnalogAESSwitch; 229 enum _BMDAudioOutputAnalogAESSwitch { 230 bmdAudioOutputSwitchAESEBU = 'aes ', 231 bmdAudioOutputSwitchAnalog = 'anlg' 232 }; 233 234 /* Enum BMDVideoOutputConversionMode - Video/audio conversion mode */ 235 236 typedef uint32_t BMDVideoOutputConversionMode; 237 enum _BMDVideoOutputConversionMode { 238 bmdNoVideoOutputConversion = 'none', 239 bmdVideoOutputLetterboxDownconversion = 'ltbx', 240 bmdVideoOutputAnamorphicDownconversion = 'amph', 241 bmdVideoOutputHD720toHD1080Conversion = '720c', 242 bmdVideoOutputHardwareLetterboxDownconversion = 'HWlb', 243 bmdVideoOutputHardwareAnamorphicDownconversion = 'HWam', 244 bmdVideoOutputHardwareCenterCutDownconversion = 'HWcc', 245 bmdVideoOutputHardware720p1080pCrossconversion = 'xcap', 246 bmdVideoOutputHardwareAnamorphic720pUpconversion = 'ua7p', 247 bmdVideoOutputHardwareAnamorphic1080iUpconversion = 'ua1i', 248 bmdVideoOutputHardwareAnamorphic149To720pUpconversion = 'u47p', 249 bmdVideoOutputHardwareAnamorphic149To1080iUpconversion = 'u41i', 250 bmdVideoOutputHardwarePillarbox720pUpconversion = 'up7p', 251 bmdVideoOutputHardwarePillarbox1080iUpconversion = 'up1i' 252 }; 253 254 /* Enum BMDVideoInputConversionMode - Video input conversion mode */ 255 256 typedef uint32_t BMDVideoInputConversionMode; 257 enum _BMDVideoInputConversionMode { 258 bmdNoVideoInputConversion = 'none', 259 bmdVideoInputLetterboxDownconversionFromHD1080 = '10lb', 260 bmdVideoInputAnamorphicDownconversionFromHD1080 = '10am', 261 bmdVideoInputLetterboxDownconversionFromHD720 = '72lb', 262 bmdVideoInputAnamorphicDownconversionFromHD720 = '72am', 263 bmdVideoInputLetterboxUpconversion = 'lbup', 264 bmdVideoInputAnamorphicUpconversion = 'amup' 265 }; 266 267 /* Enum BMDVideo3DPackingFormat - Video 3D packing format */ 268 269 typedef uint32_t BMDVideo3DPackingFormat; 270 enum _BMDVideo3DPackingFormat { 271 bmdVideo3DPackingSidebySideHalf = 'sbsh', 272 bmdVideo3DPackingLinebyLine = 'lbyl', 273 bmdVideo3DPackingTopAndBottom = 'tabo', 274 bmdVideo3DPackingFramePacking = 'frpk', 275 bmdVideo3DPackingLeftOnly = 'left', 276 bmdVideo3DPackingRightOnly = 'righ' 277 }; 278 279 /* Enum BMDIdleVideoOutputOperation - Video output operation when not playing video */ 280 281 typedef uint32_t BMDIdleVideoOutputOperation; 282 enum _BMDIdleVideoOutputOperation { 283 bmdIdleVideoOutputBlack = 'blac', 284 bmdIdleVideoOutputLastFrame = 'lafa', 285 bmdIdleVideoOutputDesktop = 'desk' 286 }; 287 288 /* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ 289 290 typedef uint32_t BMDDeckLinkAttributeID; 291 enum _BMDDeckLinkAttributeID { 292 293 /* Flags */ 294 295 BMDDeckLinkSupportsInternalKeying = 'keyi', 296 BMDDeckLinkSupportsExternalKeying = 'keye', 297 BMDDeckLinkSupportsHDKeying = 'keyh', 298 BMDDeckLinkSupportsInputFormatDetection = 'infd', 299 BMDDeckLinkHasReferenceInput = 'hrin', 300 BMDDeckLinkHasSerialPort = 'hspt', 301 BMDDeckLinkHasAnalogVideoOutputGain = 'avog', 302 BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain = 'ovog', 303 BMDDeckLinkHasVideoInputAntiAliasingFilter = 'aafl', 304 BMDDeckLinkHasBypass = 'byps', 305 BMDDeckLinkSupportsDesktopDisplay = 'extd', 306 BMDDeckLinkSupportsClockTimingAdjustment = 'ctad', 307 BMDDeckLinkSupportsFullDuplex = 'fdup', 308 BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset = 'frin', 309 310 /* Integers */ 311 312 BMDDeckLinkMaximumAudioChannels = 'mach', 313 BMDDeckLinkNumberOfSubDevices = 'nsbd', 314 BMDDeckLinkSubDeviceIndex = 'subi', 315 BMDDeckLinkPersistentID = 'peid', 316 BMDDeckLinkTopologicalID = 'toid', 317 BMDDeckLinkVideoOutputConnections = 'vocn', 318 BMDDeckLinkVideoInputConnections = 'vicn', 319 BMDDeckLinkDeviceBusyState = 'dbst', 320 BMDDeckLinkVideoIOSupport = 'vios', // Returns a BMDVideoIOSupport bit field 321 322 /* Floats */ 323 324 BMDDeckLinkVideoInputGainMinimum = 'vigm', 325 BMDDeckLinkVideoInputGainMaximum = 'vigx', 326 BMDDeckLinkVideoOutputGainMinimum = 'vogm', 327 BMDDeckLinkVideoOutputGainMaximum = 'vogx', 328 329 /* Strings */ 330 331 BMDDeckLinkSerialPortDeviceName = 'slpn' 332 }; 333 334 /* Enum BMDDeckLinkAPIInformationID - DeckLinkAPI information ID */ 335 336 typedef uint32_t BMDDeckLinkAPIInformationID; 337 enum _BMDDeckLinkAPIInformationID { 338 BMDDeckLinkAPIVersion = 'vers' 339 }; 340 341 /* Enum BMDDeviceBusyState - Current device busy state */ 342 343 typedef uint32_t BMDDeviceBusyState; 344 enum _BMDDeviceBusyState { 345 bmdDeviceCaptureBusy = 1 << 0, 346 bmdDevicePlaybackBusy = 1 << 1, 347 bmdDeviceSerialPortBusy = 1 << 2 348 }; 349 350 /* Enum BMDVideoIOSupport - Device video input/output support */ 351 352 typedef uint32_t BMDVideoIOSupport; 353 enum _BMDVideoIOSupport { 354 bmdDeviceSupportsCapture = 1 << 0, 355 bmdDeviceSupportsPlayback = 1 << 1 356 }; 357 358 /* Enum BMD3DPreviewFormat - Linked Frame preview format */ 359 360 typedef uint32_t BMD3DPreviewFormat; 361 enum _BMD3DPreviewFormat { 362 bmd3DPreviewFormatDefault = 'defa', 363 bmd3DPreviewFormatLeftOnly = 'left', 364 bmd3DPreviewFormatRightOnly = 'righ', 365 bmd3DPreviewFormatSideBySide = 'side', 366 bmd3DPreviewFormatTopBottom = 'topb' 367 }; 368 369 /* Enum BMDNotifications - Events that can be subscribed through IDeckLinkNotification */ 370 371 typedef uint32_t BMDNotifications; 372 enum _BMDNotifications { 373 bmdPreferencesChanged = 'pref' 374 }; 375 376 #if defined(__cplusplus) 377 378 // Forward Declarations 379 380 class IDeckLinkVideoOutputCallback; 381 class IDeckLinkInputCallback; 382 class IDeckLinkMemoryAllocator; 383 class IDeckLinkAudioOutputCallback; 384 class IDeckLinkIterator; 385 class IDeckLinkAPIInformation; 386 class IDeckLinkOutput; 387 class IDeckLinkInput; 388 class IDeckLinkVideoFrame; 389 class IDeckLinkMutableVideoFrame; 390 class IDeckLinkVideoFrame3DExtensions; 391 class IDeckLinkVideoInputFrame; 392 class IDeckLinkVideoFrameAncillary; 393 class IDeckLinkAudioInputPacket; 394 class IDeckLinkScreenPreviewCallback; 395 class IDeckLinkCocoaScreenPreviewCallback; 396 class IDeckLinkGLScreenPreviewHelper; 397 class IDeckLinkNotificationCallback; 398 class IDeckLinkNotification; 399 class IDeckLinkAttributes; 400 class IDeckLinkKeyer; 401 class IDeckLinkVideoConversion; 402 class IDeckLinkDeviceNotificationCallback; 403 class IDeckLinkDiscovery; 404 405 /* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */ 406 407 class IDeckLinkVideoOutputCallback : public IUnknown 408 { 409 public: 410 virtual HRESULT ScheduledFrameCompleted (/* in */ IDeckLinkVideoFrame *completedFrame, /* in */ BMDOutputFrameCompletionResult result) = 0; 411 virtual HRESULT ScheduledPlaybackHasStopped (void) = 0; 412 413 protected: 414 virtual ~IDeckLinkVideoOutputCallback () {}; // call Release method to drop reference count 415 }; 416 417 /* Interface IDeckLinkInputCallback - Frame arrival callback. */ 418 419 class IDeckLinkInputCallback : public IUnknown 420 { 421 public: 422 virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; 423 virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0; 424 425 protected: 426 virtual ~IDeckLinkInputCallback () {}; // call Release method to drop reference count 427 }; 428 429 /* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */ 430 431 class IDeckLinkMemoryAllocator : public IUnknown 432 { 433 public: 434 virtual HRESULT AllocateBuffer (/* in */ uint32_t bufferSize, /* out */ void **allocatedBuffer) = 0; 435 virtual HRESULT ReleaseBuffer (/* in */ void *buffer) = 0; 436 437 virtual HRESULT Commit (void) = 0; 438 virtual HRESULT Decommit (void) = 0; 439 }; 440 441 /* Interface IDeckLinkAudioOutputCallback - Optional callback to allow audio samples to be pulled as required. */ 442 443 class IDeckLinkAudioOutputCallback : public IUnknown 444 { 445 public: 446 virtual HRESULT RenderAudioSamples (/* in */ bool preroll) = 0; 447 }; 448 449 /* Interface IDeckLinkIterator - enumerates installed DeckLink hardware */ 450 451 class IDeckLinkIterator : public IUnknown 452 { 453 public: 454 virtual HRESULT Next (/* out */ IDeckLink **deckLinkInstance) = 0; 455 }; 456 457 /* Interface IDeckLinkAPIInformation - DeckLinkAPI attribute interface */ 458 459 class IDeckLinkAPIInformation : public IUnknown 460 { 461 public: 462 virtual HRESULT GetFlag (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ bool *value) = 0; 463 virtual HRESULT GetInt (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ int64_t *value) = 0; 464 virtual HRESULT GetFloat (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ double *value) = 0; 465 virtual HRESULT GetString (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ CFStringRef *value) = 0; 466 467 protected: 468 virtual ~IDeckLinkAPIInformation () {}; // call Release method to drop reference count 469 }; 470 471 /* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ 472 473 class IDeckLinkOutput : public IUnknown 474 { 475 public: 476 virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoOutputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; 477 virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; 478 479 virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; 480 481 /* Video Output */ 482 483 virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; 484 virtual HRESULT DisableVideoOutput (void) = 0; 485 486 virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; 487 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; 488 virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; 489 490 virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame *theFrame) = 0; 491 virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; 492 virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0; 493 virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0; 494 495 /* Audio Output */ 496 497 virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; 498 virtual HRESULT DisableAudioOutput (void) = 0; 499 500 virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0; 501 502 virtual HRESULT BeginAudioPreroll (void) = 0; 503 virtual HRESULT EndAudioPreroll (void) = 0; 504 virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0; 505 506 virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0; 507 virtual HRESULT FlushBufferedAudioSamples (void) = 0; 508 509 virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0; 510 511 /* Output Control */ 512 513 virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; 514 virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0; 515 virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0; 516 virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0; 517 virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus *referenceStatus) = 0; 518 519 /* Hardware Timing */ 520 521 virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; 522 virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *frameCompletionTimestamp) = 0; 523 524 protected: 525 virtual ~IDeckLinkOutput () {}; // call Release method to drop reference count 526 }; 527 528 /* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ 529 530 class IDeckLinkInput : public IUnknown 531 { 532 public: 533 virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; 534 virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; 535 536 virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; 537 538 /* Video Input */ 539 540 virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; 541 virtual HRESULT DisableVideoInput (void) = 0; 542 virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0; 543 virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; 544 545 /* Audio Input */ 546 547 virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; 548 virtual HRESULT DisableAudioInput (void) = 0; 549 virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; 550 551 /* Input Control */ 552 553 virtual HRESULT StartStreams (void) = 0; 554 virtual HRESULT StopStreams (void) = 0; 555 virtual HRESULT PauseStreams (void) = 0; 556 virtual HRESULT FlushStreams (void) = 0; 557 virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback *theCallback) = 0; 558 559 /* Hardware Timing */ 560 561 virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; 562 563 protected: 564 virtual ~IDeckLinkInput () {}; // call Release method to drop reference count 565 }; 566 567 /* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */ 568 569 class IDeckLinkVideoFrame : public IUnknown 570 { 571 public: 572 virtual long GetWidth (void) = 0; 573 virtual long GetHeight (void) = 0; 574 virtual long GetRowBytes (void) = 0; 575 virtual BMDPixelFormat GetPixelFormat (void) = 0; 576 virtual BMDFrameFlags GetFlags (void) = 0; 577 virtual HRESULT GetBytes (/* out */ void **buffer) = 0; 578 579 virtual HRESULT GetTimecode (/* in */ BMDTimecodeFormat format, /* out */ IDeckLinkTimecode **timecode) = 0; 580 virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0; 581 582 protected: 583 virtual ~IDeckLinkVideoFrame () {}; // call Release method to drop reference count 584 }; 585 586 /* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */ 587 588 class IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame 589 { 590 public: 591 virtual HRESULT SetFlags (/* in */ BMDFrameFlags newFlags) = 0; 592 593 virtual HRESULT SetTimecode (/* in */ BMDTimecodeFormat format, /* in */ IDeckLinkTimecode *timecode) = 0; 594 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; 595 virtual HRESULT SetAncillaryData (/* in */ IDeckLinkVideoFrameAncillary *ancillary) = 0; 596 virtual HRESULT SetTimecodeUserBits (/* in */ BMDTimecodeFormat format, /* in */ BMDTimecodeUserBits userBits) = 0; 597 598 protected: 599 virtual ~IDeckLinkMutableVideoFrame () {}; // call Release method to drop reference count 600 }; 601 602 /* Interface IDeckLinkVideoFrame3DExtensions - Optional interface implemented on IDeckLinkVideoFrame to support 3D frames */ 603 604 class IDeckLinkVideoFrame3DExtensions : public IUnknown 605 { 606 public: 607 virtual BMDVideo3DPackingFormat Get3DPackingFormat (void) = 0; 608 virtual HRESULT GetFrameForRightEye (/* out */ IDeckLinkVideoFrame* *rightEyeFrame) = 0; 609 610 protected: 611 virtual ~IDeckLinkVideoFrame3DExtensions () {}; // call Release method to drop reference count 612 }; 613 614 /* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ 615 616 class IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame 617 { 618 public: 619 virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, /* in */ BMDTimeScale timeScale) = 0; 620 virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0; 621 622 protected: 623 virtual ~IDeckLinkVideoInputFrame () {}; // call Release method to drop reference count 624 }; 625 626 /* Interface IDeckLinkVideoFrameAncillary - Obtained through QueryInterface() on an IDeckLinkVideoFrame object. */ 627 628 class IDeckLinkVideoFrameAncillary : public IUnknown 629 { 630 public: 631 632 virtual HRESULT GetBufferForVerticalBlankingLine (/* in */ uint32_t lineNumber, /* out */ void **buffer) = 0; 633 virtual BMDPixelFormat GetPixelFormat (void) = 0; 634 virtual BMDDisplayMode GetDisplayMode (void) = 0; 635 636 protected: 637 virtual ~IDeckLinkVideoFrameAncillary () {}; // call Release method to drop reference count 638 }; 639 640 /* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */ 641 642 class IDeckLinkAudioInputPacket : public IUnknown 643 { 644 public: 645 virtual long GetSampleFrameCount (void) = 0; 646 virtual HRESULT GetBytes (/* out */ void **buffer) = 0; 647 virtual HRESULT GetPacketTime (/* out */ BMDTimeValue *packetTime, /* in */ BMDTimeScale timeScale) = 0; 648 649 protected: 650 virtual ~IDeckLinkAudioInputPacket () {}; // call Release method to drop reference count 651 }; 652 653 /* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */ 654 655 class IDeckLinkScreenPreviewCallback : public IUnknown 656 { 657 public: 658 virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0; 659 660 protected: 661 virtual ~IDeckLinkScreenPreviewCallback () {}; // call Release method to drop reference count 662 }; 663 664 /* Interface IDeckLinkCocoaScreenPreviewCallback - Screen preview callback for Cocoa-based applications */ 665 666 class IDeckLinkCocoaScreenPreviewCallback : public IDeckLinkScreenPreviewCallback 667 { 668 public: 669 670 protected: 671 virtual ~IDeckLinkCocoaScreenPreviewCallback () {}; // call Release method to drop reference count 672 }; 673 674 /* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */ 675 676 class IDeckLinkGLScreenPreviewHelper : public IUnknown 677 { 678 public: 679 680 /* Methods must be called with OpenGL context set */ 681 682 virtual HRESULT InitializeGL (void) = 0; 683 virtual HRESULT PaintGL (void) = 0; 684 virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0; 685 virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0; 686 687 protected: 688 virtual ~IDeckLinkGLScreenPreviewHelper () {}; // call Release method to drop reference count 689 }; 690 691 /* Interface IDeckLinkNotificationCallback - DeckLink Notification Callback Interface */ 692 693 class IDeckLinkNotificationCallback : public IUnknown 694 { 695 public: 696 virtual HRESULT Notify (/* in */ BMDNotifications topic, /* in */ uint64_t param1, /* in */ uint64_t param2) = 0; 697 }; 698 699 /* Interface IDeckLinkNotification - DeckLink Notification interface */ 700 701 class IDeckLinkNotification : public IUnknown 702 { 703 public: 704 virtual HRESULT Subscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0; 705 virtual HRESULT Unsubscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0; 706 }; 707 708 /* Interface IDeckLinkAttributes - DeckLink Attribute interface */ 709 710 class IDeckLinkAttributes : public IUnknown 711 { 712 public: 713 virtual HRESULT GetFlag (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ bool *value) = 0; 714 virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t *value) = 0; 715 virtual HRESULT GetFloat (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ double *value) = 0; 716 virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ CFStringRef *value) = 0; 717 718 protected: 719 virtual ~IDeckLinkAttributes () {}; // call Release method to drop reference count 720 }; 721 722 /* Interface IDeckLinkKeyer - DeckLink Keyer interface */ 723 724 class IDeckLinkKeyer : public IUnknown 725 { 726 public: 727 virtual HRESULT Enable (/* in */ bool isExternal) = 0; 728 virtual HRESULT SetLevel (/* in */ uint8_t level) = 0; 729 virtual HRESULT RampUp (/* in */ uint32_t numberOfFrames) = 0; 730 virtual HRESULT RampDown (/* in */ uint32_t numberOfFrames) = 0; 731 virtual HRESULT Disable (void) = 0; 732 733 protected: 734 virtual ~IDeckLinkKeyer () {}; // call Release method to drop reference count 735 }; 736 737 /* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */ 738 739 class IDeckLinkVideoConversion : public IUnknown 740 { 741 public: 742 virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame* srcFrame, /* in */ IDeckLinkVideoFrame* dstFrame) = 0; 743 744 protected: 745 virtual ~IDeckLinkVideoConversion () {}; // call Release method to drop reference count 746 }; 747 748 /* Interface IDeckLinkDeviceNotificationCallback - DeckLink device arrival/removal notification callbacks */ 749 750 class IDeckLinkDeviceNotificationCallback : public IUnknown 751 { 752 public: 753 virtual HRESULT DeckLinkDeviceArrived (/* in */ IDeckLink* deckLinkDevice) = 0; 754 virtual HRESULT DeckLinkDeviceRemoved (/* in */ IDeckLink* deckLinkDevice) = 0; 755 756 protected: 757 virtual ~IDeckLinkDeviceNotificationCallback () {}; // call Release method to drop reference count 758 }; 759 760 /* Interface IDeckLinkDiscovery - DeckLink device discovery */ 761 762 class IDeckLinkDiscovery : public IUnknown 763 { 764 public: 765 virtual HRESULT InstallDeviceNotifications (/* in */ IDeckLinkDeviceNotificationCallback* deviceNotificationCallback) = 0; 766 virtual HRESULT UninstallDeviceNotifications (void) = 0; 767 768 protected: 769 virtual ~IDeckLinkDiscovery () {}; // call Release method to drop reference count 770 }; 771 772 /* Functions */ 773 774 extern "C" { 775 776 IDeckLinkIterator* CreateDeckLinkIteratorInstance (void); 777 IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void); 778 IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void); 779 IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void); 780 IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview (void* /* (NSView*) */ parentView); 781 IDeckLinkVideoConversion* CreateVideoConversionInstance (void); 782 783 }; 784 785 786 #endif // defined(__cplusplus) 787 #endif /* defined(BMD_DECKLINKAPI_H) */ 788