From e235a966a69393e817c3f690a89c4e2c3b0406a0 Mon Sep 17 00:00:00 2001
From: Marton Balint <cus@passwd.hu>
Date: Wed, 1 May 2019 12:47:43 +0200
Subject: [PATCH] avdevice/decklink: fix checking video mode in SDK version 11
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 <cus@passwd.hu>
---
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
|
b
|
int ff_decklink_set_format(AVFormatContext *avctx,
|
| 273 | 273 | #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 |
| 274 | 274 | if (direction == DIRECTION_IN) { |
| 275 | 275 | if (ctx->dli->DoesSupportVideoMode(ctx->video_input, ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format, |
| 276 | | bmdVideoInputFlagDefault, |
| | 276 | bmdSupportedVideoModeDefault, |
| 277 | 277 | &support) != S_OK) |
| 278 | 278 | return -1; |
| 279 | 279 | } else { |
| 280 | 280 | BMDDisplayMode actualMode = ctx->bmd_mode; |
| 281 | | if (!ctx->supports_vanc || ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format, |
| 282 | | bmdVideoOutputVANC, |
| 283 | | &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) { |
| 284 | | /* Try without VANC enabled */ |
| 285 | | if (ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format, |
| 286 | | bmdVideoOutputFlagDefault, |
| 287 | | &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) { |
| 288 | | return -1; |
| 289 | | } |
| 290 | | ctx->supports_vanc = 0; |
| | 281 | if (ctx->dlo->DoesSupportVideoMode(bmdVideoConnectionUnspecified, ctx->bmd_mode, ctx->raw_format, |
| | 282 | bmdSupportedVideoModeDefault, |
| | 283 | &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode) { |
| | 284 | return -1; |
| 291 | 285 | } |
| 292 | 286 | |
| 293 | 287 | } |
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index 8b621d0054..04b06aee3a 100644
|
a
|
b
|
static int decklink_setup_video(AVFormatContext *avctx, AVStream *st)
|
| 197 | 197 | " Check available formats with -list_formats 1.\n"); |
| 198 | 198 | return -1; |
| 199 | 199 | } |
| 200 | | if (ctx->dlo->EnableVideoOutput(ctx->bmd_mode, |
| 201 | | ctx->supports_vanc ? bmdVideoOutputVANC : bmdVideoOutputFlagDefault) != S_OK) { |
| | 200 | if (ctx->supports_vanc && ctx->dlo->EnableVideoOutput(ctx->bmd_mode, bmdVideoOutputVANC) != S_OK) { |
| | 201 | av_log(avctx, AV_LOG_WARNING, "Could not enable video output with VANC! Trying without...\n"); |
| | 202 | ctx->supports_vanc = 0; |
| | 203 | } |
| | 204 | if (!ctx->supports_vanc && ctx->dlo->EnableVideoOutput(ctx->bmd_mode, bmdVideoOutputFlagDefault) != S_OK) { |
| 202 | 205 | av_log(avctx, AV_LOG_ERROR, "Could not enable video output!\n"); |
| 203 | 206 | return -1; |
| 204 | 207 | } |