diff options
author | wm4 <wm4@nowhere> | 2013-04-04 01:20:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-04-04 01:22:24 +0200 |
commit | 061b99d7b9cac8c6e6be3dc4763cf44284614b7c (patch) | |
tree | 2132fba689890934e0e014952ffdee3f9205f481 /demux | |
parent | 2ade0951ef5b115797d8a4c82db587ac77ecad5e (diff) | |
download | mpv-061b99d7b9cac8c6e6be3dc4763cf44284614b7c.tar.bz2 mpv-061b99d7b9cac8c6e6be3dc4763cf44284614b7c.tar.xz |
demux_mkv: fix handling of 0 DisplayWidth/Height
Commit 546ae23 fixed aspect ratio if the DisplayWidth or DisplayHeight
elements were missing. However, some bogus files [1] can have these
elements present in the file, but set to 0. Use 1:1 pixel aspect for
such files.
[1] https://ffmpeg.org/trac/ffmpeg/ticket/2424
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_mkv.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 400bb59ad7..5b178d66b9 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -92,6 +92,7 @@ typedef struct mkv_track { int type; uint32_t v_width, v_height, v_dwidth, v_dheight; + bool v_dwidth_set, v_dheight_set; double v_frate; uint32_t colorspace; @@ -538,11 +539,13 @@ static void parse_trackvideo(struct demuxer *demuxer, struct mkv_track *track, } if (video->n_display_width) { track->v_dwidth = video->display_width; + track->v_dwidth_set = true; mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Display width: %u\n", track->v_dwidth); } if (video->n_display_height) { track->v_dheight = video->display_height; + track->v_dheight_set = true; mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Display height: %u\n", track->v_dheight); } @@ -1279,8 +1282,8 @@ 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; - uint32_t dw = track->v_dwidth ? track->v_dwidth : track->v_width; - uint32_t dh = track->v_dheight ? track->v_dheight : track->v_height; + uint32_t dw = track->v_dwidth_set ? track->v_dwidth : track->v_width; + uint32_t dh = track->v_dheight_set ? track->v_dheight : track->v_height; if (dw && dh) sh_v->aspect = (double) dw / dh; } else { |