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  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVDEVICE_DECKLINK_COMMON_H
23 #define AVDEVICE_DECKLINK_COMMON_H
24 
25 #include <DeckLinkAPIVersion.h>
26 
27 #include "decklink_common_c.h"
28 
31 
32 typedef struct AVPacketQueue {
35  unsigned long long size;
41 
42 struct decklink_ctx {
43  /* DeckLink SDK interfaces */
44  IDeckLink *dl;
45  IDeckLinkOutput *dlo;
46  IDeckLinkInput *dli;
47  IDeckLinkConfiguration *cfg;
48  IDeckLinkAttributes *attr;
51 
52  /* DeckLink mode information */
53  BMDTimeValue bmd_tb_den;
54  BMDTimeValue bmd_tb_num;
55  BMDDisplayMode bmd_mode;
56  BMDVideoConnection video_input;
57  BMDAudioConnection audio_input;
58  int bmd_width;
61 
62  /* Capture buffer queue */
64 
65  /* Streams present */
66  int audio;
67  int video;
68 
69  /* Status */
72  int64_t last_pts;
73  unsigned long frameCount;
74  unsigned int dropped;
78 
79  /* Options */
82  int64_t teletext_lines;
83  double preroll;
87  int draw_bars;
88 
91 
93 
94  int channels;
95 };
96 
98 
99 #ifdef _WIN32
100 #if BLACKMAGIC_DECKLINK_API_VERSION < 0x0a040000
101 typedef unsigned long buffercount_type;
102 #else
103 typedef unsigned int buffercount_type;
104 #endif
105 IDeckLinkIterator *CreateDeckLinkIteratorInstance(void);
106 #else
107 typedef uint32_t buffercount_type;
108 #endif
109 
110 static const BMDAudioConnection decklink_audio_connection_map[] = {
111  (BMDAudioConnection)0,
112  bmdAudioConnectionEmbedded,
113  bmdAudioConnectionAESEBU,
114  bmdAudioConnectionAnalog,
115  bmdAudioConnectionAnalogXLR,
116  bmdAudioConnectionAnalogRCA,
117  bmdAudioConnectionMicrophone,
118 };
119 
120 static const BMDVideoConnection decklink_video_connection_map[] = {
121  (BMDVideoConnection)0,
122  bmdVideoConnectionSDI,
123  bmdVideoConnectionHDMI,
124  bmdVideoConnectionOpticalSDI,
125  bmdVideoConnectionComponent,
126  bmdVideoConnectionComposite,
127  bmdVideoConnectionSVideo,
128 };
129 
130 HRESULT ff_decklink_get_display_name(IDeckLink *This, const char **displayName);
131 int ff_decklink_set_format(AVFormatContext *avctx, int width, int height, int tb_num, int tb_den, decklink_direction_t direction = DIRECTION_OUT, int num = 0);
132 int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t direction, int num);
136 int ff_decklink_init_device(AVFormatContext *avctx, const char* name);
137 
138 #endif /* AVDEVICE_DECKLINK_COMMON_H */
pthread_cond_t cond
#define sem_t
Definition: semaphore.h:25
Format I/O context.
Definition: avformat.h:1338
HMTX pthread_mutex_t
Definition: os2threads.h:49
pthread_mutex_t mutex
#define height
AVPacketList * last_pkt
AVPacketList * first_pkt
unsigned long long size
#define width
Stream structure.
Definition: avformat.h:889
AVFormatContext * avctx
DWORD HRESULT
const char * name
Definition: opengl_enc.c:103