From b184da13a4b891dabd6f25752fa316498a48ef51 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 24 Oct 2012 01:32:10 +0000 Subject: [PATCH] code to cope with -DLIBVORBISFILE_STATIC for moodles to use his statically linked libogg/libvorbis. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4137 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/snd_ov.c | 51 ++++++++++++++++++++++++---------------- engine/common/bothdefs.h | 2 ++ 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/engine/client/snd_ov.c b/engine/client/snd_ov.c index 310f38047..963ba0add 100644 --- a/engine/client/snd_ov.c +++ b/engine/client/snd_ov.c @@ -13,17 +13,8 @@ #endif -#if defined(__MORPHOS__) - - #define oggvorbislibrary VorbisFileBase - struct Library *VorbisFileBase; - -#else - dllhandle_t *oggvorbislibrary; -#endif - -#ifdef __MORPHOS__ - #define p_ov_open_callbacks(a, b, c, d, e) ov_open_callbacks(a, b, c, d, &e) +#ifdef LIBVORBISFILE_STATIC + #define p_ov_open_callbacks ov_open_callbacks #define p_ov_clear ov_clear #define p_ov_info ov_info #define p_ov_comment ov_comment @@ -31,14 +22,33 @@ #define p_ov_read ov_read #define p_ov_pcm_seek ov_pcm_seek #else - int (VARGS *p_ov_open_callbacks) (void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks); - int (VARGS *p_ov_clear)(OggVorbis_File *vf); - vorbis_info *(VARGS *p_ov_info)(OggVorbis_File *vf,int link); - vorbis_comment *(VARGS *p_ov_comment) (OggVorbis_File *vf,int link); - ogg_int64_t (VARGS *p_ov_pcm_total)(OggVorbis_File *vf,int i); - long (VARGS *p_ov_read)(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream); - int (VARGS *p_ov_pcm_seek)(OggVorbis_File *vf,ogg_int64_t pos); + #if defined(__MORPHOS__) + + #define oggvorbislibrary VorbisFileBase + struct Library *VorbisFileBase; + + #else + dllhandle_t *oggvorbislibrary; + #endif + + #ifdef __MORPHOS__ + #define p_ov_open_callbacks(a, b, c, d, e) ov_open_callbacks(a, b, c, d, &e) + #define p_ov_clear ov_clear + #define p_ov_info ov_info + #define p_ov_comment ov_comment + #define p_ov_pcm_total ov_pcm_total + #define p_ov_read ov_read + #define p_ov_pcm_seek ov_pcm_seek + #else + int (VARGS *p_ov_open_callbacks) (void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks); + int (VARGS *p_ov_clear)(OggVorbis_File *vf); + vorbis_info *(VARGS *p_ov_info)(OggVorbis_File *vf,int link); + vorbis_comment *(VARGS *p_ov_comment) (OggVorbis_File *vf,int link); + ogg_int64_t (VARGS *p_ov_pcm_total)(OggVorbis_File *vf,int i); + long (VARGS *p_ov_read)(OggVorbis_File *vf,char *buffer,int length, + int bigendianp,int word,int sgned,int *bitstream); + int (VARGS *p_ov_pcm_seek)(OggVorbis_File *vf,ogg_int64_t pos); + #endif #endif @@ -307,6 +317,7 @@ static ov_callbacks callbacks = { }; qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuffer_t *buffer) { +#ifndef LIBVORBISFILE_STATIC static qboolean tried; #ifndef __MORPHOS__ static dllfunction_t funcs[] = @@ -321,7 +332,6 @@ qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuf {NULL} }; #endif - static void *libhandle; if (!oggvorbislibrary && !tried) #if defined(__MORPHOS__) @@ -355,6 +365,7 @@ qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuf Con_Printf("ogg vorbis library is not loaded.\n"); return false; } +#endif buffer->start = start; buffer->length = length; diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index b946733a5..cf87ea075 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -105,6 +105,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //#define DYNAMIC_ZLIB //#define DYNAMIC_LIBPNG //#define DYNAMIC_LIBJPEG +//#define LIBVORBISFILE_STATIC +//#define SPEEX_STATIC #ifdef D3DQUAKE #define D3D9QUAKE