diff mbox series

[FFmpeg-devel,1/6] tools/enum_options: fix build and add to Makefile

Message ID 20201102131717.4959-1-anton@khirnov.net
State Accepted
Commit 65c4d5d72eb4999dd4325972c80f1e2746934458
Headers show
Series [FFmpeg-devel,1/6] tools/enum_options: fix build and add to Makefile | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Anton Khirnov Nov. 2, 2020, 1:17 p.m. UTC
---
 Makefile             |  3 +++
 tools/Makefile       |  2 +-
 tools/enum_options.c | 26 +++++++++++++-------------
 3 files changed, 17 insertions(+), 14 deletions(-)

Comments

James Almer Nov. 2, 2020, 3:26 p.m. UTC | #1
On 11/2/2020 10:17 AM, Anton Khirnov wrote:
> ---
>  Makefile             |  3 +++
>  tools/Makefile       |  2 +-
>  tools/enum_options.c | 26 +++++++++++++-------------
>  3 files changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index c8b548d126..977ad69965 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -62,6 +62,9 @@ tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
>  tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
>  	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
>  
> +
> +tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
> +tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
>  tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
>  tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
>  tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
> diff --git a/tools/Makefile b/tools/Makefile
> index 48fa131eeb..82baa8eadb 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -1,4 +1,4 @@
> -TOOLS = qt-faststart trasher uncoded_frame
> +TOOLS = enum_options qt-faststart trasher uncoded_frame
>  TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
>  TOOLS-$(CONFIG_ZLIB) += cws2fws
>  
> diff --git a/tools/enum_options.c b/tools/enum_options.c
> index 548e427b7a..bedebd4c67 100644
> --- a/tools/enum_options.c
> +++ b/tools/enum_options.c
> @@ -40,14 +40,14 @@ static void print_option(const AVClass *class, const AVOption *o)
>  {
>      printf("@item -%s @var{", o->name);
>      switch (o->type) {
> -    case FF_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
> -    case FF_OPT_TYPE_STRING:   printf("string");             break;
> -    case FF_OPT_TYPE_INT:
> -    case FF_OPT_TYPE_INT64:    printf("integer");            break;
> -    case FF_OPT_TYPE_FLOAT:
> -    case FF_OPT_TYPE_DOUBLE:   printf("float");              break;
> -    case FF_OPT_TYPE_RATIONAL: printf("rational number");    break;
> -    case FF_OPT_TYPE_FLAGS:    printf("flags");              break;
> +    case AV_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
> +    case AV_OPT_TYPE_STRING:   printf("string");             break;
> +    case AV_OPT_TYPE_INT:
> +    case AV_OPT_TYPE_INT64:    printf("integer");            break;
> +    case AV_OPT_TYPE_FLOAT:
> +    case AV_OPT_TYPE_DOUBLE:   printf("float");              break;
> +    case AV_OPT_TYPE_RATIONAL: printf("rational number");    break;
> +    case AV_OPT_TYPE_FLAGS:    printf("flags");              break;
>      default:                   printf("value");              break;
>      }
>      printf("} (@emph{");
> @@ -68,8 +68,8 @@ static void print_option(const AVClass *class, const AVOption *o)
>          const AVOption *u = NULL;
>          printf("\nPossible values:\n@table @samp\n");
>  
> -        while ((u = av_next_option(&class, u)))
> -            if (u->type == FF_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
> +        while ((u = av_opt_next(&class, u)))
> +            if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
>                  printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
>          printf("@end table\n");
>      }
> @@ -80,8 +80,8 @@ static void show_opts(const AVClass *class)
>      const AVOption *o = NULL;
>  
>      printf("@table @option\n");
> -    while ((o = av_next_option(&class, o)))
> -        if (o->type != FF_OPT_TYPE_CONST)
> +    while ((o = av_opt_next(&class, o)))
> +        if (o->type != AV_OPT_TYPE_CONST)
>              print_option(class, o);
>      printf("@end table\n");
>  }
> @@ -114,7 +114,7 @@ static void show_format_opts(void)
>  static void show_codec_opts(void)
>  {
>      void *iter = NULL;
> -    AVCodec *c = NULL;
> +    const AVCodec *c;
>  
>      printf("@section Generic codec AVOptions\n");
>      show_opts(avcodec_get_class());

LGTM, but does this tool have any use at all if it stayed broken for
several years and nobody cared to fix it?
Anton Khirnov Nov. 3, 2020, 1:32 p.m. UTC | #2
Quoting James Almer (2020-11-02 16:26:57)
> On 11/2/2020 10:17 AM, Anton Khirnov wrote:
> > ---
> >  Makefile             |  3 +++
> >  tools/Makefile       |  2 +-
> >  tools/enum_options.c | 26 +++++++++++++-------------
> >  3 files changed, 17 insertions(+), 14 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index c8b548d126..977ad69965 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -62,6 +62,9 @@ tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
> >  tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
> >  	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
> >  
> > +
> > +tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
> > +tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
> >  tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
> >  tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
> >  tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
> > diff --git a/tools/Makefile b/tools/Makefile
> > index 48fa131eeb..82baa8eadb 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -1,4 +1,4 @@
> > -TOOLS = qt-faststart trasher uncoded_frame
> > +TOOLS = enum_options qt-faststart trasher uncoded_frame
> >  TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
> >  TOOLS-$(CONFIG_ZLIB) += cws2fws
> >  
> > diff --git a/tools/enum_options.c b/tools/enum_options.c
> > index 548e427b7a..bedebd4c67 100644
> > --- a/tools/enum_options.c
> > +++ b/tools/enum_options.c
> > @@ -40,14 +40,14 @@ static void print_option(const AVClass *class, const AVOption *o)
> >  {
> >      printf("@item -%s @var{", o->name);
> >      switch (o->type) {
> > -    case FF_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
> > -    case FF_OPT_TYPE_STRING:   printf("string");             break;
> > -    case FF_OPT_TYPE_INT:
> > -    case FF_OPT_TYPE_INT64:    printf("integer");            break;
> > -    case FF_OPT_TYPE_FLOAT:
> > -    case FF_OPT_TYPE_DOUBLE:   printf("float");              break;
> > -    case FF_OPT_TYPE_RATIONAL: printf("rational number");    break;
> > -    case FF_OPT_TYPE_FLAGS:    printf("flags");              break;
> > +    case AV_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
> > +    case AV_OPT_TYPE_STRING:   printf("string");             break;
> > +    case AV_OPT_TYPE_INT:
> > +    case AV_OPT_TYPE_INT64:    printf("integer");            break;
> > +    case AV_OPT_TYPE_FLOAT:
> > +    case AV_OPT_TYPE_DOUBLE:   printf("float");              break;
> > +    case AV_OPT_TYPE_RATIONAL: printf("rational number");    break;
> > +    case AV_OPT_TYPE_FLAGS:    printf("flags");              break;
> >      default:                   printf("value");              break;
> >      }
> >      printf("} (@emph{");
> > @@ -68,8 +68,8 @@ static void print_option(const AVClass *class, const AVOption *o)
> >          const AVOption *u = NULL;
> >          printf("\nPossible values:\n@table @samp\n");
> >  
> > -        while ((u = av_next_option(&class, u)))
> > -            if (u->type == FF_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
> > +        while ((u = av_opt_next(&class, u)))
> > +            if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
> >                  printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
> >          printf("@end table\n");
> >      }
> > @@ -80,8 +80,8 @@ static void show_opts(const AVClass *class)
> >      const AVOption *o = NULL;
> >  
> >      printf("@table @option\n");
> > -    while ((o = av_next_option(&class, o)))
> > -        if (o->type != FF_OPT_TYPE_CONST)
> > +    while ((o = av_opt_next(&class, o)))
> > +        if (o->type != AV_OPT_TYPE_CONST)
> >              print_option(class, o);
> >      printf("@end table\n");
> >  }
> > @@ -114,7 +114,7 @@ static void show_format_opts(void)
> >  static void show_codec_opts(void)
> >  {
> >      void *iter = NULL;
> > -    AVCodec *c = NULL;
> > +    const AVCodec *c;
> >  
> >      printf("@section Generic codec AVOptions\n");
> >      show_opts(avcodec_get_class());
> 
> LGTM, but does this tool have any use at all if it stayed broken for
> several years and nobody cared to fix it?

Not sure. It seemed simpler to fix it than discuss removing it.
Either one is fine with me. Seems I wrote it and don't even remember
doing that.
James Almer Nov. 3, 2020, 3:48 p.m. UTC | #3
On 11/3/2020 10:32 AM, Anton Khirnov wrote:
> Quoting James Almer (2020-11-02 16:26:57)
>> On 11/2/2020 10:17 AM, Anton Khirnov wrote:
>>> ---
>>>  Makefile             |  3 +++
>>>  tools/Makefile       |  2 +-
>>>  tools/enum_options.c | 26 +++++++++++++-------------
>>>  3 files changed, 17 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index c8b548d126..977ad69965 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -62,6 +62,9 @@ tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
>>>  tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
>>>  	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
>>>  
>>> +
>>> +tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
>>> +tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
>>>  tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
>>>  tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
>>>  tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
>>> diff --git a/tools/Makefile b/tools/Makefile
>>> index 48fa131eeb..82baa8eadb 100644
>>> --- a/tools/Makefile
>>> +++ b/tools/Makefile
>>> @@ -1,4 +1,4 @@
>>> -TOOLS = qt-faststart trasher uncoded_frame
>>> +TOOLS = enum_options qt-faststart trasher uncoded_frame
>>>  TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
>>>  TOOLS-$(CONFIG_ZLIB) += cws2fws
>>>  
>>> diff --git a/tools/enum_options.c b/tools/enum_options.c
>>> index 548e427b7a..bedebd4c67 100644
>>> --- a/tools/enum_options.c
>>> +++ b/tools/enum_options.c
>>> @@ -40,14 +40,14 @@ static void print_option(const AVClass *class, const AVOption *o)
>>>  {
>>>      printf("@item -%s @var{", o->name);
>>>      switch (o->type) {
>>> -    case FF_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
>>> -    case FF_OPT_TYPE_STRING:   printf("string");             break;
>>> -    case FF_OPT_TYPE_INT:
>>> -    case FF_OPT_TYPE_INT64:    printf("integer");            break;
>>> -    case FF_OPT_TYPE_FLOAT:
>>> -    case FF_OPT_TYPE_DOUBLE:   printf("float");              break;
>>> -    case FF_OPT_TYPE_RATIONAL: printf("rational number");    break;
>>> -    case FF_OPT_TYPE_FLAGS:    printf("flags");              break;
>>> +    case AV_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
>>> +    case AV_OPT_TYPE_STRING:   printf("string");             break;
>>> +    case AV_OPT_TYPE_INT:
>>> +    case AV_OPT_TYPE_INT64:    printf("integer");            break;
>>> +    case AV_OPT_TYPE_FLOAT:
>>> +    case AV_OPT_TYPE_DOUBLE:   printf("float");              break;
>>> +    case AV_OPT_TYPE_RATIONAL: printf("rational number");    break;
>>> +    case AV_OPT_TYPE_FLAGS:    printf("flags");              break;
>>>      default:                   printf("value");              break;
>>>      }
>>>      printf("} (@emph{");
>>> @@ -68,8 +68,8 @@ static void print_option(const AVClass *class, const AVOption *o)
>>>          const AVOption *u = NULL;
>>>          printf("\nPossible values:\n@table @samp\n");
>>>  
>>> -        while ((u = av_next_option(&class, u)))
>>> -            if (u->type == FF_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
>>> +        while ((u = av_opt_next(&class, u)))
>>> +            if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
>>>                  printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
>>>          printf("@end table\n");
>>>      }
>>> @@ -80,8 +80,8 @@ static void show_opts(const AVClass *class)
>>>      const AVOption *o = NULL;
>>>  
>>>      printf("@table @option\n");
>>> -    while ((o = av_next_option(&class, o)))
>>> -        if (o->type != FF_OPT_TYPE_CONST)
>>> +    while ((o = av_opt_next(&class, o)))
>>> +        if (o->type != AV_OPT_TYPE_CONST)
>>>              print_option(class, o);
>>>      printf("@end table\n");
>>>  }
>>> @@ -114,7 +114,7 @@ static void show_format_opts(void)
>>>  static void show_codec_opts(void)
>>>  {
>>>      void *iter = NULL;
>>> -    AVCodec *c = NULL;
>>> +    const AVCodec *c;
>>>  
>>>      printf("@section Generic codec AVOptions\n");
>>>      show_opts(avcodec_get_class());
>>
>> LGTM, but does this tool have any use at all if it stayed broken for
>> several years and nobody cared to fix it?
> 
> Not sure. It seemed simpler to fix it than discuss removing it.
> Either one is fine with me. Seems I wrote it and don't even remember
> doing that.

Keeping it is ok, although by now it's probably outdated, considering
the opt flags used in print_option().
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index c8b548d126..977ad69965 100644
--- a/Makefile
+++ b/Makefile
@@ -62,6 +62,9 @@  tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
 tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
 	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
 
+
+tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
+tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
 tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
 tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
 tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
diff --git a/tools/Makefile b/tools/Makefile
index 48fa131eeb..82baa8eadb 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,4 +1,4 @@ 
-TOOLS = qt-faststart trasher uncoded_frame
+TOOLS = enum_options qt-faststart trasher uncoded_frame
 TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
 TOOLS-$(CONFIG_ZLIB) += cws2fws
 
diff --git a/tools/enum_options.c b/tools/enum_options.c
index 548e427b7a..bedebd4c67 100644
--- a/tools/enum_options.c
+++ b/tools/enum_options.c
@@ -40,14 +40,14 @@  static void print_option(const AVClass *class, const AVOption *o)
 {
     printf("@item -%s @var{", o->name);
     switch (o->type) {
-    case FF_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
-    case FF_OPT_TYPE_STRING:   printf("string");             break;
-    case FF_OPT_TYPE_INT:
-    case FF_OPT_TYPE_INT64:    printf("integer");            break;
-    case FF_OPT_TYPE_FLOAT:
-    case FF_OPT_TYPE_DOUBLE:   printf("float");              break;
-    case FF_OPT_TYPE_RATIONAL: printf("rational number");    break;
-    case FF_OPT_TYPE_FLAGS:    printf("flags");              break;
+    case AV_OPT_TYPE_BINARY:   printf("hexadecimal string"); break;
+    case AV_OPT_TYPE_STRING:   printf("string");             break;
+    case AV_OPT_TYPE_INT:
+    case AV_OPT_TYPE_INT64:    printf("integer");            break;
+    case AV_OPT_TYPE_FLOAT:
+    case AV_OPT_TYPE_DOUBLE:   printf("float");              break;
+    case AV_OPT_TYPE_RATIONAL: printf("rational number");    break;
+    case AV_OPT_TYPE_FLAGS:    printf("flags");              break;
     default:                   printf("value");              break;
     }
     printf("} (@emph{");
@@ -68,8 +68,8 @@  static void print_option(const AVClass *class, const AVOption *o)
         const AVOption *u = NULL;
         printf("\nPossible values:\n@table @samp\n");
 
-        while ((u = av_next_option(&class, u)))
-            if (u->type == FF_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
+        while ((u = av_opt_next(&class, u)))
+            if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
                 printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
         printf("@end table\n");
     }
@@ -80,8 +80,8 @@  static void show_opts(const AVClass *class)
     const AVOption *o = NULL;
 
     printf("@table @option\n");
-    while ((o = av_next_option(&class, o)))
-        if (o->type != FF_OPT_TYPE_CONST)
+    while ((o = av_opt_next(&class, o)))
+        if (o->type != AV_OPT_TYPE_CONST)
             print_option(class, o);
     printf("@end table\n");
 }
@@ -114,7 +114,7 @@  static void show_format_opts(void)
 static void show_codec_opts(void)
 {
     void *iter = NULL;
-    AVCodec *c = NULL;
+    const AVCodec *c;
 
     printf("@section Generic codec AVOptions\n");
     show_opts(avcodec_get_class());