[FFmpeg-cvslog] avformat/matroskaenc: wrap V_QUICKTIME codec private in something that looks like its part of quicktime stsd

Michael Niedermayer git at videolan.org
Wed Apr 16 19:57:28 CEST 2014


ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Sun Jan 19 20:59:28 2014 +0100| [92d336670f82ebb8ac216fb21b892ce27699b70d] | committer: Carl Eugen Hoyos

avformat/matroskaenc: wrap V_QUICKTIME codec private in something that looks like its part of quicktime stsd

This is needed for matroska spec compliance
Fixes playback of SVQ3 in matroska with vlc
Fixes Ticket 3256

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 8456bd2c0f3b08756f353646fe3b40a6772e665e)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=92d336670f82ebb8ac216fb21b892ce27699b70d
---

 libavformat/matroskaenc.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index ea45d9c..1a23151 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -546,8 +546,18 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
         if (qt_id) {
             if (!codec->codec_tag)
                 codec->codec_tag = ff_codec_get_tag(ff_codec_movvideo_tags, codec->codec_id);
-            if (codec->extradata_size)
+            if (codec->extradata_size) {
+                if (   ff_codec_get_id(ff_codec_movvideo_tags, codec->codec_tag) == codec->codec_id
+                    && ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(codec->extradata+4)) != codec->codec_id
+                ) {
+                    int i;
+                    avio_wb32(dyn_cp, 0x5a + codec->extradata_size);
+                    avio_wl32(dyn_cp, codec->codec_tag);
+                    for(i=0; i<0x5a-8; i++)
+                        avio_w8(dyn_cp, 0);
+                }
                 avio_write(dyn_cp, codec->extradata, codec->extradata_size);
+            }
         } else {
             if (!codec->codec_tag)
                 codec->codec_tag = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id);



More information about the ffmpeg-cvslog mailing list