diff --git a/engine/common/soundlib/ogg_filestream.c b/engine/common/soundlib/ogg_filestream.c index bee6c2db..276a9afa 100644 --- a/engine/common/soundlib/ogg_filestream.c +++ b/engine/common/soundlib/ogg_filestream.c @@ -17,14 +17,6 @@ GNU General Public License for more details. #include "soundlib.h" #include -void OggFilestream_Init( ogg_filestream_t *filestream, const char *name, const byte *buffer, size_t filesize ) -{ - filestream->name = name; - filestream->buffer = buffer; - filestream->filesize = filesize; - filestream->position = 0; -} - size_t OggFilestream_Read( void *ptr, size_t blockSize, size_t nmemb, void *datasource ) { ogg_filestream_t *filestream = (ogg_filestream_t*)datasource; diff --git a/engine/common/soundlib/ogg_filestream.h b/engine/common/soundlib/ogg_filestream.h index b13af58e..a8d0e2f6 100644 --- a/engine/common/soundlib/ogg_filestream.h +++ b/engine/common/soundlib/ogg_filestream.h @@ -17,7 +17,6 @@ GNU General Public License for more details. #define OGG_FILESTREAM_H #include "xash3d_types.h" -#include typedef struct ogg_filestream_s { @@ -27,9 +26,16 @@ typedef struct ogg_filestream_s size_t position; } ogg_filestream_t; -void OggFilestream_Init( ogg_filestream_t *filestream, const char *name, const byte *buffer, size_t filesize ); size_t OggFilestream_Read( void *ptr, size_t blockSize, size_t nmemb, void *datasource ); int OggFilestream_Seek( void *datasource, int64_t offset, int whence ); long OggFilestream_Tell( void *datasource ); +static inline void OggFilestream_Init( ogg_filestream_t *filestream, const char *name, const byte *buffer, size_t filesize ) +{ + filestream->name = name; + filestream->buffer = buffer; + filestream->filesize = filesize; + filestream->position = 0; +} + #endif // OGG_FILESTREAM_H diff --git a/engine/common/soundlib/snd_ogg_opus.c b/engine/common/soundlib/snd_ogg_opus.c index cb0adc57..708a12d5 100644 --- a/engine/common/soundlib/snd_ogg_opus.c +++ b/engine/common/soundlib/snd_ogg_opus.c @@ -13,12 +13,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#include +#include #include "soundlib.h" #include "crtlib.h" #include "ogg_filestream.h" -#include -#include -#include typedef struct opus_streaming_ctx_s { diff --git a/engine/common/soundlib/snd_ogg_vorbis.c b/engine/common/soundlib/snd_ogg_vorbis.c index 39673c87..164e26f4 100644 --- a/engine/common/soundlib/snd_ogg_vorbis.c +++ b/engine/common/soundlib/snd_ogg_vorbis.c @@ -13,14 +13,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#include +#include +#include #include "soundlib.h" #include "crtlib.h" #include "xash3d_mathlib.h" #include "ogg_filestream.h" -#include -#include -#include -#include typedef struct vorbis_streaming_ctx_s { @@ -89,6 +88,7 @@ qboolean Sound_LoadOggVorbis( const char *name, const byte *buffer, fs_offset_t long ret; int section; size_t written = 0; + vorbis_info *info; ogg_filestream_t file; OggVorbis_File vorbisFile; @@ -101,7 +101,7 @@ qboolean Sound_LoadOggVorbis( const char *name, const byte *buffer, fs_offset_t return false; } - vorbis_info *info = ov_info( &vorbisFile, -1 ); + info = ov_info( &vorbisFile, -1 ); if( info->channels < 1 || info->channels > 2 ) { Con_DPrintf( S_ERROR "%s: failed to load (%s): unsuppored channels count\n", __func__, file.name ); return false; @@ -134,6 +134,7 @@ qboolean Sound_LoadOggVorbis( const char *name, const byte *buffer, fs_offset_t stream_t *Stream_OpenOggVorbis( const char *filename ) { stream_t *stream; + vorbis_info *info; vorbis_streaming_ctx_t *ctx; ctx = (vorbis_streaming_ctx_t*)Mem_Calloc( host.soundpool, sizeof( vorbis_streaming_ctx_t )); @@ -156,7 +157,7 @@ stream_t *Stream_OpenOggVorbis( const char *filename ) return NULL; } - vorbis_info *info = ov_info( &ctx->vf, -1 ); + info = ov_info( &ctx->vf, -1 ); if( info->channels < 1 || info->channels > 2 ) { Con_DPrintf( S_ERROR "%s: failed to load (%s): unsuppored channels count\n", __func__, filename ); FS_Close( ctx->file );