[FFmpeg-cvslog] Use Matroska document version 2 for WebM files if possible.
Carl Eugen Hoyos
git at videolan.org
Mon May 12 23:21:55 CEST 2014
ffmpeg | branch: release/2.1 | Carl Eugen Hoyos <cehoyos at ag.or.at> | Mon May 12 18:12:28 2014 +0200| [c5a2c26c55eb5bd0156c74bf4248c5123e97b30f] | committer: Carl Eugen Hoyos
Use Matroska document version 2 for WebM files if possible.
Google's plugin for the Internet Explorer refuses to play
files with another document version.
Fixes ticket #3583.
(cherry picked from commit ab21acecc72a0299895583cf83347ab5e2444b71)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c5a2c26c55eb5bd0156c74bf4248c5123e97b30f
---
libavformat/matroskaenc.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1a23151..8bc13f1 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1057,7 +1057,7 @@ static int mkv_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
ebml_master ebml_header, segment_info;
AVDictionaryEntry *tag;
- int ret, i;
+ int ret, i, version = 2;
if (!strcmp(s->oformat->name, "webm")) mkv->mode = MODE_WEBM;
else mkv->mode = MODE_MATROSKAv2;
@@ -1065,7 +1065,12 @@ 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 (mkv->mode != MODE_WEBM ||
+ av_dict_get(s->metadata, "stereo_mode", NULL, 0) ||
+ av_dict_get(s->metadata, "alpha_mode", NULL, 0))
+ version = 4;
+
+ 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 ||
@@ -1077,6 +1082,11 @@ static int mkv_write_header(AVFormatContext *s)
avcodec_get_name(s->streams[i]->codec->codec_id));
return AVERROR_PATCHWELCOME;
}
+ if (s->streams[i]->codec->codec_id == AV_CODEC_ID_OPUS ||
+ av_dict_get(s->streams[i]->metadata, "stereo_mode", NULL, 0) ||
+ av_dict_get(s->streams[i]->metadata, "alpha_mode", NULL, 0))
+ version = 4;
+ }
mkv->tracks = av_mallocz(s->nb_streams * sizeof(*mkv->tracks));
if (!mkv->tracks)
@@ -1088,7 +1098,7 @@ static int mkv_write_header(AVFormatContext *s)
put_ebml_uint (pb, EBML_ID_EBMLMAXIDLENGTH , 4);
put_ebml_uint (pb, EBML_ID_EBMLMAXSIZELENGTH , 8);
put_ebml_string (pb, EBML_ID_DOCTYPE , s->oformat->name);
- put_ebml_uint (pb, EBML_ID_DOCTYPEVERSION , 4);
+ put_ebml_uint (pb, EBML_ID_DOCTYPEVERSION , version);
put_ebml_uint (pb, EBML_ID_DOCTYPEREADVERSION , 2);
end_ebml_master(pb, ebml_header);
More information about the ffmpeg-cvslog
mailing list