From 9a55c4e70cebe6da6b7c7796119f84c4c9ad2a60 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 26 Sep 2013 16:53:17 +0200 Subject: video: let sh_video->aspect always be container aspect ratio Now writing -1 to the 'aspect' property resets the video to the auto aspect ratio. Returning the aspect from the property becomes a bit more complicated, because we still try to return the container aspect ratio if no frame has been decoded yet. --- video/decode/vd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'video/decode/vd.c') diff --git a/video/decode/vd.c b/video/decode/vd.c index ad2af3a2cd..574f0468d4 100644 --- a/video/decode/vd.c +++ b/video/decode/vd.c @@ -115,12 +115,13 @@ int mpcodecs_reconfig_vo(sh_video_t *sh, const struct mp_image_params *params) } // time to do aspect ratio corrections... - if (opts->movie_aspect > -1.0) - sh->aspect = opts->movie_aspect; // cmdline overrides autodetect - else if (sh->stream_aspect != 0.0) - sh->aspect = sh->stream_aspect; + float force_aspect = opts->movie_aspect; + if (force_aspect > -1.0 && sh->stream_aspect != 0.0) + force_aspect = sh->stream_aspect; + + if (force_aspect >= 0) + vf_set_dar(&p.d_w, &p.d_h, p.w, p.h, force_aspect); - vf_set_dar(&p.d_w, &p.d_h, p.w, p.h, sh->aspect); if (abs(p.d_w - p.w) >= 4 || abs(p.d_h - p.h) >= 4) { mp_tmsg(MSGT_CPLAYER, MSGL_V, "Aspect ratio is %.2f:1 - " "scaling to correct movie aspect.\n", sh->aspect); -- cgit v1.2.3