---
libavformat/avformat.h | 10 ++++++++++
libavformat/utils.c | 18 ++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index e0b3b3f..93d61fd 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -364,6 +364,11 @@ typedef struct AVOutputFormat {
* A negative number if unknown.
*/
int (*query_codec)(enum CodecID id, int std_compliance);
+
+ /**
+ * Private muxer-specific defaults.
+ */
+ const AVCodecDefault *defaults;
} AVOutputFormat;
/**
* @}
@@ -492,6 +497,11 @@ typedef struct AVInputFormat {
* Active streams are all streams that have AVStream.discard <
AVDISCARD_ALL.
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t
min_ts, int64_t ts, int64_t max_ts, int flags);
+
+ /**
+ * Private demuxer-specific defaults.
+ */
+ const AVCodecDefault *defaults;
} AVInputFormat;
/**
* @}
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4ecf053..ab6e8c6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -533,6 +533,15 @@ int avformat_open_input(AVFormatContext **ps, const char
*filename, AVInputForma
if ((ret = init_input(s, filename, &tmp)) < 0)
goto fail;
+ if (s->iformat->defaults) {
+ const AVCodecDefault *d = s->iformat->defaults;
+ while (d->key) {
+ int ret = av_opt_set(s, d->key, d->value, 0);
+ av_assert0(ret >= 0);
+ d++;
+ }
+ }
+
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
goto fail;
@@ -2760,6 +2769,15 @@ int avformat_write_header(AVFormatContext *s,
AVDictionary **options)
AVStream *st;
AVDictionary *tmp = NULL;
+ if (s->oformat->defaults) {
+ const AVCodecDefault *d = s->oformat->defaults;
+ while (d->key) {
+ int ret = av_opt_set(s, d->key, d->value, 0);
+ av_assert0(ret >= 0);
+ d++;
+ }
+ }
+
if (options)
av_dict_copy(&tmp, *options, 0);
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
--
1.7.3.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel