summaryrefslogtreecommitdiff
path: root/libavdevice/decklink_common.h
diff options
context:
space:
mode:
authorDeti Fliegl <deti@fliegl.de>2014-09-22 01:39:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-22 01:39:50 +0200
commita5e040ee3c757f4673e3c7202e823490593f21d7 (patch)
tree2f50e968b94ee3af5ae8ecbfb7249d8d582ae186 /libavdevice/decklink_common.h
parent56b8d106769c5c5f9174dcc426f1ee2f991428b1 (diff)
downloadffmpeg-a5e040ee3c757f4673e3c7202e823490593f21d7.tar.gz
avdevice/decklink: move general code of decklink encoder to common file
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/decklink_common.h')
-rw-r--r--libavdevice/decklink_common.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
new file mode 100644
index 0000000000..544da27836
--- /dev/null
+++ b/libavdevice/decklink_common.h
@@ -0,0 +1,98 @@
+/*
+ * Blackmagic DeckLink common code
+ * Copyright (c) 2013-2014 Ramiro Polla, Luca Barbato, Deti Fliegl
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "decklink_common_c.h"
+
+class decklink_output_callback;
+class decklink_input_callback;
+
+typedef struct AVPacketQueue {
+ AVPacketList *first_pkt, *last_pkt;
+ int nb_packets;
+ unsigned long long size;
+ int abort_request;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ AVFormatContext *avctx;
+} AVPacketQueue;
+
+struct decklink_ctx {
+ /* DeckLink SDK interfaces */
+ IDeckLink *dl;
+ IDeckLinkOutput *dlo;
+ IDeckLinkInput *dli;
+ decklink_output_callback *output_callback;
+ decklink_input_callback *input_callback;
+
+ /* DeckLink mode information */
+ BMDTimeValue bmd_tb_den;
+ BMDTimeValue bmd_tb_num;
+ BMDDisplayMode bmd_mode;
+ int bmd_width;
+ int bmd_height;
+ int bmd_field_dominance;
+
+ /* Capture buffer queue */
+ AVPacketQueue queue;
+
+ /* Streams present */
+ int audio;
+ int video;
+
+ /* Status */
+ int playback_started;
+ int capture_started;
+ int64_t last_pts;
+ unsigned long frameCount;
+ unsigned int dropped;
+ AVStream *audio_st;
+ AVStream *video_st;
+
+ /* Options */
+ int list_devices;
+ int list_formats;
+ double preroll;
+
+ int frames_preroll;
+ int frames_buffer;
+
+ sem_t semaphore;
+
+ int channels;
+};
+
+typedef enum { DIRECTION_IN, DIRECTION_OUT} decklink_direction_t;
+
+#ifdef _WIN32
+typedef unsigned long buffercount_type;
+IDeckLinkIterator *CreateDeckLinkIteratorInstance(void);
+char *dup_wchar_to_utf8(wchar_t *w);
+#else
+typedef uint32_t buffercount_type;
+#endif
+
+
+HRESULT ff_decklink_get_display_name(IDeckLink *This, const char **displayName);
+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);
+int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t direction, int num);
+int ff_decklink_list_devices(AVFormatContext *avctx);
+int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direction = DIRECTION_OUT);
+