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
This commit is contained in:
Spoike 2012-10-24 01:32:10 +00:00
parent 0fda04dc46
commit b184da13a4
2 changed files with 33 additions and 20 deletions

View file

@ -13,17 +13,8 @@
#endif #endif
#if defined(__MORPHOS__) #ifdef LIBVORBISFILE_STATIC
#define p_ov_open_callbacks ov_open_callbacks
#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_clear ov_clear
#define p_ov_info ov_info #define p_ov_info ov_info
#define p_ov_comment ov_comment #define p_ov_comment ov_comment
@ -31,14 +22,33 @@
#define p_ov_read ov_read #define p_ov_read ov_read
#define p_ov_pcm_seek ov_pcm_seek #define p_ov_pcm_seek ov_pcm_seek
#else #else
int (VARGS *p_ov_open_callbacks) (void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks); #if defined(__MORPHOS__)
int (VARGS *p_ov_clear)(OggVorbis_File *vf);
vorbis_info *(VARGS *p_ov_info)(OggVorbis_File *vf,int link); #define oggvorbislibrary VorbisFileBase
vorbis_comment *(VARGS *p_ov_comment) (OggVorbis_File *vf,int link); struct Library *VorbisFileBase;
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, #else
int bigendianp,int word,int sgned,int *bitstream); dllhandle_t *oggvorbislibrary;
int (VARGS *p_ov_pcm_seek)(OggVorbis_File *vf,ogg_int64_t pos); #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 #endif
@ -307,6 +317,7 @@ static ov_callbacks callbacks = {
}; };
qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuffer_t *buffer) qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuffer_t *buffer)
{ {
#ifndef LIBVORBISFILE_STATIC
static qboolean tried; static qboolean tried;
#ifndef __MORPHOS__ #ifndef __MORPHOS__
static dllfunction_t funcs[] = static dllfunction_t funcs[] =
@ -321,7 +332,6 @@ qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuf
{NULL} {NULL}
}; };
#endif #endif
static void *libhandle;
if (!oggvorbislibrary && !tried) if (!oggvorbislibrary && !tried)
#if defined(__MORPHOS__) #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"); Con_Printf("ogg vorbis library is not loaded.\n");
return false; return false;
} }
#endif
buffer->start = start; buffer->start = start;
buffer->length = length; buffer->length = length;

View file

@ -105,6 +105,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define DYNAMIC_ZLIB //#define DYNAMIC_ZLIB
//#define DYNAMIC_LIBPNG //#define DYNAMIC_LIBPNG
//#define DYNAMIC_LIBJPEG //#define DYNAMIC_LIBJPEG
//#define LIBVORBISFILE_STATIC
//#define SPEEX_STATIC
#ifdef D3DQUAKE #ifdef D3DQUAKE
#define D3D9QUAKE #define D3D9QUAKE