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
dd7d05eb
Commit
dd7d05eb
authored
Aug 14, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config_GetPszChoices: function to retrieve config item choices
parent
d70cda88
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
0 deletions
+55
-0
include/vlc_configuration.h
include/vlc_configuration.h
+2
-0
src/config/core.c
src/config/core.c
+52
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
No files found.
include/vlc_configuration.h
View file @
dd7d05eb
...
...
@@ -96,6 +96,8 @@ VLC_API float config_GetFloat(vlc_object_t *, const char *) VLC_USED;
VLC_API
void
config_PutFloat
(
vlc_object_t
*
,
const
char
*
,
float
);
VLC_API
char
*
config_GetPsz
(
vlc_object_t
*
,
const
char
*
)
VLC_USED
VLC_MALLOC
;
VLC_API
void
config_PutPsz
(
vlc_object_t
*
,
const
char
*
,
const
char
*
);
VLC_API
ssize_t
config_GetPszChoices
(
vlc_object_t
*
,
const
char
*
,
char
***
,
char
***
)
VLC_USED
;
VLC_API
int
config_SaveConfigFile
(
vlc_object_t
*
);
#define config_SaveConfigFile(a) config_SaveConfigFile(VLC_OBJECT(a))
...
...
src/config/core.c
View file @
dd7d05eb
...
...
@@ -32,6 +32,7 @@
#include "vlc_configuration.h"
#include <errno.h>
#include <assert.h>
#include "configuration.h"
...
...
@@ -329,6 +330,57 @@ void config_PutFloat( vlc_object_t *p_this,
vlc_rwlock_unlock
(
&
config_lock
);
}
/**
* Determines a list of suggested values for a configuration item.
* \param values pointer to a table of value strings [OUT]
* \param texts pointer to a table of descriptions strings [OUT]
* \return number of choices, or -1 on error
* \note the caller is responsible for calling free() on all values, on all
* descriptions and on both tables.
* In case of error, both pointers are set to NULL.
*/
ssize_t
config_GetPszChoices
(
vlc_object_t
*
obj
,
const
char
*
name
,
char
***
restrict
values
,
char
***
restrict
texts
)
{
*
values
=
*
texts
=
NULL
;
module_config_t
*
cfg
=
config_FindConfig
(
obj
,
name
);
if
(
cfg
==
NULL
)
{
msg_Warn
(
obj
,
"option %s does not exist"
,
name
);
errno
=
ENOENT
;
return
-
1
;
}
if
(
cfg
->
pf_update_list
!=
NULL
)
{
/* FIXME: not thread-safe */
vlc_value_t
dummy
=
{
.
psz_string
=
(
char
*
)
""
};
cfg
->
pf_update_list
(
obj
,
name
,
dummy
,
dummy
,
NULL
);
}
size_t
count
=
cfg
->
i_list
;
if
(
count
==
0
)
return
0
;
char
**
vals
=
malloc
(
sizeof
(
*
vals
)
*
count
);
char
**
txts
=
malloc
(
sizeof
(
*
txts
)
*
count
);
if
(
unlikely
(
vals
==
NULL
||
txts
==
NULL
))
abort
();
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
vals
[
i
]
=
strdup
(
cfg
->
ppsz_list
[
i
]);
txts
[
i
]
=
strdup
(
cfg
->
ppsz_list_text
[
i
]);
if
(
unlikely
(
vals
[
i
]
==
NULL
||
txts
[
i
]
==
NULL
))
abort
();
}
*
values
=
vals
;
*
texts
=
txts
;
return
count
;
}
static
int
confcmp
(
const
void
*
a
,
const
void
*
b
)
{
const
module_config_t
*
const
*
ca
=
a
,
*
const
*
cb
=
b
;
...
...
src/libvlccore.sym
View file @
dd7d05eb
...
...
@@ -45,6 +45,7 @@ config_GetFloat
config_GetUserDir
config_GetInt
config_GetPsz
config_GetPszChoices
config_GetType
config_PutFloat
config_PutInt
...
...
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