1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 15:52:25 +00:00

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.
This commit is contained in:
wm4 2013-03-28 00:00:04 +01:00
parent 2182c3ffd5
commit 546ae23a0c

View File

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