From ee4bed25a85b2ef58557ab4f45ff62dbae3f863e Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 25 Oct 2016 16:05:46 +0200 Subject: command: if window-scale can't be set properly, set it as option Kind of sketchy, but happens to fix #3724. --- player/command.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index ea0df509e1..79ec3d0aef 100644 --- a/player/command.c +++ b/player/command.c @@ -2747,40 +2747,35 @@ static int mp_property_window_scale(void *ctx, struct m_property *prop, MPContext *mpctx = ctx; struct vo *vo = mpctx->video_out; if (!vo) - return mp_property_generic_option(mpctx, prop, action, arg); + goto generic; struct mp_image_params params = get_video_out_params(mpctx); int vid_w, vid_h; mp_image_params_get_dsize(¶ms, &vid_w, &vid_h); if (vid_w < 1 || vid_h < 1) - return M_PROPERTY_UNAVAILABLE; + goto generic; switch (action) { case M_PROPERTY_SET: { double scale = *(double *)arg; int s[2] = {vid_w * scale, vid_h * scale}; - if (s[0] > 0 && s[1] > 0 && - vo_control(vo, VOCTRL_SET_UNFS_WINDOW_SIZE, s) > 0) - { - mpctx->opts->vo->window_scale = scale; - return M_PROPERTY_OK; - } - return M_PROPERTY_UNAVAILABLE; + if (s[0] > 0 && s[1] > 0) + vo_control(vo, VOCTRL_SET_UNFS_WINDOW_SIZE, s); + goto generic; } case M_PROPERTY_GET: { int s[2]; if (vo_control(vo, VOCTRL_GET_UNFS_WINDOW_SIZE, s) <= 0 || s[0] < 1 || s[1] < 1) - return M_PROPERTY_UNAVAILABLE; + goto generic; double xs = (double)s[0] / vid_w; double ys = (double)s[1] / vid_h; *(double *)arg = (xs + ys) / 2; return M_PROPERTY_OK; } - case M_PROPERTY_GET_TYPE: - return mp_property_generic_option(mpctx, prop, action, arg); } - return M_PROPERTY_NOT_IMPLEMENTED; +generic: + return mp_property_generic_option(mpctx, prop, action, arg); } static int mp_property_win_minimized(void *ctx, struct m_property *prop, -- cgit v1.2.3