summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-10-25 16:05:46 +0200
committerwm4 <wm4@nowhere>2016-10-25 16:05:46 +0200
commitee4bed25a85b2ef58557ab4f45ff62dbae3f863e (patch)
tree974d39a5867941853c636cfb344971ba17f58306 /player
parent6953a1ca2f5650025599a6ec9d57214c58d9c9c4 (diff)
downloadmpv-ee4bed25a85b2ef58557ab4f45ff62dbae3f863e.tar.bz2
mpv-ee4bed25a85b2ef58557ab4f45ff62dbae3f863e.tar.xz
command: if window-scale can't be set properly, set it as option
Kind of sketchy, but happens to fix #3724.
Diffstat (limited to 'player')
-rw-r--r--player/command.c21
1 files changed, 8 insertions, 13 deletions
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(&params, &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,