From 4b531b445fa95a23c25942042e1c7402b96764d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 5 Oct 2008 16:11:34 +0300 Subject: [PATCH] module_find, module_exists, module_get_main: remove useless paramter --- include/vlc_modules.h | 14 +++----- modules/codec/mpeg_audio.c | 2 +- modules/codec/subtitles/subsusf.c | 2 +- modules/gui/macosx/simple_prefs.m | 16 ++++----- .../qt4/components/complete_preferences.cpp | 6 ++-- .../gui/qt4/components/extended_panels.cpp | 2 +- modules/gui/qt4/components/open_panels.cpp | 16 ++++----- .../qt4/components/preferences_widgets.cpp | 2 +- .../gui/qt4/components/simple_preferences.cpp | 34 +++++++++---------- modules/gui/qt4/dialogs/extended.cpp | 2 +- modules/gui/wxwidgets/dialogs/open.cpp | 16 +++------ src/audio_output/input.c | 4 +-- src/libvlccore.sym | 4 +-- src/modules/modules.c | 6 ++-- 14 files changed, 57 insertions(+), 69 deletions(-) diff --git a/include/vlc_modules.h b/include/vlc_modules.h index 4e6cfdafea..bd00200213 100644 --- a/include/vlc_modules.h +++ b/include/vlc_modules.h @@ -34,11 +34,8 @@ VLC_EXPORT( module_t *, __module_need, ( vlc_object_t *, const char *, const char *, bool ) ); #define module_unneed(a,b) __module_unneed(VLC_OBJECT(a),b) VLC_EXPORT( void, __module_unneed, ( vlc_object_t *, module_t * ) ); -#define module_exists(a,b) __module_exists(VLC_OBJECT(a),b) -VLC_EXPORT( bool, __module_exists, ( vlc_object_t *, const char * ) ); - -#define module_find(a,b) __module_find(VLC_OBJECT(a),b) -VLC_EXPORT( module_t *, __module_find, ( vlc_object_t *, const char * ) ); +VLC_EXPORT( bool, module_exists, (const char *) ); +VLC_EXPORT( module_t *, module_find, (const char *) ); VLC_EXPORT( module_config_t *, module_config_get, ( const module_t *, unsigned * ) ); VLC_EXPORT( void, module_config_free, ( module_config_t * ) ); @@ -63,12 +60,11 @@ VLC_EXPORT( const char *, module_get_name, ( const module_t *m, bool long_name ) #define module_GetLongName( m ) module_get_name( m, true ) VLC_EXPORT( const char *, module_get_help, ( const module_t *m ) ); - -#define module_get_main(a) __module_get_main(VLC_OBJECT(a)) -static inline module_t * __module_get_main( vlc_object_t * p_this ) +static inline module_t *module_get_main (void) { - return module_find( p_this, "main" ); + return module_find ("main"); } +#define module_get_main(a) module_get_main() static inline bool module_is_main( const module_t * p_module ) { diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c index e5e55f4903..8a60f164b3 100644 --- a/modules/codec/mpeg_audio.c +++ b/modules/codec/mpeg_audio.c @@ -141,7 +141,7 @@ static int OpenDecoder( vlc_object_t *p_this ) /* HACK: Don't use this codec if we don't have an mpga audio filter */ if( p_dec->i_object_type == VLC_OBJECT_DECODER && - !module_exists( p_this, "mpgatofixed32" ) ) + !module_exists( "mpgatofixed32" ) ) { return VLC_EGENERIC; } diff --git a/modules/codec/subtitles/subsusf.c b/modules/codec/subtitles/subsusf.c index 945ed09e18..d300ac042c 100644 --- a/modules/codec/subtitles/subsusf.c +++ b/modules/codec/subtitles/subsusf.c @@ -517,7 +517,7 @@ static int ParseImageAttachments( decoder_t *p_dec ) fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); /* Find a suitable decoder module */ - if( module_exists( p_dec, "sdl_image" ) ) + if( module_exists( "sdl_image" ) ) { /* ffmpeg thinks it can handle bmp properly but it can't (at least * not all of them), so use sdl_image if it is available */ diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m index 10f2ea1f6b..42ebc42c24 100644 --- a/modules/gui/macosx/simple_prefs.m +++ b/modules/gui/macosx/simple_prefs.m @@ -437,7 +437,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des [self setupButton: o_audio_visual_pop forModuleList: "audio-visual"]; /* Last.FM is optional */ - if( module_exists( p_intf, "audioscrobbler" ) ) + if( module_exists( "audioscrobbler" ) ) { [o_audio_lastuser_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "lastfm-username" ) ?: ""]]; [o_audio_lastpwd_sfld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "lastfm-password" ) ?: ""]]; @@ -538,9 +538,9 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des int i_cache = config_GetInt( p_intf, "file-caching"); TestCaC( "udp-caching" ); - if( module_exists (p_intf, "dvdread") ) + if( module_exists ("dvdread") ) TestCaC( "dvdread-caching" ); - if( module_exists (p_intf, "dvdnav") ) + if( module_exists ("dvdnav") ) TestCaC( "dvdnav-caching" ); TestCaC( "tcp-caching" ); TestCaC( "fake-caching" ); @@ -550,7 +550,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des TestCaCi( "rtsp-caching", 4 ); TestCaCi( "ftp-caching", 2 ); TestCaCi( "http-caching", 4 ); - if(module_exists (p_intf, "access_realrtsp")) + if(module_exists ("access_realrtsp")) TestCaCi( "realrtsp-caching", 10 ); TestCaCi( "mms-caching", 19 ); if( b_cache_equal ) @@ -781,7 +781,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch SaveModuleList( o_audio_visual_pop, "audio-visual" ); /* Last.FM is optional */ - if( module_exists( p_intf, "audioscrobbler" ) ) + if( module_exists( "audioscrobbler" ) ) { [o_audio_last_ckb setEnabled: YES]; if( [o_audio_last_ckb state] == NSOnState ) @@ -861,12 +861,12 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch #define CaC( name ) CaCi( name, 1 ) msg_Dbg( p_intf, "Adjusting all cache values to: %i", [[o_input_cachelevel_pop selectedItem] tag] ); CaC( "udp-caching" ); - if( module_exists (p_intf, "dvdread" ) ) + if( module_exists ( "dvdread" ) ) { CaC( "dvdread-caching" ); i = i + config_SaveConfigFile( p_intf, "dvdread" ); } - if( module_exists (p_intf, "dvdnav" ) ) + if( module_exists ( "dvdnav" ) ) { CaC( "dvdnav-caching" ); i = i + config_SaveConfigFile( p_intf, "dvdnav" ); @@ -876,7 +876,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch CaC( "screen-caching" ); CaCi( "rtsp-caching", 4 ); CaCi( "ftp-caching", 2 ); CaCi( "http-caching", 4 ); - if( module_exists (p_intf, "access_realrtsp" ) ) + if( module_exists ( "access_realrtsp" ) ) { CaCi( "realrtsp-caching", 10 ); i = i + config_SaveConfigFile( p_intf, "access_realrtsp" ); diff --git a/modules/gui/qt4/components/complete_preferences.cpp b/modules/gui/qt4/components/complete_preferences.cpp index 64416ee567..b34a14ef0d 100644 --- a/modules/gui/qt4/components/complete_preferences.cpp +++ b/modules/gui/qt4/components/complete_preferences.cpp @@ -75,7 +75,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : #undef BI /* Build the tree for the main module */ - module_t *p_module = module_get_main( p_intf ); + module_t *p_module = module_get_main(); /* Initialisation and get the confsize */ PrefsItemData *data = NULL; @@ -354,10 +354,10 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, if( data->i_type == TYPE_CATEGORY ) return; else if( data->i_type == TYPE_MODULE ) - p_module = module_find( p_intf, data->psz_name ); + p_module = module_find( data->psz_name ); else { - p_module = module_get_main( p_intf ); + p_module = module_get_main(); assert( p_module ); } diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp index 033b2f7932..9a7d2c043e 100644 --- a/modules/gui/qt4/components/extended_panels.cpp +++ b/modules/gui/qt4/components/extended_panels.cpp @@ -251,7 +251,7 @@ void ExtVideo::ChangeVFiltersString( char *psz_name, bool b_add ) char *psz_parser, *psz_string; const char *psz_filter_type; - module_t *p_obj = module_find( p_intf, psz_name ); + module_t *p_obj = module_find( psz_name ); if( !p_obj ) { msg_Err( p_intf, "Unable to find filter module \"%s\n.", psz_name ); diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index 804b8ad0d0..a3b100ec58 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -596,7 +596,7 @@ void CaptureOpenPanel::initialize() /********************* * DirectShow Stuffs * *********************/ - if( module_exists( p_intf, "dshow" ) ){ + if( module_exists( "dshow" ) ){ addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" ); /* dshow Main */ @@ -630,7 +630,7 @@ void CaptureOpenPanel::initialize() /************** * BDA Stuffs * **************/ - if( module_exists( p_intf, "bda" ) ){ + if( module_exists( "bda" ) ){ addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" ); /* bda Main */ @@ -695,7 +695,7 @@ void CaptureOpenPanel::initialize() /******* * V4L2* *******/ - if( module_exists( p_intf, "v4l2" ) ){ + if( module_exists( "v4l2" ) ){ addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" ); /* V4l Main panel */ @@ -730,7 +730,7 @@ void CaptureOpenPanel::initialize() /******* * V4L * *******/ - if( module_exists( p_intf, "v4l" ) ){ + if( module_exists( "v4l" ) ){ addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" ); /* V4l Main panel */ @@ -775,7 +775,7 @@ void CaptureOpenPanel::initialize() /******* * JACK * *******/ - if( module_exists( p_intf, "jack" ) ){ + if( module_exists( "jack" ) ){ addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" ); /* Jack Main panel */ @@ -829,7 +829,7 @@ void CaptureOpenPanel::initialize() /************ * PVR * ************/ - if( module_exists( p_intf, "pvr" ) ){ + if( module_exists( "pvr" ) ){ addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" ); /* PVR Main panel */ @@ -885,7 +885,7 @@ void CaptureOpenPanel::initialize() /************** * DVB Stuffs * **************/ - if( module_exists( p_intf, "dvb" ) ){ + if( module_exists( "dvb" ) ){ addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" ); /* DVB Main */ @@ -1122,7 +1122,7 @@ void CaptureOpenPanel::advancedDialog() /* Get the corresponding module */ module_t *p_module = - module_find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] ); + module_find( psz_devModule[i_devicetype] ); if( NULL == p_module ) return; /* Init */ diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index 588a6a9096..5d8e3b849e 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -1155,7 +1155,7 @@ void KeySelectorControl::finish() table->setAlternatingRowColors( true ); /* Get the main Module */ - module_t *p_main = module_find( p_this, "main" ); + module_t *p_main = module_get_main(); assert( p_main ); /* Access to the module_config_t */ diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index ca5bf1082b..3cfb8f40e7 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -254,7 +254,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, CONFIG_GENERIC2( "directx-audio-device", IntegerList, DirectXLabel, DirectXDevice ); #else - if( module_exists( p_intf, "alsa" ) ) + if( module_exists( "alsa" ) ) { audioControl( alsa ); optionWidgets.append( alsaControl ); @@ -264,7 +264,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, } else optionWidgets.append( NULL ); - if( module_exists( p_intf, "oss" ) ) + if( module_exists( "oss" ) ) { audioControl2( OSS ); optionWidgets.append( OSSControl ); @@ -316,7 +316,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, updateAudioOptions( ui.outputModule->currentIndex() ); /* LastFM */ - if( module_exists( p_intf, "audioscrobbler" ) ) + if( module_exists( "audioscrobbler" ) ) { CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label, lastfm_user_edit ); @@ -422,9 +422,9 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, int i_cache = config_GetInt( p_intf, "file-caching"); TestCaC( "udp-caching" ); - if (module_exists (p_intf, "dvdread")) + if (module_exists ("dvdread")) TestCaC( "dvdread-caching" ); - if (module_exists (p_intf, "dvdnav")) + if (module_exists ("dvdnav")) TestCaC( "dvdnav-caching" ); TestCaC( "tcp-caching" ); TestCaC( "fake-caching" ); TestCaC( "cdda-caching" ); @@ -432,18 +432,18 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, #ifdef WIN32 TestCaC( "dshow-caching" ); #else - if (module_exists (p_intf, "v4l")) + if (module_exists ("v4l")) TestCaC( "v4l-caching" ); - if (module_exists (p_intf, "access_jack")) + if (module_exists ("access_jack")) TestCaC( "jack-input-caching" ); - if (module_exists (p_intf, "v4l2")) + if (module_exists ("v4l2")) TestCaC( "v4l2-caching" ); - if (module_exists (p_intf, "pvr")) + if (module_exists ("pvr")) TestCaC( "pvr-caching" ); #endif TestCaCi( "rtsp-caching", 4 ); TestCaCi( "ftp-caching", 2 ); TestCaCi( "http-caching", 4 ); - if (module_exists (p_intf, "access_realrtsp")) + if (module_exists ("access_realrtsp")) TestCaCi( "realrtsp-caching", 10 ); TestCaCi( "mms-caching", 19 ); if( b_cache_equal ) ui.cachingCombo->setCurrentIndex( @@ -634,28 +634,28 @@ void SPrefsPanel::apply() if( i_comboValue ) { CaC( "udp-caching" ); - if (module_exists (p_intf, "dvdread" )) + if (module_exists ("dvdread" )) CaC( "dvdread-caching" ); - if (module_exists (p_intf, "dvdnav" )) + if (module_exists ("dvdnav" )) CaC( "dvdnav-caching" ); CaC( "tcp-caching" ); CaC( "vcd-caching" ); CaC( "fake-caching" ); CaC( "cdda-caching" ); CaC( "file-caching" ); CaC( "screen-caching" ); CaCi( "rtsp-caching", 4 ); CaCi( "ftp-caching", 2 ); CaCi( "http-caching", 4 ); - if (module_exists (p_intf, "access_realrtsp" )) + if (module_exists ("access_realrtsp" )) CaCi( "realrtsp-caching", 10 ); CaCi( "mms-caching", 19 ); #ifdef WIN32 CaC( "dshow-caching" ); #else - if (module_exists (p_intf, "v4l" )) + if (module_exists ( "v4l" )) CaC( "v4l-caching" ); - if (module_exists (p_intf, "access_jack" )) + if (module_exists ( "access_jack" )) CaC( "jack-input-caching" ); - if (module_exists (p_intf, "v4l2" )) + if (module_exists ( "v4l2" )) CaC( "v4l2-caching" ); - if (module_exists (p_intf, "pvr" )) + if (module_exists ( "pvr" )) CaC( "pvr-caching" ); #endif //CaCi( "dv-caching" ) too short... diff --git a/modules/gui/qt4/dialogs/extended.cpp b/modules/gui/qt4/dialogs/extended.cpp index 3cb89670cd..476bdc3c4d 100644 --- a/modules/gui/qt4/dialogs/extended.cpp +++ b/modules/gui/qt4/dialogs/extended.cpp @@ -76,7 +76,7 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf ) syncW = new SyncControls( p_intf, videoTab ); mainTabW->addTab( syncW, qtr( "Synchronization" ) ); - if( module_exists( p_intf, "v4l2" ) ) + if( module_exists( "v4l2" ) ) { ExtV4l2 *v4l2 = new ExtV4l2( p_intf, mainTabW ); mainTabW->addTab( v4l2, qtr( "v4l2 controls" ) ); diff --git a/modules/gui/wxwidgets/dialogs/open.cpp b/modules/gui/wxwidgets/dialogs/open.cpp index fdcf87db75..679f1aadea 100644 --- a/modules/gui/wxwidgets/dialogs/open.cpp +++ b/modules/gui/wxwidgets/dialogs/open.cpp @@ -507,48 +507,40 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, notebook->AddPage( NetPanel( notebook ), wxU(_("Network")), i_access_method == NET_ACCESS ); - module_t *p_module = module_find( VLC_OBJECT(p_intf), "v4l" ); - if( p_module ) + if( module_exists( "v4l" ) ) { AutoBuiltPanel *autopanel = new AutoBuiltPanel( notebook, this, p_intf, p_module ); input_tab_array.Add( autopanel ); notebook->AddPage( autopanel, wxU( module_get_name(p_module, 0) ), i_access_method == CAPTURE_ACCESS ); - module_release (p_module); } - p_module = module_find( VLC_OBJECT(p_intf), "pvr" ); - if( p_module ) + if( module_exists( "pvr" ) ) { AutoBuiltPanel *autopanel = new AutoBuiltPanel( notebook, this, p_intf, p_module ); input_tab_array.Add( autopanel ); notebook->AddPage( autopanel, wxU( module_get_name(p_module, 0) ), i_access_method == CAPTURE_ACCESS ); - module_release (p_module); } - p_module = module_find( VLC_OBJECT(p_intf), "dvb" ); - if( p_module ) + if( module_exists( "dvb" ) ) { AutoBuiltPanel *autopanel = new AutoBuiltPanel( notebook, this, p_intf, p_module ); input_tab_array.Add( autopanel ); notebook->AddPage( autopanel, wxU( module_get_name(p_module, 0) ), i_access_method == CAPTURE_ACCESS ); - module_release (p_module); } - p_module = module_find( VLC_OBJECT(p_intf), "dshow" ); - if( p_module ) + if( module_exists( "dshow" ) ) { AutoBuiltPanel *autopanel = new AutoBuiltPanel( notebook, this, p_intf, p_module ); input_tab_array.Add( autopanel ); notebook->AddPage( autopanel, wxU( module_get_name(p_module, 0) ), i_access_method == CAPTURE_ACCESS ); - module_release (p_module); } /* Update Disc panel */ diff --git a/src/audio_output/input.c b/src/audio_output/input.c index 25516b6f07..747842cfb2 100644 --- a/src/audio_output/input.c +++ b/src/audio_output/input.c @@ -105,14 +105,14 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); /* Look for goom plugin */ - if( module_exists( VLC_OBJECT(p_aout), "goom" ) ) + if( module_exists( "goom" ) ) { val.psz_string = (char*)"goom"; text.psz_string = (char*)"Goom"; var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); } /* Look for galaktos plugin */ - if( module_exists( VLC_OBJECT(p_aout), "galaktos" ) ) + if( module_exists( "galaktos" ) ) { val.psz_string = (char*)"galaktos"; text.psz_string = (char*)"GaLaktos"; var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); diff --git a/src/libvlccore.sym b/src/libvlccore.sym index badcf07d78..7f050db84a 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -207,8 +207,8 @@ LocaleFree mdate module_config_free module_config_get -__module_exists -__module_find +module_exists +module_find module_get_help __module_GetModulesNamesForCapability module_get_name diff --git a/src/modules/modules.c b/src/modules/modules.c index d8f82ae8c6..413b7814f0 100644 --- a/src/modules/modules.c +++ b/src/modules/modules.c @@ -663,7 +663,7 @@ void __module_unneed( vlc_object_t * p_this, module_t * p_module ) * \param psz_name the name of the module * \return a pointer to the module or NULL in case of a failure */ -module_t *__module_find( vlc_object_t *p_this, const char * psz_name ) +module_t *module_find( const char * psz_name ) { module_t **list, *module; @@ -692,9 +692,9 @@ module_t *__module_find( vlc_object_t *p_this, const char * psz_name ) * \param psz_name th name of the module * \return TRUE if the module exists */ -bool __module_exists( vlc_object_t *p_this, const char * psz_name ) +bool module_exists (const char * psz_name) { - module_t *p_module = __module_find( p_this, psz_name ); + module_t *p_module = module_find (psz_name); if( p_module ) module_release (p_module); return p_module != NULL; -- 2.39.2