[Ffmpeg-cvslog] r6385 - trunk/libavcodec/opt.c

takis subversion
Fri Sep 29 21:36:13 CEST 2006


Author: takis
Date: Fri Sep 29 21:36:12 2006
New Revision: 6385

Modified:
   trunk/libavcodec/opt.c

Log:
Reformat the output of the list of available AVOptions, by indenting the
parameters of certain options and displaying them _right after_ the actual
option taking the parameter.


Modified: trunk/libavcodec/opt.c
==============================================================================
--- trunk/libavcodec/opt.c	(original)
+++ trunk/libavcodec/opt.c	Fri Sep 29 21:36:12 2006
@@ -258,19 +258,28 @@
     return num*intnum/den;
 }
 
-int av_opt_show(void *obj, void *av_log_obj){
+static int opt_list(void *obj, void *av_log_obj, char *unit)
+{
     AVOption *opt=NULL;
 
-    if(!obj)
-        return -1;
-
-    av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
-
     while((opt= av_next_option(obj, opt))){
         if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM)))
             continue;
 
-        av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
+        /* Don't print CONST's on level one.
+         * Don't print anything but CONST's on level two.
+         * Only print items from the requested unit.
+         */
+        if (!unit && opt->type==FF_OPT_TYPE_CONST)
+            continue;
+        else if (unit && opt->type!=FF_OPT_TYPE_CONST)
+            continue;
+        else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit))
+            continue;
+        else if (unit && opt->type == FF_OPT_TYPE_CONST)
+            av_log(av_log_obj, AV_LOG_INFO, "   %-15s ", opt->name);
+        else
+            av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
 
         switch( opt->type )
         {
@@ -309,7 +318,20 @@
         if(opt->help)
             av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
         av_log(av_log_obj, AV_LOG_INFO, "\n");
+        if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
+            opt_list(obj, av_log_obj, opt->unit);
+        }
     }
+}
+
+int av_opt_show(void *obj, void *av_log_obj){
+    if(!obj)
+        return -1;
+
+    av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
+
+    opt_list(obj, av_log_obj, NULL);
+
     return 0;
 }
 




More information about the ffmpeg-cvslog mailing list