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
e6a14c1d
Commit
e6a14c1d
authored
Oct 22, 2007
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move config_*Intf() out from the header
parent
1a42f95b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
149 additions
and
159 deletions
+149
-159
include/vlc_configuration.h
include/vlc_configuration.h
+8
-159
src/modules/configuration.c
src/modules/configuration.c
+141
-0
No files found.
include/vlc_configuration.h
View file @
e6a14c1d
...
@@ -213,6 +213,10 @@ VLC_EXPORT( int, config_Duplicate,( module_t *, const module_config_t *, size_t
...
@@ -213,6 +213,10 @@ VLC_EXPORT( int, config_Duplicate,( module_t *, const module_config_t *, size_t
VLC_EXPORT
(
const
char
*
,
config_GetDataDir
,
(
void
));
VLC_EXPORT
(
const
char
*
,
config_GetDataDir
,
(
void
));
VLC_EXPORT
(
void
,
__config_AddIntf
,
(
vlc_object_t
*
,
const
char
*
)
);
VLC_EXPORT
(
void
,
__config_RemoveIntf
,
(
vlc_object_t
*
,
const
char
*
)
);
VLC_EXPORT
(
vlc_bool_t
,
__config_ExistIntf
,
(
vlc_object_t
*
,
const
char
*
)
);
#define config_GetType(a,b) __config_GetType(VLC_OBJECT(a),b)
#define config_GetType(a,b) __config_GetType(VLC_OBJECT(a),b)
#define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b)
#define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b)
#define config_PutInt(a,b,c) __config_PutInt(VLC_OBJECT(a),b,c)
#define config_PutInt(a,b,c) __config_PutInt(VLC_OBJECT(a),b,c)
...
@@ -221,6 +225,10 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
...
@@ -221,6 +225,10 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
#define config_GetPsz(a,b) __config_GetPsz(VLC_OBJECT(a),b)
#define config_GetPsz(a,b) __config_GetPsz(VLC_OBJECT(a),b)
#define config_PutPsz(a,b,c) __config_PutPsz(VLC_OBJECT(a),b,c)
#define config_PutPsz(a,b,c) __config_PutPsz(VLC_OBJECT(a),b,c)
#define config_AddIntf(a,b) __config_AddIntf(VLC_OBJECT(a),b)
#define config_RemoveIntf(a,b) __config_RemoveIntf(VLC_OBJECT(a),b)
#define config_ExistIntf(a,b) __config_ExistIntf(VLC_OBJECT(a),b)
/*****************************************************************************
/*****************************************************************************
* Macros used to build the configuration structure.
* Macros used to build the configuration structure.
...
@@ -435,165 +443,6 @@ VLC_EXPORT( void, __config_ChainParse, ( vlc_object_t *, const char *psz_prefi
...
@@ -435,165 +443,6 @@ VLC_EXPORT( void, __config_ChainParse, ( vlc_object_t *, const char *psz_prefi
VLC_EXPORT
(
char
*
,
config_ChainCreate
,
(
char
**
,
config_chain_t
**
,
const
char
*
)
);
VLC_EXPORT
(
char
*
,
config_ChainCreate
,
(
char
**
,
config_chain_t
**
,
const
char
*
)
);
VLC_EXPORT
(
void
,
config_ChainDestroy
,
(
config_chain_t
*
)
);
VLC_EXPORT
(
void
,
config_ChainDestroy
,
(
config_chain_t
*
)
);
static
inline
config_chain_t
*
config_chain_find
(
config_chain_t
*
p_cfg
,
const
char
*
psz_name
)
{
while
(
p_cfg
&&
strcmp
(
p_cfg
->
psz_name
,
psz_name
)
)
{
p_cfg
=
p_cfg
->
p_next
;
}
return
p_cfg
;
}
static
void
config_AddIntf
(
vlc_object_t
*
p_this
,
const
char
*
psz_intf
)
{
assert
(
psz_intf
);
char
*
psz_config
,
*
psz_parser
;
size_t
i_len
=
strlen
(
psz_intf
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"control"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
free
(
psz_config
);
return
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"extraintf"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
free
(
psz_config
);
return
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
/* interface not found in the config, let's add it */
if
(
psz_config
&&
strlen
(
psz_config
)
>
0
)
{
char
*
psz_newconfig
;
if
(
asprintf
(
&
psz_newconfig
,
"%s:%s"
,
psz_config
,
psz_intf
)
!=
-
1
)
{
config_PutPsz
(
p_this
->
p_libvlc
,
"extraintf"
,
psz_newconfig
);
free
(
psz_newconfig
);
}
}
else
config_PutPsz
(
p_this
->
p_libvlc
,
"extraintf"
,
psz_intf
);
free
(
psz_config
);
}
static
void
config_RemoveIntf
(
vlc_object_t
*
p_this
,
const
char
*
psz_intf
)
{
assert
(
psz_intf
);
char
*
psz_config
,
*
psz_parser
;
size_t
i_len
=
strlen
(
psz_intf
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"extraintf"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
char
*
psz_newconfig
;
char
*
psz_end
=
psz_parser
+
i_len
;
if
(
*
psz_end
==
':'
)
psz_end
++
;
*
psz_parser
=
'\0'
;
if
(
asprintf
(
&
psz_newconfig
,
"%s%s"
,
psz_config
,
psz_end
)
!=
-
1
)
{
config_PutPsz
(
p_this
->
p_libvlc
,
"extraintf"
,
psz_newconfig
);
free
(
psz_newconfig
);
}
break
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"control"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
char
*
psz_newconfig
;
char
*
psz_end
=
psz_parser
+
i_len
;
if
(
*
psz_end
==
':'
)
psz_end
++
;
*
psz_parser
=
'\0'
;
if
(
asprintf
(
&
psz_newconfig
,
"%s%s"
,
psz_config
,
psz_end
)
!=
-
1
)
{
config_PutPsz
(
p_this
->
p_libvlc
,
"control"
,
psz_newconfig
);
free
(
psz_newconfig
);
}
break
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
}
static
vlc_bool_t
config_ExistIntf
(
vlc_object_t
*
p_this
,
const
char
*
psz_intf
)
{
assert
(
psz_intf
);
char
*
psz_config
,
*
psz_parser
;
size_t
i_len
=
strlen
(
psz_intf
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"extraintf"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_parser
,
psz_intf
,
i_len
)
)
{
free
(
psz_config
);
return
VLC_TRUE
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"control"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_parser
,
psz_intf
,
i_len
)
)
{
free
(
psz_config
);
return
VLC_TRUE
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
return
VLC_FALSE
;
}
static
inline
char
*
config_chain_find_value
(
config_chain_t
*
p_cfg
,
const
char
*
psz_name
)
{
while
(
p_cfg
&&
strcmp
(
p_cfg
->
psz_name
,
psz_name
)
)
{
p_cfg
=
p_cfg
->
p_next
;
}
if
(
p_cfg
&&
p_cfg
->
psz_value
)
{
return
(
p_cfg
->
psz_value
);
}
return
NULL
;
}
# ifdef __cplusplus
# ifdef __cplusplus
}
}
# endif
# endif
...
...
src/modules/configuration.c
View file @
e6a14c1d
...
@@ -2070,3 +2070,144 @@ static char *ConfigKeyToString( int i_key )
...
@@ -2070,3 +2070,144 @@ static char *ConfigKeyToString( int i_key )
}
}
return
psz_key
;
return
psz_key
;
}
}
/* Adds an extra interface to the configuration */
void
__config_AddIntf
(
vlc_object_t
*
p_this
,
const
char
*
psz_intf
)
{
assert
(
psz_intf
);
char
*
psz_config
,
*
psz_parser
;
size_t
i_len
=
strlen
(
psz_intf
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"control"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
free
(
psz_config
);
return
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"extraintf"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
free
(
psz_config
);
return
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
/* interface not found in the config, let's add it */
if
(
psz_config
&&
strlen
(
psz_config
)
>
0
)
{
char
*
psz_newconfig
;
if
(
asprintf
(
&
psz_newconfig
,
"%s:%s"
,
psz_config
,
psz_intf
)
!=
-
1
)
{
config_PutPsz
(
p_this
->
p_libvlc
,
"extraintf"
,
psz_newconfig
);
free
(
psz_newconfig
);
}
}
else
config_PutPsz
(
p_this
->
p_libvlc
,
"extraintf"
,
psz_intf
);
free
(
psz_config
);
}
/* Removes an extra interface from the configuration */
void
__config_RemoveIntf
(
vlc_object_t
*
p_this
,
const
char
*
psz_intf
)
{
assert
(
psz_intf
);
char
*
psz_config
,
*
psz_parser
;
size_t
i_len
=
strlen
(
psz_intf
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"extraintf"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
char
*
psz_newconfig
;
char
*
psz_end
=
psz_parser
+
i_len
;
if
(
*
psz_end
==
':'
)
psz_end
++
;
*
psz_parser
=
'\0'
;
if
(
asprintf
(
&
psz_newconfig
,
"%s%s"
,
psz_config
,
psz_end
)
!=
-
1
)
{
config_PutPsz
(
p_this
->
p_libvlc
,
"extraintf"
,
psz_newconfig
);
free
(
psz_newconfig
);
}
break
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"control"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_intf
,
psz_parser
,
i_len
)
)
{
char
*
psz_newconfig
;
char
*
psz_end
=
psz_parser
+
i_len
;
if
(
*
psz_end
==
':'
)
psz_end
++
;
*
psz_parser
=
'\0'
;
if
(
asprintf
(
&
psz_newconfig
,
"%s%s"
,
psz_config
,
psz_end
)
!=
-
1
)
{
config_PutPsz
(
p_this
->
p_libvlc
,
"control"
,
psz_newconfig
);
free
(
psz_newconfig
);
}
break
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
}
/*
* Returns VLC_TRUE if the specified extra interface is present in the
* configuration, VLC_FALSE if not
*/
vlc_bool_t
__config_ExistIntf
(
vlc_object_t
*
p_this
,
const
char
*
psz_intf
)
{
assert
(
psz_intf
);
char
*
psz_config
,
*
psz_parser
;
size_t
i_len
=
strlen
(
psz_intf
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"extraintf"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_parser
,
psz_intf
,
i_len
)
)
{
free
(
psz_config
);
return
VLC_TRUE
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
psz_config
=
psz_parser
=
config_GetPsz
(
p_this
->
p_libvlc
,
"control"
);
while
(
psz_parser
)
{
if
(
!
strncmp
(
psz_parser
,
psz_intf
,
i_len
)
)
{
free
(
psz_config
);
return
VLC_TRUE
;
}
psz_parser
=
strchr
(
psz_parser
,
':'
);
if
(
psz_parser
)
psz_parser
++
;
/* skip the ':' */
}
free
(
psz_config
);
return
VLC_FALSE
;
}
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