diff mbox series

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

Message ID 1628213087-15896-3-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v2,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. 6, 2021, 1:24 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@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(+)

Comments

Marton Balint Aug. 7, 2021, 5:27 p.m. UTC | #1
On Fri, 6 Aug 2021, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@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}.
>
> +@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
Limin Wang Aug. 9, 2021, 1:13 a.m. UTC | #2
On Sat, Aug 07, 2021 at 07:27:22PM +0200, Marton Balint wrote:
> 
> 
> On Fri, 6 Aug 2021, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@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}.
> > 
> > +@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.

will update as suggestion..

> 
> > +
> > @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
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

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}.
 
+@item levelA
+If set to @option{true}, SMPTE Level A is enable on the used output.
+Defaults to @option{false}.
+
 @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;
+
+        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;
     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 },
     { "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"},