summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-16 23:07:13 +0100
committerwm4 <wm4@nowhere>2015-01-16 23:07:13 +0100
commitfc524e8a0704670d2e7daad36e54b66daf93e3d8 (patch)
treefe835d5156bbef228eb6036a390271f40bc1d16f /player/command.c
parent1883b7cc0c2844a903d51042861fca16eb3fad02 (diff)
downloadmpv-fc524e8a0704670d2e7daad36e54b66daf93e3d8.tar.bz2
mpv-fc524e8a0704670d2e7daad36e54b66daf93e3d8.tar.xz
command: unify handling of fullscreen and other VO flags
The "ontop" and "border" properties already used a common mp_property_vo_flag() function, and the corresponding VOCTRLs used the same conventions. "fullscreen" is pretty similar, but was handled slightly similar. Change how VOCTRL_FULLSCREEN behaves, and use the same helper function for "fullscreen" as the other flags.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/player/command.c b/player/command.c
index 6dc450234c..14b3cac7c2 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1986,25 +1986,6 @@ static int mp_property_hwdec(void *ctx, struct m_property *prop,
return mp_property_generic_option(mpctx, prop, action, arg);
}
-/// Fullscreen state (RW)
-static int mp_property_fullscreen(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- if (!mpctx->video_out)
- return M_PROPERTY_UNAVAILABLE;
- struct mp_vo_opts *opts = mpctx->video_out->opts;
-
- if (action == M_PROPERTY_SET) {
- int val = *(int *)arg;
- opts->fullscreen = val;
- if (mpctx->video_out->config_ok)
- vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
- return opts->fullscreen == val ? M_PROPERTY_OK : M_PROPERTY_ERROR;
- }
- return mp_property_generic_option(mpctx, prop, action, arg);
-}
-
#define VF_DEINTERLACE_LABEL "deinterlace"
static bool probe_deint_filter(struct MPContext *mpctx, const char *filt)
@@ -2254,15 +2235,25 @@ static int mp_property_vo_flag(struct m_property *prop, int action, void *arg,
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
- if (*vo_var == !!*(int *) arg)
+ int desired = !!*(int *) arg;
+ if (*vo_var == desired)
return M_PROPERTY_OK;
if (mpctx->video_out->config_ok)
vo_control(mpctx->video_out, vo_ctrl, 0);
- return M_PROPERTY_OK;
+ return *vo_var == desired ? M_PROPERTY_OK : M_PROPERTY_ERROR;
}
return mp_property_generic_option(mpctx, prop, action, arg);
}
+/// Fullscreen state (RW)
+static int mp_property_fullscreen(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ return mp_property_vo_flag(prop, action, arg, VOCTRL_FULLSCREEN,
+ &mpctx->opts->vo.fullscreen, mpctx);
+}
+
/// Window always on top (RW)
static int mp_property_ontop(void *ctx, struct m_property *prop,
int action, void *arg)