From patchwork Thu Sep 6 14:07:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baldur Gislason X-Patchwork-Id: 10255 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp515803jap; Thu, 6 Sep 2018 07:07:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZjpxLL24xMscj/bmM913o17RzAgrkEPgg7twvOiL8jGJov2ToRnwIOJeo8guqbPYZahoMd X-Received: by 2002:adf:fd12:: with SMTP id e18-v6mr2618285wrr.280.1536242845491; Thu, 06 Sep 2018 07:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536242845; cv=none; d=google.com; s=arc-20160816; b=Lt+zwpzop4Vc7Z3xOzwh0v6OMr9XeAk9bVeI7DhNG7zBqpxnCJRY4+SGkQ2bd9v4R/ zHyFerCpYmqCycuZo3XYDfB8ymtQTR1srqLw370mK7TsgmLiOLzHSBk1W07qxUYi1N8C PeMnyHylGOY4zCvZ9t2cCTLFIIL88OF4pTwSmd+ptDK32kZMzdJmy45Dcbb9n7lY8wTR 1lhbs7ExrWKOyd+wYNV0YOgkZ+RertyxzPMUNShkO5n52aVT6rwm1DUGzFQWbPzU67LS KYcX6by40jQDZ5Qdz+aI4V76UYtcSLhmq/DDL/3xkZjYGNrycNm4eFQ9xheEdU2bTtza mDwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=ePcxJua1bjAGUIYnwbkMeqV/ZMW5sIJeMX34PpntoG0=; b=CPMvz5IIDcF/fvdfTyWPY3xsbDEZweXA8ZTa9mUUYrNTggiUjxhA2hzRU6CWHz/l5k 6/sabo2P6NB+CSYmzAaBrjMF/nbdgfjPwoWSeqCYQh+Z/iVLP3ZqGEK9DZhOdGaiaytR aoXeSnBGm096YJwmD3x0lGSxU6NeWNwxoVwhxf2NUJAvOslJrQPr8yXlxINADV3EvGMJ OqZp01Tp/FUwO8UPaEZeCp4WUJPbpZzdba3ooyHcA7+iEj6eEvEZ7k3x03X5tZfC+lp5 5/V/bh/VUoY4cZoO2KK1625rQxS02b+ORBkMpwwPMAIG7jcFfaQkNMaMBgaR/K/Bxhyb EuDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=gtqKaXwY; 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 u13-v6si4823136wri.169.2018.09.06.07.07.21; Thu, 06 Sep 2018 07:07:25 -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=gtqKaXwY; 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 AC3AD689F4C; Thu, 6 Sep 2018 17:07:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 84963689AF9 for ; Thu, 6 Sep 2018 17:07:05 +0300 (EEST) Received: by mail-oi0-f50.google.com with SMTP id p84-v6so20734267oic.4 for ; Thu, 06 Sep 2018 07:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=DIE0Tz8g9KKBIcurKjHBibV4tvrfRdj5VOir9TNMHjU=; b=gtqKaXwYGo0Gme+1ruF1IiggJ7CBU6pmhk8jahUMGX3beqlLX295NntZlbOFnJN1ya TKzh+McO1k4btEvRbXv6oB01g8ZvhZ3nplf1FJfk8p6jMEppizreukc1gJlCgEy65bqf VvkPJqO4Tbd1Ob3kTApVkQ4DYUseKtz9W0KJ04qA4dsJxcHrISXQL94cOGeLtkgcFs/U Bq4zlPgtpEBvgXNTzbpkuGKLdHKNTG9sBYR6/XsVaHs8iIsVgp4S5ajJDsjhMcK+jDzf DgCxT2nFUdz0jkzirBZaXa/mDhqA4V/7DWjub8HS4vBfawg3B6wOo/L5eSIiQzWrF0s8 JJ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=DIE0Tz8g9KKBIcurKjHBibV4tvrfRdj5VOir9TNMHjU=; b=N82omuBYfS9be2zKf/ap6VQ95kHT/D9x6LFth6gfUvvEyifHRWQgUgcEpQYID5ta1Q FmJpsx/4AK5ohSt6t02/AMbUvcbU9g/+8G5aBjJgImK52Ps2ddwSRr5Wg6EVjwjoK2gD LXr41psdkjZUE9+BpW0tSiqOOxMOIR3aZIe9F5pgL9LMUnu1KrUD7Sqv1XOkKWXxkdNf WJtS1fvnUWh4Now6kEfPqUozWM99hqxFoMAt8NgMBDD+BKgQ9u0n+0jg/4qw8zZPVOg+ nJPQQpDxj39ydYDePd8NfQeRLZIXVzJFVsTzvYg6IG/UYxrdpGLqqaVDswmK1wqLSPkU c+ag== X-Gm-Message-State: APzg51CHbmXm0jp8ViO67G5X4t/yKO036q27kBzrBC1u/us1i1d1jG+u LgVGWQB38t6XI1GjpL7Gvy+p9ytfwvjw4qTnnV43EPhO X-Received: by 2002:aca:5e42:: with SMTP id s63-v6mr2841745oib.134.1536242831766; Thu, 06 Sep 2018 07:07:11 -0700 (PDT) MIME-Version: 1.0 From: Baldur Gislason Date: Thu, 6 Sep 2018 14:07:01 +0000 Message-ID: To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] libavdevice/decklink trivial patch for SDI input/output X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Sending this again as the mime type was wrong for the patch on the last message. I have prepared a patch that adds two things. On the Decklink input side, it adds a parameter called 'passthrough' which makes it possible to change from the default behaviour on cards that can handle both inputs and outputs. The default behaviour on such cards depends on the model but many of them will pass through the input signal if the application generating the output stops. This is not always desirable so the Decklink API provides a method of changing it. On the output side, it adds a parameter called 'sdi_link' which is crucial when working with SDI output cards that support 3G SDI or faster. The default behaviour for 1080p60 for example is to use two HD-SDI links and the default for 2160p29.97 is to use four HD-SDI links. This option makes it possible to specify how many SDI links are to be used to make use of 3G, 6G or 12G SDI capabilities of newer cards which can output those configurations over a single cable. Baldur Gislason From 4620016823015757c647662cf2815b7d9cbb69cb Mon Sep 17 00:00:00 2001 From: Baldur Gislason Date: Thu, 6 Sep 2018 13:27:01 +0000 Subject: [PATCH] Adding options to disable Decklink passthrough on capture as well as control the output link configuration. --- libavdevice/decklink_common.cpp | 12 ++++++++++++ libavdevice/decklink_common_c.h | 2 ++ libavdevice/decklink_dec_c.c | 4 ++++ libavdevice/decklink_enc.cpp | 13 +++++++++++++ libavdevice/decklink_enc_c.c | 1 + 5 files changed, 32 insertions(+) diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index aab9d85b94..35d9aa636b 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -352,6 +352,18 @@ int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direct if (direction == DIRECTION_IN) { int ret; + switch(cctx->passthrough) { + case 0: + ctx->cfg->SetInt(bmdDeckLinkConfigCapturePassThroughMode, bmdDeckLinkCapturePassthroughModeDirect); + break; + case 1: + ctx->cfg->SetInt(bmdDeckLinkConfigCapturePassThroughMode, bmdDeckLinkCapturePassthroughModeCleanSwitch); + break; + case 2: + ctx->cfg->SetInt(bmdDeckLinkConfigCapturePassThroughMode, bmdDeckLinkCapturePassthroughModeDisabled); + break; + } + ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection); if (ret < 0) return ret; diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h index 32a5d70ee1..0e30ec44b9 100644 --- a/libavdevice/decklink_common_c.h +++ b/libavdevice/decklink_common_c.h @@ -53,6 +53,8 @@ struct decklink_cctx { int tc_format; int draw_bars; char *format_code; + int sdi_link; + int passthrough; int raw_format; int64_t queue_size; int copyts; diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c index 6ab3819375..e9f202b0ad 100644 --- a/libavdevice/decklink_dec_c.c +++ b/libavdevice/decklink_dec_c.c @@ -84,6 +84,10 @@ static const AVOption options[] = { { "queue_size", "input queue buffer size", OFFSET(queue_size), AV_OPT_TYPE_INT64, { .i64 = (1024 * 1024 * 1024)}, 0, INT64_MAX, DEC }, { "audio_depth", "audio bitdepth (16 or 32)", OFFSET(audio_depth), AV_OPT_TYPE_INT, { .i64 = 16}, 16, 32, DEC }, { "decklink_copyts", "copy timestamps, do not remove the initial offset", OFFSET(copyts), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC }, + { "passthrough", "monitoring pass through mode", OFFSET(passthrough), AV_OPT_TYPE_INT,{ .i64 = 0}, 0, 2, DEC, "passthrough" }, + { "direct", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0}, 0, 0, DEC, "passthrough" }, + { "cleanswitch", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, DEC, "passthrough" }, + { "disabled", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, DEC, "passthrough" }, { NULL }, }; diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index ee4c962add..d98d72e847 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -150,6 +150,19 @@ static int decklink_setup_video(AVFormatContext *avctx, AVStream *st) return -1; } + switch(cctx->sdi_link) { + case 1: + ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, bmdLinkConfigurationSingleLink); + break; + case 2: + ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, bmdLinkConfigurationDualLink); + break; + case 4: + ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, bmdLinkConfigurationQuadLink); + break; + } + + if (c->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) { if (c->format != AV_PIX_FMT_UYVY422) { av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format!" diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c index 360535cfda..ab081a2493 100644 --- a/libavdevice/decklink_enc_c.c +++ b/libavdevice/decklink_enc_c.c @@ -31,6 +31,7 @@ static const AVOption options[] = { { "list_devices", "list available devices" , OFFSET(list_devices), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, ENC }, { "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 }, + { "sdi_link" , "SDI single(1)/dual(2)/quad(4) link configuration", OFFSET(sdi_link), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 4, ENC }, { NULL }, };