FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
decklink_common.h
Go to the documentation of this file.
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 
28 #include "libavutil/thread.h"
29 #include "decklink_common_c.h"
30 
31 #ifdef _WIN32
32 #define DECKLINK_BOOL BOOL
33 #else
34 #define DECKLINK_BOOL bool
35 #endif
36 
39 
40 typedef struct AVPacketQueue {
43  unsigned long long size;
48  int64_t max_q_size;
50 
51 struct decklink_ctx {
52  /* DeckLink SDK interfaces */
53  IDeckLink *dl;
54  IDeckLinkOutput *dlo;
55  IDeckLinkInput *dli;
56  IDeckLinkConfiguration *cfg;
57  IDeckLinkAttributes *attr;
60 
61  /* DeckLink mode information */
62  BMDTimeValue bmd_tb_den;
63  BMDTimeValue bmd_tb_num;
64  BMDDisplayMode bmd_mode;
65  BMDVideoConnection video_input;
66  BMDAudioConnection audio_input;
67  int bmd_width;
70 
71  /* Capture buffer queue */
73 
74  /* Streams present */
75  int audio;
76  int video;
77 
78  /* Status */
81  int64_t last_pts;
82  unsigned long frameCount;
83  unsigned int dropped;
87 
88  /* Options */
91  int64_t teletext_lines;
92  double preroll;
96  int draw_bars;
97 
100 
105 
106  int channels;
108 };
109 
111 
112 #ifdef _WIN32
113 #if BLACKMAGIC_DECKLINK_API_VERSION < 0x0a040000
114 typedef unsigned long buffercount_type;
115 #else
116 typedef unsigned int buffercount_type;
117 #endif
118 IDeckLinkIterator *CreateDeckLinkIteratorInstance(void);
119 #else
120 typedef uint32_t buffercount_type;
121 #endif
122 
123 static const BMDAudioConnection decklink_audio_connection_map[] = {
124  (BMDAudioConnection)0,
125  bmdAudioConnectionEmbedded,
126  bmdAudioConnectionAESEBU,
127  bmdAudioConnectionAnalog,
128  bmdAudioConnectionAnalogXLR,
129  bmdAudioConnectionAnalogRCA,
130  bmdAudioConnectionMicrophone,
131 };
132 
133 static const BMDVideoConnection decklink_video_connection_map[] = {
134  (BMDVideoConnection)0,
135  bmdVideoConnectionSDI,
136  bmdVideoConnectionHDMI,
137  bmdVideoConnectionOpticalSDI,
138  bmdVideoConnectionComponent,
139  bmdVideoConnectionComposite,
140  bmdVideoConnectionSVideo,
141 };
142 
143 HRESULT ff_decklink_get_display_name(IDeckLink *This, const char **displayName);
145 int ff_decklink_set_format(AVFormatContext *avctx, int width, int height, int tb_num, int tb_den, enum AVFieldOrder field_order, decklink_direction_t direction = DIRECTION_OUT, int num = 0);
146 int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t direction, int num);
147 int ff_decklink_list_devices(AVFormatContext *avctx, struct AVDeviceInfoList *device_list, int show_inputs, int show_outputs);
148 void ff_decklink_list_devices_legacy(AVFormatContext *avctx, int show_inputs, int show_outputs);
151 int ff_decklink_init_device(AVFormatContext *avctx, const char* name);
152 
153 #endif /* AVDEVICE_DECKLINK_COMMON_H */
pthread_cond_t cond
Format I/O context.
Definition: avformat.h:1342
pthread_mutex_t mutex
#define height
AVPacketList * last_pkt
uint16_t width
Definition: gdv.c:47
AVPacketList * first_pkt
unsigned long long size
Stream structure.
Definition: avformat.h:873
AVFieldOrder
Definition: avcodec.h:1496
int64_t max_q_size
AVFormatContext * avctx
List of devices.
Definition: avdevice.h:460
DWORD HRESULT
_fmutex pthread_mutex_t
Definition: os2threads.h:49
const char * name
Definition: opengl_enc.c:103