[vlc-devel] Re: Adding Configuration options (Was Re: ps.c and VCD's use)
Gildas Bazin
gbazin at netcourrier.com
Fri Jul 25 01:39:10 CEST 2003
On Thursday 24 July 2003 10:02, R. Bernstein wrote:
>
> Sorry no. In the example and code fragment that I was using to try to
> use convey this:
>
> vlc_module_begin();
> set_description( _("Video CD (VCD 1.0, 1.1, 2.0, SVCD, HQVCD) input")
);
> add_category_hint( N_("VCD"), NULL, VLC_TRUE );
> add_integer ( "vcd-debug", 0, NULL, DEBUG_TEXT, DEBUG_LONGTEXT,
VLC_TRUE );
> ...
>
> the intent was to a set a *new* dynamic debug variable to control
> output for just the VCD plugin. I was referring to new variables that
> would appear in the GUI such as the GTK+ GUI and ~/.vlc/vlvcrc.
>
> Here's another example of such a configuration variable. Suppose I
> want the user to be able indicate whether the slider range should
> represent the range of an entry rather than the range of a track. In
> the GTK+ GUI this might appear as a checkbox and as additional lines in
> vlcrc.
>
Ok, all you need to do is declare the config variable in the
"vlc_module_begin()" section.
For instance:
add_bool( "vcd-debug", 0, NULL, DEBUG_TEXT, DEBUG_LONGTEXT, VLC_TRUE
/*advanced option*/ );
add_string(...
add_integer(...
Once an option is declared, you can simply access to its content by using
one of these functions:
int config_GetInt(vlc_object_t *, const char *);
float config_GetFloat(vlc_object_t *, const char *);
char *config_GetPsz(vlc_object_t *, const char *);
"const char *" being the name of the config variable.
Beware that you need to free the string given back by config_GetPsz() and
you also need to check for its return value as it can be NULL.
All options declared like this will automatically appear in the command line
help menu (./vlc --advanced -H), in the "preferences dialog" of the
interface and in the config file.
Hope this helps,
--
Gildas
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vlc-devel
mailing list