Commit c87d50dd authored by Gildas Bazin's avatar Gildas Bazin

* ALL: changed the prototype of module_Need() to accept a "strict" boolean argument.
If "strict" is true and a module name is provided then module_Need() will only look for the specified module
If "strict" is false, then module_Need() will first look for the specified module and if it wasn't found, will continue with the other modules with the same "capability".
parent 577e22f2
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.65 2003/10/04 12:25:00 sam Exp $
* $Id: modules.h,v 1.66 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -126,8 +126,8 @@ void __module_EndBank ( vlc_object_t * );
#define module_ResetBank(a) __module_ResetBank(VLC_OBJECT(a))
void __module_ResetBank ( vlc_object_t * );
#define module_Need(a,b,c) __module_Need(VLC_OBJECT(a),b,c)
VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char * ) );
#define module_Need(a,b,c,d) __module_Need(VLC_OBJECT(a),b,c,d)
VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char *, vlc_bool_t ) );
#define module_Unneed(a,b) __module_Unneed(VLC_OBJECT(a),b)
VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) );
/* demux.c: DVD demux functions.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: demux.c,v 1.3 2003/09/07 22:49:05 fenrir Exp $
* $Id: demux.c,v 1.4 2004/03/03 20:39:51 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -85,7 +85,7 @@ int E_(DVDInit) ( vlc_object_t *p_this )
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
......
......@@ -2,7 +2,7 @@
* demux.c: demux functions for dvdplay.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: demux.c,v 1.7 2003/09/07 22:49:05 fenrir Exp $
* $Id: demux.c,v 1.8 2004/03/03 20:39:51 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -92,7 +92,7 @@ int E_(InitDVD) ( vlc_object_t *p_this )
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
......
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001, 2003 VideoLAN
* $Id: input.c,v 1.23 2003/09/07 22:49:05 fenrir Exp $
* $Id: input.c,v 1.24 2004/03/03 20:39:51 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -121,7 +121,7 @@ int E_(InitDVD) ( vlc_object_t *p_this )
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
......
......@@ -2,7 +2,7 @@
* demux.c: demux functions for dvdplay.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: demux.c,v 1.3 2003/12/05 04:24:47 rocky Exp $
* $Id: demux.c,v 1.4 2004/03/03 20:39:51 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -95,7 +95,7 @@ int E_(InitVCD) ( vlc_object_t *p_this )
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
......
......@@ -2,7 +2,7 @@
* udp.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.22 2004/03/03 10:51:55 massiot Exp $
* $Id: udp.c,v 1.23 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -203,7 +203,7 @@ static int Open( vlc_object_t *p_this )
socket_desc.i_ttl = atoi( psz_val );
}
p_sys->p_thread->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_sys->p_thread, "network", "" ) ) )
if( !( p_network = module_Need( p_sys->p_thread, "network", NULL, 0 ) ) )
{
msg_Err( p_access, "failed to open a connection (udp)" );
return VLC_EGENERIC;
......
......@@ -2,7 +2,7 @@
* coreaudio.c resampler based on CoreAudio's AudioConverter
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: coreaudio.c,v 1.4 2003/05/11 01:00:26 massiot Exp $
* $Id: coreaudio.c,v 1.5 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -168,7 +168,7 @@ static int Create( vlc_object_t *p_this )
sizeof(audio_sample_format_t) );
p_sys->p_secondary_resampler->p_module
= module_Need( p_sys->p_secondary_resampler, "audio filter",
"ugly_resampler" );
"ugly_resampler", VLC_TRUE );
if ( p_sys->p_secondary_resampler->p_module == NULL )
{
vlc_object_detach( p_sys->p_secondary_resampler );
......
......@@ -2,7 +2,7 @@
* a52.c : raw A/52 stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: a52.c,v 1.7 2004/03/03 11:40:19 fenrir Exp $
* $Id: a52.c,v 1.8 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -165,7 +165,7 @@ static int Open( vlc_object_t * p_this )
VLC_FOURCC( 'a', '5', '2', ' ' ) );
p_sys->p_packetizer->p_module =
module_Need( p_sys->p_packetizer, "packetizer", NULL );
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( !p_sys->p_packetizer->p_module )
{
msg_Err( p_demux, "cannot find A52 packetizer" );
......
......@@ -2,7 +2,7 @@
* aac.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: aac.c,v 1.10 2004/03/03 11:40:19 fenrir Exp $
* $Id: aac.c,v 1.11 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -126,7 +126,7 @@ static int Open( vlc_object_t * p_this )
}
/* skip possible id3 header */
if( ( p_id3 = module_Need( p_demux, "id3", NULL ) ) )
if( ( p_id3 = module_Need( p_demux, "id3", NULL, 0 ) ) )
{
module_Unneed( p_demux, p_id3 );
}
......
......@@ -2,7 +2,7 @@
* demuxstream.c: Read an MPEG stream from the satellite and stream it
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: demuxstream.c,v 1.2 2004/01/25 20:05:28 hartman Exp $
* $Id: demuxstream.c,v 1.3 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -217,8 +217,7 @@ static int Activate( vlc_object_t * p_this )
socket_desc.i_bind_port = 0;
socket_desc.i_ttl = 0;
p_input->p_private = (void*)&socket_desc;
if( !( p_network = module_Need( p_input,
"network", "" ) ) )
if( !( p_network = module_Need( p_input, "network", NULL, 0 ) ) )
{
msg_Err( p_input, "failed to open a connection (udp)" );
return( VLC_EGENERIC );
......@@ -269,7 +268,7 @@ static int Activate( vlc_object_t * p_this )
p_demux->i_handle = socket_desc.i_handle;
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
......
......@@ -2,7 +2,7 @@
* dts.c : raw DTS stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: dts.c,v 1.11 2004/03/03 11:40:19 fenrir Exp $
* $Id: dts.c,v 1.12 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -173,7 +173,7 @@ static int Open( vlc_object_t * p_this )
VLC_FOURCC( 'd', 't', 's', ' ' ) );
p_sys->p_packetizer->p_module =
module_Need( p_sys->p_packetizer, "packetizer", NULL );
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( !p_sys->p_packetizer->p_module )
{
msg_Err( p_demux, "cannot find DTS packetizer" );
......
......@@ -2,7 +2,7 @@
* flac.c : FLAC demux module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: flac.c,v 1.12 2004/03/03 11:40:19 fenrir Exp $
* $Id: flac.c,v 1.13 2004/03/03 20:39:51 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -136,7 +136,7 @@ static int Open( vlc_object_t * p_this )
STREAMINFO_SIZE + 4 );
p_sys->p_packetizer->p_module =
module_Need( p_sys->p_packetizer, "packetizer", NULL );
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( !p_sys->p_packetizer->p_module )
{
if( p_sys->p_packetizer->fmt_in.p_extra )
......
......@@ -2,7 +2,7 @@
* m4v.c : MPEG-4 Video demuxer
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: m4v.c,v 1.11 2003/12/22 02:24:52 sam Exp $
* $Id: m4v.c,v 1.12 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -122,10 +122,11 @@ static int Open( vlc_object_t * p_this )
p_sys->p_packetizer->pf_decode_video = NULL;
p_sys->p_packetizer->pf_decode_sub = NULL;
p_sys->p_packetizer->pf_packetize = NULL;
es_format_Init( &p_sys->p_packetizer->fmt_in, VIDEO_ES, VLC_FOURCC( 'm', 'p', '4', 'v' ) );
es_format_Init( &p_sys->p_packetizer->fmt_in, VIDEO_ES,
VLC_FOURCC( 'm', 'p', '4', 'v' ) );
es_format_Init( &p_sys->p_packetizer->fmt_out, UNKNOWN_ES, 0 );
p_sys->p_packetizer->p_module =
module_Need( p_sys->p_packetizer, "packetizer", NULL );
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( p_sys->p_packetizer->p_module == NULL)
{
......
......@@ -2,7 +2,7 @@
* mpga.c : MPEG-I/II Audio input module for vlc
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id: mpga.c,v 1.17 2004/03/03 11:41:04 fenrir Exp $
* $Id: mpga.c,v 1.18 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -166,7 +166,7 @@ static int Open( vlc_object_t * p_this )
}
/* skip possible id3 header */
if( ( p_id3 = module_Need( p_demux, "id3", NULL ) ) )
if( ( p_id3 = module_Need( p_demux, "id3", NULL, 0 ) ) )
{
module_Unneed( p_demux, p_id3 );
}
......
......@@ -2,7 +2,7 @@
* mpgv.c : MPEG-I/II Video demuxer
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: mpgv.c,v 1.5 2004/01/25 20:05:28 hartman Exp $
* $Id: mpgv.c,v 1.6 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -135,10 +135,11 @@ static int Open( vlc_object_t * p_this )
p_sys->p_packetizer->pf_decode_video = NULL;
p_sys->p_packetizer->pf_decode_sub = NULL;
p_sys->p_packetizer->pf_packetize = NULL;
es_format_Init( &p_sys->p_packetizer->fmt_in, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
es_format_Init( &p_sys->p_packetizer->fmt_in, VIDEO_ES,
VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
es_format_Init( &p_sys->p_packetizer->fmt_out, UNKNOWN_ES, 0 );
p_sys->p_packetizer->p_module =
module_Need( p_sys->p_packetizer, "packetizer", NULL );
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( p_sys->p_packetizer->p_module == NULL)
{
......
......@@ -2,7 +2,7 @@
* ps.c : Program Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2004, 2004 VideoLAN
* $Id: ps.c,v 1.17 2004/01/25 20:05:28 hartman Exp $
* $Id: ps.c,v 1.18 2004/03/03 20:39:52 gbazin Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -123,7 +123,7 @@ static int Activate( vlc_object_t * p_this )
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
......
......@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* $Id: ts.c,v 1.46 2004/01/25 20:05:28 hartman Exp $
* $Id: ts.c,v 1.47 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -230,7 +230,7 @@ static int Activate( vlc_object_t * p_this )
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
......
......@@ -2,7 +2,7 @@
* sub.h
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id: sub.h,v 1.19 2004/01/27 13:10:29 fenrir Exp $
* $Id: sub.h,v 1.20 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -91,7 +91,7 @@ static inline subtitle_demux_t *subtitle_New( input_thread_t *p_input,
p_sub = vlc_object_create( p_input, sizeof( subtitle_demux_t ) );
p_sub->psz_object_name = "subtitle demux";
vlc_object_attach( p_sub, p_input );
p_sub->p_module = module_Need( p_sub, "subtitle demux", "" );
p_sub->p_module = module_Need( p_sub, "subtitle demux", NULL, 0 );
if( p_sub->p_module &&
p_sub->pf_open( p_sub, p_input, psz_name, i_microsecperframe ) >=0 )
......
......@@ -2,7 +2,7 @@
* gnome.c : Gnome plugin for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: gnome.c,v 1.17 2004/01/25 18:53:07 gbazin Exp $
* $Id: gnome.c,v 1.18 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -98,7 +98,8 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
}
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gui-helper", "gnome" );
p_intf->p_sys->p_gtk_main =
module_Need( p_this, "gui-helper", "gnome", VLC_TRUE );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
......
......@@ -2,7 +2,7 @@
* gtk.c : Gtk+ plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: gtk.c,v 1.22 2004/01/25 18:53:07 gbazin Exp $
* $Id: gtk.c,v 1.23 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -97,7 +97,8 @@ static int Open( vlc_object_t *p_this )
}
#ifdef NEED_GTK_MAIN
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gui-helper", "gtk" );
p_intf->p_sys->p_gtk_main =
module_Need( p_this, "gui-helper", "gtk", VLC_TRUE );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
......
......@@ -2,7 +2,7 @@
* gnome2.c : GNOME 2 plugin for vlc
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gnome2.c,v 1.2 2003/03/30 18:14:37 gbazin Exp $
* $Id: gnome2.c,v 1.3 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -83,7 +83,8 @@ static int Open( vlc_object_t *p_this )
}
#ifdef NEED_GTK2_MAIN
p_intf->p_sys->p_gui_helper = module_Need( p_this, "gui-helper", "gnome2" );
p_intf->p_sys->p_gui_helper =
module_Need( p_this, "gui-helper", "gnome2", VLC_TRUE );
if( p_intf->p_sys->p_gui_helper == NULL )
{
free( p_intf->p_sys );
......
......@@ -2,7 +2,7 @@
* gtk2.c : Gtk2 plugin for vlc
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2.c,v 1.2 2003/03/30 18:14:37 gbazin Exp $
* $Id: gtk2.c,v 1.3 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -84,7 +84,8 @@ static int Open( vlc_object_t *p_this )
}
#ifdef NEED_GTK2_MAIN
p_intf->p_sys->p_gui_helper = module_Need( p_this, "gui-helper", "gtk2" );
p_intf->p_sys->p_gui_helper =
module_Need( p_this, "gui-helper", "gtk2", VLC_TRUE );
if( p_intf->p_sys->p_gui_helper == NULL )
{
free( p_intf->p_sys );
......
......@@ -2,7 +2,7 @@
* pda.c : PDA Gtk2 plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: pda.c,v 1.22 2004/02/29 22:59:59 jpsaman Exp $
* $Id: pda.c,v 1.23 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* Marc Ariberti <marcari@videolan.org>
......@@ -87,7 +87,8 @@ static int Open( vlc_object_t *p_this )
#ifdef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Using gui-helper" );
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gui-helper", "gtk2" );
p_intf->p_sys->p_gtk_main =
module_Need( p_this, "gui-helper", "gtk2", VLC_TRUE );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
......
......@@ -2,7 +2,7 @@
* dialogs.cpp: Handles all the different dialog boxes we provide.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: dialogs.cpp,v 1.17 2003/12/11 02:26:03 asmax Exp $
* $Id: dialogs.cpp,v 1.18 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -63,7 +63,7 @@ Dialogs::Dialogs( intf_thread_t *_p_intf )
return;
}
p_module = module_Need( p_provider, "dialogs provider", NULL );
p_module = module_Need( p_provider, "dialogs provider", NULL, 0 );
if( p_module == NULL )
{
msg_Err( p_intf, "no suitable dialogs provider found" );
......
......@@ -2,7 +2,7 @@
* dialogs.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: dialogs.cpp,v 1.2 2004/01/25 17:20:19 kuehne Exp $
* $Id: dialogs.cpp,v 1.3 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -132,7 +132,7 @@ bool Dialogs::init()
return false;
}
m_pModule = module_Need( m_pProvider, "dialogs provider", NULL );
m_pModule = module_Need( m_pProvider, "dialogs provider", NULL, 0 );
if( m_pModule == NULL )
{
msg_Err( getIntf(), "No suitable dialogs provider found" );
......
......@@ -2,7 +2,7 @@
* sap.c : SAP interface module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: sap.c,v 1.53 2004/02/23 21:00:37 sigmunau Exp $
* $Id: sap.c,v 1.54 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr>
......@@ -263,7 +263,7 @@ static int Open( vlc_object_t *p_this )
sock.i_ttl = 0;
p_intf->p_private = (void*) &sock;
p_network = module_Need( p_intf, "network", "ipv4" );
p_network = module_Need( p_intf, "network", "ipv4", VLC_TRUE );
if( p_network )
{
p_sys->fd[0] = sock.i_handle;
......@@ -299,7 +299,7 @@ static int Open( vlc_object_t *p_this )
sock.i_ttl = 0;
p_intf->p_private = (void*) &sock;
p_network = module_Need( p_intf, "network", "ipv6" );
p_network = module_Need( p_intf, "network", "ipv6", VLC_TRUE );
if( p_network )
{
p_sys->fd[1] = sock.i_handle;
......
......@@ -220,7 +220,7 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout,
/* Call the network module */
p_sout->p_private = (void*) &socket_desc;
if( !( p_network = module_Need( p_sout, "network", "ipv4" ) ) )
if( !( p_network = module_Need(p_sout, "network", "ipv4", VLC_TRUE) ) )
{
msg_Warn( p_sout, "failed to open a connection (udp)" );
return NULL;
......@@ -260,7 +260,7 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout,
/* Call the network module */
p_sout->p_private = (void *) &socket_desc;
if( !( p_network = module_Need( p_sout, "network", "ipv6" ) ) )
if( !( p_network = module_Need(p_sout, "network", "ipv6", VLC_TRUE) ) )
{
msg_Warn( p_sout, "failed to open a connection (udp)" );
return NULL;
......
......@@ -2,7 +2,7 @@
* transcode.c: transcoding stream output module
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
* $Id: transcode.c,v 1.81 2004/03/03 11:29:26 massiot Exp $
* $Id: transcode.c,v 1.82 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -786,7 +786,7 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream,
id->p_encoder->fmt_out.i_bitrate = id->f_dst.i_bitrate;
id->p_encoder->p_module =
module_Need( id->p_encoder, "encoder", NULL );
module_Need( id->p_encoder, "encoder", NULL, 0 );
if( !id->p_encoder->p_module )
{
vlc_object_destroy( id->p_encoder );
......@@ -1178,7 +1178,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream,
id->p_vresample = NULL;
id->p_encoder->p_module =
module_Need( id->p_encoder, "encoder", NULL );
module_Need( id->p_encoder, "encoder", NULL, 0 );
if( !id->p_encoder->p_module )
{
......@@ -1375,7 +1375,7 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
id->p_encoder->fmt_out.p_extra = NULL;
id->p_encoder->p_module =
module_Need( id->p_encoder, "encoder", NULL );
module_Need( id->p_encoder, "encoder", NULL, 0 );
if( !id->p_encoder->p_module )
{
vlc_object_destroy( id->p_encoder );
......
......@@ -2,7 +2,7 @@
* qte.cpp : QT Embedded plugin for vlc
*****************************************************************************
* Copyright (C) 1998-2003 VideoLAN
* $Id: qte.cpp,v 1.21 2004/01/26 16:45:02 zorglub Exp $
* $Id: qte.cpp,v 1.22 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Gerald Hansink <gerald.hansink@ordain.nl>
* Jean-Paul Saman <jpsaman@wxs.nl>
......@@ -150,7 +150,8 @@ static int Open( vlc_object_t *p_this )
p_vout->pf_display = Display;
#ifdef NEED_QTE_MAIN
p_vout->p_sys->p_qte_main = module_Need( p_this, "gui-helper", "qte" );
p_vout->p_sys->p_qte_main =
module_Need( p_this, "gui-helper", "qte", VLC_TRUE );
if( p_vout->p_sys->p_qte_main == NULL )
{
free( p_vout->p_sys );
......
......@@ -2,7 +2,7 @@
* filters.c : audio output filters management
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
* $Id: filters.c,v 1.19 2004/01/06 12:02:05 zorglub Exp $
* $Id: filters.c,v 1.20 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -52,7 +52,7 @@ static aout_filter_t * FindFilter( aout_instance_t * p_aout,
memcpy( &p_filter->input, p_input_format, sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, p_output_format,
sizeof(audio_sample_format_t) );
p_filter->p_module = module_Need( p_filter, "audio filter", NULL );
p_filter->p_module = module_Need( p_filter, "audio filter", NULL, 0 );
if ( p_filter->p_module == NULL )
{
vlc_object_detach( p_filter );
......
......@@ -2,7 +2,7 @@
* input.c : internal management of input streams for the audio output
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
* $Id: input.c,v 1.43 2004/01/06 12:02:05 zorglub Exp $
* $Id: input.c,v 1.44 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -177,7 +177,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
sizeof(audio_sample_format_t) );
p_filter->p_module =
module_Need( p_filter,"audio filter", psz_parser );
module_Need( p_filter,"audio filter", psz_parser, VLC_TRUE );
if( p_filter->p_module== NULL )
{
......@@ -527,7 +527,7 @@ static aout_filter_t * allocateUserChannelMixer( aout_instance_t * p_aout,
memcpy( &p_channel_mixer->output, p_output_format,
sizeof(audio_sample_format_t) );
p_channel_mixer->p_module =
module_Need( p_channel_mixer,"audio filter", psz_name );
module_Need( p_channel_mixer,"audio filter", psz_name, VLC_TRUE );
if( p_channel_mixer->p_module== NULL )
{
msg_Err( p_aout, "cannot add user channel mixer %s", psz_name );
......
......@@ -2,7 +2,7 @@
* mixer.c : audio output mixing operations
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
* $Id: mixer.c,v 1.29 2004/01/06 12:02:05 zorglub Exp $
* $Id: mixer.c,v 1.30 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -43,7 +43,7 @@
*****************************************************************************/
int aout_MixerNew( aout_instance_t * p_aout )
{
p_aout->mixer.p_module = module_Need( p_aout, "audio mixer", NULL );
p_aout->mixer.p_module = module_Need( p_aout, "audio mixer", NULL, 0 );
if ( p_aout->mixer.p_module == NULL )
{
msg_Err( p_aout, "no suitable aout mixer" );
......
......@@ -2,7 +2,7 @@
* output.c : internal management of output streams for the audio output
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
* $Id: output.c,v 1.43 2004/01/26 21:37:58 hartman Exp $
* $Id: output.c,v 1.44 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -41,7 +41,6 @@ int aout_OutputNew( aout_instance_t * p_aout,
audio_sample_format_t * p_format )
{
/* Retrieve user defaults. */
char * psz_name = config_GetPsz( p_aout, "aout" );
int i_rate = config_GetInt( p_aout, "aout-rate" );
vlc_value_t val, text;
/* kludge to avoid a fpu error when rate is 0... */
......@@ -55,8 +54,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
vlc_mutex_lock( &p_aout->output_fifo_lock );
/* Find the best output plug-in. */
p_aout->output.p_module = module_Need( p_aout, "audio output", psz_name );
if ( psz_name != NULL ) free( psz_name );
p_aout->output.p_module = module_Need( p_aout, "audio output", "$aout", 0);
if ( p_aout->output.p_module == NULL )
{
msg_Err( p_aout, "no suitable aout module" );
......
......@@ -2,7 +2,7 @@
* demux.c
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: demux.c,v 1.12 2004/03/03 12:01:38 fenrir Exp $
* $Id: demux.c,v 1.13 2004/03/03 20:39:53 gbazin Exp $
*
* Author: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -238,7 +238,8 @@ demux_t *__demux2_New( vlc_object_t *p_obj,
/* Before module_Need (for var_Create...) */
vlc_object_attach( p_demux, p_obj );
p_demux->p_module = module_Need( p_demux, "demux2", p_demux->psz_demux );
p_demux->p_module =
module_Need( p_demux, "demux2", p_demux->psz_demux, VLC_TRUE );
if( p_demux->p_module == NULL )
{
vlc_object_detach( p_demux );
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: input.c,v 1.291 2004/03/03 11:59:41 fenrir Exp $
* $Id: input.c,v 1.292 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -673,7 +673,7 @@ static int InitThread( input_thread_t * p_input )
/* Find and open appropriate access module */
p_input->p_access = module_Need( p_input, "access",
p_input->psz_access );
p_input->psz_access, VLC_TRUE );
#ifndef WIN32 /* Remove this gross hack from the win32 build as colons
* are forbidden in filenames on Win32. */
......@@ -688,7 +688,7 @@ static int InitThread( input_thread_t * p_input )
p_input->psz_dupsource = NULL;
p_input->p_access = module_Need( p_input, "access",
p_input->psz_access );
p_input->psz_access, VLC_TRUE );
}
#endif
......@@ -778,7 +778,9 @@ static int InitThread( input_thread_t * p_input )
p_input->p_demux =
module_Need( p_input, "demux",
(p_input->psz_demux && *p_input->psz_demux) ?
p_input->psz_demux : "$demux" );
p_input->psz_demux : "$demux",
(p_input->psz_demux && *p_input->psz_demux) ?
VLC_TRUE : VLC_FALSE );
if( p_input->p_demux == NULL )
{
......
......@@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: input_dec.c,v 1.93 2004/03/03 11:12:08 massiot Exp $
* $Id: input_dec.c,v 1.94 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -106,7 +106,7 @@ decoder_t * input_RunDecoder( input_thread_t * p_input, es_descriptor_t * p_es )
return NULL;
}
p_dec->p_module = module_Need( p_dec, "packetizer", "$packetizer" );
p_dec->p_module = module_Need( p_dec, "packetizer", "$packetizer", 0 );
}
else
{
......@@ -119,7 +119,7 @@ decoder_t * input_RunDecoder( input_thread_t * p_input, es_descriptor_t * p_es )
}
/* default Get a suitable decoder module */
p_dec->p_module = module_Need( p_dec, "decoder", "$codec" );
p_dec->p_module = module_Need( p_dec, "decoder", "$codec", 0 );
}
if( !p_dec->p_module )
......
......@@ -4,7 +4,7 @@
* interface, such as command line.
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: interface.c,v 1.113 2004/02/08 11:23:17 gbazin Exp $
* $Id: interface.c,v 1.114 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -98,7 +98,7 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module )
}
/* Choose the best module */
p_intf->p_module = module_Need( p_intf, "interface", psz_module );
p_intf->p_module = module_Need( p_intf, "interface", psz_module, 0 );
if( p_intf->p_module == NULL )
{
......@@ -296,7 +296,7 @@ static void RunInterface( intf_thread_t *p_intf )
/* Make sure the old interface is completely uninitialised */
module_Unneed( p_intf, p_intf->p_module );
p_intf->p_module = module_Need( p_intf, "interface", psz_intf );
p_intf->p_module = module_Need( p_intf, "interface", psz_intf, 0 );
free( psz_intf );
if( p_intf->p_module )
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: libvlc.c,v 1.117 2004/02/22 15:41:27 massiot Exp $
* $Id: libvlc.c,v 1.118 2004/03/03 20:39:52 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -559,7 +559,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
/*
* Choose the best memcpy module
*/
p_vlc->p_memcpy_module = module_Need( p_vlc, "memcpy", "$memcpy" );
p_vlc->p_memcpy_module = module_Need( p_vlc, "memcpy", "$memcpy", 0 );
if( p_vlc->pf_memcpy == NULL )
{
......
......@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id: modules.c,v 1.145 2004/03/03 15:47:08 sigmunau Exp $
* $Id: modules.c,v 1.146 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Sam Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -262,7 +262,7 @@ void __module_LoadPlugins( vlc_object_t * p_this )
* This function returns the module that best fits the asked capabilities.
*****************************************************************************/
module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
const char *psz_name )
const char *psz_name, vlc_bool_t b_strict )
{
typedef struct module_list_t module_list_t;
......@@ -299,7 +299,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
/* Count how many different shortcuts were asked for */
if( psz_name && *psz_name )
{
char *psz_parser;
char *psz_parser, *psz_last_shortcut;
/* If the user wants none, give him none. */
if( !strcmp( psz_name, "none" ) )
......@@ -309,7 +309,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
}
i_shortcuts++;
psz_shortcuts = strdup( psz_name );
psz_shortcuts = psz_last_shortcut = strdup( psz_name );
for( psz_parser = psz_shortcuts; *psz_parser; psz_parser++ )
{
......@@ -317,8 +317,16 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
{
*psz_parser = '\0';
i_shortcuts++;
psz_last_shortcut = psz_parser + 1;
}
}
/* Check if the user wants to override the "strict" mode */
if( psz_last_shortcut )
{
if( !strcmp(psz_last_shortcut, "none") ) b_strict = VLC_TRUE;
else if( !strcmp(psz_last_shortcut, "any") ) b_strict = VLC_FALSE;
}
}
/* Sort the modules and test them */
......@@ -377,10 +385,10 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
while( i_short )
{
/* If the last given shortcut is "none" and we couldn't
/* If we are in "strict" mode and we couldn't
* find the module in the list of provided shortcuts,
* then kick the bastard out of here!!! */
if( (i_short == 1) && !strcmp(psz_name, "none") )
if( i_short == 1 && b_strict )
{
b_trash = VLC_TRUE;
break;
......
......@@ -2,7 +2,7 @@
* net.c:
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: net.c,v 1.9 2004/01/25 17:16:06 zorglub Exp $
* $Id: net.c,v 1.10 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@videolan.org>
*
......@@ -72,7 +72,6 @@ int __net_OpenTCP( vlc_object_t *p_this, char *psz_host, int i_port )
network_socket_t sock;
module_t *p_network;
/* Check if we have force ipv4 or ipv6 */
var_Create( p_this, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_this, "ipv4", &val );
......@@ -99,9 +98,10 @@ int __net_OpenTCP( vlc_object_t *p_this, char *psz_host, int i_port )
msg_Dbg( p_this, "net: connecting to '%s:%d'", psz_host, i_port );
private = p_this->p_private;
p_this->p_private = (void*)&sock;
if( ( p_network = module_Need( p_this, "network", psz_network ) ) == NULL )
if( !( p_network = module_Need( p_this, "network", psz_network, 0 ) ) )
{
msg_Dbg( p_this, "net: connection to '%s:%d' failed", psz_host, i_port );
msg_Dbg( p_this, "net: connection to '%s:%d' failed",
psz_host, i_port );
return -1;
}
module_Unneed( p_this, p_network );
......@@ -155,7 +155,7 @@ int __net_OpenUDP( vlc_object_t *p_this, char *psz_bind, int i_bind,
psz_server, i_server, psz_bind, i_bind );
private = p_this->p_private;
p_this->p_private = (void*)&sock;
if( ( p_network = module_Need( p_this, "network", psz_network ) ) == NULL )
if( !( p_network = module_Need( p_this, "network", psz_network, 0 ) ) )
{
msg_Dbg( p_this, "net: connection to '%s:%d@%s:%d' failed",
psz_server, i_server, psz_bind, i_bind );
......
......@@ -2,7 +2,7 @@
* loadsave.c : Playlist loading / saving functions
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: loadsave.c,v 1.10 2004/01/29 17:51:08 zorglub Exp $
* $Id: loadsave.c,v 1.11 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -113,7 +113,7 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
vlc_mutex_lock( &p_playlist->object_lock );
/* And call the module ! All work is done now */
p_module = module_Need( p_playlist, "playlist export", psz_type);
p_module = module_Need( p_playlist, "playlist export", psz_type, VLC_TRUE);
if( !p_module )
{
msg_Warn( p_playlist, "failed to export playlist" );
......
......@@ -2,7 +2,7 @@
* stream_output.c : stream output module
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
* $Id: stream_output.c,v 1.40 2004/02/22 16:08:47 fenrir Exp $
* $Id: stream_output.c,v 1.41 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -42,9 +42,6 @@ static void sout_cfg_free( sout_cfg_t * );
#define sout_stream_url_to_chain( p, s ) _sout_stream_url_to_chain( VLC_OBJECT(p), s )
static char *_sout_stream_url_to_chain( vlc_object_t *, char * );
#define module_NeedStrict(a,b,c) __module_NeedStrict(VLC_OBJECT(a),b,c)
static module_t *__module_NeedStrict( vlc_object_t *, const char *, const char * );
/*
* Generic MRL parser
*
......@@ -282,7 +279,7 @@ sout_access_out_t *sout_AccessOutNew( sout_instance_t *p_sout,
p_access->pf_write = NULL;
p_access->p_module =
module_NeedStrict( p_access, "sout access", p_access->psz_access );
module_Need( p_access, "sout access", p_access->psz_access, VLC_TRUE );
if( !p_access->p_module )
{
......@@ -373,7 +370,7 @@ sout_mux_t * sout_MuxNew ( sout_instance_t *p_sout,
p_mux->p_sys = NULL;
p_mux->p_module =
module_NeedStrict( p_mux, "sout mux", p_mux->psz_mux );
module_Need( p_mux, "sout mux", p_mux->psz_mux, VLC_TRUE );
if( p_mux->p_module == NULL )
{
......@@ -1213,7 +1210,7 @@ sout_stream_t *sout_stream_new( sout_instance_t *p_sout,
msg_Dbg( p_sout, "stream=`%s'", p_stream->psz_name );
p_stream->p_module =
module_NeedStrict( p_stream, "sout stream", p_stream->psz_name );
module_Need( p_stream, "sout stream", p_stream->psz_name, VLC_TRUE );
if( !p_stream->p_module )
{
......@@ -1263,28 +1260,3 @@ static char *_sout_stream_url_to_chain( vlc_object_t *p_this, char *psz_url )
mrl_Clean( &mrl );
return( psz_chain );
}
/*****************************************************************************/
static module_t *__module_NeedStrict( vlc_object_t *p_obj, const char *psz_capacity, const char *psz_name )
{
module_t *p_module;
if( !psz_name || !*psz_name )
{
p_module = module_Need( p_obj, psz_capacity, psz_name );
}
else
{
char *psz_name_strict = malloc( strlen( psz_name ) + 6 );
strcpy( psz_name_strict, psz_name );
strcat( psz_name_strict, ",none" );
p_module = module_Need( p_obj, psz_capacity, psz_name_strict );
free( psz_name_strict );
}
return p_module;
}
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* $Id: video_output.c,v 1.245 2004/01/25 17:16:06 zorglub Exp $
* $Id: video_output.c,v 1.246 2004/03/03 20:39:53 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -403,10 +403,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
/* Create the vout thread */
p_vout->p_module = module_Need( p_vout,
( p_vout->psz_filter_chain &&
*p_vout->psz_filter_chain ) ?
"video filter" : "video output",
psz_plugin );
( p_vout->psz_filter_chain && *p_vout->psz_filter_chain ) ?
"video filter" : "video output", psz_plugin, 0 );
if( psz_plugin ) free( psz_plugin );
if( p_vout->p_module == NULL )
......@@ -416,8 +414,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
return NULL;
}
p_vout->p_text_renderer_module = module_Need( p_vout, "text renderer",
NULL );
p_vout->p_text_renderer_module =
module_Need( p_vout, "text renderer", NULL, 0 );
if( p_vout->p_text_renderer_module == NULL )
{
msg_Warn( p_vout, "no suitable text renderer module" );
......@@ -669,7 +667,7 @@ static int InitThread( vout_thread_t *p_vout )
p_vout->b_direct = 0;
/* Choose the best module */
p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL );
p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL, 0 );
if( p_vout->chroma.p_module == NULL )
{
......
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