Message ID | 1628552283-26880-3-git-send-email-lance.lmwang@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v3,1/4] avdevice/decklink: add link configuration | expand |
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 |
On Tue, 10 Aug 2021, lance.lmwang@gmail.com wrote: > From: Limin Wang <lance.lmwang@gmail.com> > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > doc/outdevs.texi | 5 +++++ > libavdevice/decklink_common.cpp | 17 +++++++++++++++++ > libavdevice/decklink_common_c.h | 1 + > libavdevice/decklink_enc_c.c | 4 ++++ > 4 files changed, 27 insertions(+) > > diff --git a/doc/outdevs.texi b/doc/outdevs.texi > index e3e88b2..cc0c94a 100644 > --- a/doc/outdevs.texi > +++ b/doc/outdevs.texi > @@ -216,6 +216,11 @@ Enable Square Division Quad Split mode for Quad-link SDI output. > Must be @samp{unset}, @samp{true} or @samp{false}. > Defaults to @option{unset}. > > +@item level_a > +Enable SMPTE Level A mode on the used output. > +Must be @samp{unset}, @samp{true} or @samp{false}. > +Defaults to @option{unset}. > + > @end table > > @subsection Examples > diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp > index a892a6c..0569462 100644 > --- a/libavdevice/decklink_common.cpp > +++ b/libavdevice/decklink_common.cpp > @@ -230,6 +230,23 @@ int ff_decklink_set_configs(AVFormatContext *avctx, > } > } > > + if (direction == DIRECTION_OUT && cctx->level_a >= 0) { > + DECKLINK_BOOL level_a_supported = false; > + > + if (ctx->attr->GetFlag(BMDDeckLinkSupportsSMPTELevelAOutput, &level_a_supported) != S_OK) > + level_a_supported = false; > + > + if (level_a_supported) { > + res = ctx->cfg->SetFlag(bmdDeckLinkConfigSMPTELevelAOutput, cctx->level_a); > + 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..c257721 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 level_a; > 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 4bcdbfe..559f078 100644 > --- a/libavdevice/decklink_enc_c.c > +++ b/libavdevice/decklink_enc_c.c > @@ -44,6 +44,10 @@ static const AVOption options[] = { > { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "sqd"}, > { "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "sqd"}, > { "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "sqd"}, > + { "level_a" , "set SMPTE LevelA" , OFFSET(level_a) , AV_OPT_TYPE_INT, { .i64 = -1 }, -1,1, ENC, "level_a"}, > + { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "level_a"}, > + { "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "level_a"}, > + { "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "level_a"}, > { "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 }, Looks good with a micro bump. Thanks, Marton
diff --git a/doc/outdevs.texi b/doc/outdevs.texi index e3e88b2..cc0c94a 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -216,6 +216,11 @@ Enable Square Division Quad Split mode for Quad-link SDI output. Must be @samp{unset}, @samp{true} or @samp{false}. Defaults to @option{unset}. +@item level_a +Enable SMPTE Level A mode on the used output. +Must be @samp{unset}, @samp{true} or @samp{false}. +Defaults to @option{unset}. + @end table @subsection Examples diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index a892a6c..0569462 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -230,6 +230,23 @@ int ff_decklink_set_configs(AVFormatContext *avctx, } } + if (direction == DIRECTION_OUT && cctx->level_a >= 0) { + DECKLINK_BOOL level_a_supported = false; + + if (ctx->attr->GetFlag(BMDDeckLinkSupportsSMPTELevelAOutput, &level_a_supported) != S_OK) + level_a_supported = false; + + if (level_a_supported) { + res = ctx->cfg->SetFlag(bmdDeckLinkConfigSMPTELevelAOutput, cctx->level_a); + 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..c257721 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 level_a; 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 4bcdbfe..559f078 100644 --- a/libavdevice/decklink_enc_c.c +++ b/libavdevice/decklink_enc_c.c @@ -44,6 +44,10 @@ static const AVOption options[] = { { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "sqd"}, { "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "sqd"}, { "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "sqd"}, + { "level_a" , "set SMPTE LevelA" , OFFSET(level_a) , AV_OPT_TYPE_INT, { .i64 = -1 }, -1,1, ENC, "level_a"}, + { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "level_a"}, + { "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "level_a"}, + { "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "level_a"}, { "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 },