From patchwork Wed Aug 4 00:33:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29222 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp2926369ioh; Tue, 3 Aug 2021 17:39:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbiZ6RPkXgNjGMOe0bJF8b1wNA4sFs2au8gBd+CkrYBQcKBDMg4TtWPLpt6G7u/CVNO3XH X-Received: by 2002:a17:906:b34c:: with SMTP id cd12mr23580006ejb.104.1628037554509; Tue, 03 Aug 2021 17:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628037554; cv=none; d=google.com; s=arc-20160816; b=goG12UfADH8kuk385lzY8M/jBiVZwdZsStfdJC1nFWluTfBQrVMTSE65uXNhcAGDuu 7Sasl3YtrQtU2yCTj0AudTHOgXhc0D/T/ZiFrrmnNujXe0/F9q1FfmgkQ0zmTB4FrQBF niPVbkNPOsCyLfVfLNJi5vHUUQXmo7Arrj8J7wGR1sZ1AvpaLehTVeGsLfV4VvM7kVKM 73VIkyi4CKa7EDFJej93jKFLHRpTsyZ42fIypncmiZJyeQ6ctz+WF/UnSmSod3dE6lJA utjLaP6XrPy+hEyHW4F+cEOSwhYxz0CqxWREmnpNyp92/aZMVRrbg+0l7UB4kF3OCdxA z9kw== 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=WFax4Csv1OSh2XdInLiXAHnFiqy9pbMnU3B8l5eJT6g=; b=qFhwuS/UfyKywMf4Qz3LdswHqAdFUjJ2R6I1HM7aWMmhR6eZdrkWDutpfd5duDmHQn gNduJR/OTii6uFu28ONOowoeq4H4bxEoAU418+gg1iGWwDcUni3BS/DIgz6uX1/xu2WV 0J8lgz8PA/B3skD9FQtFEq3oA695Us+tEbVtHhuHoUrwiMnyvvjqdNMCaUAiQJC0e9HC /CSZ7PeKtpMk2jPBEOpitNuDmCAF5C2Ax9my7QU8sZCUm3/uWVoH0cKidU7N1AcBWEgR /AN5iDVGKA6MINjudoVs3pZYOQ9d4m/2hj+8oikdOE7DmuRx/dcmiXytN1fNAuGVSkoU fh2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=HdM8IpbZ; 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 n14si452722edv.569.2021.08.03.17.39.14; Tue, 03 Aug 2021 17:39:14 -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=HdM8IpbZ; 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 0A5B068A126; Wed, 4 Aug 2021 03:39:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 61748680986 for ; Wed, 4 Aug 2021 03:39:04 +0300 (EEST) Received: by mail-pl1-f179.google.com with SMTP id u2so1076740plg.10 for ; Tue, 03 Aug 2021 17:39:04 -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=jAIws37lMT4YbqVqw7ks/gFF/Q8+xBkqWG1ch670/H0=; b=HdM8IpbZcAfn86cFzgCQ6pKgQAht0vfIdpDsLZeciZYc2MTb6O+nOC8l/pqe3Gelkp CK7+d8StoMpFashdczV4tsvyqk8ImZM6bzF4dZ8MNh8xRv92ojHhxUbEisvXGHWzRiKy o9Muk42SE925wXPTnBG4Mc/h7Kq+IGmvQ14K4cB4Ry/idnT7+3QHzc6aZew3yTZ6RAIR 8354ZhiYcf58MiemeL0U8lYpu8nGWIemxou6BaXJu5kF2Fs/sqpWnXILF1/iNwomrPeZ jN2h7Tu2pFg0SWfAbEdzEFl9+YBGZ0L2BgS8ZotpmNuIwwD1dSP0N74B2fQl/+eRasIb TrIw== 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=jAIws37lMT4YbqVqw7ks/gFF/Q8+xBkqWG1ch670/H0=; b=ZnwsqW9pa4APviTpfz0fOv1+NRiM+N9fRy7SqrboyNZHxU3sMz4izJY3HnDHGUGdOF 6kKiGRrIhn00uGaJqaaylKIwoog5nwJhR+ileurytN5SVW4p6Xw5kA+dYO8hsLnLZkmK KqlKuJ5NdzHtzjSemd+6gPB+pVnsG10xbwUpp5qz1hwWAQnGVXA4RA7UyS0kxt/oPcPv zuKcuiruJG2xuHeh/43kZcLO+cydylLOY8MX/Obej7ZrpDcNqpZehXyWTRgLxt5SIXWb pK84eU4Q0vFJRvRqxPyls+3d65SK1TKOJZYGI0QuPkvTWrnKQF0io6EsrHD0OxdhJyRf Ec7w== X-Gm-Message-State: AOAM531r+4VbsyjHtGJ5g/piJJApVJuTVcSsFr3QjSiCQGScX2ZgBsR0 imhAtep1+jaSK+GBSWkHx2L3p5Yg41Y= X-Received: by 2002:a65:40cc:: with SMTP id u12mr1609082pgp.18.1628037197576; Tue, 03 Aug 2021 17:33:17 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id g1sm386366pfo.0.2021.08.03.17.33.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Aug 2021 17:33:17 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Aug 2021 08:33:08 +0800 Message-Id: <1628037188-8826-4-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 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: YTTU5u0Eghfp 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 ba52df7..fca9c1e 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"},