[vlc-commits] [Git][videolan/vlc][master] 3 commits: libvlc-module: add mouse-pause-policy string input
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Mon Oct 5 08:13:27 UTC 2026
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
43aaec79 by Khalid Masum at 2026-10-05T09:54:47+02:00
libvlc-module: add mouse-pause-policy string input
The purpose of the string input is to get the policy for mouse-pause
from the user.
Right now,
disabled: do not pause-toggle based on mouse event
auto, pause-on-released: Toggle pause on mouse released immediately
Default: auto
- - - - -
bbc8f121 by Khalid Masum at 2026-10-05T09:54:47+02:00
libvlc: inherit mouse-pause-policy to variables
It can be read/updated to keep track of current policy
and user's choice in use.
- - - - -
f2f82936 by Khalid Masum at 2026-10-05T09:54:47+02:00
es_out: mouse-pause: determine user policy using mouse-pause-policy var
Currently only enable disable of mouse-pause is handled from here.
Later, based on various flags, we will have to implement various behaviors
here.
- - - - -
5 changed files:
- src/input/es_out.c
- src/input/input_internal.h
- src/input/test/es_out.c
- src/libvlc-module.c
- src/libvlc.c
Changes:
=====================================
src/input/es_out.c
=====================================
@@ -242,6 +242,8 @@ typedef struct
unsigned cc_decoder;
+ enum vlc_mouse_pause_policy mouse_pause_policy;
+
struct vlc_input_es_out out;
} es_out_sys_t;
@@ -343,6 +345,45 @@ default_val:
for( int fetes_i=0; fetes_i<2; fetes_i++ ) \
vlc_list_foreach( pos, (!fetes_i ? &p_sys->es : &p_sys->es_slaves), node )
+struct mouse_pause_policy_mapping
+{
+ char key[sizeof("pause-on-released")];
+ enum vlc_mouse_pause_policy val;
+};
+
+static int mouse_pause_policy_cmp(const void *key, const void *val)
+{
+ const struct mouse_pause_policy_mapping *entry = val;
+ return strcmp( key, entry->key );
+}
+
+static enum vlc_mouse_pause_policy
+mouse_pause_policy_inherit(input_thread_t *obj)
+{
+ static const struct mouse_pause_policy_mapping mouse_pause_policy_list[] =
+ {
+ { "auto", VLC_MOUSE_IMMEDIATE_PAUSE_ON_RELEASED},
+ { "disabled", VLC_MOUSE_PAUSE_DISABLED},
+ { "pause-on-released", VLC_MOUSE_IMMEDIATE_PAUSE_ON_RELEASED},
+ };
+
+ char *policy_str = var_InheritString(obj, "mouse-pause-policy");
+ if (policy_str == NULL)
+ goto default_val;
+
+ const struct mouse_pause_policy_mapping *entry =
+ bsearch(policy_str, mouse_pause_policy_list, ARRAY_SIZE(mouse_pause_policy_list),
+ sizeof (*mouse_pause_policy_list), mouse_pause_policy_cmp);
+ free(policy_str);
+ if (entry == NULL)
+ goto default_val;
+
+ return entry->val;
+
+default_val:
+ return VLC_MOUSE_IMMEDIATE_PAUSE_ON_RELEASED;
+}
+
static void MouseEventCb(const vlc_mouse_t *newmouse, void *userdata)
{
es_out_id_t *id = userdata;
@@ -352,6 +393,13 @@ static void MouseEventCb(const vlc_mouse_t *newmouse, void *userdata)
if(!p_sys->p_input)
return;
+ enum vlc_mouse_pause_policy policy = p_sys->mouse_pause_policy;
+
+ //TODO: More behaviors to be implemented.
+
+ if (policy == VLC_MOUSE_PAUSE_DISABLED)
+ return;
+
if(!newmouse)
{
vlc_mouse_Init(&id->oldmouse);
@@ -4400,6 +4448,7 @@ input_EsOutNew(input_thread_t *p_input, input_source_t *main_source, float rate,
"sub-track-id", "sub-track", "sub-language", "sub" );
p_sys->cc_decoder = var_InheritInteger( p_input, "captions" );
+ p_sys->mouse_pause_policy = mouse_pause_policy_inherit(p_sys->p_input);
p_sys->i_group_id = var_GetInteger( p_input, "program" );
p_sys->i_audio_delay = p_sys->i_spu_delay = p_sys->i_video_delay = 0;
=====================================
src/input/input_internal.h
=====================================
@@ -166,6 +166,14 @@ typedef enum input_event_type_e
INPUT_EVENT_FRAME_PREVIOUS_STATUS,
} input_event_type_e;
+/**
+ * Mouse Pause Policy
+ */
+enum vlc_mouse_pause_policy {
+ VLC_MOUSE_PAUSE_DISABLED,
+ VLC_MOUSE_IMMEDIATE_PAUSE_ON_RELEASED
+};
+
#define VLC_INPUT_CAPABILITIES_SEEKABLE (1<<0)
#define VLC_INPUT_CAPABILITIES_PAUSEABLE (1<<1)
#define VLC_INPUT_CAPABILITIES_CHANGE_RATE (1<<2)
=====================================
src/input/test/es_out.c
=====================================
@@ -363,6 +363,9 @@ static void test_playback(void)
var_Create(root, "captions", VLC_VAR_INTEGER);
var_SetInteger(root, "captions", 608);
+ var_Create(root, "mouse-pause-policy", VLC_VAR_STRING);
+ var_SetString(root, "mouse-pause-policy", "auto");
+
input_item_t *item = input_item_NewStream("mock://", "mock", 0);
input_thread_private_t *priv = vlc_object_create(root, sizeof(*priv));
@@ -473,6 +476,9 @@ static void test_multiple_programs(void)
var_Create(root, "captions", VLC_VAR_INTEGER);
var_SetInteger(root, "captions", 608);
+ var_Create(root, "mouse-pause-policy", VLC_VAR_STRING);
+ var_SetString(root, "mouse-pause-policy", "auto");
+
input_item_t *item = input_item_NewStream("mock://", "mock", 0);
input_thread_private_t *priv = vlc_object_create(root, sizeof(*priv));
=====================================
src/libvlc-module.c
=====================================
@@ -540,6 +540,17 @@ static const char *const fit_descriptions[] = {
#define MOUSE_EVENTS_LONGTEXT N_( \
"This enables handling of mouse clicks on the video." )
+#define MOUSE_PAUSE_POLICY_TEXT N_("Mouse Pause Policy")
+#define MOUSE_PAUSE_POLICY_LONGTEXT N_(\
+ "This controls how pause on mouse click is handled")
+
+static const char *const ppsz_mouse_pause_policy_values[] = {
+ "auto", "disabled", "pause-on-released"
+};
+
+static const char *const ppsz_mouse_pause_policy_descriptions[] =
+ { N_("Auto"), N_("Disabled"), N_("Toggle pause immediately on mouse released") };
+
/*****************************************************************************
* Input
****************************************************************************/
@@ -1681,6 +1692,9 @@ vlc_module_begin ()
KEYBOARD_EVENTS_LONGTEXT )
add_bool( "mouse-events", true, MOUSE_EVENTS_TEXT,
MOUSE_EVENTS_LONGTEXT )
+ add_string( "mouse-pause-policy", ppsz_mouse_pause_policy_values[0], MOUSE_PAUSE_POLICY_TEXT,
+ MOUSE_PAUSE_POLICY_LONGTEXT);
+ change_string_list(ppsz_mouse_pause_policy_values, ppsz_mouse_pause_policy_descriptions)
add_bool( "video-on-top", false, VIDEO_ON_TOP_TEXT,
VIDEO_ON_TOP_LONGTEXT )
add_bool( "video-wallpaper", false, WALLPAPER_TEXT,
=====================================
src/libvlc.c
=====================================
@@ -293,6 +293,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
var_Create( p_libvlc, "drawable-nsobject", VLC_VAR_ADDRESS );
#endif
+ var_Create( p_libvlc, "mouse-pause-policy", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+
/*
* Get input filenames given as commandline arguments.
* We assume that the remaining parameters are filenames
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/48fc4c626285f58f0e3359bc483d978b16c9421a...f2f82936265ba2ea46520d47c879cfc175c06885
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/48fc4c626285f58f0e3359bc483d978b16c9421a...f2f82936265ba2ea46520d47c879cfc175c06885
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list