comparison opt.c @ 3788:484d719a2028 libavcodec

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.
author takis
date Fri, 29 Sep 2006 19:36:12 +0000
parents 616a81d04758
children c8c591fe26f8
comparison
equal deleted inserted replaced
3787:89ed4a761f51 3788:484d719a2028
256 256
257 av_get_number(obj, name, o_out, &num, &den, &intnum); 257 av_get_number(obj, name, o_out, &num, &den, &intnum);
258 return num*intnum/den; 258 return num*intnum/den;
259 } 259 }
260 260
261 int av_opt_show(void *obj, void *av_log_obj){ 261 static int opt_list(void *obj, void *av_log_obj, char *unit)
262 {
262 AVOption *opt=NULL; 263 AVOption *opt=NULL;
263
264 if(!obj)
265 return -1;
266
267 av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
268 264
269 while((opt= av_next_option(obj, opt))){ 265 while((opt= av_next_option(obj, opt))){
270 if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM))) 266 if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM)))
271 continue; 267 continue;
272 268
273 av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name); 269 /* Don't print CONST's on level one.
270 * Don't print anything but CONST's on level two.
271 * Only print items from the requested unit.
272 */
273 if (!unit && opt->type==FF_OPT_TYPE_CONST)
274 continue;
275 else if (unit && opt->type!=FF_OPT_TYPE_CONST)
276 continue;
277 else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit))
278 continue;
279 else if (unit && opt->type == FF_OPT_TYPE_CONST)
280 av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
281 else
282 av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
274 283
275 switch( opt->type ) 284 switch( opt->type )
276 { 285 {
277 case FF_OPT_TYPE_FLAGS: 286 case FF_OPT_TYPE_FLAGS:
278 av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>" ); 287 av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>" );
307 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); 316 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
308 317
309 if(opt->help) 318 if(opt->help)
310 av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); 319 av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
311 av_log(av_log_obj, AV_LOG_INFO, "\n"); 320 av_log(av_log_obj, AV_LOG_INFO, "\n");
312 } 321 if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
322 opt_list(obj, av_log_obj, opt->unit);
323 }
324 }
325 }
326
327 int av_opt_show(void *obj, void *av_log_obj){
328 if(!obj)
329 return -1;
330
331 av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
332
333 opt_list(obj, av_log_obj, NULL);
334
313 return 0; 335 return 0;
314 } 336 }
315 337
316 /** Set the values of the AVCodecContext or AVFormatContext structure. 338 /** Set the values of the AVCodecContext or AVFormatContext structure.
317 * They are set to the defaults specified in the according AVOption options 339 * They are set to the defaults specified in the according AVOption options