From patchwork Fri Aug 6 01:24:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29304 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp91684ioh; Thu, 5 Aug 2021 18:25:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzehIY7SUiyldI3vQUYwGR6lER8NsTV5dKYoGeFvudXrj52FUrQagJtC5dkwpqiv1gVTQV2 X-Received: by 2002:a17:906:e54:: with SMTP id q20mr7694324eji.86.1628213109321; Thu, 05 Aug 2021 18:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628213109; cv=none; d=google.com; s=arc-20160816; b=dOHaw5w6qHmIYj31h+Znr+7ay+Be+inozxNWpawEl+mZbrgiGOOFnEEq+ELCj2VMn/ i/+Twn7fSrN4YsX9IqBD6/A3oxBf6QqB5Z9cwj3Y/QLKEDber90jaiEfvF2hywYV6zEN irfNBTc/caxQZ3NMnyZ51mVPu27glu5/Fnrp4XzxvVz0HfABTTxIE11XmhBg9qovsjKX f5GAk12luGv6H1jZHMwU3tCYVmCceVb35rT4TnOLGrUCJONKJ0eHCUMy6E2djvVUU52Z lGkgWGPjaOG4FMM5cAgVlPCnlvA840dFk2CHjp5J2pXMHuPXIPHMTm5XrKNYojb4Mma3 z6Pg== 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=EWoJjZL6p9O+bPSQ3Eg2/KAsGshJM07NPtrONuXWTUo=; b=BR6z/G+MEVNcTelsl/Z33uIj5oP6o0XwDWKe0bdFiL6w01QGkS+tP8w0yPv+42/Plb zptPXIk/GRTPmPcDkIP/9QLu9x4txkkIe15f6YJg3vEQxCDMPP3fr7BYt86PedHyMScR /SXOfmB3tScOjcjYn5tHgh2e4LhxRQR9Ox2HrB62Pr9vYBpp5h3Wf16DZDIfvw+M2OYg ImhzSpCPf12vzuCk/155Dl5zgFCcLwWlQ5Jr/ZDaUjzM1vVemeLaUCtnhOLYIa46Te8v 33TfUUeh9S4RFIir+aPOH9sB9je7NVks+Vl42irISKHlKX+ZCSqfwHu/OW5ea0RrlzjI AgUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=SXFfpKFb; 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 w18si7322390ejv.669.2021.08.05.18.25.08; Thu, 05 Aug 2021 18:25:09 -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=SXFfpKFb; 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 C15B4680518; Fri, 6 Aug 2021 04:25:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8DBDB680518 for ; Fri, 6 Aug 2021 04:24:55 +0300 (EEST) Received: by mail-pj1-f41.google.com with SMTP id l19so13413783pjz.0 for ; Thu, 05 Aug 2021 18:24:55 -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=0eclQwsSarVhM2y6K/R3oZRpFXaxX5txv3UcQe8wlUI=; b=SXFfpKFb2cgaG2jYI4smdxd06IXjFYOMvFxuhEqgKgs3Kd3sVosG/C4rzKpOMXUFNK 7+vGuykxcFxAMkRK/7hApUkZs4zTPNI4f/zXFb+xgdJDjNGZEw0oIF+lIQb++2Ab51gn 16VtRijmUHGdO5krCjEl+3NLSgOtC4RJlfYCXNAPAyE3k8xjKw29LGVL9eBCH3hdTWSl 4Rrt5m7rWaAv7I/qRM8paZvhLQQeINjfAYo2JReau1zhvBUq9u+jkecT2tckF2jPV8Yl DeIxHvi59wUh7Kpk+taGG7JcQbCfD1f7jL7Tz15aECc5ALHeXpygayGXiPs2b8etA5za rX3A== 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=0eclQwsSarVhM2y6K/R3oZRpFXaxX5txv3UcQe8wlUI=; b=YHx4+iIgh8nePJTPnHSswDeObNT9x7YcXKy9aD3oM3NHfPsFNi2iEdJIv97ZZ/yPs+ KZ8EomyMS8wVjOk+rE8o9pVXQJlApY6MnvVhu8Lu79olYPIfyuwTxFDKFM8HgNjCFFW+ g0SwPmSS6PbaRs0RpxZ7FXqNCTCuHoc1+AqT1u4NS5pai1AY9XQTD14tKHIFin+1PnsF SNWS7/Mjdxw3inaazG1YXqESjel0vM29Ka8fyoi7rO1/bt7xOxmH5bfb2lSBXOA6+VuM 63MrwkFjV4iN2kckPWdDg5ggj7dXg7iG73AyvVALZAfs/5dMO9uLSim8HO7d22gRsmpZ QxEw== X-Gm-Message-State: AOAM532BTga/YEhXPt7Sj1uMboYnxvTNq6y/doRl1YUyf4ubOEzLCmuO CXXl+nDCI46rigF+NtzdttAaH6Bp2qE= X-Received: by 2002:a17:902:b093:b029:12c:843:b55a with SMTP id p19-20020a170902b093b029012c0843b55amr6385157plr.83.1628213093272; Thu, 05 Aug 2021 18:24:53 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id x8sm7426339pjn.10.2021.08.05.18.24.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Aug 2021 18:24:52 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Aug 2021 09:24:44 +0800 Message-Id: <1628213087-15896-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 v2 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: 9egEsXTpC6qJ From: Limin Wang Signed-off-by: Limin Wang --- doc/outdevs.texi | 5 +++++ 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, 30 insertions(+) diff --git a/doc/outdevs.texi b/doc/outdevs.texi index aaf2479..dd55904 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -205,6 +205,11 @@ Defaults to @samp{unset}. Sets the genlock timing pixel offset on the used output. Defaults to @samp{unset}. +@item link +Sets the video link configuration on the used output. Must be @samp{unset}, @samp{single}, +@samp{dual}, @samp{quad}. +Defaults to @samp{unset}. + @end table @subsection Examples diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index 24aa9b1..d7b4829 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..d85d540 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" , "link configure" , 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 },