]> git.sesse.net Git - ffmpeg/commitdiff
nut: Use the correct codec_tag when multiple are available
authorLuca Barbato <lu_zero@gentoo.org>
Thu, 3 Sep 2015 15:31:14 +0000 (17:31 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 2 Nov 2015 11:10:38 +0000 (12:10 +0100)
Some codecs use the codec_tag to signal specific information and
picking the first one would lead to a broken file.

Bug-Id: 883
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavformat/nutenc.c

index b7b0c9c7903f0aec424bb454f32e5146316ea5aa..be6579dadbb4182be487e96188dcf144ac8be4c8 100644 (file)
@@ -438,7 +438,8 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc,
     }
     ff_put_v(bc, 4);
 
-    if (!codec_tag || codec->codec_id == AV_CODEC_ID_RAWVIDEO)
+    if (av_codec_get_id(ff_nut_codec_tags, codec->codec_tag) == codec->codec_id ||
+        !codec_tag || codec->codec_id == AV_CODEC_ID_RAWVIDEO)
         codec_tag = codec->codec_tag;
 
     if (codec_tag) {