Hacker Guide/How To Write a Module: Difference between revisions
Jump to navigation
Jump to search
m Plugin Writers Guide moved to Module Writers Guide: VLC doesn't have plugins, it has Modules |
First Check and cosmetic. |
||
| Line 1: | Line 1: | ||
*This guide is being written by a VLC novice. Please | * This guide is being written by a {{VLC}} novice. Please check all statements below. | ||
*Using dvdread.c as the template | * Using dvdread.c as the template | ||
== Module Descriptor == | == Module Descriptor == | ||
A VLC Module must include a description of itself, and the parameters it accepts. | |||
A {{VLC}} Module must include a description of itself, and the parameters it accepts. | |||
The module descriptor begins with: | The module descriptor begins with: | ||
| Line 16: | Line 17: | ||
set_category( CAT_INPUT ); | set_category( CAT_INPUT ); | ||
</pre> | </pre> | ||
Note the use of _("") to create a string. | Note the use of _("") to create a string that needs to be translated. | ||
Predefined Categories include: | Predefined Categories include: | ||
| Line 30: | Line 31: | ||
set_subcategory( SUBCAT_INPUT_ACCESS ); | set_subcategory( SUBCAT_INPUT_ACCESS ); | ||
</pre> | </pre> | ||
See include/configuration.h for definition of all categories and sub-categories | See [http://trac.videolan.org/vlc/browser/trunk/include/configuration.h include/configuration.h] | ||
for definition of all categories and sub-categories. | |||
=== Adding Parameters === | === Adding Parameters === | ||
All macros take the following argument list: | All macros take the following argument list: | ||
<pre> add_integer(name, value, p_callback, text, longtext, advc) </pre> | <pre> add_integer(name, value, p_callback, text, longtext, advc) </pre> | ||
* '''name''' is the string that identifies this parameter in the configuration. This name may be used at the command prompt to set the configuration value | * '''name''' is the string that identifies this parameter in the configuration. This name may be used at the command prompt to set the configuration value. | ||
* '''value''' is the default value for this parameter | * '''value''' is the default value for this parameter, | ||
* '''p_callback''' is a function pointer that will be called when the value of this parameter is changed. | * '''p_callback''' is a function pointer that will be called when the value of this parameter is changed. | ||
** p_callback is called with the following arguments: | ** p_callback is called with the following arguments: <pre>( p_this, psz_name, oldval, val, p_config->p_callback_data )</pre> | ||
<pre>( p_this, psz_name, oldval, val, p_config->p_callback_data )</pre> | *** '''p_this''' is a pointer to a vlc_object_t struct, | ||
*** '''p_this''' is a pointer to a vlc_object_t struct | *** '''psz_name''' is the '''name''' of your parameter that is being changed, | ||
*** '''psz_name''' is the '''name''' of your parameter that is being changed | *** '''oldval''' is the old value of the parameter, | ||
*** '''oldval''' is the old value of the parameter | *** '''val''' is the new value of the parameter, | ||
*** '''val''' is the new value of the parameter | |||
*** '''p_call_back_data''' is void* data that you can assign for each parameter. Usually NULL. | *** '''p_call_back_data''' is void* data that you can assign for each parameter. Usually NULL. | ||
* '''text''' A short description of the parameter | * '''text''' A short description of the parameter, | ||
* '''longtext''' A complete description of the parameter | * '''longtext''' A complete description of the parameter, | ||
* '''advc''' Boolean, ADVanced Configuration. If TRUE, this parameter will only be displayed when using the --advanced flag. e.g. | * '''advc''' Boolean, ADVanced Configuration. If TRUE, this parameter will only be displayed when using the --advanced flag. e.g. | ||
<pre>vlc -p dvdread --advanced</pre> | <pre>vlc -p dvdread --advanced</pre> | ||
| Line 54: | Line 55: | ||
You may add the following parameters to your module: | You may add the following parameters to your module: | ||
* add_integer | * add_integer, | ||
* add_string | * add_string, | ||
* add_float | * add_float, | ||
* add_bool | * add_bool, | ||
* add_key | * add_key, | ||
* add_file | * add_file, | ||
* add_directory | * add_directory, | ||
For complete definitions, see include/configuration.h | For complete definitions, see [http://trac.videolan.org/vlc/browser/trunk/include/configuration.h include/configuration.h] | ||
== Open(vlc_object_t *) == | == Open(vlc_object_t *) == | ||
== Close(vlc_object_t *) == | == Close(vlc_object_t *) == | ||
Revision as of 08:11, 13 February 2007
- This guide is being written by a VLC media player novice. Please check all statements below.
- Using dvdread.c as the template
Module Descriptor
A VLC media player Module must include a description of itself, and the parameters it accepts.
The module descriptor begins with:
vlc_module_being();
You should set some category information on your module:
set_shortname( _("DVD without menus") );
set_description( _("DVDRead Input (DVD without menu support)") );
set_category( CAT_INPUT );
Note the use of _("") to create a string that needs to be translated.
Predefined Categories include:
- CAT_INTERFACE
- CAT_AUDIO
- CAT_VIDEO
- CAT_INPUT
- CAT_SOUT
- CAT_ADVANCED
- CAT_PLAYLIST
set_subcategory( SUBCAT_INPUT_ACCESS );
See include/configuration.h for definition of all categories and sub-categories.
Adding Parameters
All macros take the following argument list:
add_integer(name, value, p_callback, text, longtext, advc)
- name is the string that identifies this parameter in the configuration. This name may be used at the command prompt to set the configuration value.
- value is the default value for this parameter,
- p_callback is a function pointer that will be called when the value of this parameter is changed.
- p_callback is called with the following arguments:
( p_this, psz_name, oldval, val, p_config->p_callback_data )
- p_this is a pointer to a vlc_object_t struct,
- psz_name is the name of your parameter that is being changed,
- oldval is the old value of the parameter,
- val is the new value of the parameter,
- p_call_back_data is void* data that you can assign for each parameter. Usually NULL.
- p_callback is called with the following arguments:
- text A short description of the parameter,
- longtext A complete description of the parameter,
- advc Boolean, ADVanced Configuration. If TRUE, this parameter will only be displayed when using the --advanced flag. e.g.
vlc -p dvdread --advanced
e.g.
add_integer("dvdread-angle", 1, NULL, "DVD Angle", "Default DVD Angle", NULL")
You may add the following parameters to your module:
- add_integer,
- add_string,
- add_float,
- add_bool,
- add_key,
- add_file,
- add_directory,
For complete definitions, see include/configuration.h