From patchwork Wed May 1 16:45:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 12960 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 1E4C24480C3 for ; Wed, 1 May 2019 19:46:03 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EE25B68AAB0; Wed, 1 May 2019 19:46:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 64FBB68AAAB for ; Wed, 1 May 2019 19:45:57 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 24510E171D; Wed, 1 May 2019 18:45:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BajxqUS9p1RL; Wed, 1 May 2019 18:45:54 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id AB7B5E1601; Wed, 1 May 2019 18:45:54 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 1 May 2019 18:45:50 +0200 Message-Id: <20190501164550.29777-1-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 Subject: [FFmpeg-devel] [PATCH] avdevice/decklink: fix checking video mode in SDK version 11 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Apparently in the new SDK one cannot query if VANC output is supported, so we will fall back to non-VANC output if enabling the video output with VANC fails. Fixes ticket #7867. Signed-off-by: Marton Balint --- libavdevice/decklink_common.cpp | 16 +++++----------- libavdevice/decklink_enc.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index c3a1d5588c..659aa9be3f 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -273,21 +273,15 @@ int ff_decklink_set_format(AVFormatContext *avctx, #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 if (direction == DIRECTION_IN) { if (ctx->dli->DoesSupportVideoMode(ctx->video_input, ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format, - bmdVideoInputFlagDefault, + bmdSupportedVideoModeDefault, &support) != S_OK) return -1; } else { BMDDisplayMode actualMode = ctx->bmd_mode; - if (!ctx->supports_vanc || ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format, - bmdVideoOutputVANC, - &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) { - /* Try without VANC enabled */ - if (ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format, - bmdVideoOutputFlagDefault, - &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) { - return -1; - } - ctx->supports_vanc = 0; + if (ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format, + bmdSupportedVideoModeDefault, + &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) { + return -1; } } diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index 8b621d0054..04b06aee3a 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -197,8 +197,11 @@ static int decklink_setup_video(AVFormatContext *avctx, AVStream *st) " Check available formats with -list_formats 1.\n"); return -1; } - if (ctx->dlo->EnableVideoOutput(ctx->bmd_mode, - ctx->supports_vanc ? bmdVideoOutputVANC : bmdVideoOutputFlagDefault) != S_OK) { + if (ctx->supports_vanc && ctx->dlo->EnableVideoOutput(ctx->bmd_mode, bmdVideoOutputVANC) != S_OK) { + av_log(avctx, AV_LOG_WARNING, "Could not enable video output with VANC! Trying without...\n"); + ctx->supports_vanc = 0; + } + if (!ctx->supports_vanc && ctx->dlo->EnableVideoOutput(ctx->bmd_mode, bmdVideoOutputFlagDefault) != S_OK) { av_log(avctx, AV_LOG_ERROR, "Could not enable video output!\n"); return -1; }