comparison opt.c @ 12509:7220936dc29c libavcodec

Deprecate av_opt_show() in favor of a new function av_opt_show2(), which allows to specify only a subset of all the options to show.
author stefano
date Fri, 24 Sep 2010 00:51:40 +0000
parents e522dbf60abd
children 776789af0304
comparison
equal deleted inserted replaced
12508:750ff18b7394 12509:7220936dc29c
317 317
318 av_get_number(obj, name, o_out, &num, &den, &intnum); 318 av_get_number(obj, name, o_out, &num, &den, &intnum);
319 return num*intnum/den; 319 return num*intnum/den;
320 } 320 }
321 321
322 static void opt_list(void *obj, void *av_log_obj, const char *unit) 322 static void opt_list(void *obj, void *av_log_obj, const char *unit,
323 int req_flags, int rej_flags)
323 { 324 {
324 const AVOption *opt=NULL; 325 const AVOption *opt=NULL;
325 326
326 while((opt= av_next_option(obj, opt))){ 327 while((opt= av_next_option(obj, opt))){
327 if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM))) 328 if (!(opt->flags & req_flags) || (opt->flags & rej_flags))
328 continue; 329 continue;
329 330
330 /* Don't print CONST's on level one. 331 /* Don't print CONST's on level one.
331 * Don't print anything but CONST's on level two. 332 * Don't print anything but CONST's on level two.
332 * Only print items from the requested unit. 333 * Only print items from the requested unit.
381 382
382 if(opt->help) 383 if(opt->help)
383 av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); 384 av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
384 av_log(av_log_obj, AV_LOG_INFO, "\n"); 385 av_log(av_log_obj, AV_LOG_INFO, "\n");
385 if (opt->unit && opt->type != FF_OPT_TYPE_CONST) { 386 if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
386 opt_list(obj, av_log_obj, opt->unit); 387 opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags);
387 } 388 }
388 } 389 }
389 } 390 }
390 391
391 int av_opt_show(void *obj, void *av_log_obj){ 392 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
393 {
392 if(!obj) 394 if(!obj)
393 return -1; 395 return -1;
394 396
395 av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name); 397 av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
396 398
397 opt_list(obj, av_log_obj, NULL); 399 opt_list(obj, av_log_obj, NULL, req_flags, rej_flags);
398 400
399 return 0; 401 return 0;
400 } 402 }
403
404 #if FF_API_OPT_SHOW
405 int av_opt_show(void *obj, void *av_log_obj){
406 return av_opt_show2(obj, av_log_obj,
407 AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
408 }
409 #endif
401 410
402 /** Set the values of the AVCodecContext or AVFormatContext structure. 411 /** Set the values of the AVCodecContext or AVFormatContext structure.
403 * They are set to the defaults specified in the according AVOption options 412 * They are set to the defaults specified in the according AVOption options
404 * array default_val field. 413 * array default_val field.
405 * 414 *