From patchwork Wed Aug 4 00:33:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29221 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp2927652ioh; Tue, 3 Aug 2021 17:41:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ9yzLzp4bhkfbV30QtYul6RGoL4gybQy1T7fd0uEcCz1ZDx2lCEH5J/sAmdj7SzeX5K9M X-Received: by 2002:a05:6402:111a:: with SMTP id u26mr28308325edv.260.1628037689300; Tue, 03 Aug 2021 17:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628037689; cv=none; d=google.com; s=arc-20160816; b=A4/5Vio1LpQmXY8mpHVk8M1GxEB8Ra7z3rN2E65b9orIEdC9htTD2Bera3qEElTJsz Bt9zPJJjfqXjpp4+gMYthd5xWmtdggKBYYNTSzzyZFQVdC6KDFgwr15avLczmvFLY8K3 5EWzrYpRMxOCr3Y4PdSaL4/l88Bpgu91F0XUxQPxbxg1RRScsviljGt/h71HMy8pweUH Y7sYtLOYJ1WUd+K0G/dIL9C0WW8373GvyoJJbPDQt9raa4i+Hoa6f6PyKWe/130sAq/5 0DsFpFdPnZ/PlRNqvqAqDxYc6MUUnWuu3lch20H3ubxG6/8nG3K1Xx0Qpjor3BuG4o1y dcBw== 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:message-id:date:to:from:dkim-signature :delivered-to; bh=EWoJjZL6p9O+bPSQ3Eg2/KAsGshJM07NPtrONuXWTUo=; b=p39LPW0qXAr1FUiAenN+Nt8GlaF8PLV4ZqncPjOWcrDq8rkFqC/J7n7aqY9E5GTIuw htflkdF5l47jXNcNs5Yqr525y5v5nLcGR1DOB+pbp3A9Xz2qSjaRizZPsoqFDDdAkthL Qf/CHvGPIRsKjauwD4PHmSpQIyzZeaY5ed/8BHrRYsbOA3J8HW29pNMVOYtPZrPBCVvL 5zLFgQ4yCJ8f/yXdvv2pnpqR5LOStDCp9SNq5HU3N9PGEY3taLcvzVHvRSRTEktEFTU1 TiK6RKNAsni9XbaQk60frC97ESTNOpUh1hrj9vwLQfPAW/v+V+NvlDT6zobLlBTYh4PB jPpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=bDswG+LJ; 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 b26si446253eje.399.2021.08.03.17.41.28; Tue, 03 Aug 2021 17:41:29 -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=bDswG+LJ; 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 4283C68A1C3; Wed, 4 Aug 2021 03:41:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80960680858 for ; Wed, 4 Aug 2021 03:41:19 +0300 (EEST) Received: by mail-vs1-f43.google.com with SMTP id y1so164476vsc.1 for ; Tue, 03 Aug 2021 17:41:19 -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; bh=0eclQwsSarVhM2y6K/R3oZRpFXaxX5txv3UcQe8wlUI=; b=bDswG+LJpjOcOitnfNXmrtY2BNdHP5ns0e7Wbcv9ApDTsxX1LdNsWanrJ/hcyvugNa x9Sxuu6vLni/R5lHixO5lhTsenIKMpyI2C1zjw1V29pzrtigyxlBJLLB9IgDhei5KefG oovaGf9uJWBr26hXYhCbgYqokK+a1NqL12idSS7CoPjeiWV+mw3RWfOkGX9pI1gDu/5z cAqbwn0C4CFxvtAWD5whONVTfk3uWsAdYiV/pz4iLXmKr8s8/cyXRnxA4SNkxdQ3uQ21 b2Guce0w7eEx8qfw/O75W+ZjwSn80M08e2wQBradEO4GQo58zDIlaK9fSPwkHzVHpHA2 hIVQ== 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; bh=0eclQwsSarVhM2y6K/R3oZRpFXaxX5txv3UcQe8wlUI=; b=VurJfB0cg5TFy/1PqEeDKnJnVCJ7KQwv1w6kvLMEJni5MsA8bgWBC9e4Ks9F2GctdG T9nRWQFyt7j1ATWw1RD1obnAFxgj/h0VWvIigfZBBvmbwDoZHte6DDnMPWOYJ0muHLNZ BVQyx/NkFSTyVvsly3EdBUVXv9SWlw+p/YNsVFIy1JSrc/DCaI1RapXyCfMEehpa/MSE rzP9/4WhaXljnEVADhEUgCS0j13qxTfXJPAN4T9z3IaVAZZxx5MEHlhLDXQoYvEdfBRd aIZ24FKl1+IbhdHU7Q2kAMrGyUpxKbWv1ilS3hq5g/oujyf6oSAfub/FBoiCKsSsAwLb YrbA== X-Gm-Message-State: AOAM5306FGHX6hOjcUDl8DKApTI/nsIfcQr7cCXv93m2zCs44CJZAmJB 4kVRXbxK64eG8CRnzNMimIamOfmP6Mc= X-Received: by 2002:a17:903:228c:b029:12c:a49c:10c0 with SMTP id b12-20020a170903228cb029012ca49c10c0mr15026306plh.6.1628037193794; Tue, 03 Aug 2021 17:33:13 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id g1sm386366pfo.0.2021.08.03.17.33.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Aug 2021 17:33:13 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Aug 2021 08:33:05 +0800 Message-Id: <1628037188-8826-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 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: yX1Gxz3E2y6q 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 Wed Aug 4 00:33:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29223 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp2937464ioh; Tue, 3 Aug 2021 17:59:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNml8xfGxA+LzV7ePmgKdtqhlSj9bvW/L/G1oE6rZeMoyceH2V9W13XSbRX6m0jb4Qcbz/ X-Received: by 2002:a17:906:3193:: with SMTP id 19mr24327119ejy.433.1628038776678; Tue, 03 Aug 2021 17:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628038776; cv=none; d=google.com; s=arc-20160816; b=aaRLk44niPDCiUw73GFSK9RfYgaLvsZeFVFkOnoj1JQxCmMn1BzMjrUQdC5XLSfHZA Xh30YfCuTNUMPWyQ8VYSbTX7iAbijsU9YlApIyzSvIKtkE3dH7a4ozQRDaMkDipL6EVR tQpQOzSUJj5JjEy3AHai7iCbWsTZZ88k44P1F298nwT4vy1Fo0/ZZcKM5KFTR86CvU9x gGq5McEVLtYAxKZ32p4A4JgXqG+HaRXQIf7F1Eg07r0w+9bTMOcZIotdfCUW4RA27t1z tO2rcIX4mG+PtrGUvkru8UBdYzn+X+12jLsRmCd6GdHSqz+hXrsFyhBpCcU525fphVCo Lo3g== 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=lHPWfc4LLiglpEYYiRHFNYHhtNT38dwPrhyFp6BaP9U=; b=jMNygMicFocT3Knz29Kz51iMIacXLrJp4oniu46Yel8/Zm59TRUcENEEi05Qv36cBo nO+A3dspIKMrBtI8+rAxcoJoNXUEe7lVpTXx6hsl0wT+p2vGeW6NR3bBQnHtgJQ/oJdC Ip2KmPI83xbnh1Y26leiD6Op00W8C1YejskPjxflXdzNGzx5fTv5kNPLQ5f0P2A6Mreu Yop2HDSaNtfO9mxlaVPw0dSVUE/42FCHhU1QLP276cOjBIkbTe5wQWTEqXckQMTWCthl sjG7MGDmXe40dPF1Sl5rovV4Ew58TemkLnEUDiNhfkJogaeTtWObNKXc/9RKEWxXeWfn ejQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=QVMmZ3EH; 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 f11si532817edl.305.2021.08.03.17.59.35; Tue, 03 Aug 2021 17:59:36 -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=QVMmZ3EH; 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 B604068921B; Wed, 4 Aug 2021 03:59:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C7A016807AA for ; Wed, 4 Aug 2021 03:59:25 +0300 (EEST) Received: by mail-pl1-f174.google.com with SMTP id z3so1133803plg.8 for ; Tue, 03 Aug 2021 17:59:25 -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=k1puRd6pvEryP2BnZF3xoAiP1QFqdxXZLlnJQTF+1vQ=; b=QVMmZ3EHrfH8f7ep8f3L2PUFybIuaHbZT2xCjS8IMnKlhrfwSJ5LyFWQNzYP6Eb/HG Gbdkkhe/YsxKzXLFKfNWq4hp7tUiW3zUtVqXLPar/AAB7uitIWA2+zWzm4NkcJG0uPhd SQ46Tyk7pCWj4XuERspNRxsldxqHaLDhxb5so8a7JgRAVM0XD9WrgL4rLkSiAMjslrPd XGXg3hc28bl5B4FtG33PgzG4dRKi0+ALHawla9KvgNpx+Bv0wqEf+w7dp4yzWEyD2vda /1X3TR8eoT8zDZewl/B8PG9MgNZPvi4ZXYf/0/rPD2wrsSniLvST8WgRm5wyg5S5X6mM ycaw== 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=k1puRd6pvEryP2BnZF3xoAiP1QFqdxXZLlnJQTF+1vQ=; b=afs8B3os2q4pAkkiaDBpQLV/+Uone4l2cn4dHW0WSMx1yujd2WKb1lblZcwkTDnGfH fCh8VJzU4/DtYT2D9vSa/rnTGBaplzKglRdfeFucYFJ0LzMhiqanokdrS6KwU4eCSNKk JpRIR1ZARUIWU70BmkiI15rveSML1ssr0Yc79smNkqCLSw/qlPc+My0YvGCEbFpWTsNN trMNt4Q3j6stFgVb6rDza1YsIAcO77co+kMMVGmOjamCndHQZcGVEvzOn33AlImLMJCO P0f13D6UjlVf3sRcApwu3XZ59sFd1ZgNAY1WjUCLLv1xyD1L5bS9T2o+oATCoesgHcv+ wcmA== X-Gm-Message-State: AOAM531om36rJ67h8AlPVRcgjkI7Mgc9gaY9fT1bcJMa+2rh2I0gd1n1 41IQ8cGgcJmDHcWuBa5YxIpu9mET/Ts= X-Received: by 2002:a63:ed50:: with SMTP id m16mr256795pgk.231.1628037195078; Tue, 03 Aug 2021 17:33:15 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id g1sm386366pfo.0.2021.08.03.17.33.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Aug 2021 17:33:14 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Aug 2021 08:33:06 +0800 Message-Id: <1628037188-8826-2-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 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: S6G69HyLrNkU 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..488b1e4 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 Wed Aug 4 00:33:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 29225 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp2957474ioh; Tue, 3 Aug 2021 18:33:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwQFdasMQEsPBwBtBtu80iS2H7Guli5WWxe5wi94MbuAdQ4D+1H4EHl7r4VzTfrW7bA7lk X-Received: by 2002:a17:906:d7b2:: with SMTP id pk18mr23501157ejb.541.1628040786404; Tue, 03 Aug 2021 18:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628040786; cv=none; d=google.com; s=arc-20160816; b=foEBuV/u9G4hwKXAqpGuhounR0mn/sMn16TsP21OPcPPCUnFETqiZn6S2Q7uGFoIVH 57lLreTPDMGUqWc9gHsuTlDzk9mi71gMRqY1xFSnbzaDv4bMfIX1COL8P+tN9SE32o2i MnXZok1Vafqs58gR30DOHaojiwzHwIR9K3fRJpzFxpSwpkFbOQGiprjuHE7skstcyd5D Yi93rZPD2+AsRh0klJE2TnHhHKleAEWALVP8je68Firmw3Dwh5YSPtK67lZe25vXzmBH SY0/xrhGvWAwEZxUzcNrvTE1SR46aw8XliXcCRXOHkHEYf9c6nV9t/BA3wlIbmVeHcxR lwNQ== 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=5u/+S5qXkhT3P6hn5tZHAsj33NbMt9OGSpfcpqxul0Q=; b=liDL9qjIPsdR3gYAGEJ2qTiwfQZq2l1yADWzn5Y/KRuLgdQXgxyMp2UsLtT0AWfVyl ZgVPLwKa9rekrUCOHFyP7Eh3jhleAlcSOtJwETDna/1T4MA/5lxyaBknhjSAdVYlgR0B 0PVBUjvUymVnf8dIolkbGl3v2Mdt3HRqec5tmxW+1xvDzvS3snhaNpbsH46x/fn1DfNY 5o1xn1pqZXOfvUUK0YO1xT+7BBV22M4I5Gbg3P7tGPcHBr1TpuWeEsl1KNwnf9Jwnvnj Vu3IejQ2WWL1lD6tBByIUwQ0yxy/zcWSD4RJXgVkhUN2aNI58/hl5soir4X5bBMInPNi olsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=agK8wGiM; 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 fl21si610018ejc.563.2021.08.03.18.33.06; Tue, 03 Aug 2021 18:33:06 -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=agK8wGiM; 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 1A99E680549; Wed, 4 Aug 2021 04:33:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 645C8680549 for ; Wed, 4 Aug 2021 04:32:57 +0300 (EEST) Received: by mail-pj1-f52.google.com with SMTP id e2-20020a17090a4a02b029016f3020d867so1344501pjh.3 for ; Tue, 03 Aug 2021 18:32: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=rhrFsgybffps/5P7yur6Y1mhBwAoHCSIu/pS88pISXw=; b=agK8wGiMZBnYiu0Gud2HboNsS+EZ6bo+p2cRLjL89GxDOLwuhRHIzzJ+3TOQ+41pLy PLdZcNaJ4l554yg+3tXq+yjw1twQi7RtAAmSwUfHtVdbMtUim+Hw5F/R6wJ7ykWl434R 43Rkzv4FaeA1wnEHKi1Fi8+SUXAs3o4nRyN0KcKpQVeA4BUn/PucjgVYXKxluPlbqH45 1HROIyrfpLj1KaDMiPoevvLV5hRIh3reqb3Y+kWXt1oNu6AEHNdawbRuGw5U5NkJP+Xd un2IINGpMMBbhLY+RdZftprmP4R+U5e8I5sNqbFUUBNhhZ17E6lJv1D/Lv+c/rhZ/4zB 8ZPA== 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=rhrFsgybffps/5P7yur6Y1mhBwAoHCSIu/pS88pISXw=; b=dthFcAE5Ue4+B6tXpS1MFQWz8NdZJ8VqpELCBJw2Ot7plMLd5++K3lzRDdjvQbIAbB pDUbqrc4/jUtc1EGUNOZ6OtXoQQWEtq5DrCyr4dscLhX9UoGHSEEd/db6fGwauXLy1ti VZ8CZMc7407lnyG4BTLpD6pQOcSa8t7qUnfXhx5A40WHcga8cc5pTg2c9X+TUTQ6jUZ5 ZfRIfHrkV+eEeAKYQi7+XnqP3cINEX6eCKonp581HZRogXtq1PPAmvwn2QeoHZZy3SwF BfhgMfwywo2N4/P5WQyjEg070gwJpQzkfI6srfvoXEcNc05hoECY8OyufmuaoMbuzypq +4RQ== X-Gm-Message-State: AOAM530oHDnSr/Vo3wbQZoGqAuIKhLNT88sN8Z0QtmbcaNAHgPD7UjHB 1Imgh7rW2xqBHzipjP985DAzf8G6sLM= X-Received: by 2002:a17:902:ab4a:b029:12c:4a36:1561 with SMTP id ij10-20020a170902ab4ab029012c4a361561mr20812448plb.8.1628037196307; Tue, 03 Aug 2021 17:33:16 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id g1sm386366pfo.0.2021.08.03.17.33.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Aug 2021 17:33:16 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Aug 2021 08:33:07 +0800 Message-Id: <1628037188-8826-3-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 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: 9SXdPBOknYtr From: Limin Wang Signed-off-by: Limin Wang --- 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 488b1e4..ba52df7 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 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"},