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
2ef7e0e7
Commit
2ef7e0e7
authored
Oct 12, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config_GetPszChoices(): add support for module config items
parent
d1e140e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
src/config/core.c
src/config/core.c
+45
-1
No files found.
src/config/core.c
View file @
2ef7e0e7
...
...
@@ -379,6 +379,38 @@ ssize_t config_GetIntChoices (vlc_object_t *obj, const char *name,
}
static
ssize_t
config_ListModules
(
const
char
*
cap
,
char
***
restrict
values
,
char
***
restrict
texts
)
{
module_t
**
list
;
ssize_t
n
=
module_list_cap
(
&
list
,
cap
);
if
(
n
<=
0
)
{
*
values
=
*
texts
=
NULL
;
return
n
;
}
char
**
vals
=
xmalloc
((
n
+
2
)
*
sizeof
(
*
vals
));
char
**
txts
=
xmalloc
((
n
+
2
)
*
sizeof
(
*
txts
));
vals
[
0
]
=
xstrdup
(
"any"
);
txts
[
0
]
=
xstrdup
(
_
(
"Automatic"
));
for
(
ssize_t
i
=
0
;
i
<
n
;
i
++
)
{
vals
[
i
+
1
]
=
xstrdup
(
module_get_object
(
list
[
i
]));
txts
[
i
+
1
]
=
xstrdup
(
module_gettext
(
list
[
i
],
module_get_name
(
list
[
i
],
true
)));
}
vals
[
n
+
1
]
=
xstrdup
(
"none"
);
txts
[
n
+
1
]
=
xstrdup
(
_
(
"Disable"
));
*
values
=
vals
;
*
texts
=
txts
;
return
n
+
2
;
}
/**
* Determines a list of suggested values for a string configuration item.
* \param values pointer to a table of value strings [OUT]
...
...
@@ -396,11 +428,23 @@ ssize_t config_GetPszChoices (vlc_object_t *obj, const char *name,
module_config_t
*
cfg
=
config_FindConfig
(
obj
,
name
);
if
(
cfg
==
NULL
)
{
msg_Warn
(
obj
,
"option %s does not exist"
,
name
);
errno
=
ENOENT
;
return
-
1
;
}
switch
(
cfg
->
i_type
)
{
case
CONFIG_ITEM_MODULE
:
return
config_ListModules
(
cfg
->
psz_type
,
values
,
texts
);
default:
if
(
!
IsConfigStringType
(
cfg
->
i_type
))
{
errno
=
EINVAL
;
return
-
1
;
}
break
;
}
size_t
count
=
cfg
->
list_count
;
if
(
count
==
0
)
{
...
...
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