diff options
author | Panagiotis Issaris <takis.issaris@uhasselt.be> | 2006-09-29 19:36:12 +0000 |
---|---|---|
committer | Panagiotis Issaris <takis.issaris@uhasselt.be> | 2006-09-29 19:36:12 +0000 |
commit | d70ef6d7618d2a14ffaae26b9cc6837c373fa64c (patch) | |
tree | 271fec403c9821d804119b5fff008f20ea6e016e /libavcodec/opt.c | |
parent | 6d6f42d202b2cacaf7288bda99ad6df1baaeb03c (diff) | |
download | ffmpeg-d70ef6d7618d2a14ffaae26b9cc6837c373fa64c.tar.gz |
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.
Originally committed as revision 6385 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/opt.c')
-rw-r--r-- | libavcodec/opt.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/libavcodec/opt.c b/libavcodec/opt.c index 248e68c200..2b9f270261 100644 --- a/libavcodec/opt.c +++ b/libavcodec/opt.c @@ -258,19 +258,28 @@ int64_t av_get_int(void *obj, const char *name, AVOption **o_out){ 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 @@ int av_opt_show(void *obj, void *av_log_obj){ 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; } |