1 /*
2 * Blackmagic DeckLink common code
3 * Copyright (c) 2013-2014 Ramiro Polla, Luca Barbato, Deti Fliegl
4 * Copyright (c) 2017 Akamai Technologies, Inc.
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef AVDEVICE_DECKLINK_COMMON_H
24 #define AVDEVICE_DECKLINK_COMMON_H
25
26 #include <DeckLinkAPIVersion.h>
27 #if BLACKMAGIC_DECKLINK_API_VERSION < 0x0b000000
28 #define IID_IDeckLinkProfileAttributes IID_IDeckLinkAttributes
29 #define IDeckLinkProfileAttributes IDeckLinkAttributes
30 #endif
31
32 extern "C" {
34 }
37 #if CONFIG_LIBKLVANC
38 #include "libklvanc/vanc.h"
39 #endif
40
41 #ifdef _WIN32
42 #define DECKLINK_BOOL BOOL
43 #else
44 #define DECKLINK_BOOL bool
45 #endif
46
47 #ifdef _WIN32
49 {
51 int l = WideCharToMultiByte(CP_UTF8, 0,
w, -1, 0, 0, 0, 0);
54 WideCharToMultiByte(CP_UTF8, 0,
w, -1,
s, l, 0, 0);
56 }
57 #define DECKLINK_STR OLECHAR *
58 #define DECKLINK_STRDUP dup_wchar_to_utf8
59 #define DECKLINK_FREE(s) SysFreeString(s)
60 #elif defined(__APPLE__)
61 static char *dup_cfstring_to_utf8(CFStringRef
w)
62 {
64 CFStringGetCString(
w,
s, 255, kCFStringEncodingUTF8);
66 }
67 #define DECKLINK_STR const __CFString *
68 #define DECKLINK_STRDUP dup_cfstring_to_utf8
69 #define DECKLINK_FREE(s) CFRelease(s)
70 #else
71 #define DECKLINK_STR const char *
72 #define DECKLINK_STRDUP av_strdup
73 /* free() is needed for a string returned by the DeckLink SDL. */
74 #define DECKLINK_FREE(s) free((void *) s)
75 #endif
76
79
90
92 /* DeckLink SDK interfaces */
96 IDeckLinkConfiguration *
cfg;
99
100 /* DeckLink mode information */
111
112 /* Capture buffer queue */
114
115 /* Streams present */
118
119 /* Status */
129
130 /* Options */
142
145
150
151 #if CONFIG_LIBKLVANC
152 struct klvanc_context_s *vanc_ctx;
153 #endif
154
157 unsigned long tc_seen;
// used with option wait_for_tc
158 };
159
161
163 (BMDPixelFormat)0,
164 bmdFormat8BitYUV,
165 bmdFormat10BitYUV,
166 bmdFormat8BitARGB,
167 bmdFormat8BitBGRA,
168 bmdFormat10BitRGB,
169 };
170
172 (BMDAudioConnection)0,
173 bmdAudioConnectionEmbedded,
174 bmdAudioConnectionAESEBU,
175 bmdAudioConnectionAnalog,
176 bmdAudioConnectionAnalogXLR,
177 bmdAudioConnectionAnalogRCA,
178 bmdAudioConnectionMicrophone,
179 };
180
182 (BMDVideoConnection)0,
183 bmdVideoConnectionSDI,
184 bmdVideoConnectionHDMI,
185 bmdVideoConnectionOpticalSDI,
186 bmdVideoConnectionComponent,
187 bmdVideoConnectionComposite,
188 bmdVideoConnectionSVideo,
189 };
190
192 (BMDTimecodeFormat)0,
193 bmdTimecodeRP188VITC1,
194 bmdTimecodeRP188VITC2,
195 bmdTimecodeRP188LTC,
196 bmdTimecodeRP188Any,
197 bmdTimecodeVITC,
198 bmdTimecodeVITCField2,
199 bmdTimecodeSerial,
200 #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
201 bmdTimecodeRP188HighFrameRate,
202 #else
203 (BMDTimecodeFormat)0,
204 #endif
205 };
206
208 (BMDLinkConfiguration)0,
209 bmdLinkConfigurationSingleLink,
210 bmdLinkConfigurationDualLink,
211 bmdLinkConfigurationQuadLink
212 };
213
214 #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
215 static const BMDProfileID decklink_profile_id_map[] = {
216 (BMDProfileID)0,
217 bmdProfileTwoSubDevicesHalfDuplex,
218 bmdProfileOneSubDeviceFullDuplex,
219 bmdProfileOneSubDeviceHalfDuplex,
220 bmdProfileTwoSubDevicesFullDuplex,
221 bmdProfileFourSubDevicesHalfDuplex,
222 };
223 #endif
224
233
234 #endif /* AVDEVICE_DECKLINK_COMMON_H */