On Sun, 12 Jun 2011 19:30:59 -0400, "Ronald S. Bultje" <[email protected]> wrote: > Hi, > > On Fri, Jun 10, 2011 at 4:13 PM, Anton Khirnov <[email protected]> wrote: > > --- > > ffprobe.c | 12 ++++++++++-- > > 1 files changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/ffprobe.c b/ffprobe.c > > index e00790f..d5961c8 100644 > > --- a/ffprobe.c > > +++ b/ffprobe.c > > @@ -263,14 +263,22 @@ static int open_input_file(AVFormatContext > > **fmt_ctx_ptr, const char *filename) > > { > > int err, i; > > AVFormatContext *fmt_ctx; > > + AVDictionaryEntry *t; > > + AVDictionary *tmp = NULL; > > > > fmt_ctx = avformat_alloc_context(); > > - set_context_opts(fmt_ctx, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, > > NULL); > > + fmt_ctx->iformat = iformat; > > > > - if ((err = av_open_input_file(&fmt_ctx, filename, iformat, 0, NULL)) < > > 0) { > > + if ((err = avformat_open_input(&fmt_ctx, filename, format_opts, &tmp)) > > < 0) { > > print_error(filename, err); > > return err; > > } > > + if ((t = av_dict_get(tmp, "", NULL, AV_DICT_IGNORE_SUFFIX))) { > > + av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); > > + return AVERROR_OPTION_NOT_FOUND; > > + } > > + av_dict_free(&tmp); > > If you provide NULL instead of &tmp, av_opt_set_dict() will print the > errors for you. >
Oh yeah? And how will it know when to log the errors? There are rare, but legitimate cases when you want to completely ignore options that weren't found, in such a case you don't want to log anything. See AVFormatParameters emulation in the av_open_input_* compat wrappers for an example. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
