Browse code

Make ffprobe able to set AVFormatContext options.

Originally committed as revision 25187 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2010/09/25 10:32:02
Showing 2 changed files
... ...
@@ -39,6 +39,7 @@ version <next>:
39 39
 - frei0r wrapper filter
40 40
 - change crop filter syntax to width:height:x:y
41 41
 - make the crop filter accept parametric expressions
42
+- make ffprobe accept AVFormatContext options
42 43
 
43 44
 
44 45
 version 0.6:
... ...
@@ -269,6 +269,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
269 269
     AVFormatContext *fmt_ctx;
270 270
 
271 271
     fmt_ctx = avformat_alloc_context();
272
+    set_context_opts(fmt_ctx, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);
272 273
 
273 274
     if ((err = av_open_input_file(&fmt_ctx, filename, iformat, 0, NULL)) < 0) {
274 275
         print_error(filename, err);
... ...
@@ -353,9 +354,12 @@ static void opt_input_file(const char *arg)
353 353
 
354 354
 static void show_help(void)
355 355
 {
356
+    av_log_set_callback(log_callback_help);
356 357
     show_usage();
357 358
     show_help_options(options, "Main options:\n", 0, 0);
358 359
     printf("\n");
360
+    av_opt_show2(avformat_opts, NULL,
361
+                 AV_OPT_FLAG_DECODING_PARAM, 0);
359 362
 }
360 363
 
361 364
 static void opt_pretty(void)
... ...
@@ -381,16 +385,21 @@ static const OptionDef options[] = {
381 381
     { "show_format",  OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
382 382
     { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
383 383
     { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
384
+    { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
384 385
     { NULL, },
385 386
 };
386 387
 
387 388
 int main(int argc, char **argv)
388 389
 {
390
+    int ret;
391
+
389 392
     av_register_all();
390 393
 #if CONFIG_AVDEVICE
391 394
     avdevice_register_all();
392 395
 #endif
393 396
 
397
+    avformat_opts = avformat_alloc_context();
398
+
394 399
     show_banner();
395 400
     parse_options(argc, argv, options, opt_input_file);
396 401
 
... ...
@@ -401,5 +410,9 @@ int main(int argc, char **argv)
401 401
         exit(1);
402 402
     }
403 403
 
404
-    return probe_file(input_filename);
404
+    ret = probe_file(input_filename);
405
+
406
+    av_free(avformat_opts);
407
+
408
+    return ret;
405 409
 }