mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
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.
This commit is contained in:
parent
a01fedd9b8
commit
ab21acecc7
@ -1096,7 +1096,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;
|
||||
@ -1104,7 +1104,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 ||
|
||||
@ -1116,6 +1121,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)
|
||||
@ -1127,7 +1137,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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user