1
0
Fork 0

matroskadec_haali: only use default values for DisplayWidth/Height if appropriate.

The default values are only valid when the DisplayUnit is 0 (pixels), and all other
values require explicit coding of the DisplayWidth/Height values.
This commit is contained in:
Hendrik Leppkes 2013-01-03 15:23:50 +01:00
parent 2d4e0910d2
commit f95b40648f
Signed by: hendrik
GPG Key ID: 846079A4B0A7C1B5
2 changed files with 14 additions and 4 deletions

View File

@ -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) {

View File

@ -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);