diff mbox

[FFmpeg-devel] swscale/options: Use AV_OPT_TYPE_PIXEL_FMT

Message ID 20161119014146.4124-1-michael@niedermayer.cc
State Accepted
Commit ac206bb1756dde813d1ab528eaa1d9837b24ef07
Headers show

Commit Message

Michael Niedermayer Nov. 19, 2016, 1:41 a.m. UTC
Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswscale/options.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Cadhalpun Nov. 19, 2016, 1:09 p.m. UTC | #1
On 19.11.2016 02:41, Michael Niedermayer wrote:
> Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libswscale/options.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libswscale/options.c b/libswscale/options.c
> index c1ea336..7eb2752 100644
> --- a/libswscale/options.c
> +++ b/libswscale/options.c
> @@ -57,8 +57,8 @@ static const AVOption swscale_options[] = {
>      { "srch",            "source height",                 OFFSET(srcH),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
>      { "dstw",            "destination width",             OFFSET(dstW),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
>      { "dsth",            "destination height",            OFFSET(dstH),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
> -    { "src_format",      "source format",                 OFFSET(srcFormat), AV_OPT_TYPE_INT,    { .i64 = DEFAULT            }, 0,       AV_PIX_FMT_NB - 1, VE },
> -    { "dst_format",      "destination format",            OFFSET(dstFormat), AV_OPT_TYPE_INT,    { .i64 = DEFAULT            }, 0,       AV_PIX_FMT_NB - 1, VE },
> +    { "src_format",      "source format",                 OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT          }, 0,       INT_MAX, VE },
> +    { "dst_format",      "destination format",            OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT          }, 0,       INT_MAX, VE },
>      { "src_range",       "source is full range",          OFFSET(srcRange),  AV_OPT_TYPE_BOOL,   { .i64 = DEFAULT            }, 0,       1,              VE },
>      { "dst_range",       "destination is full range",     OFFSET(dstRange),  AV_OPT_TYPE_BOOL,   { .i64 = DEFAULT            }, 0,       1,              VE },
>      { "param0",          "scaler param 0",                OFFSET(param[0]),  AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT  }, INT_MIN, INT_MAX,        VE },
> 

Probably OK.

There are more occurrences, though.
$ git grep AV_PIX_FMT_NB -- libavc* libavd* libs*
libavcodec/imgconvert.c:    if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavcodec/imgconvert.c:    if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavcodec/tests/imgconvert.c:    for (i=0; i<AV_PIX_FMT_NB*2; i++) {
libavdevice/lavfi.c:    int *pix_fmts = create_all_formats(AV_PIX_FMT_NB);
libswscale/tests/swscale.c:         srcFormat < AV_PIX_FMT_NB; srcFormat++) {
libswscale/tests/swscale.c:             dstFormat < AV_PIX_FMT_NB; dstFormat++) {
libswscale/utils.c:static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
libswscale/utils.c:    return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
libswscale/utils.c:    return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
libswscale/utils.c:    return (unsigned)pix_fmt < AV_PIX_FMT_NB ?

Best regards,
Andreas
Michael Niedermayer Nov. 19, 2016, 5:01 p.m. UTC | #2
On Sat, Nov 19, 2016 at 02:09:38PM +0100, Andreas Cadhalpun wrote:
> On 19.11.2016 02:41, Michael Niedermayer wrote:
> > Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libswscale/options.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libswscale/options.c b/libswscale/options.c
> > index c1ea336..7eb2752 100644
> > --- a/libswscale/options.c
> > +++ b/libswscale/options.c
> > @@ -57,8 +57,8 @@ static const AVOption swscale_options[] = {
> >      { "srch",            "source height",                 OFFSET(srcH),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
> >      { "dstw",            "destination width",             OFFSET(dstW),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
> >      { "dsth",            "destination height",            OFFSET(dstH),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
> > -    { "src_format",      "source format",                 OFFSET(srcFormat), AV_OPT_TYPE_INT,    { .i64 = DEFAULT            }, 0,       AV_PIX_FMT_NB - 1, VE },
> > -    { "dst_format",      "destination format",            OFFSET(dstFormat), AV_OPT_TYPE_INT,    { .i64 = DEFAULT            }, 0,       AV_PIX_FMT_NB - 1, VE },
> > +    { "src_format",      "source format",                 OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT          }, 0,       INT_MAX, VE },
> > +    { "dst_format",      "destination format",            OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT          }, 0,       INT_MAX, VE },
> >      { "src_range",       "source is full range",          OFFSET(srcRange),  AV_OPT_TYPE_BOOL,   { .i64 = DEFAULT            }, 0,       1,              VE },
> >      { "dst_range",       "destination is full range",     OFFSET(dstRange),  AV_OPT_TYPE_BOOL,   { .i64 = DEFAULT            }, 0,       1,              VE },
> >      { "param0",          "scaler param 0",                OFFSET(param[0]),  AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT  }, INT_MIN, INT_MAX,        VE },
> > 
> 
> Probably OK.

applied

thx

[...]
diff mbox

Patch

diff --git a/libswscale/options.c b/libswscale/options.c
index c1ea336..7eb2752 100644
--- a/libswscale/options.c
+++ b/libswscale/options.c
@@ -57,8 +57,8 @@  static const AVOption swscale_options[] = {
     { "srch",            "source height",                 OFFSET(srcH),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
     { "dstw",            "destination width",             OFFSET(dstW),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
     { "dsth",            "destination height",            OFFSET(dstH),      AV_OPT_TYPE_INT,    { .i64 = 16                 }, 1,       INT_MAX,        VE },
-    { "src_format",      "source format",                 OFFSET(srcFormat), AV_OPT_TYPE_INT,    { .i64 = DEFAULT            }, 0,       AV_PIX_FMT_NB - 1, VE },
-    { "dst_format",      "destination format",            OFFSET(dstFormat), AV_OPT_TYPE_INT,    { .i64 = DEFAULT            }, 0,       AV_PIX_FMT_NB - 1, VE },
+    { "src_format",      "source format",                 OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT          }, 0,       INT_MAX, VE },
+    { "dst_format",      "destination format",            OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT          }, 0,       INT_MAX, VE },
     { "src_range",       "source is full range",          OFFSET(srcRange),  AV_OPT_TYPE_BOOL,   { .i64 = DEFAULT            }, 0,       1,              VE },
     { "dst_range",       "destination is full range",     OFFSET(dstRange),  AV_OPT_TYPE_BOOL,   { .i64 = DEFAULT            }, 0,       1,              VE },
     { "param0",          "scaler param 0",                OFFSET(param[0]),  AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT  }, INT_MIN, INT_MAX,        VE },