re organisation
This commit is contained in:
20433
apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_h.h
Normal file
20433
apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_h.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,486 @@
|
||||
|
||||
|
||||
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
|
||||
|
||||
/* link this file in with the server and any clients */
|
||||
|
||||
|
||||
/* File created by MIDL compiler version 8.01.0628 */
|
||||
/* at Tue Jan 19 14:14:07 2038
|
||||
*/
|
||||
/* Compiler settings for ..\..\3rdParty\Blackmagic DeckLink SDK 16.0\Win\include\DeckLinkAPI.idl:
|
||||
Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0628
|
||||
protocol : all , ms_ext, c_ext, robust
|
||||
error checks: allocation ref bounds_check enum stub_data
|
||||
VC __declspec() decoration level:
|
||||
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
|
||||
DECLSPEC_UUID(), MIDL_INTERFACE()
|
||||
*/
|
||||
/* @@MIDL_FILE_HEADING( ) */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
#include <rpc.h>
|
||||
#include <rpcndr.h>
|
||||
|
||||
#ifdef _MIDL_USE_GUIDDEF_
|
||||
|
||||
#ifndef INITGUID
|
||||
#define INITGUID
|
||||
#include <guiddef.h>
|
||||
#undef INITGUID
|
||||
#else
|
||||
#include <guiddef.h>
|
||||
#endif
|
||||
|
||||
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
|
||||
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
|
||||
|
||||
#else // !_MIDL_USE_GUIDDEF_
|
||||
|
||||
#ifndef __IID_DEFINED__
|
||||
#define __IID_DEFINED__
|
||||
|
||||
typedef struct _IID
|
||||
{
|
||||
unsigned long x;
|
||||
unsigned short s1;
|
||||
unsigned short s2;
|
||||
unsigned char c[8];
|
||||
} IID;
|
||||
|
||||
#endif // __IID_DEFINED__
|
||||
|
||||
#ifndef CLSID_DEFINED
|
||||
#define CLSID_DEFINED
|
||||
typedef IID CLSID;
|
||||
#endif // CLSID_DEFINED
|
||||
|
||||
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
|
||||
EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
|
||||
|
||||
#endif // !_MIDL_USE_GUIDDEF_
|
||||
|
||||
MIDL_DEFINE_GUID(IID, LIBID_DeckLinkAPI,0xD864517A,0xEDD5,0x466D,0x86,0x7D,0xC8,0x19,0xF1,0xC0,0x52,0xBB);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkTimecode,0xBC6CFBD3,0x8317,0x4325,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayModeIterator,0x9C88499F,0xF601,0x4021,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayMode,0x3EB2C1AB,0x0A3D,0x4523,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLink,0xC418FBDD,0x0587,0x48ED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration,0x5a68ffd4,0x1c12,0x4ede,0xa6,0xd2,0x45,0x45,0x1d,0x38,0x5f,0xc1);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderConfiguration,0x138050E5,0xC60A,0x4552,0xBF,0x3F,0x0F,0x35,0x80,0x49,0x32,0x7E);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControlStatusCallback,0x53436FFB,0xB434,0x4906,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControl,0x8E1C3ACE,0x19C7,0x4E00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDeviceNotificationCallback,0xF9531D64,0x3305,0x4B29,0xA3,0x87,0x7F,0x74,0xBB,0x0D,0x0E,0x84);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264InputCallback,0x823C475F,0x55AE,0x46F9,0x89,0x0C,0x53,0x7C,0xC5,0xCE,0xDC,0xCA);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDiscovery,0x2C837444,0xF989,0x4D87,0x90,0x1A,0x47,0xC8,0xA3,0x6D,0x09,0x6D);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingVideoEncodingMode,0x1AB8035B,0xCD13,0x458D,0xB6,0xDF,0x5E,0x8F,0x7C,0x21,0x41,0xD9);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingMutableVideoEncodingMode,0x19BF7D90,0x1E0A,0x400D,0xB2,0xC6,0xFF,0xC4,0xE7,0x8A,0xD4,0x9D);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingVideoEncodingModePresetIterator,0x7AC731A3,0xC950,0x4AD0,0x80,0x4A,0x83,0x77,0xAA,0x51,0xC6,0xC4);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDeviceInput,0x24B6B6EC,0x1727,0x44BB,0x98,0x18,0x34,0xFF,0x08,0x6A,0xCF,0x98);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264NALPacket,0xE260E955,0x14BE,0x4395,0x97,0x75,0x9F,0x02,0xCC,0x0A,0x9D,0x89);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingAudioPacket,0xD9EB5902,0x1AD2,0x43F4,0x9E,0x2C,0x3C,0xFA,0x50,0xB5,0xEE,0x19);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingMPEG2TSPacket,0x91810D1C,0x4FB3,0x4AAA,0xAE,0x56,0xFA,0x30,0x1D,0x3D,0xFA,0x4C);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264NALParser,0x5867F18C,0x5BFA,0x4CCC,0xB2,0xA7,0x9D,0xFD,0x14,0x04,0x17,0xD2);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingDiscovery,0x23A4EDF5,0xA0E5,0x432C,0x94,0xEF,0x3B,0xAB,0xB5,0xF8,0x1C,0x82);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingH264NALParser,0x7753EFBD,0x951C,0x407C,0x97,0xA5,0x23,0xC7,0x37,0xB7,0x3B,0x52);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback,0x5BE6DF26,0x02CE,0x433E,0x99,0xD9,0x9A,0x87,0xC3,0xAC,0x17,0x1F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback,0x3A94F075,0xC37D,0x4BA8,0xBC,0xC0,0x1D,0x77,0x8C,0x8F,0x88,0x1B);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInputCallback,0xACF13E61,0xF4A0,0x4974,0xA6,0xA7,0x59,0xAF,0xF6,0x26,0x8B,0x31);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocator,0xF35DFA8D,0x9078,0x4622,0x95,0xBB,0x56,0x89,0x40,0x54,0xEB,0x0F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocatorProvider,0x6DF6F20A,0xD8DF,0x45D2,0x89,0x14,0x38,0x3C,0xE7,0xE6,0x24,0x3F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioOutputCallback,0x403C681B,0x7F46,0x4A12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkIterator,0x50FB36CD,0x3063,0x4B73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAPIInformation,0x7BEA3C68,0x730D,0x4322,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowAttributes,0xCDA938DA,0x6479,0x40C6,0xB2,0xEC,0xA3,0x57,0x9B,0x3A,0xEE,0xCD);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowStatus,0x31C41656,0x4992,0x4396,0xBB,0xE9,0x5F,0x84,0x06,0xAA,0xB5,0xAF);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowSetting,0x86DD9174,0x27D3,0x4032,0xB2,0xAD,0x60,0x67,0xC3,0xBB,0x24,0x24);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlow,0xC5FC83C7,0x5B8E,0x42A7,0x9A,0x40,0x7C,0x06,0x59,0x55,0xD4,0xE1);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowIterator,0xBD296AB2,0xA5C5,0x4153,0x88,0x8F,0xAA,0xB1,0xFD,0xBD,0x8A,0x5C);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput,0x5F227C95,0x39D7,0x46C7,0x8B,0x7D,0x9C,0x81,0x79,0x5F,0xBB,0xE4);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput,0x6A515F8A,0xFBCE,0x4853,0xB0,0xF7,0x2A,0x09,0xDB,0x1E,0xCA,0x0B);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPExtensions,0x46CF7903,0xA9FD,0x4D0B,0x8F,0xFC,0x01,0x03,0x72,0x2A,0xB4,0x42);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkHDMIInputEDID,0xABBBACBC,0x45BC,0x4665,0x9D,0x92,0xAC,0xE6,0xE5,0xA9,0x79,0x02);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInput,0x46C1332E,0x6FD9,0x472A,0x85,0x91,0xFE,0x59,0xC2,0x21,0x92,0xE1);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBuffer,0x81F03D70,0xDE13,0x4B17,0x87,0x3A,0xC8,0xAC,0x96,0x89,0xC6,0x82);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame,0x6502091C,0x615F,0x4F51,0xBA,0xF6,0x45,0xC4,0x25,0x6D,0xD5,0xB0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkMutableVideoFrame,0xCF9EB134,0x0374,0x4C5B,0x95,0xFA,0x1E,0xC1,0x48,0x19,0xFF,0x62);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame3DExtensions,0xD4DBE9C6,0xB4D2,0x49D3,0xAB,0xF2,0xB4,0xE8,0x6C,0x73,0x91,0xB0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameMetadataExtensions,0xE232A5B7,0x4DB4,0x44C9,0x91,0x52,0xF4,0x7C,0x12,0xE5,0xF0,0x51);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameMutableMetadataExtensions,0xCC198FC6,0x8298,0x4419,0x94,0x2D,0x83,0x57,0xEC,0x35,0x5E,0x58);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame,0xC9ADD3D2,0xBE52,0x488D,0xAB,0x2D,0x7F,0xDE,0xF7,0xAF,0x0C,0x95);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacket,0xF5C0D498,0x5CD3,0x4C77,0x97,0x73,0x8E,0xFA,0x20,0xBB,0x33,0x4B);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacketIterator,0x10F1AA88,0x54BE,0x42F7,0xB9,0xF8,0xEC,0x2F,0x5F,0x09,0x95,0x51);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillaryPackets,0x8A72D630,0x8070,0x4D05,0x8A,0x93,0xE6,0x0C,0x40,0xEE,0x08,0x8A);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillary,0x732E723C,0xD1A4,0x4E29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderPacket,0xB693F36C,0x316E,0x4AF1,0xB6,0xC2,0xF3,0x89,0xA4,0xBC,0xA6,0x20);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderVideoPacket,0x4E7FD944,0xE8C7,0x4EAC,0xB8,0xC0,0x7B,0x77,0xF8,0x0F,0x5A,0xE0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderAudioPacket,0x49E8EDC8,0x693B,0x4E14,0x8E,0xF6,0x12,0xC6,0x58,0xF5,0xA0,0x7A);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkH265NALPacket,0x639C8E0B,0x68D5,0x4BDE,0xA6,0xD4,0x95,0xF3,0xAE,0xAF,0xF2,0xE7);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioInputPacket,0xE43D5870,0x2894,0x11DE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkScreenPreviewCallback,0xD4FA2345,0x9FBA,0x4497,0x95,0xC3,0xC0,0xC3,0xCE,0xD3,0xCD,0xA8);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkGLScreenPreviewHelper,0xCEB778E2,0xC202,0x4EC8,0x90,0x85,0x0C,0xD2,0x85,0xCC,0x55,0x22);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDX9ScreenPreviewHelper,0xF2DD78CA,0x2921,0x4AC2,0xB5,0xBC,0xBF,0xDC,0xC2,0x03,0x5A,0x1F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkWPFDX9ScreenPreviewHelper,0xC59346CD,0x9326,0x4266,0xAC,0x2D,0x5C,0x19,0x0F,0x57,0x99,0xEE);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotificationCallback,0xb002a1ec,0x070d,0x4288,0x82,0x89,0xbd,0x5d,0x36,0xe5,0xff,0x0d);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotification,0x1d70faac,0xfd27,0x4866,0x9d,0xe6,0x09,0x39,0xd1,0xe4,0xc7,0xf1);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileAttributes,0xF47551D7,0xAD22,0x47AF,0xBC,0xFD,0x6B,0xE8,0x8A,0xA8,0x79,0xD9);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileIterator,0x29E5A8C0,0x8BE4,0x46EB,0x93,0xAC,0x31,0xDA,0xAB,0x5B,0x7B,0xF2);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfile,0x16093466,0x674A,0x432B,0x9D,0xA0,0x1A,0xC2,0xC5,0xA8,0x24,0x1C);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileCallback,0xA4F9341E,0x97AA,0x4E04,0x89,0x35,0x15,0xF8,0x09,0x89,0x8C,0xEA);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileManager,0x30D41429,0x3998,0x4B6D,0x84,0xF8,0x78,0xC9,0x4A,0x79,0x7C,0x6E);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkStatistics,0x21CB2ED1,0x4429,0x42BE,0xAA,0xF3,0x22,0xA3,0xB1,0xDD,0x3A,0xE0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkStatus,0x2A04A635,0xED42,0x41EF,0x93,0x42,0x0E,0x11,0xF8,0xCF,0x6B,0x5E);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkKeyer,0x89AFCAF5,0x65F8,0x421E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion,0x94C536D6,0xC821,0x42F5,0xA6,0x00,0xC6,0x66,0x29,0x95,0x51,0x01);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeviceNotificationCallback,0x4997053B,0x0ADF,0x4CC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDiscovery,0xCDBF631C,0xBC76,0x45FA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator,0xBA6C6F44,0x6DA5,0x4DCE,0x94,0xAA,0xEE,0x2D,0x13,0x72,0xA6,0x76);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkAPIInformation,0x263CA19F,0xED09,0x482E,0x9F,0x9D,0x84,0x00,0x57,0x83,0xA2,0x37);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGLScreenPreviewHelper,0x1E332DAE,0x0D04,0x49EB,0xB8,0xA1,0xB6,0xE0,0x0B,0x2B,0x6B,0xD0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGL3ScreenPreviewHelper,0x166804E4,0x15EF,0x4BFD,0xB6,0x23,0xB5,0xBA,0x92,0x16,0x67,0xC5);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDX9ScreenPreviewHelper,0x0EB111ED,0xADA6,0x43A6,0x8B,0x16,0xCA,0x5D,0x27,0xEE,0xA1,0x5E);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkWPFDX9ScreenPreviewHelper,0x5E64496D,0x4BB2,0x45D5,0x9B,0x63,0xBF,0x1B,0x46,0x3B,0x18,0xAF);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion,0x771AD62D,0x671F,0x4442,0xAC,0x90,0xB0,0x70,0xC5,0x41,0x09,0x0A);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDiscovery,0x22FBFC33,0x8D07,0x495C,0xA5,0xBF,0xDA,0xB5,0xEA,0x9B,0x82,0xDB);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoFrameAncillaryPackets,0x6F47097E,0xB390,0x4650,0xBC,0xB6,0xC4,0xD5,0x2F,0xAA,0x16,0x43);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkStatus_v15_3_1,0x5F558200,0x4028,0x49BC,0xBE,0xAC,0xDB,0x3F,0xA4,0xA9,0x6E,0x46);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v15_3_1,0x912F634B,0x2D4E,0x40A4,0x8A,0xAB,0x8D,0x80,0xB7,0x3F,0x12,0x89);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBuffer_v15_3_1,0xCCB4B64A,0x5C86,0x4E02,0xB7,0x78,0x88,0x5D,0x35,0x27,0x09,0xFE);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocator_v15_3_1,0x3481A4DF,0x2B11,0x4E55,0xAC,0x61,0x83,0x6B,0x87,0x98,0x5E,0x9A);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocatorProvider_v15_3_1,0x08B80403,0xBFF2,0x49D0,0xB4,0x48,0x8C,0x90,0x8B,0x9E,0x9F,0xC9);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v15_3_1,0x4095DB82,0xE294,0x4B8C,0xAA,0xA8,0x3B,0x9E,0x80,0xC4,0x93,0x36);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v15_3_1,0x1A8077F1,0x9FE2,0x4533,0x81,0x47,0x22,0x94,0x30,0x5E,0x25,0x3F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion_v15_3_1,0xA48755D9,0x8BD5,0x4727,0xA1,0xE9,0x06,0x9F,0xDE,0xDB,0xA6,0xE9);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotification_v15_3_1,0xB85DF4C8,0xBDF5,0x47C1,0x80,0x64,0x28,0x16,0x2E,0xBD,0xD4,0xEB);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion_v15_3_1,0x89BA47BD,0x1FE2,0x4D76,0x9B,0xFE,0xDE,0x85,0x04,0x9C,0x49,0x87);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileAttributes_v15_3_1,0x17D4BF8E,0x4911,0x473A,0x80,0xA0,0x73,0x1C,0xF6,0xFF,0x34,0x5B);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback_v14_2_1,0x20AA5225,0x1958,0x47CB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v14_2_1,0xC6FCE4C9,0xC4E4,0x4047,0x82,0xFB,0x5D,0x23,0x82,0x32,0xA9,0x02);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkMemoryAllocator_v14_2_1,0xB36EB6E7,0x9D29,0x4AA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v14_2_1,0xBE2D9020,0x461E,0x442F,0x84,0xB7,0xE9,0x49,0xCB,0x95,0x3B,0x9D);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v14_2_1,0xC21CDB6E,0xF414,0x46E4,0xA6,0x36,0x80,0xA5,0x66,0xE0,0xED,0x37);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInput_v14_2_1,0xF222551D,0x13DF,0x4FD8,0xB5,0x87,0x9D,0x4F,0x19,0xEC,0x12,0xC9);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame_v14_2_1,0x3F716FE0,0xF023,0x4111,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkMutableVideoFrame_v14_2_1,0x69E2639F,0x40DA,0x4E19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame3DExtensions_v14_2_1,0xDA0F7E4A,0xEDC7,0x48A8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame_v14_2_1,0x05CFE374,0x537C,0x4094,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkScreenPreviewCallback_v14_2_1,0xB1D3F49A,0x85FE,0x4C5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkGLScreenPreviewHelper_v14_2_1,0x504E2209,0xCAC7,0x4C1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkDX9ScreenPreviewHelper_v14_2_1,0x2094B522,0xD1A1,0x40C0,0x9A,0xC7,0x1C,0x01,0x22,0x18,0xEF,0x02);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1,0xAD8EC84A,0x7DDE,0x11E9,0x8F,0x9E,0x2A,0x86,0xE4,0x08,0x5A,0x59);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion_v14_2_1,0x3BBCB8A2,0xDA2C,0x42D9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGLScreenPreviewHelper_v14_2_1,0xF63E77C7,0xB655,0x4A4A,0x9A,0xD0,0x3C,0xA8,0x5D,0x39,0x43,0x43);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGL3ScreenPreviewHelper_v14_2_1,0x00696A71,0xEBC7,0x491F,0xAC,0x02,0x18,0xD3,0x39,0x3F,0x33,0xF0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDX9ScreenPreviewHelper_v14_2_1,0xCC010023,0xE01D,0x4525,0x9D,0x59,0x80,0xC8,0xAB,0x3D,0xC7,0xA0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1,0xEF2A8478,0x7DDF,0x11E9,0x8F,0x9E,0x2A,0x86,0xE4,0x08,0x5A,0x59);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion_v14_2_1,0x7DBBBB11,0x5B7B,0x467D,0xAE,0xA4,0xCE,0xA4,0x68,0xFD,0x36,0x8C);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v11_5_1,0xDD04E5EC,0x7415,0x42AB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v11_5_1,0x9434C6E4,0xB15D,0x4B1C,0x97,0x9E,0x66,0x1E,0x3D,0xDC,0xB4,0xB9);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_11,0xEF90380B,0x4AE5,0x4346,0x90,0x77,0xE2,0x88,0xE1,0x49,0xF1,0x29);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAttributes_v10_11,0xABC11843,0xD966,0x44CB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotification_v10_11,0x0A1FB207,0xE215,0x441B,0x9B,0x19,0x6F,0xA1,0x57,0x59,0x46,0xC5);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v10_11,0xCC5C8A6E,0x3F2F,0x4B3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v10_11,0xAF22762B,0xDFAC,0x4846,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInput_v10_11,0x270587DA,0x6B7D,0x42E7,0xA1,0xF0,0x6D,0x85,0x3F,0x58,0x11,0x85);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator_v10_11,0x87D2693F,0x8D4A,0x45C7,0xB4,0x3F,0x10,0xAC,0xBA,0x25,0xE6,0x8F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDiscovery_v10_11,0x652615D4,0x26CD,0x4514,0xB1,0x61,0x2F,0xD5,0x07,0x2E,0xD0,0x08);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_9,0xCB71734A,0xFE37,0x4E8D,0x8E,0x13,0x80,0x21,0x33,0xA1,0xC3,0xF2);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingDiscovery_v10_8,0x0CAA31F6,0x8A26,0x40B0,0x86,0xA4,0xBF,0x58,0xDC,0xCA,0x71,0x0C);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_4,0x1E69FCF6,0x4203,0x4936,0x80,0x76,0x2A,0x9F,0x4C,0xFD,0x50,0xCB);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_2,0xC679A35B,0x610C,0x4D09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacket_v15_2,0xCC5BBF7E,0x029C,0x4D3B,0x91,0x58,0x60,0x00,0xEF,0x5E,0x36,0x70);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacketIterator_v15_2,0x3FC8994B,0x88FB,0x4C17,0x96,0x8F,0x9A,0xAB,0x69,0xD9,0x64,0xA7);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillaryPackets_v15_2,0x6C186C0F,0x459E,0x41D8,0xAE,0xE2,0x48,0x12,0xD8,0x1A,0xEE,0x68);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoFrameAncillaryPackets_v15_2,0xF891AD29,0xD0C2,0x46E9,0xA9,0x26,0x4E,0x2D,0x0D,0xD8,0xCF,0xAD);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameMetadataExtensions_v11_5,0xD5973DC9,0x6432,0x46D0,0x8F,0x0B,0x24,0x96,0xF8,0xA1,0x23,0x8F);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v11_4,0x065A0F6C,0xC508,0x4D0D,0xB9,0x19,0xF5,0xEB,0x0E,0xBF,0xC9,0x6B);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v11_4,0x2A88CF76,0xF494,0x4216,0xA7,0xEF,0xDC,0x74,0xEE,0xB8,0x38,0x82);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator_v10_8,0x1F2E109A,0x8F4F,0x49E4,0x92,0x03,0x13,0x55,0x95,0xCB,0x6F,0xA5);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDiscovery_v10_8,0x1073A05C,0xD885,0x47E9,0xB3,0xC6,0x12,0x9B,0x3F,0x9F,0x64,0x8B);
|
||||
|
||||
|
||||
MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderConfiguration_v10_5,0x67455668,0x0848,0x45DF,0x8D,0x8E,0x35,0x0A,0x77,0xC9,0xA0,0x28);
|
||||
|
||||
#undef MIDL_DEFINE_GUID
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
#include "DeckLinkDisplayMode.h"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
std::string NormalizeModeToken(const std::string& value)
|
||||
{
|
||||
std::string normalized;
|
||||
for (unsigned char ch : value)
|
||||
{
|
||||
if (std::isalnum(ch))
|
||||
normalized.push_back(static_cast<char>(std::tolower(ch)));
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::string& frameRate, BMDDisplayMode& displayMode, std::string& displayModeName)
|
||||
{
|
||||
VideoFormat videoMode;
|
||||
if (!ResolveConfiguredVideoFormat(videoFormat, frameRate, videoMode))
|
||||
return false;
|
||||
|
||||
displayMode = videoMode.displayMode;
|
||||
displayModeName = videoMode.displayName;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResolveConfiguredVideoFormat(const std::string& videoFormat, const std::string& frameRate, VideoFormat& videoMode)
|
||||
{
|
||||
const std::string formatToken = NormalizeModeToken(videoFormat);
|
||||
const std::string frameToken = NormalizeModeToken(frameRate);
|
||||
const std::string combinedToken = formatToken + frameToken;
|
||||
|
||||
struct ModeOption
|
||||
{
|
||||
const char* token;
|
||||
BMDDisplayMode mode;
|
||||
const char* displayName;
|
||||
};
|
||||
|
||||
static const ModeOption options[] =
|
||||
{
|
||||
{ "720p50", bmdModeHD720p50, "720p50" },
|
||||
{ "hd720p50", bmdModeHD720p50, "720p50" },
|
||||
{ "720p5994", bmdModeHD720p5994, "720p59.94" },
|
||||
{ "hd720p5994", bmdModeHD720p5994, "720p59.94" },
|
||||
{ "720p60", bmdModeHD720p60, "720p60" },
|
||||
{ "hd720p60", bmdModeHD720p60, "720p60" },
|
||||
{ "1080i50", bmdModeHD1080i50, "1080i50" },
|
||||
{ "hd1080i50", bmdModeHD1080i50, "1080i50" },
|
||||
{ "1080i5994", bmdModeHD1080i5994, "1080i59.94" },
|
||||
{ "hd1080i5994", bmdModeHD1080i5994, "1080i59.94" },
|
||||
{ "1080i60", bmdModeHD1080i6000, "1080i60" },
|
||||
{ "hd1080i60", bmdModeHD1080i6000, "1080i60" },
|
||||
{ "1080p2398", bmdModeHD1080p2398, "1080p23.98" },
|
||||
{ "hd1080p2398", bmdModeHD1080p2398, "1080p23.98" },
|
||||
{ "1080p24", bmdModeHD1080p24, "1080p24" },
|
||||
{ "hd1080p24", bmdModeHD1080p24, "1080p24" },
|
||||
{ "1080p25", bmdModeHD1080p25, "1080p25" },
|
||||
{ "hd1080p25", bmdModeHD1080p25, "1080p25" },
|
||||
{ "1080p2997", bmdModeHD1080p2997, "1080p29.97" },
|
||||
{ "hd1080p2997", bmdModeHD1080p2997, "1080p29.97" },
|
||||
{ "1080p30", bmdModeHD1080p30, "1080p30" },
|
||||
{ "hd1080p30", bmdModeHD1080p30, "1080p30" },
|
||||
{ "1080p50", bmdModeHD1080p50, "1080p50" },
|
||||
{ "hd1080p50", bmdModeHD1080p50, "1080p50" },
|
||||
{ "1080p5994", bmdModeHD1080p5994, "1080p59.94" },
|
||||
{ "hd1080p5994", bmdModeHD1080p5994, "1080p59.94" },
|
||||
{ "1080p60", bmdModeHD1080p6000, "1080p60" },
|
||||
{ "hd1080p60", bmdModeHD1080p6000, "1080p60" },
|
||||
{ "2160p2398", bmdMode4K2160p2398, "2160p23.98" },
|
||||
{ "4k2160p2398", bmdMode4K2160p2398, "2160p23.98" },
|
||||
{ "2160p24", bmdMode4K2160p24, "2160p24" },
|
||||
{ "4k2160p24", bmdMode4K2160p24, "2160p24" },
|
||||
{ "2160p25", bmdMode4K2160p25, "2160p25" },
|
||||
{ "4k2160p25", bmdMode4K2160p25, "2160p25" },
|
||||
{ "2160p2997", bmdMode4K2160p2997, "2160p29.97" },
|
||||
{ "4k2160p2997", bmdMode4K2160p2997, "2160p29.97" },
|
||||
{ "2160p30", bmdMode4K2160p30, "2160p30" },
|
||||
{ "4k2160p30", bmdMode4K2160p30, "2160p30" },
|
||||
{ "2160p50", bmdMode4K2160p50, "2160p50" },
|
||||
{ "4k2160p50", bmdMode4K2160p50, "2160p50" },
|
||||
{ "2160p5994", bmdMode4K2160p5994, "2160p59.94" },
|
||||
{ "4k2160p5994", bmdMode4K2160p5994, "2160p59.94" },
|
||||
{ "2160p60", bmdMode4K2160p60, "2160p60" },
|
||||
{ "4k2160p60", bmdMode4K2160p60, "2160p60" }
|
||||
};
|
||||
|
||||
for (const ModeOption& option : options)
|
||||
{
|
||||
if (combinedToken == option.token || (frameToken.empty() && formatToken == option.token))
|
||||
{
|
||||
videoMode.displayMode = option.mode;
|
||||
videoMode.displayName = option.displayName;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ResolveConfiguredVideoFormats(
|
||||
const std::string& inputVideoFormat,
|
||||
const std::string& inputFrameRate,
|
||||
const std::string& outputVideoFormat,
|
||||
const std::string& outputFrameRate,
|
||||
VideoFormatSelection& videoModes,
|
||||
std::string& error)
|
||||
{
|
||||
if (!ResolveConfiguredVideoFormat(inputVideoFormat, inputFrameRate, videoModes.input))
|
||||
{
|
||||
error = "Unsupported DeckLink inputVideoFormat/inputFrameRate in config/runtime-host.json: " +
|
||||
inputVideoFormat + " / " + inputFrameRate;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ResolveConfiguredVideoFormat(outputVideoFormat, outputFrameRate, videoModes.output))
|
||||
{
|
||||
error = "Unsupported DeckLink outputVideoFormat/outputFrameRate in config/runtime-host.json: " +
|
||||
outputVideoFormat + " / " + outputFrameRate;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FindDeckLinkDisplayMode(IDeckLinkDisplayModeIterator* iterator, BMDDisplayMode targetMode, IDeckLinkDisplayMode** foundMode)
|
||||
{
|
||||
if (!iterator || !foundMode)
|
||||
return false;
|
||||
|
||||
*foundMode = NULL;
|
||||
IDeckLinkDisplayMode* candidate = NULL;
|
||||
while (iterator->Next(&candidate) == S_OK)
|
||||
{
|
||||
if (candidate->GetDisplayMode() == targetMode)
|
||||
{
|
||||
*foundMode = candidate;
|
||||
return true;
|
||||
}
|
||||
|
||||
candidate->Release();
|
||||
candidate = NULL;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include "DeckLinkAPI_h.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
struct FrameSize
|
||||
{
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
|
||||
bool IsEmpty() const { return width == 0 || height == 0; }
|
||||
};
|
||||
|
||||
inline bool operator==(const FrameSize& left, const FrameSize& right)
|
||||
{
|
||||
return left.width == right.width && left.height == right.height;
|
||||
}
|
||||
|
||||
inline bool operator!=(const FrameSize& left, const FrameSize& right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
struct VideoFormat
|
||||
{
|
||||
BMDDisplayMode displayMode = bmdModeHD1080p5994;
|
||||
std::string displayName = "1080p59.94";
|
||||
};
|
||||
|
||||
struct VideoFormatSelection
|
||||
{
|
||||
VideoFormat input;
|
||||
VideoFormat output;
|
||||
};
|
||||
|
||||
std::string NormalizeModeToken(const std::string& value);
|
||||
bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::string& frameRate, BMDDisplayMode& displayMode, std::string& displayModeName);
|
||||
bool ResolveConfiguredVideoFormat(const std::string& videoFormat, const std::string& frameRate, VideoFormat& videoMode);
|
||||
bool ResolveConfiguredVideoFormats(
|
||||
const std::string& inputVideoFormat,
|
||||
const std::string& inputFrameRate,
|
||||
const std::string& outputVideoFormat,
|
||||
const std::string& outputFrameRate,
|
||||
VideoFormatSelection& videoModes,
|
||||
std::string& error);
|
||||
bool FindDeckLinkDisplayMode(IDeckLinkDisplayModeIterator* iterator, BMDDisplayMode targetMode, IDeckLinkDisplayMode** foundMode);
|
||||
@@ -0,0 +1,104 @@
|
||||
#include "DeckLinkFrameTransfer.h"
|
||||
|
||||
#include "DeckLinkSession.h"
|
||||
|
||||
////////////////////////////////////////////
|
||||
// DeckLink Capture Delegate Class
|
||||
////////////////////////////////////////////
|
||||
CaptureDelegate::CaptureDelegate(DeckLinkSession* pOwner) :
|
||||
m_pOwner(pOwner),
|
||||
mRefCount(1)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CaptureDelegate::QueryInterface(REFIID, LPVOID* ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG CaptureDelegate::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&mRefCount);
|
||||
}
|
||||
|
||||
ULONG CaptureDelegate::Release()
|
||||
{
|
||||
int newCount = InterlockedDecrement(&mRefCount);
|
||||
if (newCount == 0)
|
||||
delete this;
|
||||
return newCount;
|
||||
}
|
||||
|
||||
HRESULT CaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* inputFrame, IDeckLinkAudioInputPacket*)
|
||||
{
|
||||
if (!inputFrame)
|
||||
{
|
||||
// It's possible to receive a NULL inputFrame, but a valid audioPacket. Ignore audio-only frame.
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
bool hasNoInputSource = (inputFrame->GetFlags() & bmdFrameHasNoInputSource) == bmdFrameHasNoInputSource;
|
||||
m_pOwner->HandleVideoInputFrame(inputFrame, hasNoInputSource);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CaptureDelegate::VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
// DeckLink Playout Delegate Class
|
||||
////////////////////////////////////////////
|
||||
PlayoutDelegate::PlayoutDelegate(DeckLinkSession* pOwner) :
|
||||
m_pOwner(pOwner),
|
||||
mRefCount(1)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT PlayoutDelegate::QueryInterface(REFIID, LPVOID* ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG PlayoutDelegate::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&mRefCount);
|
||||
}
|
||||
|
||||
ULONG PlayoutDelegate::Release()
|
||||
{
|
||||
int newCount = InterlockedDecrement(&mRefCount);
|
||||
if (newCount == 0)
|
||||
delete this;
|
||||
return newCount;
|
||||
}
|
||||
|
||||
HRESULT PlayoutDelegate::ScheduledFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case bmdOutputFrameDisplayedLate:
|
||||
OutputDebugStringA("ScheduledFrameCompleted() frame did not complete: Frame Displayed Late\n");
|
||||
break;
|
||||
case bmdOutputFrameDropped:
|
||||
OutputDebugStringA("ScheduledFrameCompleted() frame did not complete: Frame Dropped\n");
|
||||
break;
|
||||
case bmdOutputFrameCompleted:
|
||||
case bmdOutputFrameFlushed:
|
||||
// Don't log bmdOutputFrameFlushed result since it is expected when Stop() is called
|
||||
break;
|
||||
default:
|
||||
OutputDebugStringA("ScheduledFrameCompleted() frame did not complete: Unknown error\n");
|
||||
}
|
||||
|
||||
m_pOwner->HandlePlayoutFrameCompleted(completedFrame, result);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT PlayoutDelegate::ScheduledPlaybackHasStopped()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "DeckLinkAPI_h.h"
|
||||
|
||||
class DeckLinkSession;
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Capture Delegate Class
|
||||
////////////////////////////////////////////
|
||||
class CaptureDelegate : public IDeckLinkInputCallback
|
||||
{
|
||||
DeckLinkSession* m_pOwner;
|
||||
LONG mRefCount;
|
||||
|
||||
public:
|
||||
CaptureDelegate(DeckLinkSession* pOwner);
|
||||
|
||||
// IUnknown needs only a dummy implementation
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID* ppv);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioPacket);
|
||||
virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents notificationEvents, IDeckLinkDisplayMode* newDisplayMode, BMDDetectedVideoInputFormatFlags detectedSignalFlags);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Render Delegate Class
|
||||
////////////////////////////////////////////
|
||||
class PlayoutDelegate : public IDeckLinkVideoOutputCallback
|
||||
{
|
||||
DeckLinkSession* m_pOwner;
|
||||
LONG mRefCount;
|
||||
|
||||
public:
|
||||
PlayoutDelegate(DeckLinkSession* pOwner);
|
||||
|
||||
// IUnknown needs only a dummy implementation
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID* ppv);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result);
|
||||
virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped();
|
||||
};
|
||||
@@ -0,0 +1,614 @@
|
||||
#include "DeckLinkSession.h"
|
||||
|
||||
#include "GlRenderConstants.h"
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string BstrToUtf8(BSTR value)
|
||||
{
|
||||
if (value == nullptr)
|
||||
return std::string();
|
||||
|
||||
const int requiredBytes = WideCharToMultiByte(CP_UTF8, 0, value, -1, NULL, 0, NULL, NULL);
|
||||
if (requiredBytes <= 1)
|
||||
return std::string();
|
||||
|
||||
std::vector<char> utf8Name(static_cast<std::size_t>(requiredBytes), '\0');
|
||||
if (WideCharToMultiByte(CP_UTF8, 0, value, -1, utf8Name.data(), requiredBytes, NULL, NULL) <= 0)
|
||||
return std::string();
|
||||
|
||||
return std::string(utf8Name.data());
|
||||
}
|
||||
|
||||
bool InputSupportsFormat(IDeckLinkInput* input, BMDDisplayMode displayMode, BMDPixelFormat pixelFormat)
|
||||
{
|
||||
if (input == nullptr)
|
||||
return false;
|
||||
|
||||
BOOL supported = FALSE;
|
||||
BMDDisplayMode actualMode = bmdModeUnknown;
|
||||
const HRESULT result = input->DoesSupportVideoMode(
|
||||
bmdVideoConnectionUnspecified,
|
||||
displayMode,
|
||||
pixelFormat,
|
||||
bmdNoVideoInputConversion,
|
||||
bmdSupportedVideoModeDefault,
|
||||
&actualMode,
|
||||
&supported);
|
||||
return result == S_OK && supported != FALSE;
|
||||
}
|
||||
|
||||
bool OutputSupportsFormat(IDeckLinkOutput* output, BMDDisplayMode displayMode, BMDPixelFormat pixelFormat)
|
||||
{
|
||||
if (output == nullptr)
|
||||
return false;
|
||||
|
||||
BOOL supported = FALSE;
|
||||
BMDDisplayMode actualMode = bmdModeUnknown;
|
||||
const HRESULT result = output->DoesSupportVideoMode(
|
||||
bmdVideoConnectionUnspecified,
|
||||
displayMode,
|
||||
pixelFormat,
|
||||
bmdNoVideoOutputConversion,
|
||||
bmdSupportedVideoModeDefault,
|
||||
&actualMode,
|
||||
&supported);
|
||||
return result == S_OK && supported != FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
DeckLinkSession::~DeckLinkSession()
|
||||
{
|
||||
ReleaseResources();
|
||||
}
|
||||
|
||||
void DeckLinkSession::ReleaseResources()
|
||||
{
|
||||
if (input != nullptr)
|
||||
input->SetCallback(nullptr);
|
||||
captureDelegate.Release();
|
||||
input.Release();
|
||||
|
||||
if (output != nullptr)
|
||||
output->SetScheduledFrameCompletionCallback(nullptr);
|
||||
|
||||
if (keyer != nullptr)
|
||||
{
|
||||
keyer->Disable();
|
||||
mState.externalKeyingActive = false;
|
||||
}
|
||||
keyer.Release();
|
||||
|
||||
playoutDelegate.Release();
|
||||
outputVideoFrameQueue.clear();
|
||||
output.Release();
|
||||
}
|
||||
|
||||
bool DeckLinkSession::DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error)
|
||||
{
|
||||
CComPtr<IDeckLinkIterator> deckLinkIterator;
|
||||
CComPtr<IDeckLinkDisplayMode> inputMode;
|
||||
CComPtr<IDeckLinkDisplayMode> outputMode;
|
||||
|
||||
mState.inputDisplayModeName = videoModes.input.displayName;
|
||||
mState.outputDisplayModeName = videoModes.output.displayName;
|
||||
|
||||
HRESULT result = CoCreateInstance(CLSID_CDeckLinkIterator, nullptr, CLSCTX_ALL, IID_IDeckLinkIterator, reinterpret_cast<void**>(&deckLinkIterator));
|
||||
if (FAILED(result))
|
||||
{
|
||||
error = "Please install the Blackmagic DeckLink drivers to use the features of this application.";
|
||||
return false;
|
||||
}
|
||||
|
||||
CComPtr<IDeckLink> deckLink;
|
||||
while (deckLinkIterator->Next(&deckLink) == S_OK)
|
||||
{
|
||||
int64_t duplexMode;
|
||||
bool deviceSupportsInternalKeying = false;
|
||||
bool deviceSupportsExternalKeying = false;
|
||||
std::string modelName;
|
||||
CComPtr<IDeckLinkProfileAttributes> deckLinkAttributes;
|
||||
|
||||
if (deckLink->QueryInterface(IID_IDeckLinkProfileAttributes, (void**)&deckLinkAttributes) != S_OK)
|
||||
{
|
||||
printf("Could not obtain the IDeckLinkProfileAttributes interface\n");
|
||||
deckLink.Release();
|
||||
continue;
|
||||
}
|
||||
|
||||
result = deckLinkAttributes->GetInt(BMDDeckLinkDuplex, &duplexMode);
|
||||
BOOL attributeFlag = FALSE;
|
||||
if (deckLinkAttributes->GetFlag(BMDDeckLinkSupportsInternalKeying, &attributeFlag) == S_OK)
|
||||
deviceSupportsInternalKeying = (attributeFlag != FALSE);
|
||||
attributeFlag = FALSE;
|
||||
if (deckLinkAttributes->GetFlag(BMDDeckLinkSupportsExternalKeying, &attributeFlag) == S_OK)
|
||||
deviceSupportsExternalKeying = (attributeFlag != FALSE);
|
||||
CComBSTR modelNameBstr;
|
||||
if (deckLinkAttributes->GetString(BMDDeckLinkModelName, &modelNameBstr) == S_OK)
|
||||
modelName = BstrToUtf8(modelNameBstr);
|
||||
|
||||
if (result != S_OK || duplexMode == bmdDuplexInactive)
|
||||
{
|
||||
deckLink.Release();
|
||||
continue;
|
||||
}
|
||||
|
||||
bool inputUsed = false;
|
||||
if (!input && deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&input) == S_OK)
|
||||
inputUsed = true;
|
||||
|
||||
if (!output && (!inputUsed || (duplexMode == bmdDuplexFull)))
|
||||
{
|
||||
if (deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&output) != S_OK)
|
||||
output.Release();
|
||||
else
|
||||
{
|
||||
mState.outputModelName = modelName;
|
||||
mState.supportsInternalKeying = deviceSupportsInternalKeying;
|
||||
mState.supportsExternalKeying = deviceSupportsExternalKeying;
|
||||
}
|
||||
}
|
||||
|
||||
deckLink.Release();
|
||||
|
||||
if (output && input)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!output)
|
||||
{
|
||||
error = "Expected an Output DeckLink device";
|
||||
ReleaseResources();
|
||||
return false;
|
||||
}
|
||||
|
||||
CComPtr<IDeckLinkDisplayModeIterator> inputDisplayModeIterator;
|
||||
if (input && input->GetDisplayModeIterator(&inputDisplayModeIterator) != S_OK)
|
||||
{
|
||||
error = "Cannot get input Display Mode Iterator.";
|
||||
ReleaseResources();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (input && !FindDeckLinkDisplayMode(inputDisplayModeIterator, videoModes.input.displayMode, &inputMode))
|
||||
{
|
||||
error = "Cannot get specified input BMDDisplayMode for configured mode: " + videoModes.input.displayName;
|
||||
ReleaseResources();
|
||||
return false;
|
||||
}
|
||||
inputDisplayModeIterator.Release();
|
||||
|
||||
CComPtr<IDeckLinkDisplayModeIterator> outputDisplayModeIterator;
|
||||
if (output->GetDisplayModeIterator(&outputDisplayModeIterator) != S_OK)
|
||||
{
|
||||
error = "Cannot get output Display Mode Iterator.";
|
||||
ReleaseResources();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!FindDeckLinkDisplayMode(outputDisplayModeIterator, videoModes.output.displayMode, &outputMode))
|
||||
{
|
||||
error = "Cannot get specified output BMDDisplayMode for configured mode: " + videoModes.output.displayName;
|
||||
ReleaseResources();
|
||||
return false;
|
||||
}
|
||||
|
||||
mState.outputFrameSize = { static_cast<unsigned>(outputMode->GetWidth()), static_cast<unsigned>(outputMode->GetHeight()) };
|
||||
mState.inputFrameSize = inputMode
|
||||
? FrameSize{ static_cast<unsigned>(inputMode->GetWidth()), static_cast<unsigned>(inputMode->GetHeight()) }
|
||||
: mState.outputFrameSize;
|
||||
if (!input)
|
||||
mState.inputDisplayModeName = "No input - black frame";
|
||||
BMDTimeValue frameDuration = 0;
|
||||
BMDTimeScale frameTimescale = 0;
|
||||
outputMode->GetFrameRate(&frameDuration, &frameTimescale);
|
||||
mScheduler.Configure(frameDuration, frameTimescale);
|
||||
mState.frameBudgetMilliseconds = mScheduler.FrameBudgetMilliseconds();
|
||||
|
||||
mState.inputFrameRowBytes = mState.inputFrameSize.width * 2u;
|
||||
mState.outputFrameRowBytes = mState.outputFrameSize.width * 4u;
|
||||
mState.captureTextureWidth = mState.inputFrameSize.width / 2u;
|
||||
mState.outputPackTextureWidth = mState.outputFrameSize.width;
|
||||
mState.hasInputDevice = input != nullptr;
|
||||
mState.hasInputSource = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::SelectPreferredFormats(const VideoFormatSelection& videoModes, std::string& error)
|
||||
{
|
||||
if (!output)
|
||||
{
|
||||
error = "Expected an Output DeckLink device";
|
||||
return false;
|
||||
}
|
||||
|
||||
mState.formatStatusMessage.clear();
|
||||
|
||||
const bool inputTenBitSupported = input != nullptr && InputSupportsFormat(input, videoModes.input.displayMode, bmdFormat10BitYUV);
|
||||
mState.inputPixelFormat = input != nullptr ? ChoosePreferredVideoIOFormat(inputTenBitSupported) : VideoIOPixelFormat::Uyvy8;
|
||||
if (input != nullptr && !inputTenBitSupported)
|
||||
mState.formatStatusMessage += "DeckLink input does not report 10-bit YUV support for the configured mode; using 8-bit capture. ";
|
||||
|
||||
const bool outputTenBitSupported = OutputSupportsFormat(output, videoModes.output.displayMode, bmdFormat10BitYUV);
|
||||
mState.outputPixelFormat = outputTenBitSupported ? VideoIOPixelFormat::V210 : VideoIOPixelFormat::Bgra8;
|
||||
if (!outputTenBitSupported)
|
||||
mState.formatStatusMessage += "DeckLink output does not report 10-bit YUV support for the configured mode; using 8-bit BGRA output. ";
|
||||
|
||||
int deckLinkOutputRowBytes = 0;
|
||||
if (output->RowBytesForPixelFormat(DeckLinkPixelFormatForVideoIO(mState.outputPixelFormat), mState.outputFrameSize.width, &deckLinkOutputRowBytes) != S_OK)
|
||||
{
|
||||
error = "DeckLink output setup failed while calculating output row bytes.";
|
||||
return false;
|
||||
}
|
||||
mState.outputFrameRowBytes = static_cast<unsigned>(deckLinkOutputRowBytes);
|
||||
mState.outputPackTextureWidth = OutputIsTenBit()
|
||||
? PackedTextureWidthFromRowBytes(mState.outputFrameRowBytes)
|
||||
: mState.outputFrameSize.width;
|
||||
|
||||
if (InputIsTenBit())
|
||||
{
|
||||
int deckLinkInputRowBytes = 0;
|
||||
if (output->RowBytesForPixelFormat(bmdFormat10BitYUV, mState.inputFrameSize.width, &deckLinkInputRowBytes) == S_OK)
|
||||
mState.inputFrameRowBytes = static_cast<unsigned>(deckLinkInputRowBytes);
|
||||
else
|
||||
mState.inputFrameRowBytes = MinimumV210RowBytes(mState.inputFrameSize.width);
|
||||
}
|
||||
else
|
||||
{
|
||||
mState.inputFrameRowBytes = mState.inputFrameSize.width * 2u;
|
||||
}
|
||||
mState.captureTextureWidth = InputIsTenBit()
|
||||
? PackedTextureWidthFromRowBytes(mState.inputFrameRowBytes)
|
||||
: mState.inputFrameSize.width / 2u;
|
||||
|
||||
std::ostringstream status;
|
||||
status << "DeckLink formats: capture " << (input ? VideoIOPixelFormatName(mState.inputPixelFormat) : "none")
|
||||
<< ", output " << VideoIOPixelFormatName(mState.outputPixelFormat) << ".";
|
||||
if (!mState.formatStatusMessage.empty())
|
||||
status << " " << mState.formatStatusMessage;
|
||||
mState.formatStatusMessage = status.str();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::ConfigureInput(InputFrameCallback callback, const VideoFormat& inputVideoMode, std::string& error)
|
||||
{
|
||||
mInputFrameCallback = std::move(callback);
|
||||
|
||||
if (!input)
|
||||
{
|
||||
mState.hasInputSource = false;
|
||||
mState.inputDisplayModeName = "No input - black frame";
|
||||
return true;
|
||||
}
|
||||
|
||||
const BMDPixelFormat deckLinkInputPixelFormat = DeckLinkPixelFormatForVideoIO(mState.inputPixelFormat);
|
||||
if (input->EnableVideoInput(inputVideoMode.displayMode, deckLinkInputPixelFormat, bmdVideoInputFlagDefault) != S_OK)
|
||||
{
|
||||
if (mState.inputPixelFormat == VideoIOPixelFormat::V210)
|
||||
{
|
||||
OutputDebugStringA("DeckLink 10-bit input could not be enabled; falling back to 8-bit capture.\n");
|
||||
mState.inputPixelFormat = VideoIOPixelFormat::Uyvy8;
|
||||
mState.inputFrameRowBytes = mState.inputFrameSize.width * 2u;
|
||||
mState.captureTextureWidth = mState.inputFrameSize.width / 2u;
|
||||
if (input->EnableVideoInput(inputVideoMode.displayMode, bmdFormat8BitYUV, bmdVideoInputFlagDefault) == S_OK)
|
||||
{
|
||||
std::ostringstream status;
|
||||
status << "DeckLink formats: capture " << VideoIOPixelFormatName(mState.inputPixelFormat)
|
||||
<< ", output " << VideoIOPixelFormatName(mState.outputPixelFormat)
|
||||
<< ". DeckLink 10-bit input enable failed; using 8-bit capture.";
|
||||
mState.formatStatusMessage = status.str();
|
||||
goto input_enabled;
|
||||
}
|
||||
}
|
||||
|
||||
OutputDebugStringA("DeckLink input could not be enabled; continuing in output-only black-frame mode.\n");
|
||||
input.Release();
|
||||
mState.hasInputDevice = false;
|
||||
mState.hasInputSource = false;
|
||||
mState.inputDisplayModeName = "No input - black frame";
|
||||
return true;
|
||||
}
|
||||
|
||||
input_enabled:
|
||||
captureDelegate.Attach(new (std::nothrow) CaptureDelegate(this));
|
||||
if (captureDelegate == nullptr)
|
||||
{
|
||||
error = "DeckLink input setup failed while creating the capture callback.";
|
||||
return false;
|
||||
}
|
||||
if (input->SetCallback(captureDelegate) != S_OK)
|
||||
{
|
||||
error = "DeckLink input setup failed while installing the capture callback.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::ConfigureOutput(OutputFrameCallback callback, const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error)
|
||||
{
|
||||
mOutputFrameCallback = std::move(callback);
|
||||
|
||||
if (output->EnableVideoOutput(outputVideoMode.displayMode, bmdVideoOutputFlagDefault) != S_OK)
|
||||
{
|
||||
error = "DeckLink output setup failed while enabling video output.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (output->QueryInterface(IID_IDeckLinkKeyer, (void**)&keyer) == S_OK && keyer != NULL)
|
||||
mState.keyerInterfaceAvailable = true;
|
||||
|
||||
if (externalKeyingEnabled)
|
||||
{
|
||||
if (!mState.supportsExternalKeying)
|
||||
{
|
||||
mState.statusMessage = "External keying was requested, but the selected DeckLink output does not report external keying support.";
|
||||
}
|
||||
else if (!mState.keyerInterfaceAvailable)
|
||||
{
|
||||
mState.statusMessage = "External keying was requested, but the selected DeckLink output does not expose the IDeckLinkKeyer interface.";
|
||||
}
|
||||
else if (keyer->Enable(TRUE) != S_OK || keyer->SetLevel(255) != S_OK)
|
||||
{
|
||||
mState.statusMessage = "External keying was requested, but enabling the DeckLink keyer failed.";
|
||||
}
|
||||
else
|
||||
{
|
||||
mState.externalKeyingActive = true;
|
||||
mState.statusMessage = "External keying is active on the selected DeckLink output.";
|
||||
}
|
||||
}
|
||||
else if (mState.supportsExternalKeying)
|
||||
{
|
||||
mState.statusMessage = "Selected DeckLink output supports external keying. Set enableExternalKeying to true in runtime-host.json to request it.";
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
CComPtr<IDeckLinkMutableVideoFrame> outputFrame;
|
||||
|
||||
const BMDPixelFormat deckLinkOutputPixelFormat = DeckLinkPixelFormatForVideoIO(mState.outputPixelFormat);
|
||||
if (output->CreateVideoFrame(mState.outputFrameSize.width, mState.outputFrameSize.height, mState.outputFrameRowBytes, deckLinkOutputPixelFormat, bmdFrameFlagFlipVertical, &outputFrame) != S_OK)
|
||||
{
|
||||
error = "DeckLink output setup failed while creating an output video frame.";
|
||||
return false;
|
||||
}
|
||||
|
||||
outputVideoFrameQueue.push_back(outputFrame);
|
||||
}
|
||||
|
||||
playoutDelegate.Attach(new (std::nothrow) PlayoutDelegate(this));
|
||||
if (playoutDelegate == nullptr)
|
||||
{
|
||||
error = "DeckLink output setup failed while creating the playout callback.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (output->SetScheduledFrameCompletionCallback(playoutDelegate) != S_OK)
|
||||
{
|
||||
error = "DeckLink output setup failed while installing the scheduled-frame callback.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mState.formatStatusMessage.empty())
|
||||
mState.statusMessage = mState.statusMessage.empty() ? mState.formatStatusMessage : mState.formatStatusMessage + " " + mState.statusMessage;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
double DeckLinkSession::FrameBudgetMilliseconds() const
|
||||
{
|
||||
return mScheduler.FrameBudgetMilliseconds();
|
||||
}
|
||||
|
||||
bool DeckLinkSession::BeginOutputFrame(VideoIOOutputFrame& frame)
|
||||
{
|
||||
CComPtr<IDeckLinkMutableVideoFrame> outputVideoFrame = outputVideoFrameQueue.front();
|
||||
outputVideoFrameQueue.push_back(outputVideoFrame);
|
||||
outputVideoFrameQueue.pop_front();
|
||||
|
||||
CComPtr<IDeckLinkVideoBuffer> outputVideoFrameBuffer;
|
||||
if (outputVideoFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&outputVideoFrameBuffer) != S_OK)
|
||||
return false;
|
||||
|
||||
if (outputVideoFrameBuffer->StartAccess(bmdBufferAccessWrite) != S_OK)
|
||||
return false;
|
||||
|
||||
void* pFrame = nullptr;
|
||||
outputVideoFrameBuffer->GetBytes(&pFrame);
|
||||
|
||||
frame.bytes = pFrame;
|
||||
frame.rowBytes = outputVideoFrame->GetRowBytes();
|
||||
frame.width = mState.outputFrameSize.width;
|
||||
frame.height = mState.outputFrameSize.height;
|
||||
frame.pixelFormat = mState.outputPixelFormat;
|
||||
frame.nativeFrame = outputVideoFrame.p;
|
||||
frame.nativeBuffer = outputVideoFrameBuffer.Detach();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeckLinkSession::EndOutputFrame(VideoIOOutputFrame& frame)
|
||||
{
|
||||
IDeckLinkVideoBuffer* outputVideoFrameBuffer = static_cast<IDeckLinkVideoBuffer*>(frame.nativeBuffer);
|
||||
if (outputVideoFrameBuffer != nullptr)
|
||||
{
|
||||
outputVideoFrameBuffer->EndAccess(bmdBufferAccessWrite);
|
||||
outputVideoFrameBuffer->Release();
|
||||
}
|
||||
frame.nativeBuffer = nullptr;
|
||||
frame.bytes = nullptr;
|
||||
}
|
||||
|
||||
void DeckLinkSession::AccountForCompletionResult(VideoIOCompletionResult completionResult)
|
||||
{
|
||||
mScheduler.AccountForCompletionResult(completionResult);
|
||||
}
|
||||
|
||||
bool DeckLinkSession::ScheduleOutputFrame(const VideoIOOutputFrame& frame)
|
||||
{
|
||||
IDeckLinkMutableVideoFrame* outputVideoFrame = static_cast<IDeckLinkMutableVideoFrame*>(frame.nativeFrame);
|
||||
const VideoIOScheduleTime scheduleTime = mScheduler.NextScheduleTime();
|
||||
if (outputVideoFrame == nullptr || output->ScheduleVideoFrame(outputVideoFrame, scheduleTime.streamTime, scheduleTime.duration, scheduleTime.timeScale) != S_OK)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::Start()
|
||||
{
|
||||
mScheduler.Reset();
|
||||
if (!output)
|
||||
{
|
||||
MessageBoxA(NULL, "Cannot start playout because no DeckLink output device is available.", "DeckLink start failed", MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
if (outputVideoFrameQueue.empty())
|
||||
{
|
||||
MessageBoxA(NULL, "Cannot start playout because the output frame queue is empty.", "DeckLink start failed", MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < kPrerollFrameCount; i++)
|
||||
{
|
||||
CComPtr<IDeckLinkMutableVideoFrame> outputVideoFrame = outputVideoFrameQueue.front();
|
||||
outputVideoFrameQueue.push_back(outputVideoFrame);
|
||||
outputVideoFrameQueue.pop_front();
|
||||
|
||||
CComPtr<IDeckLinkVideoBuffer> outputVideoFrameBuffer;
|
||||
if (outputVideoFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&outputVideoFrameBuffer) != S_OK)
|
||||
{
|
||||
MessageBoxA(NULL, "Could not query the preroll output frame buffer.", "DeckLink start failed", MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outputVideoFrameBuffer->StartAccess(bmdBufferAccessWrite) != S_OK)
|
||||
{
|
||||
MessageBoxA(NULL, "Could not write to the preroll output frame buffer.", "DeckLink start failed", MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
void* pFrame = nullptr;
|
||||
outputVideoFrameBuffer->GetBytes((void**)&pFrame);
|
||||
memset(pFrame, 0, outputVideoFrame->GetRowBytes() * mState.outputFrameSize.height);
|
||||
|
||||
outputVideoFrameBuffer->EndAccess(bmdBufferAccessWrite);
|
||||
|
||||
const VideoIOScheduleTime scheduleTime = mScheduler.NextScheduleTime();
|
||||
if (output->ScheduleVideoFrame(outputVideoFrame, scheduleTime.streamTime, scheduleTime.duration, scheduleTime.timeScale) != S_OK)
|
||||
{
|
||||
MessageBoxA(NULL, "Could not schedule a preroll output frame.", "DeckLink start failed", MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (input)
|
||||
{
|
||||
if (input->StartStreams() != S_OK)
|
||||
{
|
||||
MessageBoxA(NULL, "Could not start the DeckLink input stream.", "DeckLink start failed", MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (output->StartScheduledPlayback(0, mScheduler.TimeScale(), 1.0) != S_OK)
|
||||
{
|
||||
MessageBoxA(NULL, "Could not start DeckLink scheduled playback.", "DeckLink start failed", MB_OK | MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeckLinkSession::Stop()
|
||||
{
|
||||
if (keyer != nullptr)
|
||||
{
|
||||
keyer->Disable();
|
||||
mState.externalKeyingActive = false;
|
||||
}
|
||||
|
||||
if (input)
|
||||
{
|
||||
input->StopStreams();
|
||||
input->DisableVideoInput();
|
||||
}
|
||||
|
||||
if (output)
|
||||
{
|
||||
output->StopScheduledPlayback(0, NULL, 0);
|
||||
output->DisableVideoOutput();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeckLinkSession::HandleVideoInputFrame(IDeckLinkVideoInputFrame* inputFrame, bool hasNoInputSource)
|
||||
{
|
||||
mState.hasInputSource = !hasNoInputSource;
|
||||
if (hasNoInputSource || mInputFrameCallback == nullptr)
|
||||
{
|
||||
VideoIOFrame frame;
|
||||
frame.width = mState.inputFrameSize.width;
|
||||
frame.height = mState.inputFrameSize.height;
|
||||
frame.pixelFormat = mState.inputPixelFormat;
|
||||
frame.hasNoInputSource = hasNoInputSource;
|
||||
if (mInputFrameCallback)
|
||||
mInputFrameCallback(frame);
|
||||
return;
|
||||
}
|
||||
|
||||
CComPtr<IDeckLinkVideoBuffer> inputFrameBuffer;
|
||||
void* videoPixels = nullptr;
|
||||
if (inputFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&inputFrameBuffer) != S_OK)
|
||||
return;
|
||||
if (inputFrameBuffer->StartAccess(bmdBufferAccessRead) != S_OK)
|
||||
return;
|
||||
|
||||
inputFrameBuffer->GetBytes(&videoPixels);
|
||||
|
||||
VideoIOFrame frame;
|
||||
frame.bytes = videoPixels;
|
||||
frame.rowBytes = inputFrame->GetRowBytes();
|
||||
frame.width = static_cast<unsigned>(inputFrame->GetWidth());
|
||||
frame.height = static_cast<unsigned>(inputFrame->GetHeight());
|
||||
frame.pixelFormat = mState.inputPixelFormat;
|
||||
frame.hasNoInputSource = hasNoInputSource;
|
||||
mInputFrameCallback(frame);
|
||||
|
||||
inputFrameBuffer->EndAccess(bmdBufferAccessRead);
|
||||
}
|
||||
|
||||
void DeckLinkSession::HandlePlayoutFrameCompleted(IDeckLinkVideoFrame*, BMDOutputFrameCompletionResult completionResult)
|
||||
{
|
||||
if (!mOutputFrameCallback)
|
||||
return;
|
||||
|
||||
VideoIOCompletion completion;
|
||||
switch (completionResult)
|
||||
{
|
||||
case bmdOutputFrameDisplayedLate:
|
||||
completion.result = VideoIOCompletionResult::DisplayedLate;
|
||||
break;
|
||||
case bmdOutputFrameDropped:
|
||||
completion.result = VideoIOCompletionResult::Dropped;
|
||||
break;
|
||||
case bmdOutputFrameFlushed:
|
||||
completion.result = VideoIOCompletionResult::Flushed;
|
||||
break;
|
||||
case bmdOutputFrameCompleted:
|
||||
completion.result = VideoIOCompletionResult::Completed;
|
||||
break;
|
||||
default:
|
||||
completion.result = VideoIOCompletionResult::Unknown;
|
||||
break;
|
||||
}
|
||||
mOutputFrameCallback(completion);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#include "DeckLinkAPI_h.h"
|
||||
#include "DeckLinkDisplayMode.h"
|
||||
#include "DeckLinkFrameTransfer.h"
|
||||
#include "DeckLinkVideoIOFormat.h"
|
||||
#include "VideoIOFormat.h"
|
||||
#include "VideoIOTypes.h"
|
||||
#include "VideoPlayoutScheduler.h"
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
class OpenGLComposite;
|
||||
|
||||
class DeckLinkSession : public VideoIODevice
|
||||
{
|
||||
public:
|
||||
DeckLinkSession() = default;
|
||||
~DeckLinkSession();
|
||||
|
||||
void ReleaseResources() override;
|
||||
bool DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error) override;
|
||||
bool SelectPreferredFormats(const VideoFormatSelection& videoModes, std::string& error) override;
|
||||
bool ConfigureInput(InputFrameCallback callback, const VideoFormat& inputVideoMode, std::string& error) override;
|
||||
bool ConfigureOutput(OutputFrameCallback callback, const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error) override;
|
||||
bool Start() override;
|
||||
bool Stop() override;
|
||||
|
||||
bool HasInputDevice() const { return mState.hasInputDevice; }
|
||||
bool HasInputSource() const { return mState.hasInputSource; }
|
||||
void SetInputSourceMissing(bool missing) { mState.hasInputSource = !missing; }
|
||||
bool InputOutputDimensionsDiffer() const { return mState.inputFrameSize != mState.outputFrameSize; }
|
||||
const FrameSize& InputFrameSize() const { return mState.inputFrameSize; }
|
||||
const FrameSize& OutputFrameSize() const { return mState.outputFrameSize; }
|
||||
unsigned InputFrameWidth() const { return mState.inputFrameSize.width; }
|
||||
unsigned InputFrameHeight() const { return mState.inputFrameSize.height; }
|
||||
unsigned OutputFrameWidth() const { return mState.outputFrameSize.width; }
|
||||
unsigned OutputFrameHeight() const { return mState.outputFrameSize.height; }
|
||||
VideoIOPixelFormat InputPixelFormat() const { return mState.inputPixelFormat; }
|
||||
VideoIOPixelFormat OutputPixelFormat() const { return mState.outputPixelFormat; }
|
||||
bool InputIsTenBit() const { return VideoIOPixelFormatIsTenBit(mState.inputPixelFormat); }
|
||||
bool OutputIsTenBit() const { return VideoIOPixelFormatIsTenBit(mState.outputPixelFormat); }
|
||||
unsigned InputFrameRowBytes() const { return mState.inputFrameRowBytes; }
|
||||
unsigned OutputFrameRowBytes() const { return mState.outputFrameRowBytes; }
|
||||
unsigned CaptureTextureWidth() const { return mState.captureTextureWidth; }
|
||||
unsigned OutputPackTextureWidth() const { return mState.outputPackTextureWidth; }
|
||||
const std::string& FormatStatusMessage() const { return mState.formatStatusMessage; }
|
||||
const std::string& InputDisplayModeName() const { return mState.inputDisplayModeName; }
|
||||
const std::string& OutputModelName() const { return mState.outputModelName; }
|
||||
bool SupportsInternalKeying() const { return mState.supportsInternalKeying; }
|
||||
bool SupportsExternalKeying() const { return mState.supportsExternalKeying; }
|
||||
bool KeyerInterfaceAvailable() const { return mState.keyerInterfaceAvailable; }
|
||||
bool ExternalKeyingActive() const { return mState.externalKeyingActive; }
|
||||
const std::string& StatusMessage() const { return mState.statusMessage; }
|
||||
void SetStatusMessage(const std::string& message) { mState.statusMessage = message; }
|
||||
const VideoIOState& State() const override { return mState; }
|
||||
VideoIOState& MutableState() override { return mState; }
|
||||
double FrameBudgetMilliseconds() const;
|
||||
void AccountForCompletionResult(VideoIOCompletionResult completionResult) override;
|
||||
bool BeginOutputFrame(VideoIOOutputFrame& frame) override;
|
||||
void EndOutputFrame(VideoIOOutputFrame& frame) override;
|
||||
bool ScheduleOutputFrame(const VideoIOOutputFrame& frame) override;
|
||||
void HandleVideoInputFrame(IDeckLinkVideoInputFrame* inputFrame, bool hasNoInputSource);
|
||||
void HandlePlayoutFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult completionResult);
|
||||
|
||||
private:
|
||||
CComPtr<CaptureDelegate> captureDelegate;
|
||||
CComPtr<PlayoutDelegate> playoutDelegate;
|
||||
CComPtr<IDeckLinkInput> input;
|
||||
CComPtr<IDeckLinkOutput> output;
|
||||
CComPtr<IDeckLinkKeyer> keyer;
|
||||
std::deque<CComPtr<IDeckLinkMutableVideoFrame>> outputVideoFrameQueue;
|
||||
VideoIOState mState;
|
||||
VideoPlayoutScheduler mScheduler;
|
||||
InputFrameCallback mInputFrameCallback;
|
||||
OutputFrameCallback mOutputFrameCallback;
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "DeckLinkVideoIOFormat.h"
|
||||
|
||||
BMDPixelFormat DeckLinkPixelFormatForVideoIO(VideoIOPixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case VideoIOPixelFormat::V210:
|
||||
return bmdFormat10BitYUV;
|
||||
case VideoIOPixelFormat::Bgra8:
|
||||
return bmdFormat8BitBGRA;
|
||||
case VideoIOPixelFormat::Uyvy8:
|
||||
default:
|
||||
return bmdFormat8BitYUV;
|
||||
}
|
||||
}
|
||||
|
||||
VideoIOPixelFormat VideoIOPixelFormatFromDeckLink(BMDPixelFormat format)
|
||||
{
|
||||
if (format == bmdFormat10BitYUV)
|
||||
return VideoIOPixelFormat::V210;
|
||||
if (format == bmdFormat8BitBGRA)
|
||||
return VideoIOPixelFormat::Bgra8;
|
||||
return VideoIOPixelFormat::Uyvy8;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "DeckLinkAPI_h.h"
|
||||
#include "VideoIOFormat.h"
|
||||
|
||||
BMDPixelFormat DeckLinkPixelFormatForVideoIO(VideoIOPixelFormat format);
|
||||
VideoIOPixelFormat VideoIOPixelFormatFromDeckLink(BMDPixelFormat format);
|
||||
Reference in New Issue
Block a user