From 3f5313a9e542d60fae69775b29cdf4929cbf7f40 Mon Sep 17 00:00:00 2001 From: mosu Date: Tue, 6 May 2003 20:40:24 +0000 Subject: Support for aspect ratio set via DisplayWidth/DisplayHeight. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10082 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_mkv.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'libmpdemux') diff --git a/libmpdemux/demux_mkv.cpp b/libmpdemux/demux_mkv.cpp index fe4f5ee8ea..3e8a34db79 100644 --- a/libmpdemux/demux_mkv.cpp +++ b/libmpdemux/demux_mkv.cpp @@ -135,7 +135,7 @@ typedef struct mkv_track { char type; // 'v' = video, 'a' = audio, 's' = subs char v_fourcc[5]; - uint32_t v_width, v_height; + uint32_t v_width, v_height, v_dwidth, v_dheight; float v_frate; uint16_t a_formattag; @@ -393,6 +393,11 @@ static int check_track_information(mkv_demuxer_t *d) { continue; } + if (t->v_dwidth == 0) + t->v_dwidth = t->v_width; + if (t->v_dheight == 0) + t->v_dheight = t->v_height; + // This track seems to be ok. t->ok = 1; @@ -1131,6 +1136,24 @@ extern "C" int demux_mkv_open(demuxer_t *demuxer) { mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Pixel height: " "%u\n", track->v_height); + } else if (EbmlId(*l4) == + KaxVideoDisplayWidth::ClassInfos.GlobalId) { + KaxVideoDisplayWidth &width = + *static_cast(l4); + width.ReadData(es->I_O()); + track->v_dwidth = uint16(width); + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Display width: " + "%u\n", track->v_dwidth); + + } else if (EbmlId(*l4) == + KaxVideoDisplayHeight::ClassInfos.GlobalId) { + KaxVideoDisplayHeight &height = + *static_cast(l4); + height.ReadData(es->I_O()); + track->v_dheight = uint16(height); + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Display height: " + "%u\n", track->v_dheight); + } else if (EbmlId(*l4) == KaxVideoFrameRate::ClassInfos.GlobalId) { KaxVideoFrameRate &framerate = @@ -1423,8 +1446,10 @@ extern "C" int demux_mkv_open(demuxer_t *demuxer) { sh_v->format = sh_v->bih->biCompression; sh_v->fps = track->v_frate; sh_v->frametime = 1 / track->v_frate; - sh_v->disp_w = sh_v->bih->biWidth; - sh_v->disp_h = sh_v->bih->biHeight; + sh_v->disp_w = track->v_width; + sh_v->disp_h = track->v_height; + sh_v->aspect = (float)track->v_dwidth / (float)track->v_dheight; + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Aspect: %f\n", sh_v->aspect); demuxer->video->id = track->tnum; demuxer->video->sh = sh_v; -- cgit v1.2.3