From 546ae23a0c40726a31a152da4fb6363c918065a0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 28 Mar 2013 00:00:04 +0100 Subject: demux_mkv: set correct aspect ratio even if DisplayHeight is unset Fixes the file test2.mkv from the official Matroska test file collection. libavformat does the same thing. --- demux/demux_mkv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'demux/demux_mkv.c') diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 3917621384..1e9a61806e 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -1278,8 +1278,10 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track, if (!track->realmedia) { sh_v->disp_w = track->v_width; sh_v->disp_h = track->v_height; - if (track->v_dheight) - sh_v->aspect = (double) track->v_dwidth / track->v_dheight; + uint32_t dw = track->v_dwidth ? track->v_dwidth : track->v_width; + uint32_t dh = track->v_dheight ? track->v_dheight : track->v_height; + if (dw && dh) + sh_v->aspect = (double) dw / dh; } else { // vd_realvid.c will set aspect to disp_w/disp_h and rederive // disp_w and disp_h from the RealVideo stream contents returned -- cgit v1.2.3