diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-01-03 18:23:50 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-01-05 20:55:22 +0400 |
commit | 4b38303cc29dde626c8db2eaf191e6cb98b1c38c (patch) | |
tree | 00e0203156a18403dfcb4a13d18d9722dbd1015a | |
parent | 8c355492001b4c29f5ddfd1178b4892065424ef4 (diff) |
The default values are only valid when the DisplayUnit is 0 (pixels), and all other
values require explicit coding of the DisplayWidth/Height values.
-rw-r--r-- | libavformat/MatroskaParser.c | 8 | ||||
-rw-r--r-- | libavformat/matroskadec_haali.c | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/libavformat/MatroskaParser.c b/libavformat/MatroskaParser.c index e14d236d87..4e1eeb3115 100644 --- a/libavformat/MatroskaParser.c +++ b/libavformat/MatroskaParser.c @@ -1227,6 +1227,14 @@ static void parseVideoInfo(MatroskaFile *mf,ulonglong toplen,struct TrackInfo *t ti->AV.Video.GammaValue = readFloat(mf,(unsigned)len); break; ENDFOR(mf); + + // DisplayWidth/Height defaults don't apply for DisplayUnit != 0 + if (ti->AV.Video.DisplayUnit != 0) { + if (!dW) + ti->AV.Video.DisplayWidth = 0; + if (!dH) + ti->AV.Video.DisplayHeight = 0; + } } static void parseAudioInfo(MatroskaFile *mf,ulonglong toplen,struct TrackInfo *ti) { diff --git a/libavformat/matroskadec_haali.c b/libavformat/matroskadec_haali.c index e5bae12b16..7d4e2d9ab5 100644 --- a/libavformat/matroskadec_haali.c +++ b/libavformat/matroskadec_haali.c @@ -447,10 +447,12 @@ static int mkv_read_header(AVFormatContext *s) st->codec->codec_tag = fourcc; st->codec->width = info->AV.Video.PixelWidth; st->codec->height = info->AV.Video.PixelHeight; - av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, - st->codec->height * info->AV.Video.DisplayWidth, - st->codec-> width * info->AV.Video.DisplayHeight, - 1 << 30); + if (info->AV.Video.DisplayWidth && info->AV.Video.DisplayHeight) { + av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, + st->codec->height * info->AV.Video.DisplayWidth, + st->codec-> width * info->AV.Video.DisplayHeight, + 1 << 30); + } if (st->codec->codec_id != AV_CODEC_ID_H264) st->need_parsing = AVSTREAM_PARSE_HEADERS; av_log(s, AV_LOG_DEBUG, "Default Duration: %"PRId64"\n", info->DefaultDuration); |