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 }, From patchwork Fri Aug 6 01:24:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29301 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp91817ioh; Thu, 5 Aug 2021 18:25:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+eS74xvGc2WyFtUmshjIhB/evNLwFGlf7qKjN+RhcEqGgBahqoy364cdWkYWibAev/K/b X-Received: by 2002:aa7:cc83:: with SMTP id p3mr10048842edt.365.1628213121585; Thu, 05 Aug 2021 18:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628213121; cv=none; d=google.com; s=arc-20160816; b=Lva19X9OM2WGQgpzVYY6eqnxcdnpmudDg30Qly5wWLvfwSziZrY/M7zXpHaAoAXaA+ LqNUxx7dcKE/lr12vVT+coV51Vm562sJKslA6x7tGJE3pOzn3atB+ZefazSyIawYK2Dn 25NYqYJXzfhW9uw5dxMxCEPKyH1YyFEdb3f2FtRycte2yGnAXMm4K8N1GiDwGpQkA/Vh QVfq2NURyME40QhSdztg93bBrnveM/6aCR0TpDuHem7DQBE2Tu6TPhz5oCJZC5vrYdxq 8LIrfQNvcc/2T8SO0ygbZ/8jiwIKQMxlDthTKKolqY575Uk36gW063VAG69AaY9HAbSM sqIA== 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=qf2rBIqCbZplGnrBfHhnE5laQIgGsWWuGuV3T92QunM=; b=iGQUo6JLGqNPfebfKdkgaYVr2iM3b2TRS4kzXZaKTOdjyq9oD1uX7Khv+tWkYglf4t bJsyBNVOvxU/tW/LBm2+HpXLmU8pCp5uXRNk/sMoI6eJozzYcWK1BdfQcGhHddCW6ePH T9rtYSwz7Cia93/b2QNikU9EOqZGAFeq2v5ecxDJn2ytRGdDCqShevkquvs3zofAH9M4 A7gcUqpO/RJ+Dd5BPpmrQ9rNh3iRB4nRubyJgNCW5J4xd1Ik/BLs26C10tYN86DiCPoU bmxUeXPy9ccD7rz3NhC60dt6xQb7Fa+4ZzP9/qr+7+Mu69aLldr3wdW5+Ej3KaOTgty2 jLDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=urlY7CNy; 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 dr21si6823346ejc.474.2021.08.05.18.25.21; Thu, 05 Aug 2021 18:25:21 -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=urlY7CNy; 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 09C36689FB4; Fri, 6 Aug 2021 04:25:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 227CC680518 for ; Fri, 6 Aug 2021 04:24:56 +0300 (EEST) Received: by mail-pj1-f49.google.com with SMTP id l19so13413903pjz.0 for ; Thu, 05 Aug 2021 18:24:56 -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=4QCPfXUwS2FnUqHUMMEqdV+CTzMuG0fChucNGwasyCE=; b=urlY7CNyY2boIDRE8OFCxJIPrNBLlV2YgRlO+M/oWZ3OBukrwTi0x0fzOtnp8/X87s EfaqaRAXp/+fpaDMgq8ZrqCG7+89Gy+c4vdxwR4n1t2PV97nBeQWH3fth2H4rfiFJUHC AU5bD0N9y1ss/bQnBPPqCWdiGWb7i1e+V8Nz8PG8JgAM5xdv9Z1MXPGmF8+jJLA/o6fq IHVUjZK08DJmtL0cIHTMYZhPoXw5wTGsXGBBslaVkFtzNYgK7Mw49FYqzotD3+mjPpfp iBKraGsTWw8HPDDHF3BOBgdAYg92EHcveRP+Uode0l27gYl150SqfTrVjt0NcASgFl7a GATg== 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=4QCPfXUwS2FnUqHUMMEqdV+CTzMuG0fChucNGwasyCE=; b=ENe/DPbrrCZePkzwuADAvPJoDZeZZizKl7Y5NpG5+IWdDZftuMxNkmuBWixIdNwoai UdCiQGpPADipX4X3WIuCBsPHBz3cGJ9x4REz7HuGk3X2V92qUDwQJuH+t/cZ6nNZOkEE 8AIYYwY6gL86Z4LYZkGlH3FGYuFmG/SLXpoq58li7i0e2aLyPMfAq4QFjB3ZnTT25F8S 0POHEnZqX4nw/rPVTPm9++BkCZuM9AFqy8zKxAaeneBesT/FkeKJsTQZjfZPSMyxL/1M epwx+fMc3p6L1P8fOf/O6HOQL1Mx7ZMp57hXyoad5G6jEzT7Gb77+kHo7zk4LJGrWJlx +K2Q== X-Gm-Message-State: AOAM532yjWNFdvSNii1nt4bR4UQnrS+BDxRry1VtmhZo6KTKB/Ai/mCN mWugayTWhh57UUv9PonyqdH2ajiyRUM= X-Received: by 2002:a17:902:e74d:b029:12b:e3f2:f5d3 with SMTP id p13-20020a170902e74db029012be3f2f5d3mr6421826plf.82.1628213094493; Thu, 05 Aug 2021 18:24:54 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id x8sm7426339pjn.10.2021.08.05.18.24.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Aug 2021 18:24:54 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Aug 2021 09:24:45 +0800 Message-Id: <1628213087-15896-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628213087-15896-1-git-send-email-lance.lmwang@gmail.com> References: <1628037188-8826-1-git-send-email-lance.lmwang@gmail.com> <1628213087-15896-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 2/4] avdevice/decklink: add sqd configure 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: xmPMi7p1GcOS From: Limin Wang Signed-off-by: Limin Wang --- doc/outdevs.texi | 4 ++++ libavdevice/decklink_common.cpp | 11 +++++++++++ libavdevice/decklink_common_c.h | 1 + libavdevice/decklink_enc_c.c | 1 + 4 files changed, 17 insertions(+) diff --git a/doc/outdevs.texi b/doc/outdevs.texi index dd55904..c4c1eba 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -210,6 +210,10 @@ Sets the video link configuration on the used output. Must be @samp{unset}, @sam @samp{dual}, @samp{quad}. Defaults to @samp{unset}. +@item sqd +If set to @option{true}, Quad-link SDI is output in Square Division Quad Split mode. +Defaults to @option{false}. + @end table @subsection Examples diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index d7b4829..bb69a54 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -221,6 +221,17 @@ int ff_decklink_set_configs(AVFormatContext *avctx, 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); + if (ctx->link == bmdLinkConfigurationQuadLink && cctx->sqd) { +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a0b0400 + res = ctx->cfg->SetFlag(bmdDeckLinkConfigQuadLinkSDIVideoOutputSquareDivisionSplit, cctx->sqd); + if (res != S_OK) + av_log(avctx, AV_LOG_WARNING, "Setting SquareDivisionSplit failed.\n"); + else + av_log(avctx, AV_LOG_VERBOSE, "Successfully set SquareDivisionSplit.\n"); +#else + av_log(avctx, AV_LOG_VERBOSE, "Unable to set SquareDivisionSplit, require version of SDK >= 10.11.4.\n"); +#endif + } } return 0; diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h index f37e0c0..fdaa1f9 100644 --- a/libavdevice/decklink_common_c.h +++ b/libavdevice/decklink_common_c.h @@ -49,6 +49,7 @@ struct decklink_cctx { int audio_depth; int duplex_mode; int link; + int sqd; DecklinkPtsSource audio_pts_source; DecklinkPtsSource video_pts_source; int audio_input; diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c index d85d540..b26c93b 100644 --- a/libavdevice/decklink_enc_c.c +++ b/libavdevice/decklink_enc_c.c @@ -40,6 +40,7 @@ static const AVOption options[] = { { "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"}, + { "sqd" , "set Square Division" , OFFSET(sqd) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, { "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 }, From patchwork Fri Aug 6 01:24:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29302 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp91932ioh; Thu, 5 Aug 2021 18:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQjvSKqaG6RDcLhZ0Hl6XyS3k2VVonQcxWjGlfxaQ49RAVOs4O2EQrVBF+e3zgCznRUtp1 X-Received: by 2002:a17:906:1ccf:: with SMTP id i15mr7659972ejh.120.1628213131930; Thu, 05 Aug 2021 18:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628213131; cv=none; d=google.com; s=arc-20160816; b=Xz9DFYGcnqIVZ0adBWmyX1QsCbmF3EmArJW9NMMAbEqGp2VdBaffK0lvVLVTERdVjy HjaiSIFr8endiVNBl8bDA0ciWk9zjMNBvwhhAqnvx6uh5YlMuzYB+FK6tJkFPUqHi87T d8xoxiZE/hE+MOy8dxtl/Prgy9JSjijyMBIljoLd4CxWoSrkTJolY3rD96LoAHYrIbOs jC3/37BO+6yP+UdRd/xH8w4Xeo212t334o+3QB1gFFBfPZFTJ0nQWy/9G3ina6zkj043 652lHz21CC2hRByg30urab8IVp/e74rfzm2OylpeJ5behvGxoO7nO71UtplpDSdIzj3d JmQw== 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=6BADai24DLGqZ5lzxq+c/Wwl5C2iuKiuVfzJqTjpMak=; b=0FluS5Ml3jHGEZiO6GZAZsYxR5GBE9Q02buaYxL6s5PLeWl0+d/NETYavQR6xdhiMD nibK7WRfnz7kBtsOEoRTZQKMMEa/25vVBlt8zR9YrWmUzxkfTtgt597R3Ain5NHzUSUt pE8xvj//kPHzY7hTFrqFLLUwj0uyyXKmlboYo3fRoEe40w59a8mLtSS6FnkFmFRafvTm L7y4fmqBWGwxxsQwMNeIzGX7CHRbIw3yb8ytSJgrdwxct2hBnEVOwDga0gvxgnzRv5/S 2PfgQzUI+7ZVgTHR6cEN5e7TohdQOJ3z6bpDblRj8o71DLOWs4lQk/xWE22atLGgoAnT 5Ugg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=KIfKNJTZ; 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 du1si8077371ejc.712.2021.08.05.18.25.31; Thu, 05 Aug 2021 18:25:31 -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=KIfKNJTZ; 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 2CC4368A073; Fri, 6 Aug 2021 04:25:05 +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 0B4FD689248 for ; Fri, 6 Aug 2021 04:24:58 +0300 (EEST) Received: by mail-pj1-f45.google.com with SMTP id s22-20020a17090a1c16b0290177caeba067so19433378pjs.0 for ; Thu, 05 Aug 2021 18:24:57 -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=QaUMxBghS8DejxAqsqo7Dk8ASEK+SyaVoq8Q9M85Afk=; b=KIfKNJTZyka1IAkWf01yUVT5fUNz5htZHSSl9WJErBnMP2+/6L6D0lHvjo3LMGg3QZ my/2knyLJSdIiuVgZHFkzqeGaqsQrTPHMewu7il24m8yYChdfte3TPiqEzc4WSZvReqG 1dKY3K8Mi2ieN5dG8vfDyTd5iA7GfgjOwPYTJQYfRE5l1TuMGtk4Do6nRmPlsr33Znu9 jlguywI3/b3MmaSW620pueRyk8K3d9Vy8YjDRkqxEfy00ikn518War4fyqQTtu8is3Ur xdEQQZleV/s7gvRQZwu2XoFJh6Co8HPL6xS61ZLSDA0AAZhkW9Es5yOkEg7rB4rC8hEC Ntyg== 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=QaUMxBghS8DejxAqsqo7Dk8ASEK+SyaVoq8Q9M85Afk=; b=hyPcupnN0uHZl6kskw4QtbPZIeB3MWmk6K+wIEgPdqg25qK4mGW88tDRxKSc01HluM uv0GgH6ySZQ3ce8qVPur5R9XVh7kBXWAB0gRGlzYBS92SEJTpFATBbJMphxctNo9x6nO q3LJflFgWqhkohkHFuvTZavI5dYaDKe5ghZ34JsKhlnIENwucRSi6HqBQ9gWyfjYarSL FTm24zN7KKOaQggno9GGv5m7JSpiJ7VBEmbUEsp50ZnkyWuyV3GW0uNmzXs61Fta06Qh aHxJmZwteZyxIwrNkYc/x1psOYYb70xAFIW4D5DFEk/94BXSMwpp/Rq/FgLlR/drx/qV iTtA== X-Gm-Message-State: AOAM5322DIuAVcOHwavMpyIY5/fRw1gG6OEa0zX6aHE870uSXjPjTI0v MtRy0OONQLiRvd2tqLN4Q8bgXv/Iuk0= X-Received: by 2002:a17:902:cec2:b029:12c:bef0:ec4b with SMTP id d2-20020a170902cec2b029012cbef0ec4bmr6378953plg.74.1628213095787; Thu, 05 Aug 2021 18:24:55 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id x8sm7426339pjn.10.2021.08.05.18.24.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Aug 2021 18:24:55 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Aug 2021 09:24:46 +0800 Message-Id: <1628213087-15896-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628213087-15896-1-git-send-email-lance.lmwang@gmail.com> References: <1628037188-8826-1-git-send-email-lance.lmwang@gmail.com> <1628213087-15896-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 3/4] avdevice/decklink: add levelA configure 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: 5R7Jq0TbeBwx From: Limin Wang Signed-off-by: Limin Wang --- just rebase the code to the master branch to fix the first warning. doc/outdevs.texi | 4 ++++ libavdevice/decklink_common.cpp | 17 +++++++++++++++++ libavdevice/decklink_common_c.h | 1 + libavdevice/decklink_enc_c.c | 1 + 4 files changed, 23 insertions(+) diff --git a/doc/outdevs.texi b/doc/outdevs.texi index c4c1eba..dee9de3 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -214,6 +214,10 @@ Defaults to @samp{unset}. If set to @option{true}, Quad-link SDI is output in Square Division Quad Split mode. Defaults to @option{false}. +@item levelA +If set to @option{true}, SMPTE Level A is enable on the used output. +Defaults to @option{false}. + @end table @subsection Examples diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index bb69a54..46e9768 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -234,6 +234,23 @@ int ff_decklink_set_configs(AVFormatContext *avctx, } } + if (direction == DIRECTION_OUT && cctx->levelA) { + DECKLINK_BOOL levelA_supported = false; + + if (ctx->attr->GetFlag(BMDDeckLinkSupportsSMPTELevelAOutput, &levelA_supported) != S_OK) + levelA_supported = false; + + if (levelA_supported) { + res = ctx->cfg->SetFlag(bmdDeckLinkConfigSMPTELevelAOutput, cctx->levelA); + if (res != S_OK) + av_log(avctx, AV_LOG_WARNING, "Setting SMPTE levelA failed.\n"); + else + av_log(avctx, AV_LOG_VERBOSE, "Successfully set SMPTE levelA.\n"); + } else { + av_log(avctx, AV_LOG_WARNING, "Unable to set SMPTE levelA mode, because it is not supported.\n"); + } + } + return 0; } diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h index fdaa1f9..d855311 100644 --- a/libavdevice/decklink_common_c.h +++ b/libavdevice/decklink_common_c.h @@ -50,6 +50,7 @@ struct decklink_cctx { int duplex_mode; int link; int sqd; + int levelA; DecklinkPtsSource audio_pts_source; DecklinkPtsSource video_pts_source; int audio_input; diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c index b26c93b..614a84a 100644 --- a/libavdevice/decklink_enc_c.c +++ b/libavdevice/decklink_enc_c.c @@ -40,6 +40,7 @@ static const AVOption options[] = { { "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"}, + { "levelA" , "set SMPTE LevelA" , OFFSET(levelA) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, { "sqd" , "set Square Division" , OFFSET(sqd) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, { "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"}, From patchwork Fri Aug 6 01:24:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29303 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp92045ioh; Thu, 5 Aug 2021 18:25:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlVtJlZwwYEpK8A+tMntf5k1Dz9RN5ruwMtEPSsCX5Ue6+DOZRrCtteOYKNs64irSgPRw4 X-Received: by 2002:a05:6402:26c6:: with SMTP id x6mr10537680edd.175.1628213142413; Thu, 05 Aug 2021 18:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628213142; cv=none; d=google.com; s=arc-20160816; b=Jo8ZA2fWvtTo9o12Ax245xwcBxg9/y/Vuj8TGfOybV8qezOikOsff9Ze1qvfKBp7N/ bZCvbCW+sVfp2LIPgm1EOvVKw27ztiPPepUoxeDoIKoLtNwfewXr2dSmDQ4O20Dq7GQs 3CDZvoCTHIPXFj6Qmo5NKhRQyhrg9SISfEixot98+pJ0mVcjBPTg0FiF/OiicQpnyUqz YwVSci1I/ZKxumwkTlg6ShQiGJcyaDXwl8OmiDxtxJamPkv112EHceL41GW3OdaGmEA3 ml5PLEUs/k43uQ864nW9rrdLlbsOzSrn81ugq+tmXkE+ruFduhCocsCa+IYXa0GIdYpQ F8HA== 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=KTgLHhDHiwcMhXhTCn2/1UnXhTEieSKw6NMB8mejxow=; b=jhNOTZTamw7Jm2MwOSh73s7dn20IQtmFPQhpALhyJX96aOf/ziJZ6D1fq/IDEEK/5A aaPMeYn4Gj55TIiV+rHZFOlyQElt7guZmUMapyiS/o1zapLWZprWwyHPB01QSnb2lSGV mu2emUx/UOIqZweUrAnd4ncYVSs0neULcH/jeSqqbDVwzP4k6Ksk5S6sEcOIGtOt3clk MHGagdt/qA/TyaV0xn2fmBkUgpSjqSWHVWU3Tl2zMU8rBZjf3nxPhJ/MJz4eRioaeyXA iCJKOiSOpXJXR4cyAH7vXUcjU28uoth4BHTY4shs6llXm6PpHdBgs3rPCARTiPUOzuiA f2UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=DWQuFw3b; 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 ch11si6973795edb.414.2021.08.05.18.25.41; Thu, 05 Aug 2021 18:25:42 -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=DWQuFw3b; 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 2828E68A212; Fri, 6 Aug 2021 04:25:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D065D689FB4 for ; Fri, 6 Aug 2021 04:24:58 +0300 (EEST) Received: by mail-pj1-f44.google.com with SMTP id u21-20020a17090a8915b02901782c36f543so10467068pjn.4 for ; Thu, 05 Aug 2021 18:24:58 -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=6bk4UlU4k/BFEqy3PwSzJkE7ClC40D1gPmjWb/BZOxg=; b=DWQuFw3bD4ZHbO1CKd9DSiZ4Chaoqk4PYdc0WGMoKdbRs0HjxCTal2wXGQCOCq9XZo rhY+BUVS84rXGdHfd8G0NEmf5cXOJ0Iceg33i+nH2SmoyIbqtk9uDsDSGr7+3dqJ7lwk zWSQxJAPA6EY7Qox7lAFjlZUCRS/p6O6yVczfdKArpkRo8VXl2VLhtMr6gwyPfstJ4Nz bnwHPL8laYbOgulgMmdHlbb1LQPf29U/fc78nxptP/Ys7+ZwUbsIEvpdhH65G336VRS/ yAF9UHN+C5kE3NfqOKugaQHnJxWT1aBgufnHlUmGgjHD9d/AvMT13v60BzvobD6VCWo9 68bQ== 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=6bk4UlU4k/BFEqy3PwSzJkE7ClC40D1gPmjWb/BZOxg=; b=DFb1f57TFl2rLps45gXczFJQihSMD+r0oe1rpz+s8Wzs2nKnHTrGv0ESz5Su1B6Cwp 8oQHDfc/ceC0z5/bolNHGMu+NYOflI7JsRZdJi3P1OenRcnOL4KfYsBn5j3UnwxTLORy 6qygeJbpJBZ0k+FFApii6h+rb691gXuQ7/GG2CpOEjZSL6mAPIT0/G5ENqEVksu4mVvU CPTLRPce+OeuxSZM4yWsm4ocBsKhZRdSbyILysiTZWskYSQNYMEjAfK1HUY3QY0mmz0c ZbS0zZJ+6+cydDcxxdXpOw9pnMyBEGAxsibVChhgsRWshWgP77d/JB1lYzbpo/GODTSY hBmA== X-Gm-Message-State: AOAM532cHq3gW+lcoJ8jHnIuU2taU+953d64l/H4VFYij5cyVLZs1hHh ggoiq22P7dsqLw97wwTaJf68GKAWJ1I= X-Received: by 2002:a17:902:c10a:b029:12c:dda2:39c0 with SMTP id 10-20020a170902c10ab029012cdda239c0mr6382930pli.7.1628213097058; Thu, 05 Aug 2021 18:24:57 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id x8sm7426339pjn.10.2021.08.05.18.24.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Aug 2021 18:24:56 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Aug 2021 09:24:47 +0800 Message-Id: <1628213087-15896-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628213087-15896-1-git-send-email-lance.lmwang@gmail.com> References: <1628037188-8826-1-git-send-email-lance.lmwang@gmail.com> <1628213087-15896-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 4/4] avdevice/decklink: support for more duplex mode for Decklink 8K Pro 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: 7HzzIuJmXpnS From: Limin Wang Signed-off-by: Limin Wang --- doc/indevs.texi | 16 +++++++++++++++- doc/outdevs.texi | 16 +++++++++++++++- libavdevice/decklink_common.cpp | 8 ++++++++ libavdevice/decklink_common.h | 11 +++++++++++ libavdevice/decklink_dec_c.c | 10 ++++++++++ libavdevice/decklink_enc_c.c | 10 ++++++++++ 6 files changed, 69 insertions(+), 2 deletions(-) diff --git a/doc/indevs.texi b/doc/indevs.texi index b377924..af0380a 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -344,9 +344,23 @@ Defines number of audio channels to capture. Must be @samp{2}, @samp{8} or @samp Defaults to @samp{2}. @item duplex_mode -Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}. +Sets the decklink device duplex/profile mode. Must be @samp{unset}, @samp{half}, @samp{full}, +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} Defaults to @samp{unset}. +Note: DeckLink SDK 11.2 have replaced the duplex property by a profile property. +For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2 +sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a profile +is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles. + +Valid profile mode for DeckLink 8K Pro(Updated DeckLink SDK to >= 11.2): +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} + +Valid profile mode for DeckLink Quad 2 and DeckLink Duo 2: +@samp{half}, @samp{full} + @item timecode_format Timecode type to include in the frame and video stream metadata. Must be @samp{none}, @samp{rp188vitc}, @samp{rp188vitc2}, @samp{rp188ltc}, diff --git a/doc/outdevs.texi b/doc/outdevs.texi index dee9de3..76a9d7d 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -198,9 +198,23 @@ Amount of time to preroll video in seconds. Defaults to @option{0.5}. @item duplex_mode -Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}. +Sets the decklink device duplex/profile mode. Must be @samp{unset}, @samp{half}, @samp{full}, +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} Defaults to @samp{unset}. +Note: DeckLink SDK 11.2 have replaced the duplex property by a profile property. +For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2 +sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a profile +is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles. + +Valid profile mode for DeckLink 8K Pro(Updated DeckLink SDK to >= 11.2): +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} + +Valid profile mode for DeckLink Quad 2 and DeckLink Duo 2: +@samp{half}, @samp{full} + @item timing_offset Sets the genlock timing pixel offset on the used output. Defaults to @samp{unset}. diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index 46e9768..de7d2f4 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -182,7 +182,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx, if (duplex_supported) { #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 IDeckLinkProfile *profile = NULL; +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b020000 + BMDProfileID bmd_profile_id = decklink_profile_id_map[ctx->duplex_mode]; +#else BMDProfileID bmd_profile_id = ctx->duplex_mode == 2 ? bmdProfileOneSubDeviceFullDuplex : bmdProfileTwoSubDevicesHalfDuplex; +#endif res = manager->GetProfile(bmd_profile_id, &profile); if (res == S_OK) { res = profile->SetActive(); @@ -195,7 +199,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx, if (res != S_OK) av_log(avctx, AV_LOG_WARNING, "Setting duplex mode failed.\n"); else +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b020000 + av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 || ctx->duplex_mode == 4 ? "full" : "half"); +#else av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 ? "full" : "half"); +#endif } else { av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n"); } diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h index ad8b33c..a2d6509 100644 --- a/libavdevice/decklink_common.h +++ b/libavdevice/decklink_common.h @@ -208,6 +208,17 @@ static const BMDLinkConfiguration decklink_link_conf_map[] = { bmdLinkConfigurationQuadLink }; +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b020000 +static const BMDProfileID decklink_profile_id_map[] = { + (BMDProfileID)0, + bmdProfileTwoSubDevicesHalfDuplex, + bmdProfileOneSubDeviceFullDuplex, + bmdProfileOneSubDeviceHalfDuplex, + bmdProfileTwoSubDevicesFullDuplex, + bmdProfileFourSubDevicesHalfDuplex, +}; +#endif + 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_dec_c.c b/libavdevice/decklink_dec_c.c index 1d93e8b..d0ef86a 100644 --- a/libavdevice/decklink_dec_c.c +++ b/libavdevice/decklink_dec_c.c @@ -45,10 +45,20 @@ static const AVOption options[] = { { "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7fff9fffeLL}, 0, 0, DEC, "teletext_lines"}, { "all", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7ffffffffLL}, 0, 0, DEC, "teletext_lines"}, { "channels", "number of audio channels", OFFSET(audio_channels), AV_OPT_TYPE_INT , { .i64 = 2 }, 2, 16, DEC }, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b020000 + { "duplex_mode", "duplex mode", OFFSET(duplex_mode), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 5, DEC, "duplex_mode"}, +#else { "duplex_mode", "duplex mode", OFFSET(duplex_mode), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 2, DEC, "duplex_mode"}, +#endif { "unset", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0}, 0, 0, DEC, "duplex_mode"}, { "half", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, DEC, "duplex_mode"}, { "full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, DEC, "duplex_mode"}, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b020000 + { "one_sub_device_full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, DEC, "duplex_mode"}, + { "one_sub_device_half", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3}, 0, 0, DEC, "duplex_mode"}, + { "two_sub_device_full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 4}, 0, 0, DEC, "duplex_mode"}, + { "four_sub_device_half", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 5}, 0, 0, DEC, "duplex_mode"}, +#endif { "timecode_format", "timecode format", OFFSET(tc_format), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 8, DEC, "tc_format"}, { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0}, 0, 0, DEC, "tc_format"}, { "rp188vitc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, DEC, "tc_format"}, diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c index 614a84a..4b05908 100644 --- a/libavdevice/decklink_enc_c.c +++ b/libavdevice/decklink_enc_c.c @@ -31,10 +31,20 @@ static const AVOption options[] = { { "list_devices", "use ffmpeg -sinks decklink instead", OFFSET(list_devices), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC | AV_OPT_FLAG_DEPRECATED}, { "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 }, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b020000 + { "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 5, ENC, "duplex_mode"}, +#else { "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 2, ENC, "duplex_mode"}, +#endif { "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"}, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b020000 + { "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 { "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"},