[FFmpeg-devel] [PATCH v2 3/4] avdevice/decklink: add levelA configure

Marton Balint cus at passwd.hu
Sat Aug 7 20:27:22 EEST 2021



On Fri, 6 Aug 2021, lance.lmwang at gmail.com wrote:

> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> just rebase the code to the master branch to fix the first warning.
>
> doc/outdevs.texi                |  4 ++++
> libavdevice/decklink_common.cpp | 17 +++++++++++++++++
> libavdevice/decklink_common_c.h |  1 +
> libavdevice/decklink_enc_c.c    |  1 +
> 4 files changed, 23 insertions(+)
>
> diff --git a/doc/outdevs.texi b/doc/outdevs.texi
> index c4c1eba..dee9de3 100644
> --- a/doc/outdevs.texi
> +++ b/doc/outdevs.texi
> @@ -214,6 +214,10 @@ Defaults to @samp{unset}.
> If set to @option{true}, Quad-link SDI is output in Square Division Quad Split mode.
> Defaults to @option{false}.
>
> + at item levelA

level_a, no camelcase for option names.

> +If set to @option{true}, SMPTE Level A is enable on the used output.

If set to @option{true}, SMPTE Level A is enabled on the SDI output.

> +Defaults to @option{false}.

Same here, please add a default (-1) unset mode.

> +
> @end table
>
> @subsection Examples
> diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
> index bb69a54..46e9768 100644
> --- a/libavdevice/decklink_common.cpp
> +++ b/libavdevice/decklink_common.cpp
> @@ -234,6 +234,23 @@ int ff_decklink_set_configs(AVFormatContext *avctx,
>         }
>     }
>
> +    if (direction == DIRECTION_OUT && cctx->levelA) {
> +        DECKLINK_BOOL levelA_supported = false;

level_a_supported

> +
> +        if (ctx->attr->GetFlag(BMDDeckLinkSupportsSMPTELevelAOutput, &levelA_supported) != S_OK)
> +            levelA_supported = false;
> +
> +        if (levelA_supported) {
> +            res = ctx->cfg->SetFlag(bmdDeckLinkConfigSMPTELevelAOutput, cctx->levelA);
> +            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..d855311 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 levelA;

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 b26c93b..614a84a 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"},
> +    { "levelA"      , "set SMPTE LevelA"        , OFFSET(levelA)      , AV_OPT_TYPE_BOOL,   { .i64 = 0   }, 0, 1, ENC },

"level_a"

>     { "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"},
> -- 
> 1.8.3.1

Thanks,
Marton


More information about the ffmpeg-devel mailing list