[vlc-devel] [PATCH 2/2] modules: add 'vlc_' prefix to module_exists()

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 28 09:15:05 CEST 2020


On 2020-09-27 1:36, Lyndon Brown wrote:
> From: Lyndon Brown <jnqnfe at gmail.com>
> Date: Sat, 25 May 2019 08:24:12 +0100
> Subject: modules: add 'vlc_' prefix to module_exists()
> 
> having just inlined it and thus changed the api/abi anyway

It seems odd that it's the only function of that header with the proper 
prefix. I think it's better to do all or none at once.

> diff --git a/include/vlc_modules.h b/include/vlc_modules.h
> index 3927252469..e930f5fbfa 100644
> --- a/include/vlc_modules.h
> +++ b/include/vlc_modules.h
> @@ -139,7 +139,7 @@ VLC_API module_t *module_find(const char *name) VLC_USED;
>    * \retval true if the module exists
>    * \retval false if the module does not exist (in the running installation)
>    */
> -VLC_USED static inline bool module_exists (const char * name)
> +VLC_USED static inline bool vlc_module_exists (const char * name)
>   {
>       return module_find(name) != NULL;
>   }
> diff --git a/lib/audio.c b/lib/audio.c
> index aab84cd47a..29bec4135f 100644
> --- a/lib/audio.c
> +++ b/lib/audio.c
> @@ -124,7 +124,7 @@ int libvlc_audio_output_set( libvlc_media_player_t *mp, const char *psz_name )
>   {
>       char *value;
>   
> -    if( !module_exists( psz_name )
> +    if( !vlc_module_exists( psz_name )
>        || asprintf( &value, "%s,none", psz_name ) == -1 )
>           return -1;
>       var_SetString( mp, "aout", value );
> diff --git a/modules/codec/subsusf.c b/modules/codec/subsusf.c
> index 44248ff664..2778fc2886 100644
> --- a/modules/codec/subsusf.c
> +++ b/modules/codec/subsusf.c
> @@ -518,7 +518,7 @@ static int ParseImageAttachments( decoder_t *p_dec )
>                       video_format_Init( &fmt_out, VLC_CODEC_YUVA );
>   
>                       /* Find a suitable decoder module */
> -                    if( module_exists( "sdl_image" ) )
> +                    if( vlc_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/preferences/VLCSimplePrefsController.m b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
> index f05f749da9..985df0df85 100644
> --- a/modules/gui/macosx/preferences/VLCSimplePrefsController.m
> +++ b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
> @@ -697,7 +697,7 @@ static inline const char * __config_GetLabel(vlc_object_t *p_this, const char *p
>       [self setupButton:_audio_visualPopup forModuleList: "audio-visual"];
>   
>       /* Last.FM is optional */
> -    if (module_exists("audioscrobbler")) {
> +    if (vlc_module_exists("audioscrobbler")) {
>           [self setupField:_audio_lastuserTextField forOption:"lastfm-username"];
>           [self setupField:_audio_lastpwdSecureTextField forOption:"lastfm-password"];
>   
> @@ -998,7 +998,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
>           SaveModuleList(_audio_visualPopup, "audio-visual");
>   
>           /* Last.FM is optional */
> -        if (module_exists("audioscrobbler")) {
> +        if (vlc_module_exists("audioscrobbler")) {
>               [_audio_lastCheckbox setEnabled: YES];
>               if ([_audio_lastCheckbox state] == NSOnState)
>                   config_AddIntf("audioscrobbler");
> diff --git a/modules/gui/qt/dialogs/extended/extended.cpp b/modules/gui/qt/dialogs/extended/extended.cpp
> index ff0b5b00a0..6fd9167d58 100644
> --- a/modules/gui/qt/dialogs/extended/extended.cpp
> +++ b/modules/gui/qt/dialogs/extended/extended.cpp
> @@ -109,7 +109,7 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf )
>       syncW = new SyncControls( p_intf, videoTab );
>       mainTabW->insertTab( SYNCHRO_TAB, syncW, qtr( "Synchronization" ) );
>   
> -    if( module_exists( "v4l2" ) )
> +    if( vlc_module_exists( "v4l2" ) )
>       {
>           ExtV4l2 *v4l2 = new ExtV4l2( p_intf, mainTabW );
>           mainTabW->insertTab( V4L2_TAB, v4l2, qtr( "v4l2 controls" ) );
> diff --git a/modules/gui/qt/dialogs/fingerprint/chromaprint.cpp b/modules/gui/qt/dialogs/fingerprint/chromaprint.cpp
> index 585fc5e167..0a5f312ca4 100644
> --- a/modules/gui/qt/dialogs/fingerprint/chromaprint.cpp
> +++ b/modules/gui/qt/dialogs/fingerprint/chromaprint.cpp
> @@ -68,7 +68,7 @@ bool Chromaprint::enqueue( input_item_t *p_item )
>   
>   bool Chromaprint::isSupported( QString uri )
>   {
> -    if ( !module_exists( "stream_out_chromaprint" ) )
> +    if ( !vlc_module_exists( "stream_out_chromaprint" ) )
>           return false;
>       else
>       return ( uri.startsWith( "file://" ) || uri.startsWith( "/" ) );
> diff --git a/modules/gui/qt/dialogs/open/open_panels.cpp b/modules/gui/qt/dialogs/open/open_panels.cpp
> index d2be788cf8..4a92604306 100644
> --- a/modules/gui/qt/dialogs/open/open_panels.cpp
> +++ b/modules/gui/qt/dialogs/open/open_panels.cpp
> @@ -794,7 +794,7 @@ void CaptureOpenPanel::initialize()
>       /*********************
>        * DirectShow Stuffs *
>        *********************/
> -    if( module_exists( "dshow" ) ){
> +    if( vlc_module_exists( "dshow" ) ){
>       addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow", QGridLayout );
>   
>       /* dshow Main */
> @@ -833,7 +833,7 @@ void CaptureOpenPanel::initialize()
>       char const * const ppsz_v4lvdevices[] = {
>           "video*"
>       };
> -    if( module_exists( "v4l2" ) ){
> +    if( vlc_module_exists( "v4l2" ) ){
>       addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video camera", QGridLayout );
>   
>       /* V4L2 main panel */
> @@ -886,7 +886,7 @@ void CaptureOpenPanel::initialize()
>       /*******
>        * JACK *
>        *******/
> -    if( module_exists( "jack" ) ){
> +    if( vlc_module_exists( "jack" ) ){
>       addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit",
>                            QGridLayout);
>   
> @@ -932,7 +932,7 @@ void CaptureOpenPanel::initialize()
>       /*************
>        * DVB Stuff *
>        *************/
> -    if( module_exists( "dtv" ) ){
> +    if( vlc_module_exists( "dtv" ) ){
>       addModuleAndLayouts( DTV_DEVICE, dvb, N_("TV - digital"), QGridLayout );
>   
>       /* DVB Main */
> @@ -1053,7 +1053,7 @@ void CaptureOpenPanel::initialize()
>       /************
>        * PVR      *
>        ************/
> -    if( module_exists( "v4l2" ) ){
> +    if( vlc_module_exists( "v4l2" ) ){
>       addModuleAndLayouts( PVR_DEVICE, pvr, N_("TV - analog"), QGridLayout );
>   
>       /* PVR Main panel */
> diff --git a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
> index 5c567a854d..679215aeee 100644
> --- a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
> +++ b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
> @@ -157,7 +157,7 @@ static int getDefaultAudioVolume(const char *aout)
>           return -1;
>       else
>   #ifdef __linux__
> -    if (!strcmp(aout, "alsa") && module_exists("alsa"))
> +    if (!strcmp(aout, "alsa") && vlc_module_exists("alsa"))
>           return cbrtf(config_GetFloat("alsa-gain")) * 100.f + .5f;
>       else
>   #endif
> @@ -167,13 +167,13 @@ static int getDefaultAudioVolume(const char *aout)
>       else
>   #endif
>   #ifdef __APPLE__
> -    if (!strcmp(aout, "auhal") && module_exists("auhal"))
> +    if (!strcmp(aout, "auhal") && vlc_module_exists("auhal"))
>           return (config_GetFloat("auhal-volume") * 100.f + .5f)
>                    / AOUT_VOLUME_DEFAULT;
>       else
>   #endif
>   #ifdef _WIN32
> -    if (!strcmp(aout, "directsound") && module_exists("directsound"))
> +    if (!strcmp(aout, "directsound") && vlc_module_exists("directsound"))
>           return config_GetFloat("directx-volume") * 100.f + .5f;
>       else
>   #endif
> @@ -476,7 +476,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
>               CONFIG_GENERIC_NO_UI( "kai-audio-device", StringList, kaiLabel,
>                       kaiDevice );
>   #else
> -            if( module_exists( "alsa" ) )
> +            if( vlc_module_exists( "alsa" ) )
>               {
>                   audioControl( alsa );
>                   optionWidgets["alsaL"] = alsaLabel;
> @@ -484,7 +484,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
>                   CONFIG_GENERIC_NO_UI( "alsa-audio-device" , StringList, alsaLabel,
>                                   alsaDevice );
>               }
> -            if( module_exists( "oss" ) )
> +            if( vlc_module_exists( "oss" ) )
>               {
>                   audioControl2( OSS );
>                   optionWidgets["ossL"] = OSSLabel;
> @@ -564,7 +564,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
>               updateAudioOptions( ui.outputModule->currentIndex() );
>   
>               /* LastFM */
> -            if( module_exists( "audioscrobbler" ) )
> +            if( vlc_module_exists( "audioscrobbler" ) )
>               {
>                   CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label,
>                           lastfm_user_edit );
> @@ -651,7 +651,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
>               /* live555 module prefs */
>               CONFIG_BOOL( "rtsp-tcp",
>                                   live555TransportRTSP_TCPRadio );
> -            if ( !module_exists( "live555" ) )
> +            if ( !vlc_module_exists( "live555" ) )
>               {
>                   ui.live555TransportRTSP_TCPRadio->hide();
>                   ui.live555TransportHTTPRadio->hide();
> @@ -832,7 +832,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
>   #endif
>               /* ONE INSTANCE options */
>   #if !defined( _WIN32 ) && !defined(__APPLE__) && !defined(__OS2__)
> -            if( !module_exists( "dbus" ) )
> +            if( !vlc_module_exists( "dbus" ) )
>                   ui.OneInterfaceBox->hide();
>               else
>   #endif
> @@ -1120,7 +1120,7 @@ void SPrefsPanel::apply()
>           float f_gain = powf( i_volume / 100.f, 3 );
>   
>   #define save_vol_aout( name ) \
> -            module_exists( name ) && ( !psz_aout || !strcmp( psz_aout, name ) || !strcmp( psz_aout, "any" ) )
> +            vlc_module_exists( name ) && ( !psz_aout || !strcmp( psz_aout, name ) || !strcmp( psz_aout, "any" ) )
>   
>           //FIXME this is moot
>   #if defined( _WIN32 )
> diff --git a/modules/services_discovery/bonjour.m b/modules/services_discovery/bonjour.m
> index aebb203393..60e798034d 100644
> --- a/modules/services_discovery/bonjour.m
> +++ b/modules/services_discovery/bonjour.m
> @@ -186,7 +186,7 @@ NSString *const VLCBonjourRendererDemux         = @"VLCBonjourRendererDemux";
>       msg_Info(_p_this, "starting discovery");
>       for (NSDictionary *protocol in VLCSupportedProtocols) {
>           /* Only discover services if we actually have a module that can handle those */
> -        if (!module_exists([[protocol objectForKey: VLCBonjourProtocolName] UTF8String]) && !_isRendererDiscovery) {
> +        if (!vlc_module_exists([[protocol objectForKey: VLCBonjourProtocolName] UTF8String]) && !_isRendererDiscovery) {
>               msg_Dbg(_p_this, "no module for %s, skipping", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
>               continue;
>           }
> diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
> index cda59f3774..535e7e3fb5 100644
> --- a/modules/services_discovery/udev.c
> +++ b/modules/services_discovery/udev.c
> @@ -96,7 +96,7 @@ static int vlc_sd_probe_Open (vlc_object_t *obj)
>       {
>           vlc_sd_probe_Add (probe, "v4l", N_("Video capture"), SD_CAT_DEVICES);
>   #ifdef HAVE_ALSA
> -        if (!module_exists ("pulselist"))
> +        if (!vlc_module_exists ("pulselist"))
>               vlc_sd_probe_Add (probe, "alsa", N_("Audio capture"),
>                                 SD_CAT_DEVICES);
>   #endif
> diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
> index 944bde923f..cd793ba965 100644
> --- a/modules/stream_out/chromecast/cast.cpp
> +++ b/modules/stream_out/chromecast/cast.cpp
> @@ -906,7 +906,7 @@ sout_stream_sys_t::GetAcodecOption( sout_stream_t *p_stream, vlc_fourcc_t *p_cod
>       }
>   
>       if ( !b_audio_mp3
> -      && p_aud->i_channels > 2 && module_exists( "vorbis" ) )
> +      && p_aud->i_channels > 2 && vlc_module_exists( "vorbis" ) )
>           *p_codec_audio = VLC_CODEC_VORBIS;
>       else
>           *p_codec_audio = VLC_CODEC_MP3;
> diff --git a/src/audio_output/output.c b/src/audio_output/output.c
> index 1d4c01421d..a3b5a86eda 100644
> --- a/src/audio_output/output.c
> +++ b/src/audio_output/output.c
> @@ -271,25 +271,25 @@ audio_output_t *aout_New (vlc_object_t *parent)
>       val.psz_string = (char *)"vuMeter";
>       var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("VU meter"));
>       /* Look for goom plugin */
> -    if (module_exists ("goom"))
> +    if (vlc_module_exists ("goom"))
>       {
>           val.psz_string = (char *)"goom";
>           var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "Goom");
>       }
>       /* Look for libprojectM plugin */
> -    if (module_exists ("projectm"))
> +    if (vlc_module_exists ("projectm"))
>       {
>           val.psz_string = (char *)"projectm";
>           var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "projectM");
>       }
>       /* Look for VSXu plugin */
> -    if (module_exists ("vsxu"))
> +    if (vlc_module_exists ("vsxu"))
>       {
>           val.psz_string = (char *)"vsxu";
>           var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "Vovoid VSXU");
>       }
>       /* Look for glspectrum plugin */
> -    if (module_exists ("glspectrum"))
> +    if (vlc_module_exists ("glspectrum"))
>       {
>           val.psz_string = (char *)"glspectrum";
>           var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "3D spectrum");
> diff --git a/test/modules/keystore/test.c b/test/modules/keystore/test.c
> index 38e9ad9aab..cce4b2d4cb 100644
> --- a/test/modules/keystore/test.c
> +++ b/test/modules/keystore/test.c
> @@ -305,7 +305,7 @@ main(int i_argc, char *ppsz_argv[])
>   
>       setenv("VLC_PLUGIN_PATH", "../modules", 1);
>   
> -    /* Create a dummy libvlc to initialize module bank, needed by module_exists */
> +    /* Create a dummy libvlc to initialize module bank, needed by vlc_module_exists */
>       libvlc_instance_t *p_libvlc = libvlc_new(0, NULL);
>       assert(p_libvlc != NULL);
>   
> @@ -314,7 +314,7 @@ main(int i_argc, char *ppsz_argv[])
>           const char *psz_module = keystore_args[i].psz_module;
>   
>           if ((b_test_all || keystore_args[i].b_test_default)
> -         && module_exists(psz_module))
> +         && vlc_module_exists(psz_module))
>           {
>               int i_vlc_argc = 1;
>               char *ppsz_vlc_argv[2] = { 0 };
> diff --git a/test/src/player/player.c b/test/src/player/player.c
> index 931b05a9c1..ab99a6d855 100644
> --- a/test/src/player/player.c
> +++ b/test/src/player/player.c
> @@ -2755,7 +2755,7 @@ test_audio_loudness_meter(struct ctx *ctx)
>           test_audio_loudness_meter_cb,
>       };
>   
> -    if (!module_exists("ebur128"))
> +    if (!vlc_module_exists("ebur128"))
>       {
>           test_log("audio loudness meter test skipped\n");
>           return;
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list