Commit d860bddf authored by Sam Hocevar's avatar Sam Hocevar

* ./src/misc/modules.c: if a module name starts with "$", vlc calls

    config_GetPsz and uses the result instead.
parent 5db40ebf
......@@ -2,7 +2,7 @@
* a52old.c: A52 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: a52old.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: a52old.c,v 1.2 2002/08/04 20:04:11 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -225,8 +225,6 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
*****************************************************************************/
static int InitThread( a52dec_t * p_a52dec )
{
char *psz_name;
/*
* Choose the best downmix module
*/
......@@ -234,10 +232,8 @@ static int InitThread( a52dec_t * p_a52dec )
sizeof( downmix_t ) );
p_a52dec->p_downmix->psz_object_name = "downmix";
psz_name = config_GetPsz( p_a52dec->p_downmix, "a52-downmix" );
p_a52dec->p_downmix->p_module =
module_Need( p_a52dec->p_downmix, "downmix", psz_name );
if( psz_name ) free( psz_name );
module_Need( p_a52dec->p_downmix, "downmix", "$a52-downmix" );
if( p_a52dec->p_downmix->p_module == NULL )
{
......@@ -253,10 +249,8 @@ static int InitThread( a52dec_t * p_a52dec )
sizeof( imdct_t ) );
#define IMDCT p_a52dec->p_imdct
psz_name = config_GetPsz( p_a52dec->p_fifo, "a52-imdct" );
p_a52dec->p_imdct->p_module =
module_Need( p_a52dec->p_imdct, "imdct", psz_name );
if( psz_name ) free( psz_name );
module_Need( p_a52dec->p_imdct, "imdct", "$a52-imdct" );
if( p_a52dec->p_imdct->p_module == NULL )
{
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: parser.c,v 1.2 2002/08/04 18:39:41 sam Exp $
* $Id: parser.c,v 1.3 2002/08/04 20:04:11 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -194,15 +194,11 @@ static int RunDecoder ( decoder_fifo_t * p_fifo )
*****************************************************************************/
static int InitThread( vpar_thread_t *p_vpar )
{
char *psz_name;
/*
* Choose the best motion compensation module
*/
psz_name = config_GetPsz( p_vpar->p_fifo, "mpeg-motion" );
p_vpar->p_motion =
module_Need( p_vpar->p_fifo, "motion compensation", psz_name );
if( psz_name ) free( psz_name );
module_Need( p_vpar->p_fifo, "motion compensation", "$mpeg-motion" );
if( p_vpar->p_motion == NULL )
{
......@@ -217,9 +213,7 @@ static int InitThread( vpar_thread_t *p_vpar )
/*
* Choose the best IDCT module
*/
psz_name = config_GetPsz( p_vpar->p_fifo, "mpeg-idct" );
p_vpar->p_idct = module_Need( p_vpar->p_fifo, "idct", psz_name );
if( psz_name ) free( psz_name );
p_vpar->p_idct = module_Need( p_vpar->p_fifo, "idct", "$mpeg-idct" );
if( p_vpar->p_idct == NULL )
{
......
......@@ -2,7 +2,7 @@
* audio_output.c : audio output thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio_output.c,v 1.88 2002/08/04 17:23:44 sam Exp $
* $Id: audio_output.c,v 1.89 2002/08/04 20:04:11 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -55,7 +55,6 @@ aout_thread_t *aout_CreateThread( vlc_object_t *p_parent,
int i_channels, int i_rate )
{
aout_thread_t * p_aout; /* thread descriptor */
char * psz_name;
int i_format;
/* Allocate descriptor */
......@@ -87,9 +86,7 @@ aout_thread_t *aout_CreateThread( vlc_object_t *p_parent,
}
/* Choose the best module */
psz_name = config_GetPsz( p_aout, "aout" );
p_aout->p_module = module_Need( p_aout, "audio output", psz_name );
if( psz_name ) free( psz_name );
p_aout->p_module = module_Need( p_aout, "audio output", "$aout" );
if( p_aout->p_module == NULL )
{
msg_Err( p_aout, "no suitable aout module" );
......
......@@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dec.c,v 1.41 2002/07/31 20:56:52 sam Exp $
* $Id: input_dec.c,v 1.42 2002/08/04 20:04:11 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -45,7 +45,6 @@ static void DeleteDecoderFifo( decoder_fifo_t * );
decoder_fifo_t * input_RunDecoder( input_thread_t * p_input,
es_descriptor_t * p_es )
{
char * psz_plugin;
decoder_fifo_t *p_fifo;
/* Create the decoder configuration structure */
......@@ -58,9 +57,7 @@ decoder_fifo_t * input_RunDecoder( input_thread_t * p_input,
}
/* Get a suitable module */
psz_plugin = config_GetPsz( p_fifo, "codec" );
p_fifo->p_module = module_Need( p_fifo, "decoder", psz_plugin );
if( psz_plugin ) free( psz_plugin );
p_fifo->p_module = module_Need( p_fifo, "decoder", "$codec" );
if( p_fifo->p_module == NULL )
{
msg_Err( p_fifo, "no suitable decoder module for fourcc `%4.4s'",
......
......@@ -4,7 +4,7 @@
* interface, such as command line.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: interface.c,v 1.97 2002/07/31 20:56:52 sam Exp $
* $Id: interface.c,v 1.98 2002/08/04 20:04:11 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -58,7 +58,6 @@ static void Manager( intf_thread_t *p_intf );
intf_thread_t* __intf_Create( vlc_object_t *p_this )
{
intf_thread_t * p_intf;
char *psz_name;
/* Allocate structure */
p_intf = vlc_object_create( p_this, VLC_OBJECT_INTF );
......@@ -69,10 +68,8 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this )
}
/* Choose the best module */
psz_name = config_GetPsz( p_intf, "intf" );
p_intf->p_module = module_Need( p_intf, "interface", psz_name );
p_intf->p_module = module_Need( p_intf, "interface", "$intf" );
if( psz_name ) free( psz_name );
if( p_intf->p_module == NULL )
{
msg_Err( p_intf, "no suitable intf module" );
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.19 2002/07/31 20:56:52 sam Exp $
* $Id: libvlc.c,v 1.20 2002/08/04 20:04:11 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -186,7 +186,6 @@ vlc_error_t vlc_init( int i_argc, char *ppsz_argv[] )
vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
{
char p_capabilities[200];
char *psz_module;
char *p_tmp;
module_t *p_help_module;
playlist_t *p_playlist;
......@@ -453,9 +452,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
/*
* Choose the best memcpy module
*/
psz_module = config_GetPsz( p_vlc, "memcpy" );
p_vlc->p_memcpy_module = module_Need( p_vlc, "memcpy", psz_module );
if( psz_module ) free( psz_module );
p_vlc->p_memcpy_module = module_Need( p_vlc, "memcpy", "$memcpy" );
if( p_vlc->p_memcpy_module == NULL )
{
......
......@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.77 2002/08/04 17:23:44 sam Exp $
* $Id: modules.c,v 1.78 2002/08/04 20:04:11 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -277,7 +277,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
module_list_t *p_list, *p_first, *p_tmp;
int i_index = 0;
vlc_bool_t b_intf = VLC_FALSE;
vlc_bool_t b_intf = VLC_FALSE, b_var = VLC_FALSE;
module_t *p_module;
......@@ -286,6 +286,13 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
msg_Dbg( p_this, "looking for %s module", psz_capability );
/* Deal with variables */
if( psz_name && psz_name[0] == '$' )
{
psz_name = config_GetPsz( p_this, psz_name + 1 );
b_var = ( psz_name != NULL );
}
/* Count how many different shortcuts were asked for */
if( psz_name && *psz_name )
{
......@@ -294,6 +301,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
/* If the user wants none, give him none. */
if( !strcmp( psz_name, "none" ) )
{
if( b_var ) free( psz_name );
return NULL;
}
......@@ -525,6 +533,11 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
free( psz_shortcuts );
}
if( b_var )
{
free( psz_name );
}
/* Don't forget that the module is still locked */
return p_module;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment