This is in preparation for adding support for demuxer specific
defaults, where the input format needs to be known before setting
the defaults, which should be done before applying the user provided
options.
---
libavformat/utils.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f67d2d4..e2d940c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -527,13 +527,30 @@ int avformat_open_input(AVFormatContext **ps, const char
*filename, AVInputForma
if (fmt)
s->iformat = fmt;
- if (options)
+ if (options) {
+ static const char* early_set_options[] = {
+ "probesize", NULL
+ };
+ const char** ptr;
av_dict_copy(&tmp, *options, 0);
+ /* Set these options before calling init_input. We only set
+ * the options actually used by init_input, setting the rest
+ * of the options later after we've initialized them with
+ * demuxer specific defaults. */
+ for (ptr = early_set_options; *ptr; ptr++) {
+ AVDictionaryEntry* entry = av_dict_get(tmp, *ptr, NULL, 0);
+ if (entry) {
+ int ret = av_opt_set(s, entry->key, entry->value, 0);
+ if (ret == 0)
+ av_dict_set(&tmp, *ptr, NULL, 0);
+ }
+ }
+ }
- if ((ret = av_opt_set_dict(s, &tmp)) < 0)
+ if ((ret = init_input(s, filename, &tmp)) < 0)
goto fail;
- if ((ret = init_input(s, filename, &tmp)) < 0)
+ if ((ret = av_opt_set_dict(s, &tmp)) < 0)
goto fail;
/* check filename in case an image number is expected */
--
1.7.3.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel