diff mbox series

[FFmpeg-devel,2/4] avdevice/decklink: add sqd configure

Message ID 1628037188-8826-2-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/4] avdevice/decklink: add link configuration
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Limin Wang Aug. 4, 2021, 12:33 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 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 mbox series

Patch

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 },