summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-25 20:17:29 +0100
committerwm4 <wm4@nowhere>2019-11-25 20:29:43 +0100
commit78bb1586d34bcd0cf89267d9447a9cef6ef29761 (patch)
tree2f5354701dc467e3d49abd3eec483a913ecb9a79 /player/command.c
parentfba7c69b8afe7a2c06f14b7fc96b53b1a55819cf (diff)
downloadmpv-78bb1586d34bcd0cf89267d9447a9cef6ef29761.tar.bz2
mpv-78bb1586d34bcd0cf89267d9447a9cef6ef29761.tar.xz
command: shuffle around even more crap
Convert some remaining properties to work without the option-to-property bridge. Behavior shouldn't change (except for the corner case that it tries to reapply the new state when setting a property, while it used to ignore redundant sets). As it is the case with many of these changes, much of the code is not in its final proper state yet, but is rather a temporary workaround. For example, these "VO flag" properties should just be fully handled in the VO backend. (Currently, the config or VO layers don't provide enough mechanism yet as that all the backends like x11, win32, etc. could be changed yet, but that's another refactoring mess for another time.) Now nothing relies on this option-to-property bridge anymore, which opens the way to even more refactoring, which eventually may result in tiny improvements for the end user.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c93
1 files changed, 17 insertions, 76 deletions
diff --git a/player/command.c b/player/command.c
index 43d1fbb1c4..744f87abd9 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2104,77 +2104,6 @@ static int mp_property_hwdec_interop(void *ctx, struct m_property *prop,
return res;
}
-/// Helper to set vo flags.
-/** \ingroup PropertyImplHelper
- */
-static int mp_property_vo_flag(struct m_property *prop, int action, void *arg,
- int vo_ctrl, int *vo_var, MPContext *mpctx)
-{
- int old = *vo_var;
- int res = mp_property_generic_option(mpctx, prop, action, arg);
- if (action == M_PROPERTY_SET && old != *vo_var) {
- if (mpctx->video_out)
- vo_control(mpctx->video_out, vo_ctrl, 0);
- }
- return res;
-}
-
-/// Fullscreen state (RW)
-static int mp_property_fullscreen(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- int oldval = mpctx->opts->vo->fullscreen;
- int r = mp_property_vo_flag(prop, action, arg, VOCTRL_FULLSCREEN,
- &mpctx->opts->vo->fullscreen, mpctx);
- if (oldval && oldval != mpctx->opts->vo->fullscreen)
- mpctx->mouse_event_ts--; // Show mouse cursor
- return r;
-}
-
-/// Show playback progress in Windows 7+ taskbar (RW)
-static int mp_property_taskbar_progress(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- if (action == M_PROPERTY_SET) {
- int desired = !!*(int *) arg;
- if (mpctx->opts->vo->taskbar_progress == desired)
- return M_PROPERTY_OK;
- mpctx->opts->vo->taskbar_progress = desired;
- if (mpctx->video_out)
- update_vo_playback_state(mpctx);
- return M_PROPERTY_OK;
- }
- return mp_property_generic_option(mpctx, prop, action, arg);
-}
-
-/// Window always on top (RW)
-static int mp_property_ontop(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- return mp_property_vo_flag(prop, action, arg, VOCTRL_ONTOP,
- &mpctx->opts->vo->ontop, mpctx);
-}
-
-/// Show window borders (RW)
-static int mp_property_border(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- return mp_property_vo_flag(prop, action, arg, VOCTRL_BORDER,
- &mpctx->opts->vo->border, mpctx);
-}
-
-static int mp_property_all_workspaces(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- return mp_property_vo_flag(prop, action, arg, VOCTRL_ALL_WORKSPACES,
- &mpctx->opts->vo->all_workspaces, mpctx);
-}
-
static int get_frame_count(struct MPContext *mpctx)
{
struct demuxer *demuxer = mpctx->demuxer;
@@ -3464,11 +3393,6 @@ static const struct m_property mp_properties_base[] = {
{"current-ao", mp_property_ao},
// Video
- {"fullscreen", mp_property_fullscreen},
- {"taskbar-progress", mp_property_taskbar_progress},
- {"ontop", mp_property_ontop},
- {"border", mp_property_border},
- {"on-all-workspaces", mp_property_all_workspaces},
{"video-out-params", mp_property_vo_imgparams},
{"video-dec-params", mp_property_dec_imgparams},
{"video-params", mp_property_vd_imgparams},
@@ -6297,6 +6221,23 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
}
}
}
+
+ if (mpctx->video_out) {
+ if (opt_ptr == &opts->vo->fullscreen) {
+ vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
+ if (!opts->vo->fullscreen)
+ mpctx->mouse_event_ts--; // Show mouse cursor
+ }
+ if (opt_ptr == &opts->vo->ontop)
+ vo_control(mpctx->video_out, VOCTRL_ONTOP, 0);
+ if (opt_ptr == &opts->vo->border)
+ vo_control(mpctx->video_out, VOCTRL_BORDER, 0);
+ if (opt_ptr == &opts->vo->all_workspaces)
+ vo_control(mpctx->video_out, VOCTRL_ALL_WORKSPACES, 0);
+ }
+
+ if (opt_ptr == &opts->vo->taskbar_progress)
+ update_vo_playback_state(mpctx);
}
void mp_notify_property(struct MPContext *mpctx, const char *property)