Commit 6afd569e authored by Stefano Sabatini's avatar Stefano Sabatini

Make ffprobe able to set AVFormatContext options.

Originally committed as revision 25187 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 20e021c7
...@@ -39,6 +39,7 @@ version <next>: ...@@ -39,6 +39,7 @@ version <next>:
- frei0r wrapper filter - frei0r wrapper filter
- change crop filter syntax to width:height:x:y - change crop filter syntax to width:height:x:y
- make the crop filter accept parametric expressions - make the crop filter accept parametric expressions
- make ffprobe accept AVFormatContext options
version 0.6: version 0.6:
......
...@@ -269,6 +269,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) ...@@ -269,6 +269,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
AVFormatContext *fmt_ctx; AVFormatContext *fmt_ctx;
fmt_ctx = avformat_alloc_context(); fmt_ctx = avformat_alloc_context();
set_context_opts(fmt_ctx, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);
if ((err = av_open_input_file(&fmt_ctx, filename, iformat, 0, NULL)) < 0) { if ((err = av_open_input_file(&fmt_ctx, filename, iformat, 0, NULL)) < 0) {
print_error(filename, err); print_error(filename, err);
...@@ -353,9 +354,12 @@ static void opt_input_file(const char *arg) ...@@ -353,9 +354,12 @@ static void opt_input_file(const char *arg)
static void show_help(void) static void show_help(void)
{ {
av_log_set_callback(log_callback_help);
show_usage(); show_usage();
show_help_options(options, "Main options:\n", 0, 0); show_help_options(options, "Main options:\n", 0, 0);
printf("\n"); printf("\n");
av_opt_show2(avformat_opts, NULL,
AV_OPT_FLAG_DECODING_PARAM, 0);
} }
static void opt_pretty(void) static void opt_pretty(void)
...@@ -381,16 +385,21 @@ static const OptionDef options[] = { ...@@ -381,16 +385,21 @@ static const OptionDef options[] = {
{ "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
{ "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
{ NULL, }, { NULL, },
}; };
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int ret;
av_register_all(); av_register_all();
#if CONFIG_AVDEVICE #if CONFIG_AVDEVICE
avdevice_register_all(); avdevice_register_all();
#endif #endif
avformat_opts = avformat_alloc_context();
show_banner(); show_banner();
parse_options(argc, argv, options, opt_input_file); parse_options(argc, argv, options, opt_input_file);
...@@ -401,5 +410,9 @@ int main(int argc, char **argv) ...@@ -401,5 +410,9 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
return probe_file(input_filename); ret = probe_file(input_filename);
av_free(avformat_opts);
return ret;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment