1
0
Fork 0
forked from fte/fteqw

OggVorbis support now turned on (AVAIL_OGGVORBIS)

Ogg/Vorbis: Will now look for 'libvorbisfile-3.dll' as well as 'vorbisfile.dll' in Windows.
MinGW builds now have OggVorbis statically linked. (LIBVORBISFILE_STATIC)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4138 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Lance 2012-10-24 02:59:31 +00:00
parent b184da13a4
commit c16517fbcb
8 changed files with 245 additions and 119 deletions

View file

@ -312,6 +312,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -v win),)
endif endif
IMAGELDFLAGS=$(MINGW_LIBS_DIR)/libpng.a $(MINGW_LIBS_DIR)/libz.a $(MINGW_LIBS_DIR)/libjpeg.a IMAGELDFLAGS=$(MINGW_LIBS_DIR)/libpng.a $(MINGW_LIBS_DIR)/libz.a $(MINGW_LIBS_DIR)/libjpeg.a
SOUNDLDFLAGS=$(MINGW_LIBS_DIR)/libvorbisfile.a $(MINGW_LIBS_DIR)/libvorbis.a $(MINGW_LIBS_DIR)/libogg.a
ifeq ($(shell echo $(FTE_TARGET)|grep -v -i _SDL),) ifeq ($(shell echo $(FTE_TARGET)|grep -v -i _SDL),)
RELEASE_CFLAGS+= -D_SDL RELEASE_CFLAGS+= -D_SDL
@ -320,6 +321,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -v win),)
endif endif
IMAGELDFLAGS ?= -lpng -ljpeg IMAGELDFLAGS ?= -lpng -ljpeg
SOUNDLDFLAGS ?= -lvorbisfile -lvorbis -logg
#BASELDFLAGS=-lm -lz #BASELDFLAGS=-lm -lz
GLXLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext $(IMAGELDFLAGS) GLXLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext $(IMAGELDFLAGS)
@ -630,7 +632,7 @@ GLCL_EXE_NAME=../fteqwcl_sdl.gl$(BITS)
ifdef windir ifdef windir
GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `sdl-config --libs` GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `sdl-config --libs`
else else
GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) `sdl-config --libs` GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(SOUNDLDFLAGS) `sdl-config --libs`
endif endif
GL_CFLAGS=$(GLCFLAGS) `sdl-config --cflags` GL_CFLAGS=$(GLCFLAGS) `sdl-config --cflags`
GLB_DIR=gl_sdl$(FTE_TARGET)$(BITS) GLB_DIR=gl_sdl$(FTE_TARGET)$(BITS)
@ -648,13 +650,13 @@ MB_DIR=m_sdl$(FTE_TARGET)$(BITS)
M_EXE_NAME=../fteqw_sdl$(BITS) M_EXE_NAME=../fteqw_sdl$(BITS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o
M_CFLAGS=$(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL M_CFLAGS=$(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(SOUNDLDFLAGS)
ifdef windir ifdef windir
M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 -lSDLmain -lSDL M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 -lSDLmain -lSDL
else else
#pthread is needed because of SDL. #pthread is needed because of SDL.
M_LDFLAGS=$(MLDFLAGS) `sdl-config --libs` $(IMAGELDFLAGS) M_LDFLAGS=$(MLDFLAGS) `sdl-config --libs` $(IMAGELDFLAGS) $(SOUNDLDFLAGS)
endif endif
@ -696,10 +698,10 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win(32|64)_sdl$$"),)
ifdef windir ifdef windir
GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `sdl-config --libs` GL_LDFLAGS=$(GLLDFLAGS) -lmingw32 -lws2_32 `sdl-config --libs`
else else
GL_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `sdl-config --libs` GL_LDFLAGS=$(IMAGELDFLAGS) $(SOUNDLDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 $(GLLDFLAGS) `sdl-config --libs`
endif endif
GL_CFLAGS=-D_SDL -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(GLCFLAGS) `sdl-config --cflags` $(DX7SDK) GL_CFLAGS=-D_SDL -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) -I$(LIBS_DIR) $(GLCFLAGS) -DLIBVORBISFILE_STATIC `sdl-config --cflags` $(DX7SDK)
ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win32.*sdl"),) ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win32.*sdl"),)
GL_CFLAGS+= -D_MINGW_VFPRINTF GL_CFLAGS+= -D_MINGW_VFPRINTF
endif endif
@ -718,26 +720,26 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win(32|64)_sdl$$"),)
MB_DIR=m_mgw_sdl$(BITS) MB_DIR=m_mgw_sdl$(BITS)
M_EXE_NAME=../fteqw_sdl$(BITS).exe M_EXE_NAME=../fteqw_sdl$(BITS).exe
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START) MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
M_CFLAGS=$(D3DCFLAGS) -D_SDL -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL $(DX7SDK) M_CFLAGS=$(D3DCFLAGS) -D_SDL -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(GLCFLAGS) -DLIBVORBISFILE_STATIC `sdl-config --cflags` -D_MERGED_SDL $(DX7SDK)
ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win32.*sdl"),) ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win32.*sdl"),)
M_CFLAGS+= -D_MINGW_VFPRINTF M_CFLAGS+= -D_MINGW_VFPRINTF
endif endif
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(SOUNDLDFLAGS)
ifdef windir ifdef windir
M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 -lSDLmain -lSDL M_LDFLAGS=$(MLDFLAGS) -lmingw32 -lws2_32 -lSDLmain -lSDL
else else
#pthread is needed because of SDL. #pthread is needed because of SDL.
M_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(MINGW_LIBS_DIR)/libSDL.a $(MINGW_LIBS_DIR)/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `sdl-config --libs` $(IMAGELDFLAGS) M_LDFLAGS=$(IMAGELDFLAGS) $(SOUNDLDFLAGS) -lws2_32 -lmingw32 $(MINGW_LIBS_DIR)/libSDL.a $(MINGW_LIBS_DIR)/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `sdl-config --libs` $(IMAGELDFLAGS)
endif endif
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START) D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3d_sdl_qw$(BITS).exe D3D_EXE_NAME=../fted3d_sdl_qw$(BITS).exe
D3DCL_EXE_NAME=../fted3d_sdl_clqw$(BITS).exe D3DCL_EXE_NAME=../fted3d_sdl_clqw$(BITS).exe
D3D_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32 D3D_LDFLAGS=$(IMAGELDFLAGS) $(SOUNDLDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32
D3D_CFLAGS=$(D3DCFLAGS) -D_SDL -DNO_XFLIP -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) `sdl-config --cflags` $(DX7SDK) D3D_CFLAGS=$(D3DCFLAGS) -D_SDL -DNO_XFLIP -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) -DLIBVORBISFILE_STATIC `sdl-config --cflags` $(DX7SDK)
ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win32.*sdl"),) ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win32.*sdl"),)
D3D_CFLAGS+= -D_MINGW_VFPRINTF D3D_CFLAGS+= -D_MINGW_VFPRINTF
endif endif
@ -808,32 +810,32 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -v "win(32|64)$$"),)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START) GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../fteglqw$(BITS).exe GL_EXE_NAME=../fteglqw$(BITS).exe
GLCL_EXE_NAME=../fteglqwcl$(BITS).exe GLCL_EXE_NAME=../fteglqwcl$(BITS).exe
GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(SOUNDLDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
GL_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD GL_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD -DLIBVORBISFILE_STATIC
GLB_DIR=gl_mgw$(BITS) GLB_DIR=gl_mgw$(BITS)
GLCL_DIR=glcl_mgw$(BITS) GLCL_DIR=glcl_mgw$(BITS)
NPFTECL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_npfte.o sys_axfte.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START) NPFTECL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_npfte.o sys_axfte.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START)
NPFTE_DLL_NAME=../npfte$(BITS).dll NPFTE_DLL_NAME=../npfte$(BITS).dll
NPFTECL_DLL_NAME=../npftecl$(BITS).dll NPFTECL_DLL_NAME=../npftecl$(BITS).dll
NPFTE_LDFLAGS=-Wl,--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -loleaut32 -luuid -lstdc++ -shared NPFTE_LDFLAGS=-Wl,--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) $(SOUNDLDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -loleaut32 -luuid -lstdc++ -shared
NPFTE_CFLAGS=$(NPFTECFLAGS) $(GLCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD NPFTE_CFLAGS=$(NPFTECFLAGS) $(GLCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD -DLIBVORBISFILE_STATIC
NPFTEB_DIR=npfte_mgw$(BITS) NPFTEB_DIR=npfte_mgw$(BITS)
NPFTECL_DIR=npqtvcl_mgw$(BITS) NPFTECL_DIR=npqtvcl_mgw$(BITS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START) MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
M_EXE_NAME=../fteqw$(BITS).exe M_EXE_NAME=../fteqw$(BITS).exe
MCL_EXE_NAME=../fteqwcl$(BITS).exe MCL_EXE_NAME=../fteqwcl$(BITS).exe
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(SOUNDLDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) $(DX7SDK) -DMULTITHREAD M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) $(DX7SDK) -DMULTITHREAD -DLIBVORBISFILE_STATIC
MB_DIR=m_mgw$(BITS) MB_DIR=m_mgw$(BITS)
MCL_DIR=mcl_mgw$(BITS) MCL_DIR=mcl_mgw$(BITS)
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(D3DGL_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START) D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(D3DGL_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3dqw$(BITS).exe D3D_EXE_NAME=../fted3dqw$(BITS).exe
D3DCL_EXE_NAME=../fted3dclqw$(BITS).exe D3DCL_EXE_NAME=../fted3dclqw$(BITS).exe
D3D_LDFLAGS=$(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 D3D_LDFLAGS=$(IMAGELDFLAGS) $(SOUNDLDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
D3D_CFLAGS=$(D3DCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD D3D_CFLAGS=$(D3DCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD -DLIBVORBISFILE_STATIC
D3DB_DIR=d3d_mgw$(BITS) D3DB_DIR=d3d_mgw$(BITS)
D3DCL_DIR=d3dcl_mgw$(BITS) D3DCL_DIR=d3dcl_mgw$(BITS)

View file

@ -347,8 +347,16 @@ qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuf
oggvorbislibrary = Sys_LoadLibrary("vorbisfile", funcs); oggvorbislibrary = Sys_LoadLibrary("vorbisfile", funcs);
if (!oggvorbislibrary) if (!oggvorbislibrary)
oggvorbislibrary = Sys_LoadLibrary("libvorbisfile", funcs); oggvorbislibrary = Sys_LoadLibrary("libvorbisfile", funcs);
if (!oggvorbislibrary) if (!oggvorbislibrary)
Con_Printf("Couldn't load DLL: \"vorbisfile.dll\".\n"); {
oggvorbislibrary = Sys_LoadLibrary("libvorbisfile-3", funcs);
if (!oggvorbislibrary)
oggvorbislibrary = Sys_LoadLibrary("libvorbisfile", funcs);
}
if (!oggvorbislibrary)
Con_Printf("Couldn't load DLL: \"vorbisfile.dll\" or \"libvorbisfile-3\".\n");
} }
#else #else
{ {

View file

@ -77,7 +77,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NO_OGG #define NO_OGG
#endif #endif
//#define AVAIL_OGGVORBIS #define AVAIL_OGGVORBIS
#if !defined(__CYGWIN__) && !defined(MINGW) && !defined(MACOSX) #if !defined(__CYGWIN__) && !defined(MINGW) && !defined(MACOSX)
#define AVAIL_PNGLIB #define AVAIL_PNGLIB
#define AVAIL_JPEGLIB #define AVAIL_JPEGLIB
@ -93,6 +93,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AVAIL_PNGLIB #define AVAIL_PNGLIB
#define AVAIL_ZLIB #define AVAIL_ZLIB
#define AVAIL_JPEGLIB #define AVAIL_JPEGLIB
#define AVAIL_OGGVORBIS
#endif #endif
#if !defined(NO_DIRECTX) && !defined(NODIRECTX) #if !defined(NO_DIRECTX) && !defined(NODIRECTX)

Binary file not shown.

View file

@ -5,7 +5,7 @@
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* * * *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the Xiph.Org Foundation http://www.xiph.org/ * * by the Xiph.Org Foundation http://www.xiph.org/ *
* * * *
******************************************************************** ********************************************************************
@ -21,8 +21,14 @@
extern "C" { extern "C" {
#endif #endif
#include <stddef.h>
#include <ogg/os_types.h> #include <ogg/os_types.h>
typedef struct {
void *iov_base;
size_t iov_len;
} ogg_iovec_t;
typedef struct { typedef struct {
long endbyte; long endbyte;
int endbit; int endbit;
@ -72,7 +78,7 @@ typedef struct {
ogg_int64_t packetno; /* sequence number for decode; the framing ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data, knows where there's a hole in the data,
but we need coupling so that the codec but we need coupling so that the codec
(which is in a seperate abstraction (which is in a separate abstraction
layer) also knows about the gap */ layer) also knows about the gap */
ogg_int64_t granulepos; ogg_int64_t granulepos;
@ -92,7 +98,7 @@ typedef struct {
ogg_int64_t packetno; /* sequence number for decode; the framing ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data, knows where there's a hole in the data,
but we need coupling so that the codec but we need coupling so that the codec
(which is in a seperate abstraction (which is in a separate abstraction
layer) also knows about the gap */ layer) also knows about the gap */
} ogg_packet; } ogg_packet;
@ -110,6 +116,7 @@ typedef struct {
/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ /* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
extern void oggpack_writeinit(oggpack_buffer *b); extern void oggpack_writeinit(oggpack_buffer *b);
extern int oggpack_writecheck(oggpack_buffer *b);
extern void oggpack_writetrunc(oggpack_buffer *b,long bits); extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
extern void oggpack_writealign(oggpack_buffer *b); extern void oggpack_writealign(oggpack_buffer *b);
extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
@ -128,6 +135,7 @@ extern long oggpack_bits(oggpack_buffer *b);
extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
extern void oggpackB_writeinit(oggpack_buffer *b); extern void oggpackB_writeinit(oggpack_buffer *b);
extern int oggpackB_writecheck(oggpack_buffer *b);
extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
extern void oggpackB_writealign(oggpack_buffer *b); extern void oggpackB_writealign(oggpack_buffer *b);
extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
@ -148,8 +156,12 @@ extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
/* Ogg BITSTREAM PRIMITIVES: encoding **************************/ /* Ogg BITSTREAM PRIMITIVES: encoding **************************/
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
int count, long e_o_s, ogg_int64_t granulepos);
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/ /* Ogg BITSTREAM PRIMITIVES: decoding **************************/
@ -157,6 +169,7 @@ extern int ogg_sync_init(ogg_sync_state *oy);
extern int ogg_sync_clear(ogg_sync_state *oy); extern int ogg_sync_clear(ogg_sync_state *oy);
extern int ogg_sync_reset(ogg_sync_state *oy); extern int ogg_sync_reset(ogg_sync_state *oy);
extern int ogg_sync_destroy(ogg_sync_state *oy); extern int ogg_sync_destroy(ogg_sync_state *oy);
extern int ogg_sync_check(ogg_sync_state *oy);
extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
@ -173,18 +186,19 @@ extern int ogg_stream_clear(ogg_stream_state *os);
extern int ogg_stream_reset(ogg_stream_state *os); extern int ogg_stream_reset(ogg_stream_state *os);
extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
extern int ogg_stream_destroy(ogg_stream_state *os); extern int ogg_stream_destroy(ogg_stream_state *os);
extern int ogg_stream_check(ogg_stream_state *os);
extern int ogg_stream_eos(ogg_stream_state *os); extern int ogg_stream_eos(ogg_stream_state *os);
extern void ogg_page_checksum_set(ogg_page *og); extern void ogg_page_checksum_set(ogg_page *og);
extern int ogg_page_version(ogg_page *og); extern int ogg_page_version(const ogg_page *og);
extern int ogg_page_continued(ogg_page *og); extern int ogg_page_continued(const ogg_page *og);
extern int ogg_page_bos(ogg_page *og); extern int ogg_page_bos(const ogg_page *og);
extern int ogg_page_eos(ogg_page *og); extern int ogg_page_eos(const ogg_page *og);
extern ogg_int64_t ogg_page_granulepos(ogg_page *og); extern ogg_int64_t ogg_page_granulepos(const ogg_page *og);
extern int ogg_page_serialno(ogg_page *og); extern int ogg_page_serialno(const ogg_page *og);
extern long ogg_page_pageno(ogg_page *og); extern long ogg_page_pageno(const ogg_page *og);
extern int ogg_page_packets(ogg_page *og); extern int ogg_page_packets(const ogg_page *og);
extern void ogg_packet_clear(ogg_packet *op); extern void ogg_packet_clear(ogg_packet *op);
@ -194,9 +208,3 @@ extern void ogg_packet_clear(ogg_packet *op);
#endif #endif
#endif /* _OGG_H */ #endif /* _OGG_H */

View file

@ -24,23 +24,37 @@
#define _ogg_realloc realloc #define _ogg_realloc realloc
#define _ogg_free free #define _ogg_free free
#ifdef _WIN32 #if defined(_WIN32)
# ifndef __GNUC__ # if defined(__CYGWIN__)
# include <stdint.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
typedef uint64_t ogg_uint64_t;
# elif defined(__MINGW32__)
# include <sys/types.h>
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long ogg_int64_t;
typedef unsigned long long ogg_uint64_t;
# elif defined(__MWERKS__)
typedef long long ogg_int64_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
# else
/* MSVC/Borland */ /* MSVC/Borland */
typedef __int64 ogg_int64_t; typedef __int64 ogg_int64_t;
typedef __int32 ogg_int32_t; typedef __int32 ogg_int32_t;
typedef unsigned __int32 ogg_uint32_t; typedef unsigned __int32 ogg_uint32_t;
typedef __int16 ogg_int16_t; typedef __int16 ogg_int16_t;
typedef unsigned __int16 ogg_uint16_t; typedef unsigned __int16 ogg_uint16_t;
# else
/* Cygwin */
#include <_G_config.h>
typedef _G_int64_t ogg_int64_t;
typedef _G_int32_t ogg_int32_t;
typedef _G_uint32_t ogg_uint32_t;
typedef _G_int16_t ogg_int16_t;
typedef _G_uint16_t ogg_uint16_t;
# endif # endif
#elif defined(__MACOS__) #elif defined(__MACOS__)
@ -52,23 +66,33 @@
typedef UInt32 ogg_uint32_t; typedef UInt32 ogg_uint32_t;
typedef SInt64 ogg_int64_t; typedef SInt64 ogg_int64_t;
#elif defined(__MACOSX__) /* MacOS X Framework build */ #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
# include <sys/types.h> # include <inttypes.h>
typedef int16_t ogg_int16_t; typedef int16_t ogg_int16_t;
typedef u_int16_t ogg_uint16_t; typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t; typedef int32_t ogg_int32_t;
typedef u_int32_t ogg_uint32_t; typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t; typedef int64_t ogg_int64_t;
#elif defined(__HAIKU__)
/* Haiku */
# include <sys/types.h>
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long ogg_int64_t;
#elif defined(__BEOS__) #elif defined(__BEOS__)
/* Be */ /* Be */
# include <inttypes.h> # include <inttypes.h>
typedef int16_t ogg_int16_t; typedef int16_t ogg_int16_t;
typedef u_int16_t ogg_uint16_t; typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t; typedef int32_t ogg_int32_t;
typedef u_int32_t ogg_uint32_t; typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t; typedef int64_t ogg_int64_t;
#elif defined (__EMX__) #elif defined (__EMX__)
@ -96,9 +120,26 @@
typedef unsigned ogg_uint32_t; typedef unsigned ogg_uint32_t;
typedef short ogg_int16_t; typedef short ogg_int16_t;
#elif defined(__SYMBIAN32__)
/* Symbian GCC */
typedef signed short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef signed int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long int ogg_int64_t;
#elif defined(__TMS320C6X__)
/* TI C64x compiler */
typedef signed short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef signed int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long int ogg_int64_t;
#else #else
# include <sys/types.h>
# include <ogg/config_types.h> # include <ogg/config_types.h>
#endif #endif

View file

@ -6,7 +6,7 @@
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* * * *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ * * by the Xiph.Org Foundation http://www.xiph.org/ *
******************************************************************** ********************************************************************
@ -121,7 +121,7 @@ typedef struct vorbis_block{
/* vorbis_block is a single block of data to be processed as part of /* vorbis_block is a single block of data to be processed as part of
the analysis/synthesis stream; it belongs to a specific logical the analysis/synthesis stream; it belongs to a specific logical
bitstream, but is independant from other vorbis_blocks belonging to bitstream, but is independent from other vorbis_blocks belonging to
that logical bitstream. *************************************************/ that logical bitstream. *************************************************/
struct alloc_chain{ struct alloc_chain{
@ -166,11 +166,11 @@ extern void vorbis_info_init(vorbis_info *vi);
extern void vorbis_info_clear(vorbis_info *vi); extern void vorbis_info_clear(vorbis_info *vi);
extern int vorbis_info_blocksize(vorbis_info *vi,int zo); extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
extern void vorbis_comment_init(vorbis_comment *vc); extern void vorbis_comment_init(vorbis_comment *vc);
extern void vorbis_comment_add(vorbis_comment *vc, char *comment); extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
extern void vorbis_comment_add_tag(vorbis_comment *vc, extern void vorbis_comment_add_tag(vorbis_comment *vc,
char *tag, char *contents); const char *tag, const char *contents);
extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count); extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag); extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
extern void vorbis_comment_clear(vorbis_comment *vc); extern void vorbis_comment_clear(vorbis_comment *vc);
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
@ -179,6 +179,8 @@ extern void vorbis_dsp_clear(vorbis_dsp_state *v);
extern double vorbis_granule_time(vorbis_dsp_state *v, extern double vorbis_granule_time(vorbis_dsp_state *v,
ogg_int64_t granulepos); ogg_int64_t granulepos);
extern const char *vorbis_version_string(void);
/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
@ -198,6 +200,7 @@ extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
ogg_packet *op); ogg_packet *op);
/* Vorbis PRIMITIVES: synthesis layer *******************************/ /* Vorbis PRIMITIVES: synthesis layer *******************************/
extern int vorbis_synthesis_idheader(ogg_packet *op);
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
ogg_packet *op); ogg_packet *op);

View file

@ -5,8 +5,8 @@
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* * * *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the XIPHOPHORUS Company http://www.xiph.org/ * * by the Xiph.Org Foundation http://www.xiph.org/ *
* * * *
******************************************************************** ********************************************************************
@ -37,12 +37,71 @@ extern "C"
* unseekable * unseekable
*/ */
typedef struct { typedef struct {
size_t (VARGS *read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
int (VARGS *seek_func) (void *datasource, ogg_int64_t offset, int whence); int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
int (VARGS *close_func) (void *datasource); int (*close_func) (void *datasource);
long (VARGS *tell_func) (void *datasource); long (*tell_func) (void *datasource);
} ov_callbacks; } ov_callbacks;
#ifndef OV_EXCLUDE_STATIC_CALLBACKS
/* a few sets of convenient callbacks, especially for use under
* Windows where ov_open_callbacks() should always be used instead of
* ov_open() to avoid problems with incompatible crt.o version linking
* issues. */
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
if(f==NULL)return(-1);
#ifdef __MINGW32__
return fseeko64(f,off,whence);
#elif defined (_WIN32)
return _fseeki64(f,off,whence);
#else
return fseek(f,off,whence);
#endif
}
/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
* static data. That means that every file which includes this header
* will get its own copy of these structs whether it uses them or
* not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
* These static symbols are essential on platforms such as Windows on
* which several different versions of stdio support may be linked to
* by different DLLs, and we need to be certain we know which one
* we're using (the same one as the main application).
*/
static ov_callbacks OV_CALLBACKS_DEFAULT = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
(int (*)(void *)) fclose,
(long (*)(void *)) ftell
};
static ov_callbacks OV_CALLBACKS_NOCLOSE = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
(int (*)(void *)) NULL,
(long (*)(void *)) ftell
};
static ov_callbacks OV_CALLBACKS_STREAMONLY = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, ogg_int64_t, int)) NULL,
(int (*)(void *)) fclose,
(long (*)(void *)) NULL
};
static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, ogg_int64_t, int)) NULL,
(int (*)(void *)) NULL,
(long (*)(void *)) NULL
};
#endif
#define NOTOPEN 0 #define NOTOPEN 0
#define PARTOPEN 1 #define PARTOPEN 1
#define OPENED 2 #define OPENED 2
@ -63,7 +122,7 @@ typedef struct OggVorbis_File {
ogg_int64_t *dataoffsets; ogg_int64_t *dataoffsets;
long *serialnos; long *serialnos;
ogg_int64_t *pcmlengths; /* overloaded to maintain binary ogg_int64_t *pcmlengths; /* overloaded to maintain binary
compatability; x2 size, stores both compatibility; x2 size, stores both
beginning and end values */ beginning and end values */
vorbis_info *vi; vorbis_info *vi;
vorbis_comment *vc; vorbis_comment *vc;
@ -86,14 +145,16 @@ typedef struct OggVorbis_File {
} OggVorbis_File; } OggVorbis_File;
extern int ov_clear(OggVorbis_File *vf);
extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
char *initial, long ibytes, ov_callbacks callbacks);
extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); extern int ov_clear(OggVorbis_File *vf);
extern int ov_fopen(const char *path,OggVorbis_File *vf);
extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
const char *initial, long ibytes, ov_callbacks callbacks);
extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
char *initial, long ibytes, ov_callbacks callbacks); const char *initial, long ibytes, ov_callbacks callbacks);
extern int ov_test_open(OggVorbis_File *vf); extern int ov_test_open(OggVorbis_File *vf);
extern long ov_bitrate(OggVorbis_File *vf,int i); extern long ov_bitrate(OggVorbis_File *vf,int i);
@ -127,6 +188,9 @@ extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples, extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
int *bitstream); int *bitstream);
extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
int bigendianp,int word,int sgned,int *bitstream,
void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
extern long ov_read(OggVorbis_File *vf,char *buffer,int length, extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
int bigendianp,int word,int sgned,int *bitstream); int bigendianp,int word,int sgned,int *bitstream);
extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2); extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
@ -140,4 +204,3 @@ extern int ov_halfrate_p(OggVorbis_File *vf);
#endif #endif