Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
2bca4f1c
Commit
2bca4f1c
authored
Dec 17, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add action through vlc_config_set
parent
194072ae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
45 deletions
+37
-45
include/vlc_configuration.h
include/vlc_configuration.h
+6
-14
include/vlc_modules_macros.h
include/vlc_modules_macros.h
+1
-10
src/config/core.c
src/config/core.c
+0
-21
src/modules/entry.c
src/modules/entry.c
+30
-0
No files found.
include/vlc_configuration.h
View file @
2bca4f1c
...
...
@@ -275,6 +275,9 @@ enum vlc_config_properties
VLC_CONFIG_LIST
,
/* possible values list
* (args=size_t, const <type> *, const char *const *) */
VLC_CONFIG_ADD_ACTION
,
/* add value change callback (args=vlc_callback_t, const char *) */
};
...
...
@@ -465,20 +468,9 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) );
vlc_config_set (p_config + i_config, VLC_CONFIG_RANGE, \
(double)(minv), (double)(maxv))
#define change_action_add( pf_action, action_text ) \
if( !p_config[i_config].i_action ) \
{ p_config[i_config].ppsz_action_text = 0; \
p_config[i_config].ppf_action = 0; } \
p_config[i_config].ppf_action = (vlc_callback_t *) \
realloc( p_config[i_config].ppf_action, \
(p_config[i_config].i_action + 1) * sizeof(void *) ); \
p_config[i_config].ppsz_action_text = (char **)\
realloc( p_config[i_config].ppsz_action_text, \
(p_config[i_config].i_action + 1) * sizeof(void *) ); \
p_config[i_config].ppf_action[p_config[i_config].i_action] = pf_action; \
p_config[i_config].ppsz_action_text[p_config[i_config].i_action] = \
action_text; \
p_config[i_config].i_action++;
#define change_action_add( pf_action, text ) \
vlc_config_set (p_config + i_config, VLC_CONFIG_ADD_ACTION, \
(vlc_callback_t)(pf_action), (const char *)(text))
#define change_internal() \
vlc_config_set (p_config + i_config, VLC_CONFIG_PRIVATE)
...
...
include/vlc_modules_macros.h
View file @
2bca4f1c
...
...
@@ -110,7 +110,7 @@ E_(vlc_entry) ( module_t *p_module );
EXTERN_SYMBOL DLL_SYMBOL int CDECL_SYMBOL \
__VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \
{ \
int
i_shortcut = 1, res;
\
int
res;
\
size_t i_config = (size_t)(-1); \
module_config_t *p_config = NULL; \
if (vlc_module_set (p_module, VLC_MODULE_NAME, \
...
...
@@ -122,18 +122,9 @@ E_(vlc_entry) ( module_t *p_module );
#define vlc_module_end( ) \
} \
res = config_Duplicate( p_module, p_config, ++i_config ); \
for( size_t i = 0; i < i_config; i++ ) \
{ \
if( p_config[ i ].i_action ) \
{ \
free( p_config[ i ].ppf_action ); \
free( p_config[ i ].ppsz_action_text ); \
} \
} \
free( p_config ); \
if (res) \
return res; \
(void)i_shortcut; \
return VLC_SUCCESS; \
\
error: \
...
...
src/config/core.c
View file @
2bca4f1c
...
...
@@ -520,27 +520,6 @@ int config_Duplicate( module_t *p_module, const module_config_t *p_orig,
{
p_module
->
p_config
[
i
]
=
p_orig
[
i
];
p_module
->
p_config
[
i
].
p_lock
=
&
p_module
->
object_lock
;
/* duplicate the actions list */
if
(
p_orig
[
i
].
i_action
)
{
int
j
;
p_module
->
p_config
[
i
].
ppf_action
=
malloc
(
p_orig
[
i
].
i_action
*
sizeof
(
void
*
)
);
p_module
->
p_config
[
i
].
ppsz_action_text
=
malloc
(
p_orig
[
i
].
i_action
*
sizeof
(
char
*
)
);
for
(
j
=
0
;
j
<
p_orig
[
i
].
i_action
;
j
++
)
{
p_module
->
p_config
[
i
].
ppf_action
[
j
]
=
p_orig
[
i
].
ppf_action
[
j
];
p_module
->
p_config
[
i
].
ppsz_action_text
[
j
]
=
strdupnull
(
p_orig
[
i
].
ppsz_action_text
[
j
]);
}
}
p_module
->
p_config
[
i
].
pf_callback
=
p_orig
[
i
].
pf_callback
;
}
return
VLC_SUCCESS
;
}
...
...
src/modules/entry.c
View file @
2bca4f1c
...
...
@@ -355,6 +355,36 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
ret
=
0
;
break
;
}
case
VLC_CONFIG_ADD_ACTION
:
{
vlc_callback_t
cb
=
va_arg
(
ap
,
vlc_callback_t
),
*
tabcb
;
const
char
*
name
=
va_arg
(
ap
,
const
char
*
);
char
**
tabtext
;
tabcb
=
realloc
(
item
->
ppf_action
,
(
item
->
i_action
+
2
)
*
sizeof
(
cb
));
if
(
tabcb
==
NULL
)
break
;
item
->
ppf_action
=
tabcb
;
tabcb
[
item
->
i_action
]
=
cb
;
tabcb
[
item
->
i_action
+
1
]
=
NULL
;
tabtext
=
realloc
(
item
->
ppsz_action_text
,
(
item
->
i_action
+
2
)
*
sizeof
(
name
));
if
(
tabtext
==
NULL
)
break
;
item
->
ppsz_action_text
=
tabtext
;
if
(
name
)
tabtext
[
item
->
i_action
]
=
strdup
(
gettext
(
name
));
else
tabtext
[
item
->
i_action
]
=
NULL
;
tabtext
[
item
->
i_action
+
1
]
=
NULL
;
item
->
i_action
++
;
ret
=
0
;
}
}
va_end
(
ap
);
...
...
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