diff mbox series

[FFmpeg-devel,2/2] avdevice/decklink_dec_c: use Decklink BMDPixelFormat constants directly

Message ID 1605277802-26409-2-git-send-email-lance.lmwang@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/2] avformat/rtsp: av_rescale -> av_rescale_q | expand

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

Lance Wang Nov. 13, 2020, 2:30 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavdevice/decklink_dec_c.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Marton Balint Nov. 13, 2020, 6:50 p.m. UTC | #1
On Fri, 13 Nov 2020, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavdevice/decklink_dec_c.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
> index f3fdcd3..6e43c9e 100644
> --- a/libavdevice/decklink_dec_c.c
> +++ b/libavdevice/decklink_dec_c.c
> @@ -34,12 +34,12 @@ static const AVOption options[] = {
>     { "list_formats", "list supported formats"  , OFFSET(list_formats), AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
>     { "format_code",  "set format by fourcc"    , OFFSET(format_code),  AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC },
>     { "raw_format",   "pixel format to be returned by the card when capturing" , OFFSET(raw_format),  AV_OPT_TYPE_INT, { .i64 = 0}, 0, UINT_MAX, DEC, "raw_format" },
> -    { "auto",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = 0                        }, 0, 0, DEC, "raw_format"},
> -    { "uyvy422",       NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('2','v','u','y') }, 0, 0, DEC, "raw_format"},
> -    { "yuv422p10",     NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('v','2','1','0') }, 0, 0, DEC, "raw_format"},
> -    { "argb",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = 32                       }, 0, 0, DEC, "raw_format"},
> -    { "bgra",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('B','G','R','A') }, 0, 0, DEC, "raw_format"},
> -    { "rgb10",         NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('r','2','1','0') }, 0, 0, DEC, "raw_format"},
> +    { "auto",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormatUnspecified }, 0, 0, DEC, "raw_format"},
> +    { "uyvy422",       NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitYUV     }, 0, 0, DEC, "raw_format"},
> +    { "yuv422p10",     NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat10BitYUV    }, 0, 0, DEC, "raw_format"},
> +    { "argb",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitARGB    }, 0, 0, DEC, "raw_format"},
> +    { "bgra",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitBGRA    }, 0, 0, DEC, "raw_format"},
> +    { "rgb10",         NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat10BitRGB    }, 0, 0, DEC, "raw_format"},

How can this work? The necessary headers for these are not included, and 
we can't include them because they are not C compatible, or at least not 
in version 10.10 of the SDK which is the lowest version we support.

Regards,
Marton
Lance Wang Nov. 13, 2020, 11:43 p.m. UTC | #2
On Fri, Nov 13, 2020 at 07:50:16PM +0100, Marton Balint wrote:
> 
> 
> On Fri, 13 Nov 2020, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavdevice/decklink_dec_c.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
> > index f3fdcd3..6e43c9e 100644
> > --- a/libavdevice/decklink_dec_c.c
> > +++ b/libavdevice/decklink_dec_c.c
> > @@ -34,12 +34,12 @@ static const AVOption options[] = {
> >     { "list_formats", "list supported formats"  , OFFSET(list_formats), AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
> >     { "format_code",  "set format by fourcc"    , OFFSET(format_code),  AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC },
> >     { "raw_format",   "pixel format to be returned by the card when capturing" , OFFSET(raw_format),  AV_OPT_TYPE_INT, { .i64 = 0}, 0, UINT_MAX, DEC, "raw_format" },
> > -    { "auto",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = 0                        }, 0, 0, DEC, "raw_format"},
> > -    { "uyvy422",       NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('2','v','u','y') }, 0, 0, DEC, "raw_format"},
> > -    { "yuv422p10",     NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('v','2','1','0') }, 0, 0, DEC, "raw_format"},
> > -    { "argb",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = 32                       }, 0, 0, DEC, "raw_format"},
> > -    { "bgra",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('B','G','R','A') }, 0, 0, DEC, "raw_format"},
> > -    { "rgb10",         NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('r','2','1','0') }, 0, 0, DEC, "raw_format"},
> > +    { "auto",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormatUnspecified }, 0, 0, DEC, "raw_format"},
> > +    { "uyvy422",       NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitYUV     }, 0, 0, DEC, "raw_format"},
> > +    { "yuv422p10",     NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat10BitYUV    }, 0, 0, DEC, "raw_format"},
> > +    { "argb",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitARGB    }, 0, 0, DEC, "raw_format"},
> > +    { "bgra",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitBGRA    }, 0, 0, DEC, "raw_format"},
> > +    { "rgb10",         NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat10BitRGB    }, 0, 0, DEC, "raw_format"},
> 
> How can this work? The necessary headers for these are not included, and we
> can't include them because they are not C compatible, or at least not in
> version 10.10 of the SDK which is the lowest version we support.
Sorry, my misunderstanding, I saw the argb is 32, it make me confusing. So
I think it's better to use macros from the header instead of hardcode.

I prefer to map the FFmpeg format to decklink format in the cpp code instead of
hardcode for the compatiable.

> 
> Regards,
> 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/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index f3fdcd3..6e43c9e 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -34,12 +34,12 @@  static const AVOption options[] = {
     { "list_formats", "list supported formats"  , OFFSET(list_formats), AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
     { "format_code",  "set format by fourcc"    , OFFSET(format_code),  AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC },
     { "raw_format",   "pixel format to be returned by the card when capturing" , OFFSET(raw_format),  AV_OPT_TYPE_INT, { .i64 = 0}, 0, UINT_MAX, DEC, "raw_format" },
-    { "auto",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = 0                        }, 0, 0, DEC, "raw_format"},
-    { "uyvy422",       NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('2','v','u','y') }, 0, 0, DEC, "raw_format"},
-    { "yuv422p10",     NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('v','2','1','0') }, 0, 0, DEC, "raw_format"},
-    { "argb",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = 32                       }, 0, 0, DEC, "raw_format"},
-    { "bgra",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('B','G','R','A') }, 0, 0, DEC, "raw_format"},
-    { "rgb10",         NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = MKBETAG('r','2','1','0') }, 0, 0, DEC, "raw_format"},
+    { "auto",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormatUnspecified }, 0, 0, DEC, "raw_format"},
+    { "uyvy422",       NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitYUV     }, 0, 0, DEC, "raw_format"},
+    { "yuv422p10",     NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat10BitYUV    }, 0, 0, DEC, "raw_format"},
+    { "argb",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitARGB    }, 0, 0, DEC, "raw_format"},
+    { "bgra",          NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat8BitBGRA    }, 0, 0, DEC, "raw_format"},
+    { "rgb10",         NULL,   0,  AV_OPT_TYPE_CONST, { .i64 = bmdFormat10BitRGB    }, 0, 0, DEC, "raw_format"},
     { "enable_klv",    "output klv if present in vanc", OFFSET(enable_klv), AV_OPT_TYPE_BOOL, { .i64 = 0  }, 0, 1,   DEC },
     { "teletext_lines", "teletext lines bitmask", OFFSET(teletext_lines), AV_OPT_TYPE_INT64, { .i64 = 0   }, 0, 0x7ffffffffLL, DEC, "teletext_lines"},
     { "standard",     NULL,                                           0,  AV_OPT_TYPE_CONST, { .i64 = 0x7fff9fffeLL}, 0, 0,    DEC, "teletext_lines"},