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
3655c1c6
Commit
3655c1c6
authored
Dec 17, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for aliases through vlc_config_set
parent
2bca4f1c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
53 additions
and
38 deletions
+53
-38
include/vlc_configuration.h
include/vlc_configuration.h
+10
-13
src/config/chain.c
src/config/chain.c
+10
-6
src/config/cmdline.c
src/config/cmdline.c
+11
-11
src/config/core.c
src/config/core.c
+3
-1
src/config/file.c
src/config/file.c
+1
-1
src/libvlc-common.c
src/libvlc-common.c
+2
-2
src/modules/cache.c
src/modules/cache.c
+5
-2
src/modules/entry.c
src/modules/entry.c
+10
-1
src/modules/modules.c
src/modules/modules.c
+1
-1
No files found.
include/vlc_configuration.h
View file @
3655c1c6
...
...
@@ -184,8 +184,8 @@ struct module_config_t
/* to take effect */
/* Deprecated */
c
onst
char
*
psz_current
;
/* Goo
d option name */
vlc_bool_t
b_
strict
;
/* Transitionnal or strict */
c
har
*
psz_oldname
;
/* Ol
d option name */
vlc_bool_t
b_
removed
;
/* Option values loaded from config file */
vlc_bool_t
b_autosave
;
/* Config will be auto-saved at exit time */
...
...
@@ -278,6 +278,9 @@ enum vlc_config_properties
VLC_CONFIG_ADD_ACTION
,
/* add value change callback (args=vlc_callback_t, const char *) */
VLC_CONFIG_OLDNAME
,
/* former option name (args=const char *) */
};
...
...
@@ -408,17 +411,6 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) );
add_typename_inner( CONFIG_ITEM_BOOL, name, text, longtext, advc, p_callback ); \
if (v) vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (int)VLC_TRUE)
/* For renamed option */
#define add_deprecated_alias( name ) \
add_config_inner( ); \
p_config[ i_config ].i_type = p_config[ i_config -1 ].i_type; \
vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \
(const char *)(name), (vlc_callback_t)NULL); \
p_config[i_config].b_strict = VLC_FALSE; \
p_config[ i_config ].psz_current = p_config[ i_config-1 ].psz_current \
? p_config[ i_config-1 ].psz_current \
: p_config[ i_config-1 ].psz_name;
/* For removed option */
#define add_obsolete_inner( name, type ) \
add_type_inner( type ); \
...
...
@@ -439,6 +431,11 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) );
add_obsolete_inner( name, CONFIG_ITEM_STRING )
/* Modifier macros for the config options (used for fine tuning) */
#define add_deprecated_alias( name ) \
vlc_config_set (p_config + i_config, VLC_CONFIG_OLDNAME, \
(const char *)(name))
#define change_short( ch ) \
vlc_config_set (p_config + i_config, VLC_CONFIG_SHORTCUT, (int)(ch))
...
...
src/config/chain.c
View file @
3655c1c6
...
...
@@ -296,20 +296,24 @@ void __config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
/* This is basically cut and paste from src/misc/configuration.c
* with slight changes */
if
(
p_conf
&&
p_conf
->
psz_current
)
if
(
p_conf
)
{
if
(
p_conf
->
b_
strict
)
if
(
p_conf
->
b_
removed
)
{
msg_Err
(
p_this
,
"Option %s is not supported anymore."
,
p_conf
->
psz_
name
);
name
);
/* TODO: this should return an error and end option parsing
* ... but doing this would change the VLC API and all the
* modules so i'll do it later */
continue
;
}
msg_Warn
(
p_this
,
"Option %s is obsolete. Use %s instead."
,
p_conf
->
psz_name
,
p_conf
->
psz_current
);
psz_name
=
p_conf
->
psz_current
;
if
(
p_conf
->
psz_oldname
&&
!
strcmp
(
p_conf
->
psz_oldname
,
name
)
)
{
psz_name
=
p_conf
->
psz_name
;
msg_Warn
(
p_this
,
"Option %s is obsolete. Use %s instead."
,
name
,
psz_name
);
}
}
/* </Check if the option is deprecated> */
...
...
src/config/cmdline.c
View file @
3655c1c6
...
...
@@ -278,20 +278,21 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc,
if
(
p_conf
)
{
/* Check if the option is deprecated */
if
(
p_conf
->
psz_current
)
if
(
p_conf
->
b_removed
)
{
if
(
p_conf
->
b_strict
)
{
fprintf
(
stderr
,
"Warning: option --%s no longer exists.
\n
"
,
p_conf
->
psz_name
);
continue
;
}
fprintf
(
stderr
,
"Warning: option --%s no longer exists.
\n
"
,
psz_name
);
continue
;
}
if
(
p_conf
->
psz_oldname
&&
!
strcmp
(
p_conf
->
psz_oldname
,
psz_name
)
)
{
fprintf
(
stderr
,
"%s: option --%s is deprecated. Use --%s instead.
\n
"
,
b_ignore_errors
?
"Warning"
:
"Error"
,
p
_conf
->
psz_name
,
p_conf
->
psz_current
);
p
sz_name
,
p_conf
->
psz_name
);
if
(
!
b_ignore_errors
)
{
/*free */
...
...
@@ -303,8 +304,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc,
return
-
1
;
}
psz_name
=
(
char
*
)
p_conf
->
psz_current
;
p_conf
=
config_FindConfig
(
p_this
,
psz_name
);
psz_name
=
p_conf
->
psz_name
;
}
switch
(
p_conf
->
i_type
)
...
...
src/config/core.c
View file @
3655c1c6
...
...
@@ -464,7 +464,9 @@ module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name )
if
(
p_item
->
i_type
&
CONFIG_HINT
)
/* ignore hints */
continue
;
if
(
!
strcmp
(
psz_name
,
p_item
->
psz_name
)
)
if
(
!
strcmp
(
psz_name
,
p_item
->
psz_name
)
||
(
p_item
->
psz_oldname
&&
!
strcmp
(
psz_name
,
p_item
->
psz_oldname
)
)
)
{
vlc_list_release
(
p_list
);
return
p_item
;
...
...
src/config/file.c
View file @
3655c1c6
...
...
@@ -543,7 +543,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
vlc_bool_t
b_retain
=
b_autosave
&&
!
p_item
->
b_autosave
;
if
((
p_item
->
i_type
&
CONFIG_HINT
)
/* ignore hint */
||
p_item
->
psz_current
/* ignore deprecated option */
||
p_item
->
b_removed
/* ignore deprecated option */
||
p_item
->
b_unsaveable
)
/* ignore volatile option */
continue
;
...
...
src/libvlc-common.c
View file @
3655c1c6
...
...
@@ -1455,8 +1455,8 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name )
signed
int
i
;
size_t
i_cur_width
;
/* Skip
deprecat
ed options */
if
(
p_item
->
psz_current
)
/* Skip
remov
ed options */
if
(
p_item
->
b_removed
)
{
continue
;
}
...
...
src/modules/cache.c
View file @
3655c1c6
...
...
@@ -352,7 +352,8 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
LOAD_STRING
(
p_module
->
p_config
[
i
].
psz_name
);
LOAD_STRING
(
p_module
->
p_config
[
i
].
psz_text
);
LOAD_STRING
(
p_module
->
p_config
[
i
].
psz_longtext
);
LOAD_STRING
(
p_module
->
p_config
[
i
].
psz_current
);
LOAD_STRING
(
p_module
->
p_config
[
i
].
psz_oldname
);
LOAD_IMMEDIATE
(
p_module
->
p_config
[
i
].
b_removed
);
if
(
IsConfigStringType
(
p_module
->
p_config
[
i
].
i_type
))
{
...
...
@@ -617,7 +618,9 @@ static int CacheSaveConfig( module_t *p_module, FILE *file )
SAVE_STRING
(
p_module
->
p_config
[
i
].
psz_name
);
SAVE_STRING
(
p_module
->
p_config
[
i
].
psz_text
);
SAVE_STRING
(
p_module
->
p_config
[
i
].
psz_longtext
);
SAVE_STRING
(
p_module
->
p_config
[
i
].
psz_current
);
SAVE_STRING
(
p_module
->
p_config
[
i
].
psz_oldname
);
SAVE_IMMEDIATE
(
p_module
->
p_config
[
i
].
b_removed
);
if
(
IsConfigStringType
(
p_module
->
p_config
[
i
].
i_type
))
SAVE_STRING
(
p_module
->
p_config
[
i
].
orig
.
psz
);
...
...
src/modules/entry.c
View file @
3655c1c6
...
...
@@ -268,7 +268,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
break
;
case
VLC_CONFIG_REMOVED
:
item
->
psz_current
=
"SUPPRESSED"
;
item
->
b_removed
=
VLC_TRUE
;
ret
=
0
;
break
;
...
...
@@ -384,6 +384,15 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
item
->
i_action
++
;
ret
=
0
;
break
;
}
case
VLC_CONFIG_OLDNAME
:
{
const
char
*
oldname
=
va_arg
(
ap
,
const
char
*
);
item
->
psz_oldname
=
oldname
?
strdup
(
oldname
)
:
NULL
;
ret
=
0
;
break
;
}
}
...
...
src/modules/modules.c
View file @
3655c1c6
...
...
@@ -804,7 +804,7 @@ module_config_t *module_GetConfig (const module_t *module, unsigned *restrict ps
const
module_config_t
*
item
=
module
->
p_config
+
i
;
if
(
item
->
b_internal
/* internal option */
||
item
->
b_unsaveable
/* non-modifiable option */
||
item
->
psz_current
/* deprecated option name
*/
)
||
item
->
b_removed
/* removed option
*/
)
continue
;
if
(
config
!=
NULL
)
...
...
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