2014-02-08 20:01:26 +00:00
|
|
|
/*
|
|
|
|
* Blackmagic DeckLink output
|
|
|
|
* Copyright (c) 2013-2014 Ramiro Polla
|
|
|
|
*
|
|
|
|
* 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 "libavformat/avformat.h"
|
|
|
|
#include "libavutil/opt.h"
|
|
|
|
|
2014-09-21 23:39:50 +00:00
|
|
|
#include "decklink_common_c.h"
|
2014-02-08 20:01:26 +00:00
|
|
|
#include "decklink_enc.h"
|
|
|
|
|
|
|
|
#define OFFSET(x) offsetof(struct decklink_cctx, x)
|
|
|
|
#define ENC AV_OPT_FLAG_ENCODING_PARAM
|
|
|
|
static const AVOption options[] = {
|
2020-11-29 00:07:46 +00:00
|
|
|
{ "list_devices", "use ffmpeg -sinks decklink instead", OFFSET(list_devices), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC | AV_OPT_FLAG_DEPRECATED},
|
2014-02-08 20:01:26 +00:00
|
|
|
{ "list_formats", "list supported formats" , OFFSET(list_formats), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, ENC },
|
|
|
|
{ "preroll" , "video preroll in seconds", OFFSET(preroll ), AV_OPT_TYPE_DOUBLE, { .dbl = 0.5 }, 0, 5, ENC },
|
2021-08-13 02:47:28 +00:00
|
|
|
#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
|
|
|
|
{ "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 5, ENC, "duplex_mode"},
|
|
|
|
#else
|
2018-09-06 20:46:18 +00:00
|
|
|
{ "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 2, ENC, "duplex_mode"},
|
2021-08-13 02:47:28 +00:00
|
|
|
#endif
|
2018-09-06 20:46:18 +00:00
|
|
|
{ "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "duplex_mode"},
|
|
|
|
{ "half" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "duplex_mode"},
|
|
|
|
{ "full" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 2 }, 0, 0, ENC, "duplex_mode"},
|
2021-08-13 02:47:28 +00:00
|
|
|
#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
|
|
|
|
{ "one_sub_device_full", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 2 }, 0, 0, ENC, "duplex_mode"},
|
|
|
|
{ "one_sub_device_half", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 3 }, 0, 0, ENC, "duplex_mode"},
|
|
|
|
{ "two_sub_device_full", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 4 }, 0, 0, ENC, "duplex_mode"},
|
|
|
|
{ "four_sub_device_half", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 5 }, 0, 0, ENC, "duplex_mode"},
|
|
|
|
#endif
|
2021-08-08 23:43:34 +00:00
|
|
|
{ "link" , "single/dual/quad SDI link configuration", OFFSET(link), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, ENC, "link"},
|
|
|
|
{ "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "link"},
|
|
|
|
{ "single" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "link"},
|
|
|
|
{ "dual" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 2 }, 0, 0, ENC, "link"},
|
|
|
|
{ "quad" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 3 }, 0, 0, ENC, "link"},
|
2021-08-09 00:15:02 +00:00
|
|
|
{ "sqd" , "set Square Division" , OFFSET(sqd) , AV_OPT_TYPE_INT, { .i64 = -1 }, -1,1, ENC, "sqd"},
|
|
|
|
{ "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "sqd"},
|
|
|
|
{ "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "sqd"},
|
|
|
|
{ "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "sqd"},
|
2021-08-09 00:23:18 +00:00
|
|
|
{ "level_a" , "set SMPTE LevelA" , OFFSET(level_a) , AV_OPT_TYPE_INT, { .i64 = -1 }, -1,1, ENC, "level_a"},
|
|
|
|
{ "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "level_a"},
|
|
|
|
{ "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "level_a"},
|
|
|
|
{ "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "level_a"},
|
2018-11-25 00:38:05 +00:00
|
|
|
{ "timing_offset", "genlock timing pixel offset", OFFSET(timing_offset), AV_OPT_TYPE_INT, { .i64 = INT_MIN }, INT_MIN, INT_MAX, ENC, "timing_offset"},
|
|
|
|
{ "unset" , NULL , 0 , AV_OPT_TYPE_CONST, { .i64 = INT_MIN }, 0, 0, ENC, "timing_offset"},
|
2014-02-08 20:01:26 +00:00
|
|
|
{ NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVClass decklink_muxer_class = {
|
2019-08-13 01:55:12 +00:00
|
|
|
.class_name = "Blackmagic DeckLink outdev",
|
2014-02-08 20:01:26 +00:00
|
|
|
.item_name = av_default_item_name,
|
|
|
|
.option = options,
|
|
|
|
.version = LIBAVUTIL_VERSION_INT,
|
2014-02-22 22:32:51 +00:00
|
|
|
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
|
2014-02-08 20:01:26 +00:00
|
|
|
};
|
|
|
|
|
2021-04-19 16:56:01 +00:00
|
|
|
const AVOutputFormat ff_decklink_muxer = {
|
2014-02-08 20:01:26 +00:00
|
|
|
.name = "decklink",
|
|
|
|
.long_name = NULL_IF_CONFIG_SMALL("Blackmagic DeckLink output"),
|
|
|
|
.audio_codec = AV_CODEC_ID_PCM_S16LE,
|
2017-02-18 02:13:56 +00:00
|
|
|
.video_codec = AV_CODEC_ID_WRAPPED_AVFRAME,
|
2014-02-08 20:01:26 +00:00
|
|
|
.subtitle_codec = AV_CODEC_ID_NONE,
|
2017-02-18 02:13:56 +00:00
|
|
|
.flags = AVFMT_NOFILE,
|
2017-10-06 12:55:43 +00:00
|
|
|
.get_device_list = ff_decklink_list_output_devices,
|
2014-02-08 20:01:26 +00:00
|
|
|
.priv_class = &decklink_muxer_class,
|
|
|
|
.priv_data_size = sizeof(struct decklink_cctx),
|
|
|
|
.write_header = ff_decklink_write_header,
|
|
|
|
.write_packet = ff_decklink_write_packet,
|
|
|
|
.write_trailer = ff_decklink_write_trailer,
|
|
|
|
};
|