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
8629a3fe
Commit
8629a3fe
authored
Sep 14, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: add integer list callbacks for config items
parent
75b3b2ed
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
6 deletions
+29
-6
include/vlc_configuration.h
include/vlc_configuration.h
+3
-0
include/vlc_plugin.h
include/vlc_plugin.h
+3
-0
src/config/core.c
src/config/core.c
+11
-3
src/modules/bank.c
src/modules/bank.c
+1
-1
src/modules/cache.c
src/modules/cache.c
+4
-1
src/modules/entry.c
src/modules/entry.c
+7
-1
No files found.
include/vlc_configuration.h
View file @
8629a3fe
...
...
@@ -54,6 +54,8 @@ typedef union
typedef
int
(
*
vlc_string_list_cb
)(
vlc_object_t
*
,
const
char
*
,
char
***
,
char
***
);
typedef
int
(
*
vlc_integer_list_cb
)(
vlc_object_t
*
,
const
char
*
,
int64_t
**
,
char
***
);
struct
module_config_t
{
...
...
@@ -88,6 +90,7 @@ struct module_config_t
char
**
psz
;
/* List of possible values for the option */
int
*
i
;
vlc_string_list_cb
psz_cb
;
vlc_integer_list_cb
i_cb
;
}
list
;
char
**
list_text
;
/* Friendly names for list values */
};
...
...
include/vlc_plugin.h
View file @
8629a3fe
...
...
@@ -491,6 +491,9 @@ VLC_METADATA_EXPORTS
(const int *)(list), \
(const char *const *)(list_text));
#define change_integer_cb( cb ) \
vlc_config_set (VLC_CONFIG_LIST_CB, (cb));
#define change_integer_range( minv, maxv ) \
vlc_config_set (VLC_CONFIG_RANGE, (int64_t)(minv), (int64_t)(maxv));
...
...
src/config/core.c
View file @
8629a3fe
...
...
@@ -354,7 +354,11 @@ ssize_t config_GetIntChoices (vlc_object_t *obj, const char *name,
size_t
count
=
cfg
->
list_count
;
if
(
count
==
0
)
return
0
;
{
if
(
cfg
->
list
.
i_cb
==
NULL
)
return
0
;
return
cfg
->
list
.
i_cb
(
obj
,
name
,
values
,
texts
);
}
int64_t
*
vals
=
xmalloc
(
sizeof
(
*
vals
)
*
count
);
char
**
txts
=
xmalloc
(
sizeof
(
*
txts
)
*
count
);
...
...
@@ -532,6 +536,12 @@ void config_Free (module_config_t *config, size_t confsize)
free
(
p_item
->
psz_text
);
free
(
p_item
->
psz_longtext
);
if
(
IsConfigIntegerType
(
p_item
->
i_type
))
{
if
(
p_item
->
list_count
)
free
(
p_item
->
list
.
i
);
}
else
if
(
IsConfigStringType
(
p_item
->
i_type
))
{
free
(
p_item
->
value
.
psz
);
...
...
@@ -543,8 +553,6 @@ void config_Free (module_config_t *config, size_t confsize)
free
(
p_item
->
list
.
psz
);
}
}
else
free
(
p_item
->
list
.
i
);
for
(
size_t
i
=
0
;
i
<
p_item
->
list_count
;
i
++
)
free
(
p_item
->
list_text
[
i
]);
...
...
src/modules/bank.c
View file @
8629a3fe
...
...
@@ -490,7 +490,7 @@ static int AllocatePluginFile (module_bank_t *bank, const char *abspath,
* Could be optimized by adding an API call.*/
for
(
size_t
n
=
module
->
confsize
,
i
=
0
;
i
<
n
;
i
++
)
if
(
module
->
p_config
[
i
].
list_count
==
0
&&
module
->
p_config
[
i
].
list
.
psz_cb
!=
NULL
)
&&
(
module
->
p_config
[
i
].
list
.
psz_cb
!=
NULL
||
module
->
p_config
[
i
].
list
.
i_cb
!=
NULL
)
)
{
/* !unloadable not allowed for plugins with callbacks */
vlc_module_destroy
(
module
);
...
...
src/modules/cache.c
View file @
8629a3fe
...
...
@@ -144,7 +144,10 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file)
LOAD_IMMEDIATE
(
cfg
->
max
);
cfg
->
value
=
cfg
->
orig
;
cfg
->
list
.
i
=
xmalloc
(
cfg
->
list_count
*
sizeof
(
int
));
if
(
cfg
->
list_count
)
cfg
->
list
.
i
=
xmalloc
(
cfg
->
list_count
*
sizeof
(
int
));
else
cfg
->
list
.
i_cb
=
NULL
;
for
(
unsigned
i
=
0
;
i
<
cfg
->
list_count
;
i
++
)
LOAD_IMMEDIATE
(
cfg
->
list
.
i
[
i
]);
}
...
...
src/modules/entry.c
View file @
8629a3fe
...
...
@@ -414,7 +414,13 @@ static int vlc_plugin_setter (void *plugin, void *tgt, int propid, ...)
}
case
VLC_CONFIG_LIST_CB
:
item
->
list
.
psz_cb
=
va_arg
(
ap
,
vlc_string_list_cb
);
if
(
IsConfigIntegerType
(
item
->
i_type
))
item
->
list
.
i_cb
=
va_arg
(
ap
,
vlc_integer_list_cb
);
else
if
(
IsConfigStringType
(
item
->
i_type
))
item
->
list
.
psz_cb
=
va_arg
(
ap
,
vlc_string_list_cb
);
else
break
;
break
;
default:
...
...
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