mirror of https://github.com/mpv-player/mpv
Revert "demux_mkv: PAR should be calculated after applying crop"
Matroska spec says that DisplayWidth and DisplayHeight should be applied
after cropping, but this doesn't adhere to the real files which does not
follow this rule. Revert the change and we can re-evaluate if someone
complains with spec compliant files.
See: https://datatracker.ietf.org/doc/draft-ietf-cellar-matroska/
This reverts commit f8db02b59d
.
This commit is contained in:
parent
dc2298f4da
commit
81102b0f6c
|
@ -1505,23 +1505,20 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track)
|
||||||
sh_v->disp_w = track->v_width;
|
sh_v->disp_w = track->v_width;
|
||||||
sh_v->disp_h = track->v_height;
|
sh_v->disp_h = track->v_height;
|
||||||
|
|
||||||
struct mp_rect crop;
|
|
||||||
crop.x0 = track->v_crop_left;
|
|
||||||
crop.y0 = track->v_crop_top;
|
|
||||||
crop.x1 = track->v_width - track->v_crop_right;
|
|
||||||
crop.y1 = track->v_height - track->v_crop_bottom;
|
|
||||||
|
|
||||||
// Keep the codec crop rect as 0s if we have no cropping since the
|
// Keep the codec crop rect as 0s if we have no cropping since the
|
||||||
// file may have broken width/height tags.
|
// file may have broken width/height tags.
|
||||||
if (track->v_crop_left || track->v_crop_top ||
|
if (track->v_crop_left || track->v_crop_top ||
|
||||||
track->v_crop_right || track->v_crop_bottom)
|
track->v_crop_right || track->v_crop_bottom)
|
||||||
{
|
{
|
||||||
sh_v->crop = crop;
|
sh_v->crop.x0 = track->v_crop_left;
|
||||||
|
sh_v->crop.y0 = track->v_crop_top;
|
||||||
|
sh_v->crop.x1 = track->v_width - track->v_crop_right;
|
||||||
|
sh_v->crop.y1 = track->v_height - track->v_crop_bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dw = track->v_dwidth_set ? track->v_dwidth : mp_rect_w(crop);
|
int dw = track->v_dwidth_set ? track->v_dwidth : track->v_width;
|
||||||
int dh = track->v_dheight_set ? track->v_dheight : mp_rect_h(crop);
|
int dh = track->v_dheight_set ? track->v_dheight : track->v_height;
|
||||||
struct mp_image_params p = {.w = mp_rect_w(crop), .h = mp_rect_h(crop)};
|
struct mp_image_params p = {.w = track->v_width, .h = track->v_height};
|
||||||
mp_image_params_set_dsize(&p, dw, dh);
|
mp_image_params_set_dsize(&p, dw, dh);
|
||||||
sh_v->par_w = p.p_w;
|
sh_v->par_w = p.p_w;
|
||||||
sh_v->par_h = p.p_h;
|
sh_v->par_h = p.p_h;
|
||||||
|
|
Loading…
Reference in New Issue