2 * Blackmagic DeckLink common code
3 * Copyright (c) 2013-2014 Ramiro Polla, Luca Barbato, Deti Fliegl
5 * This file is part of FFmpeg.
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.
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.
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
22 #ifndef AVDEVICE_DECKLINK_COMMON_H
23 #define AVDEVICE_DECKLINK_COMMON_H
25 #include <DeckLinkAPIVersion.h>
27 #include "libavutil/thread.h"
28 #include "decklink_common_c.h"
30 class decklink_output_callback;
31 class decklink_input_callback;
33 typedef struct AVPacketQueue {
34 AVPacketList *first_pkt, *last_pkt;
36 unsigned long long size;
38 pthread_mutex_t mutex;
40 AVFormatContext *avctx;
44 /* DeckLink SDK interfaces */
48 IDeckLinkConfiguration *cfg;
49 IDeckLinkAttributes *attr;
50 decklink_output_callback *output_callback;
51 decklink_input_callback *input_callback;
53 /* DeckLink mode information */
54 BMDTimeValue bmd_tb_den;
55 BMDTimeValue bmd_tb_num;
56 BMDDisplayMode bmd_mode;
57 BMDVideoConnection video_input;
58 BMDAudioConnection audio_input;
61 int bmd_field_dominance;
63 /* Capture buffer queue */
74 unsigned long frameCount;
78 AVStream *teletext_st;
83 int64_t teletext_lines;
86 DecklinkPtsSource audio_pts_source;
87 DecklinkPtsSource video_pts_source;
93 pthread_mutex_t mutex;
95 int frames_buffer_available_spots;
100 typedef enum { DIRECTION_IN, DIRECTION_OUT} decklink_direction_t;
103 #if BLACKMAGIC_DECKLINK_API_VERSION < 0x0a040000
104 typedef unsigned long buffercount_type;
106 typedef unsigned int buffercount_type;
108 IDeckLinkIterator *CreateDeckLinkIteratorInstance(void);
110 typedef uint32_t buffercount_type;
113 static const BMDAudioConnection decklink_audio_connection_map[] = {
114 (BMDAudioConnection)0,
115 bmdAudioConnectionEmbedded,
116 bmdAudioConnectionAESEBU,
117 bmdAudioConnectionAnalog,
118 bmdAudioConnectionAnalogXLR,
119 bmdAudioConnectionAnalogRCA,
120 bmdAudioConnectionMicrophone,
123 static const BMDVideoConnection decklink_video_connection_map[] = {
124 (BMDVideoConnection)0,
125 bmdVideoConnectionSDI,
126 bmdVideoConnectionHDMI,
127 bmdVideoConnectionOpticalSDI,
128 bmdVideoConnectionComponent,
129 bmdVideoConnectionComposite,
130 bmdVideoConnectionSVideo,
133 HRESULT ff_decklink_get_display_name(IDeckLink *This, const char **displayName);
134 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);
135 int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t direction, int num);
136 int ff_decklink_list_devices(AVFormatContext *avctx);
137 int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direction = DIRECTION_OUT);
138 void ff_decklink_cleanup(AVFormatContext *avctx);
139 int ff_decklink_init_device(AVFormatContext *avctx, const char* name);
141 #endif /* AVDEVICE_DECKLINK_COMMON_H */