summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-28 00:00:04 +0100
committerwm4 <wm4@nowhere>2013-03-28 00:00:04 +0100
commit546ae23a0c40726a31a152da4fb6363c918065a0 (patch)
tree508de416e84a2058d5531a0baadd45c43570941f /demux
parent2182c3ffd5df76272fea83a5d517c247f094c16b (diff)
downloadmpv-546ae23a0c40726a31a152da4fb6363c918065a0.tar.bz2
mpv-546ae23a0c40726a31a152da4fb6363c918065a0.tar.xz
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.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_mkv.c6
1 files changed, 4 insertions, 2 deletions
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