DeckLinkAPIStreaming.idl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. /* -LICENSE-START-
  2. ** Copyright (c) 2016 Blackmagic Design
  3. **
  4. ** Permission is hereby granted, free of charge, to any person or organization
  5. ** obtaining a copy of the software and accompanying documentation covered by
  6. ** this license (the "Software") to use, reproduce, display, distribute,
  7. ** execute, and transmit the Software, and to prepare derivative works of the
  8. ** Software, and to permit third-parties to whom the Software is furnished to
  9. ** do so, all subject to the following:
  10. **
  11. ** The copyright notices in the Software and this entire statement, including
  12. ** the above license grant, this restriction and the following disclaimer,
  13. ** must be included in all copies of the Software, in whole or in part, and
  14. ** all derivative works of the Software, unless such copies or derivative
  15. ** works are solely in the form of machine-executable object code generated by
  16. ** a source language processor.
  17. **
  18. ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
  21. ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
  22. ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
  23. ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  24. ** DEALINGS IN THE SOFTWARE.
  25. ** -LICENSE-END-
  26. */
  27. #ifndef BMD_CONST
  28. #if defined(_MSC_VER)
  29. #define BMD_CONST __declspec(selectany) static const
  30. #else
  31. #define BMD_CONST static const
  32. #endif
  33. #endif
  34. // Type Declarations
  35. // Enumeration Mapping
  36. cpp_quote("#if 0")
  37. cpp_quote("#endif")
  38. /* Enum BMDStreamingDeviceMode - Device modes */
  39. typedef [v1_enum] enum _BMDStreamingDeviceMode {
  40. bmdStreamingDeviceIdle = /* 'idle' */ 0x69646C65,
  41. bmdStreamingDeviceEncoding = /* 'enco' */ 0x656E636F,
  42. bmdStreamingDeviceStopping = /* 'stop' */ 0x73746F70,
  43. bmdStreamingDeviceUnknown = /* 'munk' */ 0x6D756E6B
  44. } BMDStreamingDeviceMode;
  45. /* Enum BMDStreamingEncodingFrameRate - Encoded frame rates */
  46. typedef [v1_enum] enum _BMDStreamingEncodingFrameRate {
  47. /* Interlaced rates */
  48. bmdStreamingEncodedFrameRate50i = /* 'e50i' */ 0x65353069,
  49. bmdStreamingEncodedFrameRate5994i = /* 'e59i' */ 0x65353969,
  50. bmdStreamingEncodedFrameRate60i = /* 'e60i' */ 0x65363069,
  51. /* Progressive rates */
  52. bmdStreamingEncodedFrameRate2398p = /* 'e23p' */ 0x65323370,
  53. bmdStreamingEncodedFrameRate24p = /* 'e24p' */ 0x65323470,
  54. bmdStreamingEncodedFrameRate25p = /* 'e25p' */ 0x65323570,
  55. bmdStreamingEncodedFrameRate2997p = /* 'e29p' */ 0x65323970,
  56. bmdStreamingEncodedFrameRate30p = /* 'e30p' */ 0x65333070,
  57. bmdStreamingEncodedFrameRate50p = /* 'e50p' */ 0x65353070,
  58. bmdStreamingEncodedFrameRate5994p = /* 'e59p' */ 0x65353970,
  59. bmdStreamingEncodedFrameRate60p = /* 'e60p' */ 0x65363070
  60. } BMDStreamingEncodingFrameRate;
  61. /* Enum BMDStreamingEncodingSupport - Output encoding mode supported flag */
  62. typedef [v1_enum] enum _BMDStreamingEncodingSupport {
  63. bmdStreamingEncodingModeNotSupported = 0,
  64. bmdStreamingEncodingModeSupported,
  65. bmdStreamingEncodingModeSupportedWithChanges
  66. } BMDStreamingEncodingSupport;
  67. /* Enum BMDStreamingVideoCodec - Video codecs */
  68. typedef [v1_enum] enum _BMDStreamingVideoCodec {
  69. bmdStreamingVideoCodecH264 = /* 'H264' */ 0x48323634
  70. } BMDStreamingVideoCodec;
  71. /* Enum BMDStreamingH264Profile - H264 encoding profile */
  72. typedef [v1_enum] enum _BMDStreamingH264Profile {
  73. bmdStreamingH264ProfileHigh = /* 'high' */ 0x68696768,
  74. bmdStreamingH264ProfileMain = /* 'main' */ 0x6D61696E,
  75. bmdStreamingH264ProfileBaseline = /* 'base' */ 0x62617365
  76. } BMDStreamingH264Profile;
  77. /* Enum BMDStreamingH264Level - H264 encoding level */
  78. typedef [v1_enum] enum _BMDStreamingH264Level {
  79. bmdStreamingH264Level12 = /* 'lv12' */ 0x6C763132,
  80. bmdStreamingH264Level13 = /* 'lv13' */ 0x6C763133,
  81. bmdStreamingH264Level2 = /* 'lv2 ' */ 0x6C763220,
  82. bmdStreamingH264Level21 = /* 'lv21' */ 0x6C763231,
  83. bmdStreamingH264Level22 = /* 'lv22' */ 0x6C763232,
  84. bmdStreamingH264Level3 = /* 'lv3 ' */ 0x6C763320,
  85. bmdStreamingH264Level31 = /* 'lv31' */ 0x6C763331,
  86. bmdStreamingH264Level32 = /* 'lv32' */ 0x6C763332,
  87. bmdStreamingH264Level4 = /* 'lv4 ' */ 0x6C763420,
  88. bmdStreamingH264Level41 = /* 'lv41' */ 0x6C763431,
  89. bmdStreamingH264Level42 = /* 'lv42' */ 0x6C763432
  90. } BMDStreamingH264Level;
  91. /* Enum BMDStreamingH264EntropyCoding - H264 entropy coding */
  92. typedef [v1_enum] enum _BMDStreamingH264EntropyCoding {
  93. bmdStreamingH264EntropyCodingCAVLC = /* 'EVLC' */ 0x45564C43,
  94. bmdStreamingH264EntropyCodingCABAC = /* 'EBAC' */ 0x45424143
  95. } BMDStreamingH264EntropyCoding;
  96. /* Enum BMDStreamingAudioCodec - Audio codecs */
  97. typedef [v1_enum] enum _BMDStreamingAudioCodec {
  98. bmdStreamingAudioCodecAAC = /* 'AAC ' */ 0x41414320
  99. } BMDStreamingAudioCodec;
  100. /* Enum BMDStreamingEncodingModePropertyID - Encoding mode properties */
  101. typedef [v1_enum] enum _BMDStreamingEncodingModePropertyID {
  102. /* Integers, Video Properties */
  103. bmdStreamingEncodingPropertyVideoFrameRate = /* 'vfrt' */ 0x76667274, // Uses values of type BMDStreamingEncodingFrameRate
  104. bmdStreamingEncodingPropertyVideoBitRateKbps = /* 'vbrt' */ 0x76627274,
  105. /* Integers, H264 Properties */
  106. bmdStreamingEncodingPropertyH264Profile = /* 'hprf' */ 0x68707266,
  107. bmdStreamingEncodingPropertyH264Level = /* 'hlvl' */ 0x686C766C,
  108. bmdStreamingEncodingPropertyH264EntropyCoding = /* 'hent' */ 0x68656E74,
  109. /* Flags, H264 Properties */
  110. bmdStreamingEncodingPropertyH264HasBFrames = /* 'hBfr' */ 0x68426672,
  111. /* Integers, Audio Properties */
  112. bmdStreamingEncodingPropertyAudioCodec = /* 'acdc' */ 0x61636463,
  113. bmdStreamingEncodingPropertyAudioSampleRate = /* 'asrt' */ 0x61737274,
  114. bmdStreamingEncodingPropertyAudioChannelCount = /* 'achc' */ 0x61636863,
  115. bmdStreamingEncodingPropertyAudioBitRateKbps = /* 'abrt' */ 0x61627274
  116. } BMDStreamingEncodingModePropertyID;
  117. // Forward Declarations
  118. interface IBMDStreamingDeviceNotificationCallback;
  119. interface IBMDStreamingH264InputCallback;
  120. interface IBMDStreamingDiscovery;
  121. interface IBMDStreamingVideoEncodingMode;
  122. interface IBMDStreamingMutableVideoEncodingMode;
  123. interface IBMDStreamingVideoEncodingModePresetIterator;
  124. interface IBMDStreamingDeviceInput;
  125. interface IBMDStreamingH264NALPacket;
  126. interface IBMDStreamingAudioPacket;
  127. interface IBMDStreamingMPEG2TSPacket;
  128. interface IBMDStreamingH264NALParser;
  129. /* Interface IBMDStreamingDeviceNotificationCallback - Device notification callbacks. */
  130. [
  131. object,
  132. uuid(F9531D64-3305-4B29-A387-7F74BB0D0E84),
  133. helpstring("Device notification callbacks.")
  134. ] interface IBMDStreamingDeviceNotificationCallback : IUnknown
  135. {
  136. HRESULT StreamingDeviceArrived([in] IDeckLink* device);
  137. HRESULT StreamingDeviceRemoved([in] IDeckLink* device);
  138. HRESULT StreamingDeviceModeChanged([in] IDeckLink* device, [in] BMDStreamingDeviceMode mode);
  139. };
  140. /* Interface IBMDStreamingH264InputCallback - H264 input callbacks. */
  141. [
  142. object,
  143. uuid(823C475F-55AE-46F9-890C-537CC5CEDCCA),
  144. helpstring("H264 input callbacks.")
  145. ] interface IBMDStreamingH264InputCallback : IUnknown
  146. {
  147. HRESULT H264NALPacketArrived([in] IBMDStreamingH264NALPacket* nalPacket);
  148. HRESULT H264AudioPacketArrived([in] IBMDStreamingAudioPacket* audioPacket);
  149. HRESULT MPEG2TSPacketArrived([in] IBMDStreamingMPEG2TSPacket* tsPacket);
  150. HRESULT H264VideoInputConnectorScanningChanged(void);
  151. HRESULT H264VideoInputConnectorChanged(void);
  152. HRESULT H264VideoInputModeChanged(void);
  153. };
  154. /* Interface IBMDStreamingDiscovery - Installs device notifications */
  155. [
  156. object,
  157. uuid(2C837444-F989-4D87-901A-47C8A36D096D),
  158. helpstring("Installs device notifications")
  159. ] interface IBMDStreamingDiscovery : IUnknown
  160. {
  161. HRESULT InstallDeviceNotifications([in] IBMDStreamingDeviceNotificationCallback* theCallback);
  162. HRESULT UninstallDeviceNotifications(void);
  163. };
  164. /* Interface IBMDStreamingVideoEncodingMode - Represents an encoded video mode. */
  165. [
  166. object,
  167. uuid(1AB8035B-CD13-458D-B6DF-5E8F7C2141D9),
  168. helpstring("Represents an encoded video mode.")
  169. ] interface IBMDStreamingVideoEncodingMode : IUnknown
  170. {
  171. HRESULT GetName([out] BSTR *name);
  172. unsigned int GetPresetID(void);
  173. unsigned int GetSourcePositionX(void);
  174. unsigned int GetSourcePositionY(void);
  175. unsigned int GetSourceWidth(void);
  176. unsigned int GetSourceHeight(void);
  177. unsigned int GetDestWidth(void);
  178. unsigned int GetDestHeight(void);
  179. HRESULT GetFlag([in] BMDStreamingEncodingModePropertyID cfgID, [out] BOOL* value);
  180. HRESULT GetInt([in] BMDStreamingEncodingModePropertyID cfgID, [out] LONGLONG* value);
  181. HRESULT GetFloat([in] BMDStreamingEncodingModePropertyID cfgID, [out] double* value);
  182. HRESULT GetString([in] BMDStreamingEncodingModePropertyID cfgID, [out] BSTR *value);
  183. HRESULT CreateMutableVideoEncodingMode([out] IBMDStreamingMutableVideoEncodingMode** newEncodingMode); // Creates a mutable copy of the encoding mode
  184. };
  185. /* Interface IBMDStreamingMutableVideoEncodingMode - Represents a mutable encoded video mode. */
  186. [
  187. object,
  188. uuid(19BF7D90-1E0A-400D-B2C6-FFC4E78AD49D),
  189. helpstring("Represents a mutable encoded video mode.")
  190. ] interface IBMDStreamingMutableVideoEncodingMode : IBMDStreamingVideoEncodingMode
  191. {
  192. HRESULT SetSourceRect([in] unsigned int posX, [in] unsigned int posY, [in] unsigned int width, [in] unsigned int height);
  193. HRESULT SetDestSize([in] unsigned int width, [in] unsigned int height);
  194. HRESULT SetFlag([in] BMDStreamingEncodingModePropertyID cfgID, [in] BOOL value);
  195. HRESULT SetInt([in] BMDStreamingEncodingModePropertyID cfgID, [in] LONGLONG value);
  196. HRESULT SetFloat([in] BMDStreamingEncodingModePropertyID cfgID, [in] double value);
  197. HRESULT SetString([in] BMDStreamingEncodingModePropertyID cfgID, [in] BSTR value);
  198. };
  199. /* Interface IBMDStreamingVideoEncodingModePresetIterator - Enumerates encoding mode presets */
  200. [
  201. object,
  202. uuid(7AC731A3-C950-4AD0-804A-8377AA51C6C4),
  203. helpstring("Enumerates encoding mode presets")
  204. ] interface IBMDStreamingVideoEncodingModePresetIterator : IUnknown
  205. {
  206. HRESULT Next([out] IBMDStreamingVideoEncodingMode** videoEncodingMode);
  207. };
  208. /* Interface IBMDStreamingDeviceInput - Created by QueryInterface from IDeckLink */
  209. [
  210. object,
  211. uuid(24B6B6EC-1727-44BB-9818-34FF086ACF98),
  212. helpstring("Created by QueryInterface from IDeckLink")
  213. ] interface IBMDStreamingDeviceInput : IUnknown
  214. {
  215. /* Input modes */
  216. HRESULT DoesSupportVideoInputMode([in] BMDDisplayMode inputMode, [out] BOOL* result);
  217. HRESULT GetVideoInputModeIterator([out] IDeckLinkDisplayModeIterator** iterator);
  218. HRESULT SetVideoInputMode([in] BMDDisplayMode inputMode);
  219. HRESULT GetCurrentDetectedVideoInputMode([out] BMDDisplayMode* detectedMode);
  220. /* Capture modes */
  221. HRESULT GetVideoEncodingMode([out] IBMDStreamingVideoEncodingMode** encodingMode);
  222. HRESULT GetVideoEncodingModePresetIterator([in] BMDDisplayMode inputMode, [out] IBMDStreamingVideoEncodingModePresetIterator** iterator);
  223. HRESULT DoesSupportVideoEncodingMode([in] BMDDisplayMode inputMode, [in] IBMDStreamingVideoEncodingMode* encodingMode, [out] BMDStreamingEncodingSupport* result, [out] IBMDStreamingVideoEncodingMode** changedEncodingMode);
  224. HRESULT SetVideoEncodingMode([in] IBMDStreamingVideoEncodingMode* encodingMode);
  225. /* Input control */
  226. HRESULT StartCapture(void);
  227. HRESULT StopCapture(void);
  228. HRESULT SetCallback([in] IUnknown* theCallback);
  229. };
  230. /* Interface IBMDStreamingH264NALPacket - Represent an H.264 NAL packet */
  231. [
  232. object,
  233. uuid(E260E955-14BE-4395-9775-9F02CC0A9D89),
  234. helpstring("Represent an H.264 NAL packet")
  235. ] interface IBMDStreamingH264NALPacket : IUnknown
  236. {
  237. long GetPayloadSize(void);
  238. HRESULT GetBytes([out] void** buffer);
  239. HRESULT GetBytesWithSizePrefix([out] void** buffer); // Contains a 32-bit unsigned big endian size prefix
  240. HRESULT GetDisplayTime([in] ULONGLONG requestedTimeScale, [out] ULONGLONG* displayTime);
  241. HRESULT GetPacketIndex([out] unsigned int* packetIndex); // Deprecated
  242. };
  243. /* Interface IBMDStreamingAudioPacket - Represents a chunk of audio data */
  244. [
  245. object,
  246. uuid(D9EB5902-1AD2-43F4-9E2C-3CFA50B5EE19),
  247. helpstring("Represents a chunk of audio data")
  248. ] interface IBMDStreamingAudioPacket : IUnknown
  249. {
  250. BMDStreamingAudioCodec GetCodec(void);
  251. long GetPayloadSize(void);
  252. HRESULT GetBytes([out] void** buffer);
  253. HRESULT GetPlayTime([in] ULONGLONG requestedTimeScale, [out] ULONGLONG* playTime);
  254. HRESULT GetPacketIndex([out] unsigned int* packetIndex); // Deprecated
  255. };
  256. /* Interface IBMDStreamingMPEG2TSPacket - Represent an MPEG2 Transport Stream packet */
  257. [
  258. object,
  259. uuid(91810D1C-4FB3-4AAA-AE56-FA301D3DFA4C),
  260. helpstring("Represent an MPEG2 Transport Stream packet")
  261. ] interface IBMDStreamingMPEG2TSPacket : IUnknown
  262. {
  263. long GetPayloadSize(void);
  264. HRESULT GetBytes([out] void** buffer);
  265. };
  266. /* Interface IBMDStreamingH264NALParser - For basic NAL parsing */
  267. [
  268. object,
  269. uuid(5867F18C-5BFA-4CCC-B2A7-9DFD140417D2),
  270. helpstring("For basic NAL parsing")
  271. ] interface IBMDStreamingH264NALParser : IUnknown
  272. {
  273. HRESULT IsNALSequenceParameterSet([in] IBMDStreamingH264NALPacket* nal);
  274. HRESULT IsNALPictureParameterSet([in] IBMDStreamingH264NALPacket* nal);
  275. HRESULT GetProfileAndLevelFromSPS([in] IBMDStreamingH264NALPacket* nal, [out] unsigned int* profileIdc, [out] unsigned int* profileCompatability, [out] unsigned int* levelIdc);
  276. };
  277. /* Coclasses */
  278. importlib("stdole2.tlb");
  279. [
  280. uuid(23A4EDF5-A0E5-432C-94EF-3BABB5F81C82),
  281. helpstring("CBMDStreamingDiscovery Class")
  282. ] coclass CBMDStreamingDiscovery
  283. {
  284. [default] interface IBMDStreamingDiscovery;
  285. };
  286. [
  287. uuid(7753EFBD-951C-407C-97A5-23C737B73B52),
  288. helpstring("CBMDStreamingH264NALParser Class")
  289. ] coclass CBMDStreamingH264NALParser
  290. {
  291. [default] interface IBMDStreamingH264NALParser;
  292. };