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
64ea6839
Commit
64ea6839
authored
Dec 16, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
short and list support for vlc_config_set
parent
f9a54b04
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
50 deletions
+132
-50
include/vlc_configuration.h
include/vlc_configuration.h
+25
-10
include/vlc_plugin.h
include/vlc_plugin.h
+28
-0
src/config/core.c
src/config/core.c
+0
-40
src/modules/entry.c
src/modules/entry.c
+79
-0
No files found.
include/vlc_configuration.h
View file @
64ea6839
...
...
@@ -165,14 +165,14 @@ struct module_config_t
void
*
p_callback_data
;
/* Values list */
c
onst
char
**
ppsz_list
;
/* List of possible values for the option */
c
har
**
ppsz_list
;
/* List of possible values for the option */
int
*
pi_list
;
/* Idem for integers */
c
onst
char
**
ppsz_list_text
;
/* Friendly names for list values */
c
har
**
ppsz_list_text
;
/* Friendly names for list values */
int
i_list
;
/* Options list size */
/* Actions list */
vlc_callback_t
*
ppf_action
;
/* List of possible actions for a config */
c
onst
char
**
ppsz_action_text
;
/* Friendly names for actions */
c
har
**
ppsz_action_text
;
/* Friendly names for actions */
int
i_action
;
/* actions list size */
/* Misc */
...
...
@@ -268,6 +268,13 @@ enum vlc_config_properties
VLC_CONFIG_CAPABILITY
,
/* capability for a module or list thereof (args=const char*) */
VLC_CONFIG_SHORTCUT
,
/* one-character (short) command line option name (args=char) */
VLC_CONFIG_LIST
,
/* possible values list
* (args=size_t, const <type> *, const char *const *) */
};
...
...
@@ -430,17 +437,25 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) );
/* Modifier macros for the config options (used for fine tuning) */
#define change_short( ch ) \
p_config[i_config].i_short = ch;
vlc_config_set (p_config + i_config, VLC_CONFIG_SHORTCUT, (int)(ch))
#define change_string_list( list, list_text, list_update_func ) \
p_config[i_config].i_list = sizeof(list)/sizeof(char *); \
p_config[i_config].ppsz_list = list; \
p_config[i_config].ppsz_list_text = list_text;
vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (char *)), \
(const char *const *)(list), \
(const char *const *)(list_text))
#define change_integer_list( list, list_text, list_update_func ) \
p_config[i_config].i_list = sizeof(list)/sizeof(int); \
p_config[i_config].pi_list = (int *)list; \
p_config[i_config].ppsz_list_text = list_text;
vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (int)), \
(const int *)(list), \
(const char *const *)(list_text))
#define change_float_list( list, list_text, list_update_func ) \
vlc_config_set (p_config + i_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (float)), \
(const float *)(list), \
(const char *const *)(list_text))
#define change_integer_range( minv, maxv ) \
vlc_config_set (p_config + i_config, VLC_CONFIG_RANGE, \
...
...
include/vlc_plugin.h
0 → 100644
View file @
64ea6839
/*****************************************************************************
* plugin.h: LibVLC plugin macros
*****************************************************************************
* Copyright © 2007 Rémi Denis-Courmont
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _VLC_PLUGIN_H
# define _VLC_PLUGIN_H 1
#include <vlc_modules.h>
#include <vlc_configuration.h>
#endif
src/config/core.c
View file @
64ea6839
...
...
@@ -522,46 +522,6 @@ int config_Duplicate( module_t *p_module, const module_config_t *p_orig,
p_module
->
p_config
[
i
]
=
p_orig
[
i
];
p_module
->
p_config
[
i
].
p_lock
=
&
p_module
->
object_lock
;
/* duplicate the string list */
if
(
p_orig
[
i
].
i_list
)
{
if
(
p_orig
[
i
].
ppsz_list
)
{
p_module
->
p_config
[
i
].
ppsz_list
=
malloc
(
(
p_orig
[
i
].
i_list
+
1
)
*
sizeof
(
char
*
)
);
if
(
p_module
->
p_config
[
i
].
ppsz_list
)
{
for
(
j
=
0
;
j
<
p_orig
[
i
].
i_list
;
j
++
)
p_module
->
p_config
[
i
].
ppsz_list
[
j
]
=
strdupnull
(
p_orig
[
i
].
ppsz_list
[
j
]);
p_module
->
p_config
[
i
].
ppsz_list
[
j
]
=
NULL
;
}
}
if
(
p_orig
[
i
].
ppsz_list_text
)
{
p_module
->
p_config
[
i
].
ppsz_list_text
=
calloc
(
(
p_orig
[
i
].
i_list
+
1
),
sizeof
(
char
*
)
);
if
(
p_module
->
p_config
[
i
].
ppsz_list_text
)
{
for
(
j
=
0
;
j
<
p_orig
[
i
].
i_list
;
j
++
)
p_module
->
p_config
[
i
].
ppsz_list_text
[
j
]
=
strdupnull
(
_
(
p_orig
[
i
].
ppsz_list_text
[
j
]));
p_module
->
p_config
[
i
].
ppsz_list_text
[
j
]
=
NULL
;
}
}
if
(
p_orig
[
i
].
pi_list
)
{
p_module
->
p_config
[
i
].
pi_list
=
malloc
(
(
p_orig
[
i
].
i_list
+
1
)
*
sizeof
(
int
)
);
if
(
p_module
->
p_config
[
i
].
pi_list
)
{
for
(
j
=
0
;
j
<
p_orig
[
i
].
i_list
;
j
++
)
p_module
->
p_config
[
i
].
pi_list
[
j
]
=
p_orig
[
i
].
pi_list
[
j
];
}
}
}
/* duplicate the actions list */
if
(
p_orig
[
i
].
i_action
)
{
...
...
src/modules/entry.c
View file @
64ea6839
...
...
@@ -158,6 +158,9 @@ module_config_t *vlc_config_create (module_t *module, int type)
module
->
confsize
++
;
memset
(
tab
+
confsize
,
0
,
sizeof
(
tab
[
confsize
]));
tab
[
confsize
].
i_type
=
type
;
tab
[
confsize
].
p_lock
=
&
module
->
object_lock
;
return
tab
+
confsize
;
}
...
...
@@ -276,6 +279,82 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
ret
=
0
;
break
;
}
case
VLC_CONFIG_SHORTCUT
:
item
->
i_short
=
va_arg
(
ap
,
int
);
ret
=
0
;
break
;
case
VLC_CONFIG_LIST
:
{
size_t
len
=
va_arg
(
ap
,
size_t
);
char
**
dtext
=
malloc
(
sizeof
(
char
*
)
*
(
len
+
1
));
if
(
dtext
==
NULL
)
break
;
/* Copy values */
if
(
IsConfigIntegerType
(
item
->
i_type
))
{
const
int
*
src
=
va_arg
(
ap
,
const
int
*
);
int
*
dst
=
malloc
(
sizeof
(
int
)
*
(
len
+
1
));
if
(
dst
!=
NULL
)
{
memcpy
(
dst
,
src
,
sizeof
(
int
)
*
len
);
dst
[
len
]
=
0
;
}
item
->
pi_list
=
dst
;
}
else
#if 0
if (IsConfigFloatType (item->i_type))
{
const float *src = va_arg (ap, const float *);
float *dst = malloc (sizeof (float) * (len + 1));
if (dst != NULL)
{
memcpy (dst, src, sizeof (float) * len);
dst[len] = 0.;
}
item->pf_list = dst;
}
else
#endif
if
(
IsConfigStringType
(
item
->
i_type
))
{
const
char
*
const
*
src
=
va_arg
(
ap
,
const
char
*
const
*
);
char
**
dst
=
malloc
(
sizeof
(
char
*
)
*
(
len
+
1
));
if
(
dst
!=
NULL
)
{
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
dst
[
i
]
=
src
[
i
]
?
strdup
(
src
[
i
])
:
NULL
;
dst
[
len
]
=
NULL
;
}
item
->
ppsz_list
=
dst
;
}
else
break
;
/* Copy textual descriptions */
const
char
*
const
*
text
=
va_arg
(
ap
,
const
char
*
const
*
);
if
(
text
!=
NULL
)
{
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
dtext
[
i
]
=
text
[
i
]
?
strdup
(
gettext
(
text
[
i
]))
:
NULL
;
dtext
[
len
]
=
NULL
;
item
->
ppsz_list_text
=
dtext
;
}
else
item
->
ppsz_list_text
=
NULL
;
item
->
i_list
=
len
;
ret
=
0
;
break
;
}
}
va_end
(
ap
);
...
...
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