Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
e1e7a510
Commit
e1e7a510
authored
Apr 15, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Thread-safe and more compact hotkeys initialization
parent
c5b09080
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
134 additions
and
123 deletions
+134
-123
include/vlc_main.h
include/vlc_main.h
+1
-1
modules/control/hotkeys.c
modules/control/hotkeys.c
+0
-8
src/libvlc-module.c
src/libvlc-module.c
+104
-104
src/libvlc.c
src/libvlc.c
+21
-7
src/libvlc.h
src/libvlc.h
+8
-3
No files found.
include/vlc_main.h
View file @
e1e7a510
...
...
@@ -38,7 +38,7 @@ struct libvlc_int_t
VLC_COMMON_MEMBERS
/* Structure storing the action name / key associations */
struct
hotkey
const
struct
hotkey
{
const
char
*
psz_action
;
int
i_action
;
...
...
modules/control/hotkeys.c
View file @
e1e7a510
...
...
@@ -169,14 +169,6 @@ static void Run( intf_thread_t *p_intf )
vlc_cleanup_push
(
__pl_Release
,
p_intf
);
/* Initialize hotkey structure */
for
(
struct
hotkey
*
p_hotkey
=
p_intf
->
p_libvlc
->
p_hotkeys
;
p_hotkey
->
psz_action
!=
NULL
;
p_hotkey
++
)
{
p_hotkey
->
i_key
=
config_GetInt
(
p_intf
,
p_hotkey
->
psz_action
);
}
for
(
;;
)
{
input_thread_t
*
p_input
;
...
...
src/libvlc-module.c
View file @
e1e7a510
This diff is collapsed.
Click to expand it.
src/libvlc.c
View file @
e1e7a510
...
...
@@ -797,11 +797,25 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
*/
var_Create
(
p_libvlc
,
"key-pressed"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"key-action"
,
VLC_VAR_INTEGER
);
p_libvlc
->
p_hotkeys
=
malloc
(
libvlc_hotkeys_size
);
/* Do a copy (we don't need to modify the strings) */
memcpy
(
p_libvlc
->
p_hotkeys
,
libvlc_hotkeys
,
libvlc_hotkeys_size
);
var_AddCallback
(
p_libvlc
,
"key-pressed"
,
vlc_key_to_action
,
p_libvlc
->
p_hotkeys
);
{
struct
hotkey
*
p_keys
=
malloc
(
(
libvlc_actions_count
+
1
)
*
sizeof
(
*
p_keys
)
);
/* Initialize from configuration */
for
(
size_t
i
=
0
;
i
<
libvlc_actions_count
;
i
++
)
{
p_keys
[
i
].
psz_action
=
libvlc_actions
[
i
].
name
;
p_keys
[
i
].
i_key
=
config_GetInt
(
p_libvlc
,
libvlc_actions
[
i
].
name
);
p_keys
[
i
].
i_action
=
libvlc_actions
[
i
].
value
;
}
p_keys
[
libvlc_actions_count
].
psz_action
=
NULL
;
p_keys
[
libvlc_actions_count
].
i_key
=
0
;
p_keys
[
libvlc_actions_count
].
i_action
=
0
;
p_libvlc
->
p_hotkeys
=
p_keys
;
var_AddCallback
(
p_libvlc
,
"key-pressed"
,
vlc_key_to_action
,
p_keys
);
}
/* Initialize playlist and get commandline files */
p_playlist
=
playlist_Create
(
VLC_OBJECT
(
p_libvlc
)
);
...
...
@@ -1093,8 +1107,8 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
FREENULL
(
priv
->
psz_configfile
);
var_DelCallback
(
p_libvlc
,
"key-pressed"
,
vlc_key_to_action
,
p_libvlc
->
p_hotkeys
);
FREENULL
(
p_libvlc
->
p_hotkeys
);
(
void
*
)
p_libvlc
->
p_hotkeys
);
free
(
(
void
*
)
p_libvlc
->
p_hotkeys
);
}
/**
...
...
src/libvlc.h
View file @
e1e7a510
...
...
@@ -29,9 +29,14 @@ typedef struct variable_t variable_t;
extern
const
char
vlc_usage
[];
/* Hotkey stuff */
extern
const
struct
hotkey
libvlc_hotkeys
[];
extern
const
size_t
libvlc_hotkeys_size
;
/* Actions (hot keys) */
typedef
struct
action
{
char
name
[
24
];
int
value
;
}
action_t
;
extern
const
struct
action
libvlc_actions
[];
extern
const
size_t
libvlc_actions_count
;
extern
int
vlc_key_to_action
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment