From patchwork Mon Aug 9 23:38:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29383 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp3301001ioh; Mon, 9 Aug 2021 16:38:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE/tea+a9kkKi3xHIVB+iqIRGSPEreNZ3r1akK2eIL+DMcWNztZAgC3MbO4ZQsGBC6aDw8 X-Received: by 2002:a05:6402:3550:: with SMTP id f16mr462374edd.191.1628552303328; Mon, 09 Aug 2021 16:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628552303; cv=none; d=google.com; s=arc-20160816; b=yOWsb6Yiq+ehwtEcbL+O00bETAKCV5Dt4TH7xLFrH0HoLcNqjvhGk/nMZ2zGAusWge dOs2XzzyzJx/RourzJr6ZAB87GS6j7atbeeAgs5ZSIUcBqQtQN4gC/763/hf2fkLZone AVX/8imSkbZDK8I8xVMeSoxU6iCBVKeRuwh4VbAKOx5PMtGMTxI9OoIlsC7xhde09ywr WKGyqTUEglu2XM/mXz/t50gtDnfej9FnyIzVnpRhI9frPCJUwKgztZ/BX2jK9Q092SEW gfgunNA9emK9yC+7leMpIMJHFoSdgOGcFyeFYJnCyTDLBg91zBJZDCVnJTmEMbVi7gD/ C1fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=E7ush+4HhxELXh/0vI3vv83r2YYUsGpeeHxAj8bF69g=; b=Oh7QJB9KpdNMn09fcxwkGiHv23za8McvRfHs8n7BUtKSSlw8f2wqKZeeI9aq1VxDLg TlJcSJZKp+PDbOuCFxybqUk7Z7k7IL5huJclt7xtykIvrwZ0ZgqXaCTZGQn5PkG2F/6f v2y/npX2+gYxBPqPDyK+Jjxw97oYC1sGjj5da5DoOIYjTz1RM4k+APuAiGrxG4pIHCAd iQy3NCuprxgxrEJm8R6E19/tPu8UK0BGXFGV55HVtxz2eZFWZdo2GnOLhuP7d0V5EP+a 118WOTMKWN9DSrnvgwly9LDN+ZvhY2Wu9n6zWpg3l9XCoW601QEyab3EDjiEXW4VZuKs S/Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Jt98OXUV; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p15si5443264edq.262.2021.08.09.16.38.22; Mon, 09 Aug 2021 16:38:23 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Jt98OXUV; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4589B6805B8; Tue, 10 Aug 2021 02:38:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ABD5168A273 for ; Tue, 10 Aug 2021 02:38:11 +0300 (EEST) Received: by mail-pj1-f45.google.com with SMTP id mq2-20020a17090b3802b0290178911d298bso2536965pjb.1 for ; Mon, 09 Aug 2021 16:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7Q08b6vSLBapfRZ04vf1yB7zsORN0JujvXwPhcSqgHw=; b=Jt98OXUVEen1F82MA6qYqsNVtUfumalFt+xPhi4wdngPubvoNK+P38aZxrKAFHR9ZQ gsCDch6qt87Tf9ld0RJc7Ix0f5yaRpvr/AuG3kzwDpfqUl638Mt4GCT2uGXNNrc/lCO9 rM7uJO/MEC+jzXaRJwT0p2VslXNxl2nURb78OU7868OBL8SRjm9vr3M5+QFIyLo8WVJI Ke7f3jlqJcOxIr+VJDyqLNGm7A1tl4tTMhfBTbiH2g7OV2KhqHhBPrlmbNRa2oCB4s7O rQYMY9CXB6lpT9+xCsu9CWfZ48O+5PncZ6/v3BJjdkIvipLl8xAJ8W4bKuFZ3b7uVq+/ BhVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7Q08b6vSLBapfRZ04vf1yB7zsORN0JujvXwPhcSqgHw=; b=FgOJGFVCtBzE0iS8+CuPZFkm7ludueLLPDeMo1a4f7JQiZDNELgnSRTbdyGVJIAa5e qYPya4ecdKUiAryfdah8HQAcv+N7+i7cKNVSHPpgP9XG2hiiwXW0vtwT3j92Wz/QCT9/ IJW0WozDUs5HCTDZA6hq23/kIiyTu6I8SgRg4gQ17nJXlDu1ozexol+JdSRNDppQeVqK nb/37V3PTLvED/aWXNs5Ig7hJbRUI2Rpj4/FPbE0VjTaCKn2EjqDxtrdqUm4W9RMK2O7 VlwDDb8/5pdzmexEAVxozwd9jQ9QNdIT8axjgjC9jhwGXWHHX5l43yUGH3VpmBhYjIke T6fA== X-Gm-Message-State: AOAM5303a7uKQKTPDcJSqRwVr+AYNbNhYtFqMF0DVEIy6OmH3clc9tP0 4lv7mAls+2f1DXwuNYYYLPozGAniNTM= X-Received: by 2002:a17:90b:e82:: with SMTP id fv2mr1615961pjb.99.1628552289640; Mon, 09 Aug 2021 16:38:09 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id n33sm21879307pfv.96.2021.08.09.16.38.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Aug 2021 16:38:09 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Aug 2021 07:38:00 +0800 Message-Id: <1628552283-26880-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628037188-8826-1-git-send-email-lance.lmwang@gmail.com> References: <1628037188-8826-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v3 1/4] avdevice/decklink: add link configuration X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1xHZ782WiS00 From: Limin Wang Signed-off-by: Limin Wang --- doc/outdevs.texi | 6 ++++++ libavdevice/decklink_common.cpp | 9 +++++++++ libavdevice/decklink_common.h | 8 ++++++++ libavdevice/decklink_common_c.h | 1 + libavdevice/decklink_enc.cpp | 2 ++ libavdevice/decklink_enc_c.c | 5 +++++ 6 files changed, 31 insertions(+) diff --git a/doc/outdevs.texi b/doc/outdevs.texi index aaf2479..f046b23 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -205,6 +205,12 @@ Defaults to @samp{unset}. Sets the genlock timing pixel offset on the used output. Defaults to @samp{unset}. +@item link +Sets the SDI video link configuration on the used output. Must be +@samp{unset}, @samp{single} link SDI, @samp{dual} link SDI or @samp{quad} link +SDI. +Defaults to @samp{unset}. + @end table @subsection Examples diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index 24aa9b1..4e0df04 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -214,6 +214,15 @@ int ff_decklink_set_configs(AVFormatContext *avctx, if (res != S_OK) av_log(avctx, AV_LOG_WARNING, "Setting timing offset failed.\n"); } + + if (direction == DIRECTION_OUT && ctx->link > 0) { + res = ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, ctx->link); + if (res != S_OK) + av_log(avctx, AV_LOG_WARNING, "Setting link configuration failed.\n"); + else + av_log(avctx, AV_LOG_VERBOSE, "Successfully set link configuration: 0x%x.\n", ctx->link); + } + return 0; } diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h index 6e03295..ad8b33c 100644 --- a/libavdevice/decklink_common.h +++ b/libavdevice/decklink_common.h @@ -131,6 +131,7 @@ struct decklink_ctx { int64_t teletext_lines; double preroll; int duplex_mode; + BMDLinkConfiguration link; DecklinkPtsSource audio_pts_source; DecklinkPtsSource video_pts_source; int draw_bars; @@ -200,6 +201,13 @@ static const BMDTimecodeFormat decklink_timecode_format_map[] = { #endif }; +static const BMDLinkConfiguration decklink_link_conf_map[] = { + (BMDLinkConfiguration)0, + bmdLinkConfigurationSingleLink, + bmdLinkConfigurationDualLink, + bmdLinkConfigurationQuadLink +}; + int ff_decklink_set_configs(AVFormatContext *avctx, decklink_direction_t direction); 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 ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t direction); diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h index 68978fa..f37e0c0 100644 --- a/libavdevice/decklink_common_c.h +++ b/libavdevice/decklink_common_c.h @@ -48,6 +48,7 @@ struct decklink_cctx { int audio_channels; int audio_depth; int duplex_mode; + int link; DecklinkPtsSource audio_pts_source; DecklinkPtsSource video_pts_source; int audio_input; diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index 4c1eb05..6dec5f3 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -559,6 +559,8 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) ctx->list_formats = cctx->list_formats; ctx->preroll = cctx->preroll; ctx->duplex_mode = cctx->duplex_mode; + if (cctx->link > 0 && (unsigned int)cctx->link < FF_ARRAY_ELEMS(decklink_link_conf_map)) + ctx->link = decklink_link_conf_map[cctx->link]; cctx->ctx = ctx; #if CONFIG_LIBKLVANC if (klvanc_context_create(&ctx->vanc_ctx) < 0) { diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c index 828cf5d..4d191d8 100644 --- a/libavdevice/decklink_enc_c.c +++ b/libavdevice/decklink_enc_c.c @@ -35,6 +35,11 @@ static const AVOption options[] = { { "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"}, + { "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"}, { "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"}, { NULL },