From 0c1959b056f6ccaa2eee2c824352ba93c8e36d52 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 1 May 2014 10:43:10 +0200 Subject: lavf: add AVFMT_FLAG_BITEXACT. Use it instead of checking CODEC_FLAG_BITEXACT in the first stream's codec context. Using codec options inside lavf is fragile and can easily break when the muxing codec context is not the encoding context. --- libavformat/mux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libavformat/mux.c') diff --git a/libavformat/mux.c b/libavformat/mux.c index 59f9c42cf1..33257ea147 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -149,6 +149,11 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) if ((ret = av_opt_set_dict(s, &tmp)) < 0) goto fail; +#if FF_API_LAVF_BITEXACT + if (s->nb_streams && s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT) + s->flags |= AVFMT_FLAG_BITEXACT; +#endif + // some sanity checks if (s->nb_streams == 0 && !(of->flags & AVFMT_NOSTREAMS)) { av_log(s, AV_LOG_ERROR, "no streams\n"); @@ -252,7 +257,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) } /* set muxer identification string */ - if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { + if (!(s->flags & AVFMT_FLAG_BITEXACT)) { av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); } -- cgit v1.2.3