comparison opt.c @ 2876:8026edf6a349 libavcodec

avoid stdio.h
author michael
date Sun, 11 Sep 2005 23:19:57 +0000
parents 1021498a5159
children b447caeb6978
comparison
equal deleted inserted replaced
2875:1021498a5159 2876:8026edf6a349
22 * @file opt.c 22 * @file opt.c
23 * AVOptions 23 * AVOptions
24 * @author Michael Niedermayer <michaelni@gmx.at> 24 * @author Michael Niedermayer <michaelni@gmx.at>
25 */ 25 */
26 26
27 #include <stdio.h> //for FILE *
28 #include "avcodec.h" 27 #include "avcodec.h"
29 28
30 static double av_parse_num(const char *name, char **tail){ 29 static double av_parse_num(const char *name, char **tail){
31 double d; 30 double d;
32 d= strtod(name, tail); 31 d= strtod(name, tail);
222 221
223 av_get_number(obj, name, o_out, &num, &den, &intnum); 222 av_get_number(obj, name, o_out, &num, &den, &intnum);
224 return num*intnum/den; 223 return num*intnum/den;
225 } 224 }
226 225
227 int av_opt_show(void *obj, FILE *f){ 226 int av_opt_show(void *obj, void *av_log_obj){
228 AVOption *opt=NULL; 227 AVOption *opt=NULL;
229 228
230 if(!obj) 229 if(!obj)
231 return -1; 230 return -1;
232 #undef fprintf 231
233 fprintf(f, "%s AVOptions:\n", (*(AVClass**)obj)->class_name); 232 av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
234 233
235 while((opt= av_next_option(obj, opt))){ 234 while((opt= av_next_option(obj, opt))){
236 if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM))) 235 if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM)))
237 continue; 236 continue;
238 237
239 fprintf(f, "-%-17s ", opt->name); 238 av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
240 fprintf(f, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.'); 239 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.');
241 fprintf(f, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.'); 240 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.');
242 fprintf(f, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.'); 241 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.');
243 fprintf(f, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.'); 242 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.');
244 fprintf(f, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); 243 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
245 244
246 fprintf(f, " %s\n", opt->help); 245 av_log(av_log_obj, AV_LOG_INFO, " %s\n", opt->help);
247 } 246 }
248 return 0; 247 return 0;
249 } 248 }