diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-01-30 10:28:53 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-01-30 10:28:53 +0100 |
commit | 91f359292a52b7acf3785ea4c399b20d8fbd24e5 (patch) | |
tree | 56879c5825cf151142c16c44c9f6dda9b0bbb790 | |
parent | 71f8d7045638eb668f2395986de59821134fb1a1 (diff) | |
download | ffmpeg-91f359292a52b7acf3785ea4c399b20d8fbd24e5.tar.gz |
Correctly mark non-default streams when muxing matroska.
Fixes ticket #1815.
Reviewed-by: Hendrik Leppkes
-rw-r--r-- | libavformat/matroskaenc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index c167c015fe..204d1b2394 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -530,7 +530,7 @@ static int mkv_write_tracks(AVFormatContext *s) MatroskaMuxContext *mkv = s->priv_data; AVIOContext *pb = s->pb; ebml_master tracks; - int i, j, ret; + int i, j, ret, default_stream_exists = 0; ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_tell(pb)); if (ret < 0) return ret; @@ -538,6 +538,10 @@ static int mkv_write_tracks(AVFormatContext *s) tracks = start_ebml_master(pb, MATROSKA_ID_TRACKS, 0); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; + default_stream_exists |= st->disposition & AV_DISPOSITION_DEFAULT; + } + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; AVCodecContext *codec = st->codec; ebml_master subinfo, track; int native_id = 0; @@ -570,8 +574,9 @@ static int mkv_write_tracks(AVFormatContext *s) tag = av_dict_get(st->metadata, "language", NULL, 0); put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, tag ? tag->value:"und"); - if (st->disposition) + if (default_stream_exists) { put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGDEFAULT, !!(st->disposition & AV_DISPOSITION_DEFAULT)); + } if (st->disposition & AV_DISPOSITION_FORCED) put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGFORCED, 1); |