[FFmpeg-cvslog] Do not write invalid matroska files.

Carl Eugen Hoyos git at videolan.org
Sun Feb 10 10:52:59 CET 2013


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sun Feb 10 10:51:12 2013 +0100| [f02f231e05e09f31cebd18f4a3c2c29753dc4608] | committer: Carl Eugen Hoyos

Do not write invalid matroska files.

Some real codecs are supported by the matroska specification
(and FFmpeg's matroska demuxer) but not the FFmpeg muxer.

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

 libavformat/matroskaenc.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 204d1b2..3606a99 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -936,6 +936,19 @@ static int mkv_write_header(AVFormatContext *s)
     if (s->avoid_negative_ts < 0)
         s->avoid_negative_ts = 1;
 
+    for (i = 0; i < s->nb_streams; i++)
+        if (s->streams[i]->codec->codec_id == AV_CODEC_ID_ATRAC3 ||
+            s->streams[i]->codec->codec_id == AV_CODEC_ID_COOK ||
+            s->streams[i]->codec->codec_id == AV_CODEC_ID_RA_288 ||
+            s->streams[i]->codec->codec_id == AV_CODEC_ID_SIPR ||
+            s->streams[i]->codec->codec_id == AV_CODEC_ID_RV10 ||
+            s->streams[i]->codec->codec_id == AV_CODEC_ID_RV20) {
+            av_log(s, AV_LOG_ERROR,
+                   "The Matroska muxer does not yet support muxing %s\n",
+                   avcodec_get_name(s->streams[i]->codec->codec_id));
+            return AVERROR_PATCHWELCOME;
+        }
+
     mkv->tracks = av_mallocz(s->nb_streams * sizeof(*mkv->tracks));
     if (!mkv->tracks)
         return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list