From e469b934eae6af120442ca554c2a1a98e4a10691 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 31 Aug 2001 00:05:58 +0000 Subject: [PATCH] get alsa0_9 working with latest cvs, we need to dlopen the plugin with RTDL_GLOBAL. To use RTDL_GLOBAL, we need to make as much static as possible and PluginInfo needs a unique name (%s_%s_PluginInfo, type, name). --- libs/audio/cd/cd_linux.c | 20 ++++----- libs/audio/cd/cd_null.c | 16 +++---- libs/audio/cd/cd_sdl.c | 20 ++++----- libs/audio/cd/cd_win.c | 18 ++++---- libs/audio/renderer/snd_dma.c | 2 +- libs/audio/renderer/snd_null.c | 2 +- libs/audio/targets/snd_alsa_0_5.c | 18 ++++---- libs/audio/targets/snd_alsa_0_9.c | 47 ++++++++++---------- libs/audio/targets/snd_disk.c | 37 ++++++++-------- libs/audio/targets/snd_mme.c | 20 ++++----- libs/audio/targets/snd_null.c | 72 ++++++++++++++----------------- libs/audio/targets/snd_oss.c | 42 +++++++++--------- libs/audio/targets/snd_sdl.c | 36 ++++++++-------- libs/audio/targets/snd_sgi.c | 30 ++++++------- libs/audio/targets/snd_sun.c | 44 +++++++++---------- libs/audio/targets/snd_win.c | 54 +++++++++++------------ libs/console/client.c | 2 +- libs/console/server.c | 2 +- libs/util/plugin.c | 11 +++-- 19 files changed, 247 insertions(+), 246 deletions(-) diff --git a/libs/audio/cd/cd_linux.c b/libs/audio/cd/cd_linux.c index 657dbeb16..add932abe 100644 --- a/libs/audio/cd/cd_linux.c +++ b/libs/audio/cd/cd_linux.c @@ -123,7 +123,7 @@ I_CDAudio_GetAudioDiskInfo (void) return 0; } -void +static void I_CDAudio_Pause (void) { if (cdfile == -1 || !mus_enabled) @@ -139,7 +139,7 @@ I_CDAudio_Pause (void) playing = false; } -void +static void I_CDAudio_Stop (void) { if (cdfile == -1 || !mus_enabled) @@ -155,7 +155,7 @@ I_CDAudio_Stop (void) playing = false; } -void +static void I_CDAudio_Play (byte track, qboolean looping) { struct cdrom_tocentry entry0; @@ -234,7 +234,7 @@ I_CDAudio_Play (byte track, qboolean looping) CDAudio_Pause (); } -void +static void I_CDAudio_Resume (void) { if (cdfile == -1 || !mus_enabled) @@ -251,7 +251,7 @@ I_CDAudio_Resume (void) playing = true; } -void +static void I_CDAudio_Shutdown (void) { if (cdfile != -1) @@ -263,7 +263,7 @@ I_CDAudio_Shutdown (void) mus_enabled = false; } -void // FIXME: was static +static void I_CD_f (void) { const char *command; @@ -369,7 +369,7 @@ I_CD_f (void) } } -void +static void I_CDAudio_Update (void) { struct cdrom_subchnl subchnl; @@ -407,7 +407,7 @@ I_CDAudio_Update (void) } } -void +static void Mus_CDChange (cvar_t *mus_cdaudio) { int i; @@ -438,7 +438,7 @@ Mus_CDChange (cvar_t *mus_cdaudio) mus_enabled = true; } -void +static void I_CDAudio_Init (void) { mus_cddevice = Cvar_Get("mus_cddevice", "/dev/cdrom", CVAR_NONE, @@ -446,7 +446,7 @@ I_CDAudio_Init (void) } plugin_t * -PluginInfo (void) +cd_linux_PluginInfo (void) { plugin_info.type = qfp_cd; plugin_info.api_version = QFPLUGIN_VERSION; diff --git a/libs/audio/cd/cd_null.c b/libs/audio/cd/cd_null.c index a98a956e4..9778f32f7 100644 --- a/libs/audio/cd/cd_null.c +++ b/libs/audio/cd/cd_null.c @@ -42,43 +42,43 @@ general_funcs_t plugin_info_general_funcs; cd_funcs_t plugin_info_cd_funcs; -void +static void I_CDAudio_Pause (void) { } -void +static void I_CDAudio_Play (byte track, qboolean looping) { } -void +static void I_CDAudio_Resume (void) { } -void +static void I_CDAudio_Shutdown (void) { } -void +static void I_CDAudio_Update (void) { } -void +static void I_CDAudio_Init (void) { } -void +static void I_CD_f (void) { } plugin_t * -PluginInfo (void) +cd_null_PluginInfo (void) { plugin_info.type = qfp_cd; plugin_info.api_version = QFPLUGIN_VERSION; diff --git a/libs/audio/cd/cd_sdl.c b/libs/audio/cd/cd_sdl.c index 510acf8bf..130bafeff 100644 --- a/libs/audio/cd/cd_sdl.c +++ b/libs/audio/cd/cd_sdl.c @@ -68,7 +68,7 @@ static SDL_CD *cd_id; static float cdvolume = 1.0; -void +static void I_CDAudio_Eject (void) { if (!cd_id || !enabled) @@ -78,7 +78,7 @@ I_CDAudio_Eject (void) Con_DPrintf ("Unable to eject CD-ROM tray.\n"); } -void +static void I_CDAudio_Pause (void) { if (!cd_id || !enabled) @@ -90,7 +90,7 @@ I_CDAudio_Pause (void) Con_DPrintf ("CDAudio_Pause: Failed to pause track.\n"); } -void +static void I_CDAudio_Stop (void) { int cdstate; @@ -105,7 +105,7 @@ I_CDAudio_Stop (void) Con_DPrintf ("CDAudio_Stop: Failed to stop track.\n"); } -void +static void I_CDAudio_Play (byte track, qboolean looping) { /* Initialize cd_stat to avoid warning */ @@ -141,7 +141,7 @@ I_CDAudio_Play (byte track, qboolean looping) playLooping = looping; } -void +static void I_CDAudio_Resume (void) { if (!cd_id || !enabled) @@ -153,7 +153,7 @@ I_CDAudio_Resume (void) Con_DPrintf ("CDAudio_Resume: Failed tp resume track.\n"); } -void +static void I_CDAudio_Shutdown (void) { if (!cd_id) @@ -163,7 +163,7 @@ I_CDAudio_Shutdown (void) cd_id = NULL; } -void +static void I_CDAudio_Update (void) { if (!cd_id || !enabled) @@ -186,7 +186,7 @@ I_CDAudio_Update (void) #define CD_f_DEFINED -void // FIXME: was static void +static void I_CD_f (void) { const char *command; @@ -249,7 +249,7 @@ I_CD_f (void) } } -void +static void I_CDAudio_Init (void) { if (SDL_Init (SDL_INIT_CDROM) < 0) { @@ -280,7 +280,7 @@ I_CDAudio_Init (void) } plugin_t * -PluginInfo (void) +cd_sdl_PluginInfo (void) { plugin_info.type = qfp_cd; plugin_info.api_version = QFPLUGIN_VERSION; diff --git a/libs/audio/cd/cd_win.c b/libs/audio/cd/cd_win.c index f018c1012..1ace14f5d 100644 --- a/libs/audio/cd/cd_win.c +++ b/libs/audio/cd/cd_win.c @@ -134,7 +134,7 @@ I_CDAudio_GetAudioDiskInfo (void) } LONG -I_CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +static I_CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (lParam != wDeviceID) return 1; @@ -166,7 +166,7 @@ I_CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } -void +static void I_CDAudio_Pause (void) { DWORD dwReturn; @@ -190,7 +190,7 @@ I_CDAudio_Pause (void) playing = false; } -void +static void I_CDAudio_Play (byte track, qboolean looping) { DWORD dwReturn; @@ -264,7 +264,7 @@ I_CDAudio_Play (byte track, qboolean looping) I_CDAudio_Pause (); } -void +static void I_CDAudio_Resume (void) { DWORD dwReturn; @@ -292,7 +292,7 @@ I_CDAudio_Resume (void) playing = true; } -void +static void I_CDAudio_Shutdown (void) { if (!initialized) @@ -302,7 +302,7 @@ I_CDAudio_Shutdown (void) Con_DPrintf ("CDAudio_Shutdown: MCI_CLOSE failed\n"); } -void +static void I_CDAudio_Stop (void) { DWORD dwReturn; @@ -322,7 +322,7 @@ I_CDAudio_Stop (void) playing = false; } -void +static void I_CDAudio_Update (void) { if (!enabled) @@ -447,7 +447,7 @@ I_CD_f (void) } } -void +static void I_CDAudio_Init (void) { DWORD dwReturn; @@ -489,7 +489,7 @@ I_CDAudio_Init (void) } plugin_t * -PluginInfo (void) +cd_win_PluginInfo (void) { plugin_info.type = qfp_cd; plugin_info.api_version = QFPLUGIN_VERSION; diff --git a/libs/audio/renderer/snd_dma.c b/libs/audio/renderer/snd_dma.c index c66633c1d..36a0423b9 100644 --- a/libs/audio/renderer/snd_dma.c +++ b/libs/audio/renderer/snd_dma.c @@ -978,7 +978,7 @@ SND_UnblockSound (void) } plugin_t * -PluginInfo (void) { +snd_render_default_PluginInfo (void) { plugin_info.type = qfp_snd_render; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/renderer/snd_null.c b/libs/audio/renderer/snd_null.c index d3eed3799..7e3f5be32 100644 --- a/libs/audio/renderer/snd_null.c +++ b/libs/audio/renderer/snd_null.c @@ -172,7 +172,7 @@ SND_UnblockSound (void) } plugin_t * -PluginInfo (void) +snd_render_null_PluginInfo (void) { plugin_info.type = qfp_sound; plugin_info.api_version = QFPLUGIN_VERSION; diff --git a/libs/audio/targets/snd_alsa_0_5.c b/libs/audio/targets/snd_alsa_0_5.c index d8dd2f37e..9f6caeb0f 100644 --- a/libs/audio/targets/snd_alsa_0_5.c +++ b/libs/audio/targets/snd_alsa_0_5.c @@ -90,7 +90,7 @@ general_funcs_t plugin_info_general_funcs; snd_output_data_t plugin_info_snd_output_data; snd_output_funcs_t plugin_info_snd_output_funcs; -void +static void SNDDMA_Init_Cvars (void) { snd_stereo = Cvar_Get ("snd_stereo", "1", CVAR_ROM, NULL, @@ -103,7 +103,7 @@ SNDDMA_Init_Cvars (void) "sound sample depth. 0 is system default"); } -int +static int check_card (int card) { snd_ctl_t *handle; @@ -141,7 +141,7 @@ check_card (int card) return 1; } -qboolean +static qboolean SNDDMA_Init (void) { int rc = 0, i; @@ -323,7 +323,7 @@ SNDDMA_Init (void) return 0; } -int +static int SNDDMA_GetDMAPos (void) { if (!snd_inited) @@ -334,7 +334,7 @@ SNDDMA_GetDMAPos (void) return shm->samplepos; } -void +static void SNDDMA_Shutdown (void) { if (snd_inited) { @@ -348,7 +348,7 @@ SNDDMA_Shutdown (void) Send sound to device if buffer isn't really the dma buffer */ -void +static void SNDDMA_Submit (void) { int count = *plugin_info_snd_output_data.paintedtime @@ -387,14 +387,14 @@ SNDDMA_Submit (void) } } -void +static void SNDDMA_BlockSound (void) { if (++snd_blocked == 1) snd_pcm_playback_pause (pcm_handle, 1); } -void +static void SNDDMA_UnblockSound (void) { if (!snd_blocked) @@ -404,7 +404,7 @@ SNDDMA_UnblockSound (void) } plugin_t * -PluginInfo (void) { +snd_output_alsa0_5_PluginInfo (void) { plugin_info.type = qfp_snd_output; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/targets/snd_alsa_0_9.c b/libs/audio/targets/snd_alsa_0_9.c index a9cccbc0a..557e31e64 100644 --- a/libs/audio/targets/snd_alsa_0_9.c +++ b/libs/audio/targets/snd_alsa_0_9.c @@ -44,26 +44,27 @@ static int snd_inited; static snd_pcm_t *pcm; static const char *pcmname = NULL; -size_t buffer_size; -int snd_blocked = 0; -volatile dma_t sn; +static size_t buffer_size; +static int snd_blocked = 0; +static volatile dma_t sn; -cvar_t *snd_stereo; -cvar_t *snd_rate; -cvar_t *snd_device; -cvar_t *snd_bits; +static cvar_t *snd_stereo; +static cvar_t *snd_rate; +static cvar_t *snd_device; +static cvar_t *snd_bits; -plugin_t plugin_info; -plugin_data_t plugin_info_data; -plugin_funcs_t plugin_info_funcs; -general_data_t plugin_info_general_data; -general_funcs_t plugin_info_general_funcs; -snd_output_data_t plugin_info_snd_output_data; -snd_output_funcs_t plugin_info_snd_output_funcs; +static plugin_t plugin_info; +static plugin_data_t plugin_info_data; +static plugin_funcs_t plugin_info_funcs; +static general_data_t plugin_info_general_data; +static general_funcs_t plugin_info_general_funcs; +static snd_output_data_t plugin_info_snd_output_data; +static snd_output_funcs_t plugin_info_snd_output_funcs; void -SNDDMA_Init_Cvars (void) +static SNDDMA_Init_Cvars (void) { + puts("boo bee boo"); snd_stereo = Cvar_Get ("snd_stereo", "1", CVAR_ROM, NULL, "sound stereo output"); snd_rate = Cvar_Get ("snd_rate", "0", CVAR_ROM, NULL, @@ -74,9 +75,9 @@ SNDDMA_Init_Cvars (void) "sound sample depth. 0 is system default"); } -int SNDDMA_GetDMAPos (void); +static int SNDDMA_GetDMAPos (void); -qboolean +static qboolean SNDDMA_Init (void) { int err; @@ -247,7 +248,7 @@ error: return 0; } -int +static int SNDDMA_GetDMAPos (void) { snd_pcm_uframes_t offset; @@ -265,7 +266,7 @@ SNDDMA_GetDMAPos (void) return shm->samplepos; } -void +static void SNDDMA_Shutdown (void) { if (snd_inited) { @@ -279,7 +280,7 @@ SNDDMA_Shutdown (void) Send sound to device if buffer isn't really the dma buffer */ -void +static void SNDDMA_Submit (void) { snd_pcm_uframes_t offset; @@ -311,14 +312,14 @@ SNDDMA_Submit (void) } } -void +static void SNDDMA_BlockSound (void) { if (++snd_blocked == 1) snd_pcm_pause (pcm, 1); } -void +static void SNDDMA_UnblockSound (void) { if (!snd_blocked) @@ -328,7 +329,7 @@ SNDDMA_UnblockSound (void) } plugin_t * -PluginInfo (void) +snd_output_alsa0_9_PluginInfo (void) { plugin_info.type = qfp_snd_output; plugin_info.api_version = QFPLUGIN_VERSION; diff --git a/libs/audio/targets/snd_disk.c b/libs/audio/targets/snd_disk.c index 96115169e..c21aec8a3 100644 --- a/libs/audio/targets/snd_disk.c +++ b/libs/audio/targets/snd_disk.c @@ -52,20 +52,20 @@ #include "QF/plugin.h" static int snd_inited; -VFile *snd_file; -int snd_blocked = 0; -volatile dma_t sn; +static VFile *snd_file; +static int snd_blocked = 0; +//FIXME static volatile dma_t sn; -plugin_t plugin_info; -plugin_data_t plugin_info_data; -plugin_funcs_t plugin_info_funcs; -general_data_t plugin_info_general_data; -general_funcs_t plugin_info_general_funcs; -snd_output_data_t plugin_info_snd_output_data; -snd_output_funcs_t plugin_info_snd_output_funcs; +static plugin_t plugin_info; +static plugin_data_t plugin_info_data; +static plugin_funcs_t plugin_info_funcs; +static general_data_t plugin_info_general_data; +static general_funcs_t plugin_info_general_funcs; +static snd_output_data_t plugin_info_snd_output_data; +static snd_output_funcs_t plugin_info_snd_output_funcs; - -qboolean +/* FIXME +static qboolean SNDDMA_Init (void) { shm = &sn; @@ -94,15 +94,16 @@ SNDDMA_Init (void) snd_inited = 1; return 1; } +*/ -int +static int SNDDMA_GetDMAPos (void) { shm->samplepos = 0; return shm->samplepos; } -void +static void SNDDMA_Shutdown (void) { if (snd_inited) { @@ -118,7 +119,7 @@ SNDDMA_Shutdown (void) Send sound to device if buffer isn't really the dma buffer */ -void +static void SNDDMA_Submit (void) { int count = (*plugin_info_snd_output_data.paintedtime @@ -130,13 +131,13 @@ SNDDMA_Submit (void) Qwrite (snd_file, shm->buffer, count); } -void +static void SNDDMA_BlockSound (void) { ++snd_blocked; } -void +static void SNDDMA_UnblockSound (void) { if (!snd_blocked) @@ -145,7 +146,7 @@ SNDDMA_UnblockSound (void) } plugin_t * -PluginInfo (void) { +snd_output_disk_PluginInfo (void) { plugin_info.type = qfp_snd_output; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/targets/snd_mme.c b/libs/audio/targets/snd_mme.c index f369f75b9..84c728f15 100644 --- a/libs/audio/targets/snd_mme.c +++ b/libs/audio/targets/snd_mme.c @@ -51,13 +51,13 @@ static qboolean snd_firsttime = true, snd_iswave; static int sample16; static int snd_sent, snd_completed; -int snd_blocked = 0; +static int snd_blocked = 0; static HPSTR lpData; static LPWAVEHDR lpWaveHdr; static HWAVEOUT hWaveOut; static DWORD gSndBufSize; -volatile dma_t sn; +static volatile dma_t sn; /* MME Callback function @@ -76,7 +76,7 @@ mme_callback ( HANDLE h, UINT wMsg, DWORD instance, LPARAM p1, LPARAM p2 ) S_BlockSound ================== */ -void +static void S_BlockSound ( void ) { if (++snd_blocked == 1) @@ -89,7 +89,7 @@ S_BlockSound ( void ) S_UnblockSound ================== */ -void +static void S_UnblockSound ( void ) { if (!snd_blocked) @@ -103,7 +103,7 @@ S_UnblockSound ( void ) FreeSound ================== */ -void +static void FreeSound ( void ) { // only release primary buffer if it's not also the mixing buffer we just released @@ -136,7 +136,7 @@ SNDDM_InitWav Crappy windows multimedia base ================== */ -qboolean +static qboolean SNDDMA_InitWav ( void ) { LPPCMWAVEFORMAT format; @@ -243,7 +243,7 @@ Returns false if nothing is found. ================== */ -qboolean +static qboolean SNDDMA_Init ( void ) { wav_init = 0; @@ -281,7 +281,7 @@ inside the recirculating dma buffer, so the mixing code will know how many sample are required to fill it up. =============== */ -int +static int SNDDMA_GetDMAPos ( void ) { int s = 0; @@ -304,7 +304,7 @@ SNDDMA_Submit Send sound to device if buffer isn't really the dma buffer =============== */ -void +static void SNDDMA_Submit ( void ) { LPWAVEHDR h; @@ -354,7 +354,7 @@ SNDDMA_Shutdown Reset the sound device for exiting =============== */ -void +static void SNDDMA_Shutdown ( void ) { FreeSound (); diff --git a/libs/audio/targets/snd_null.c b/libs/audio/targets/snd_null.c index df55f1ed7..9772da2ff 100644 --- a/libs/audio/targets/snd_null.c +++ b/libs/audio/targets/snd_null.c @@ -38,35 +38,29 @@ // FIXME - should be put in one place // ======================================================================= -extern channel_t channels[MAX_CHANNELS]; -extern int total_channels; -extern volatile dma_t *shm; -extern cvar_t *snd_loadas8bit; -extern int paintedtime; // sample PAIRS -extern qboolean snd_initialized; +static cvar_t *bgmvolume; +static cvar_t *volume; +static cvar_t *snd_loadas8bit; +static cvar_t *snd_interp; -extern cvar_t *bgmvolume; -extern cvar_t *volume; -extern cvar_t *snd_interp; +static plugin_t plugin_info; +static plugin_data_t plugin_info_data; +static plugin_funcs_t plugin_info_funcs; +static general_data_t plugin_info_general_data; +static general_funcs_t plugin_info_general_funcs; +static sound_data_t plugin_info_sound_data; +static sound_funcs_t plugin_info_sound_funcs; -plugin_t plugin_info; -plugin_data_t plugin_info_data; -plugin_funcs_t plugin_info_funcs; -general_data_t plugin_info_general_data; -general_funcs_t plugin_info_general_funcs; -sound_data_t plugin_info_sound_data; -sound_funcs_t plugin_info_sound_funcs; - -void SND_Init_Cvars (void); +static void SND_Init_Cvars (void); -void +static void SND_Init (void) { SND_Init_Cvars (); } -void +static void SND_Init_Cvars (void) { bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, NULL, @@ -79,100 +73,100 @@ SND_Init_Cvars (void) "control sample interpolation"); } -void +static void SND_AmbientOff (void) { } -void +static void SND_AmbientOn (void) { } -void +static void SND_Shutdown (void) { } -void +static void SND_TouchSound (const char *sample) { } -void +static void SND_ClearBuffer (void) { } -void +static void SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) { } -void +static void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation) { } -void +static void SND_StopSound (int entnum, int entchannel) { } -sfx_t * +static sfx_t * SND_PrecacheSound (const char *sample) { return NULL; } -void +static void SND_ClearPrecache (void) { } -void +static void SND_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up) { } -void +static void SND_StopAllSounds (qboolean clear) { } -void +static void SND_BeginPrecaching (void) { } -void +static void SND_EndPrecaching (void) { } -void +static void SND_ExtraUpdate (void) { } -void +static void SND_LocalSound (const char *s) { } -void +static void SND_BlockSound (void) { } -void +static void SND_UnblockSound (void) { } plugin_t * -PluginInfo (void) { +snd_output_null_PluginInfo (void) { plugin_info.type = qfp_sound; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/targets/snd_oss.c b/libs/audio/targets/snd_oss.c index f8e51d95c..f75d2086f 100644 --- a/libs/audio/targets/snd_oss.c +++ b/libs/audio/targets/snd_oss.c @@ -67,24 +67,24 @@ static int audio_fd; static int snd_inited; static int mmaped_io = 0; static const char *snd_dev = "/dev/dsp"; -volatile dma_t sn; -cvar_t *snd_stereo; -cvar_t *snd_rate; -cvar_t *snd_device; -cvar_t *snd_bits; -cvar_t *snd_oss_mmaped; +static volatile dma_t sn; +static cvar_t *snd_stereo; +static cvar_t *snd_rate; +static cvar_t *snd_device; +static cvar_t *snd_bits; +static cvar_t *snd_oss_mmaped; static int tryrates[] = { 11025, 22050, 22051, 44100, 8000 }; -plugin_t plugin_info; -plugin_data_t plugin_info_data; -plugin_funcs_t plugin_info_funcs; -general_data_t plugin_info_general_data; -general_funcs_t plugin_info_general_funcs; -snd_output_data_t plugin_info_snd_output_data; -snd_output_funcs_t plugin_info_snd_output_funcs; +static plugin_t plugin_info; +static plugin_data_t plugin_info_data; +static plugin_funcs_t plugin_info_funcs; +static general_data_t plugin_info_general_data; +static general_funcs_t plugin_info_general_funcs; +static snd_output_data_t plugin_info_snd_output_data; +static snd_output_funcs_t plugin_info_snd_output_funcs; -void +static void SNDDMA_Init_Cvars (void) { snd_stereo = Cvar_Get ("snd_stereo", "1", CVAR_ROM, NULL, @@ -99,7 +99,7 @@ SNDDMA_Init_Cvars (void) "mmaped io"); } -qboolean +static qboolean SNDDMA_Init (void) { int rc; @@ -292,7 +292,7 @@ SNDDMA_Init (void) } -int +static int SNDDMA_GetDMAPos (void) { @@ -316,7 +316,7 @@ SNDDMA_GetDMAPos (void) } -void +static void SNDDMA_Shutdown (void) { if (snd_inited) { @@ -332,7 +332,7 @@ SNDDMA_Shutdown (void) */ #define BITSIZE (shm->samplebits / 8) #define BYTES (samples / BITSIZE) -void +static void SNDDMA_Submit (void) { int samples; @@ -350,18 +350,18 @@ SNDDMA_Submit (void) } } -void +static void SNDDMA_BlockSound (void) { } -void +static void SNDDMA_UnblockSound (void) { } plugin_t * -PluginInfo (void) { +snd_output_oss_PluginInfo (void) { plugin_info.type = qfp_snd_output; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/targets/snd_sdl.c b/libs/audio/targets/snd_sdl.c index 7c8a8ae82..8700d37d9 100644 --- a/libs/audio/targets/snd_sdl.c +++ b/libs/audio/targets/snd_sdl.c @@ -50,18 +50,18 @@ static dma_t the_shm; static int snd_inited; -int snd_blocked = 0; +static int snd_blocked = 0; -int desired_speed = 11025; -int desired_bits = 16; +static int desired_speed = 11025; +static int desired_bits = 16; -plugin_t plugin_info; -plugin_data_t plugin_info_data; -plugin_funcs_t plugin_info_funcs; -general_data_t plugin_info_general_data; -general_funcs_t plugin_info_general_funcs; -snd_output_data_t plugin_info_snd_output_data; -snd_output_funcs_t plugin_info_snd_output_funcs; +static plugin_t plugin_info; +static plugin_data_t plugin_info_data; +static plugin_funcs_t plugin_info_funcs; +static general_data_t plugin_info_general_data; +static general_funcs_t plugin_info_general_funcs; +static snd_output_data_t plugin_info_snd_output_data; +static snd_output_funcs_t plugin_info_snd_output_funcs; static void @@ -93,12 +93,12 @@ paint_audio (void *unused, Uint8 * stream, int len) } } -void +static void SNDDMA_Init_Cvars (void) { } -qboolean +static qboolean SNDDMA_Init (void) { SDL_AudioSpec desired, obtained; @@ -183,13 +183,13 @@ SNDDMA_Init (void) return 1; } -int +static int SNDDMA_GetDMAPos (void) { return shm->samplepos; } -void +static void SNDDMA_Shutdown (void) { if (snd_inited) { @@ -206,7 +206,7 @@ SNDDMA_Shutdown (void) Send sound to device if buffer isn't really the dma buffer */ -void +static void SNDDMA_Submit (void) { if (snd_blocked) @@ -216,13 +216,13 @@ SNDDMA_Submit (void) SDL_LockAudio(); } -void +static void SNDDMA_BlockSound (void) { ++snd_blocked; } -void +static void SNDDMA_UnblockSound (void) { if (!snd_blocked) @@ -231,7 +231,7 @@ SNDDMA_UnblockSound (void) } plugin_t * -PluginInfo (void) { +snd_output_sdl_PluginInfo (void) { plugin_info.type = qfp_snd_output; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/targets/snd_sgi.c b/libs/audio/targets/snd_sgi.c index d089c1c64..ea99ac4c7 100644 --- a/libs/audio/targets/snd_sgi.c +++ b/libs/audio/targets/snd_sgi.c @@ -49,18 +49,18 @@ static unsigned char *dma_buffer, *write_buffer; static int bufsize; static int wbufp; static int framecount; -volatile dma_t sn; +static volatile dma_t sn; -plugin_t plugin_info; -plugin_data_t plugin_info_data; -plugin_funcs_t plugin_info_funcs; -general_data_t plugin_info_general_data; -general_funcs_t plugin_info_general_funcs; -sound_data_t plugin_info_sound_data; -sound_funcs_t plugin_info_sound_funcs; +static plugin_t plugin_info; +static plugin_data_t plugin_info_data; +static plugin_funcs_t plugin_info_funcs; +static general_data_t plugin_info_general_data; +static general_funcs_t plugin_info_general_funcs; +static sound_data_t plugin_info_sound_data; +static sound_funcs_t plugin_info_sound_funcs; -qboolean +static qboolean SNDDMA_Init (void) { ALpv alpv; @@ -256,7 +256,7 @@ SNDDMA_Init (void) } -int +static int SNDDMA_GetDMAPos (void) { /* Con_Printf("framecount: %d %d\n", (framecount * shm->channels) % @@ -267,7 +267,7 @@ SNDDMA_GetDMAPos (void) } -void +static void SNDDMA_Shutdown (void) { if (snd_inited) { @@ -285,7 +285,7 @@ SNDDMA_Shutdown (void) Send sound to device if buffer isn't really the dma buffer */ -void +static void SNDDMA_Submit (void) { int bsize; @@ -327,7 +327,7 @@ SNDDMA_Submit (void) plugin_t * -PluginInfo (void) { +snd_output_sgi_PluginInfo (void) { plugin_info.type = qfp_sound; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; @@ -369,12 +369,12 @@ PluginInfo (void) { return &plugin_info; } -void +static void SNDDMA_BlockSound (void) { } -void +static void SNDDMA_UnblockSound (void) { } diff --git a/libs/audio/targets/snd_sun.c b/libs/audio/targets/snd_sun.c index c602de72c..ac33632a2 100644 --- a/libs/audio/targets/snd_sun.c +++ b/libs/audio/targets/snd_sun.c @@ -52,29 +52,29 @@ #include "QF/sound.h" #include "QF/plugin.h" -int audio_fd; -int snd_inited; -int snd_blocked = 0; +static int audio_fd; +static int snd_inited; +static int snd_blocked = 0; static int wbufp; static audio_info_t info; #define BUFFER_SIZE 8192 -unsigned char dma_buffer[BUFFER_SIZE]; -unsigned char pend_buffer[BUFFER_SIZE]; -int pending; -volatile dma_t sn; +static unsigned char dma_buffer[BUFFER_SIZE]; +static unsigned char pend_buffer[BUFFER_SIZE]; +static int pending; +static volatile dma_t sn; -plugin_t plugin_info; -plugin_data_t plugin_info_data; -plugin_funcs_t plugin_info_funcs; -general_data_t plugin_info_general_data; -general_funcs_t plugin_info_general_funcs; -sound_data_t plugin_info_sound_data; -sound_funcs_t plugin_info_sound_funcs; +static plugin_t plugin_info; +static plugin_data_t plugin_info_data; +static plugin_funcs_t plugin_info_funcs; +static general_data_t plugin_info_general_data; +static general_funcs_t plugin_info_general_funcs; +static sound_data_t plugin_info_sound_data; +static sound_funcs_t plugin_info_sound_funcs; -qboolean +static qboolean SNDDMA_Init (void) { if (snd_inited) { @@ -151,7 +151,7 @@ SNDDMA_Init (void) return 1; } -int +static int SNDDMA_GetDMAPos (void) { if (!snd_inited) @@ -168,7 +168,7 @@ SNDDMA_GetDMAPos (void) return ((info.play.samples * shm->channels) % shm->samples); } -int +static int SNDDMA_GetSamples (void) { if (!snd_inited) @@ -185,7 +185,7 @@ SNDDMA_GetSamples (void) return info.play.samples; } -void +static void SNDDMA_Shutdown (void) { if (snd_inited) { @@ -199,7 +199,7 @@ SNDDMA_Shutdown (void) Send sound to device if buffer isn't really the dma buffer */ -void +static void SNDDMA_Submit (void) { int bsize; @@ -241,13 +241,13 @@ SNDDMA_Submit (void) } -void +static void SNDDMA_BlockSound (void) { ++snd_blocked; } -void +static void SNDDMA_UnblockSound (void) { if (!snd_blocked) @@ -256,7 +256,7 @@ SNDDMA_UnblockSound (void) } plugin_t * -PluginInfo (void) { +snd_output_sun_PluginInfo (void) { plugin_info.type = qfp_sound; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/targets/snd_win.c b/libs/audio/targets/snd_win.c index e451941e7..2806a60a6 100644 --- a/libs/audio/targets/snd_win.c +++ b/libs/audio/targets/snd_win.c @@ -59,41 +59,41 @@ static qboolean primary_format_set; static int sample16; static int snd_sent, snd_completed; -int snd_blocked = 0; -volatile dma_t sn; +static int snd_blocked = 0; +static volatile dma_t sn; /* * Global variables. Must be visible to window-procedure function * so it can unlock and free the data block after it has been played. */ -HANDLE hData; -HPSTR lpData, lpData2; +static HANDLE hData; +static HPSTR lpData, lpData2; -HGLOBAL hWaveHdr; -LPWAVEHDR lpWaveHdr; +static HGLOBAL hWaveHdr; +static LPWAVEHDR lpWaveHdr; -HWAVEOUT hWaveOut; +static HWAVEOUT hWaveOut; -WAVEOUTCAPS wavecaps; +static WAVEOUTCAPS wavecaps; -DWORD gSndBufSize; +static DWORD gSndBufSize; -MMTIME mmstarttime; +static MMTIME mmstarttime; -LPDIRECTSOUND pDS; -LPDIRECTSOUNDBUFFER pDSBuf, pDSPBuf; +static LPDIRECTSOUND pDS; +static LPDIRECTSOUNDBUFFER pDSBuf, pDSPBuf; -HINSTANCE hInstDS; +static HINSTANCE hInstDS; -sndinitstat SNDDMA_InitDirect (void); -qboolean SNDDMA_InitWav (void); +static sndinitstat SNDDMA_InitDirect (void); +static qboolean SNDDMA_InitWav (void); /* S_BlockSound */ -void +static void S_BlockSound (void) { // DirectSound takes care of blocking itself @@ -106,7 +106,7 @@ S_BlockSound (void) /* S_UnblockSound */ -void +static void S_UnblockSound (void) { // DirectSound takes care of blocking itself @@ -119,7 +119,7 @@ S_UnblockSound (void) /* FreeSound */ -void +static void FreeSound (void) { int i; @@ -179,7 +179,7 @@ FreeSound (void) Direct-Sound support */ -sndinitstat SNDDMA_InitDirect (void) +static sndinitstat SNDDMA_InitDirect (void) { DSBUFFERDESC dsbuf; DSBCAPS dsbcaps; @@ -375,7 +375,7 @@ sndinitstat SNDDMA_InitDirect (void) Crappy windows multimedia base */ -qboolean +static qboolean SNDDMA_InitWav (void) { WAVEFORMATEX format; @@ -490,7 +490,7 @@ SNDDMA_InitWav (void) Returns false if nothing is found. */ -qboolean +static qboolean SNDDMA_Init (void) { sndinitstat stat; @@ -556,7 +556,7 @@ SNDDMA_Init (void) inside the recirculating dma buffer, so the mixing code will know how many sample are required to fill it up. */ -int +static int SNDDMA_GetDMAPos (void) { MMTIME mmtime; @@ -585,7 +585,7 @@ SNDDMA_GetDMAPos (void) Send sound to device if buffer isn't really the dma buffer */ -void +static void SNDDMA_Submit (void) { LPWAVEHDR h; @@ -637,13 +637,13 @@ SNDDMA_Submit (void) Reset the sound device for exiting */ -void +static void SNDDMA_Shutdown (void) { FreeSound (); } -DWORD * +static DWORD * DSOUND_LockBuffer (qboolean lockit) { int reps; @@ -689,7 +689,7 @@ DSOUND_LockBuffer (qboolean lockit) return (pbuf1); } -void +static void DSOUND_ClearBuffer (int clear) { DWORD *pData; @@ -700,7 +700,7 @@ DSOUND_ClearBuffer (int clear) DSOUND_LockBuffer (false); } -void +static void DSOUND_Restore (void) { // if the buffer was lost or stopped, restore it and/or restart it diff --git a/libs/console/client.c b/libs/console/client.c index a71dce74b..591b023e6 100644 --- a/libs/console/client.c +++ b/libs/console/client.c @@ -640,7 +640,7 @@ static plugin_t plugin_info = { }; plugin_t * -PluginInfo (void) +console_client_PluginInfo (void) { return &plugin_info; } diff --git a/libs/console/server.c b/libs/console/server.c index 8767d6624..930de4719 100644 --- a/libs/console/server.c +++ b/libs/console/server.c @@ -219,7 +219,7 @@ static plugin_t plugin_info = { }; plugin_t * -PluginInfo (void) +console_server_PluginInfo (void) { return &plugin_info; } diff --git a/libs/util/plugin.c b/libs/util/plugin.c index 6482e6099..75e37b0d4 100644 --- a/libs/util/plugin.c +++ b/libs/util/plugin.c @@ -90,6 +90,7 @@ plugin_t * PI_LoadPlugin (const char *type, const char *name) { char realname[4096]; + char plugin_info_name[1024]; char *tmpname; void *dlhand = NULL; plugin_t *plugin = NULL; @@ -100,6 +101,9 @@ PI_LoadPlugin (const char *type, const char *name) tmpname = strrchr (name, '/'); // Get the base name, don't allow paths + // Build the plugin info name + snprintf (plugin_info_name, sizeof (plugin_info_name), "%s_%s_PluginInfo", + type, name); // Build the path to the file to load #if defined(HAVE_DLOPEN) snprintf (realname, sizeof (realname), "%s/lib%s_%s.so", @@ -113,7 +117,8 @@ PI_LoadPlugin (const char *type, const char *name) #endif #if defined(HAVE_DLOPEN) - if (!(dlhand = dlopen (realname, RTLD_LAZY))) { // lib not found + if (!(dlhand = dlopen (realname, RTLD_GLOBAL | RTLD_NOW))) { + // lib not found Con_Printf ("Could not load plugin \"%s\": %s\n", realname, dlerror ()); return NULL; @@ -126,7 +131,7 @@ PI_LoadPlugin (const char *type, const char *name) #endif #if defined(HAVE_DLOPEN) - if (!(plugin_info = dlsym (dlhand, "PluginInfo"))) { + if (!(plugin_info = dlsym (dlhand, plugin_info_name))) { // info function not found dlclose (dlhand); Con_Printf ("Plugin info function not found\n"); @@ -134,7 +139,7 @@ PI_LoadPlugin (const char *type, const char *name) } #elif defined (_WIN32) if (!(plugin_info = (P_PluginInfo) GetProcAddress (dlhand, - "PluginInfo"))) { + plugin_info_name))) { // info function not found FreeLibrary (dlhand); Con_Printf ("Plugin info function not found\n");