mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Fix the OGG codec code to deal with OGGs in
pak files
This commit is contained in:
parent
1276aa62cd
commit
01556256fa
3 changed files with 7 additions and 4 deletions
|
@ -226,6 +226,8 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
|
|||
stream->codec = codec;
|
||||
stream->file = hnd;
|
||||
stream->length = length;
|
||||
stream->startpos = Sys_FileTell(hnd);
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ typedef struct snd_stream_s
|
|||
snd_info_t info;
|
||||
int length;
|
||||
int pos;
|
||||
int startpos;
|
||||
void *ptr;
|
||||
} snd_stream_t;
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ int S_OGG_Callback_seek(void *datasource, ogg_int64_t offset, int whence)
|
|||
{
|
||||
// set the file position in the actual file with the Q3 function
|
||||
errno = 0;
|
||||
Sys_FileSeek(stream->file, (long) offset);
|
||||
Sys_FileSeek(stream->file, (long) stream->startpos + (long) offset);
|
||||
|
||||
// something has gone wrong, so we return here
|
||||
if(errno != 0)
|
||||
|
@ -144,7 +144,7 @@ int S_OGG_Callback_seek(void *datasource, ogg_int64_t offset, int whence)
|
|||
{
|
||||
// set the file position in the actual file with the Q3 function
|
||||
errno = 0;
|
||||
Sys_FileSeek(stream->file, (long) stream->pos + (long) offset);
|
||||
Sys_FileSeek(stream->file, (long) stream->startpos + (long) stream->pos + (long) offset);
|
||||
|
||||
// something has gone wrong, so we return here
|
||||
if(errno != 0)
|
||||
|
@ -164,7 +164,7 @@ int S_OGG_Callback_seek(void *datasource, ogg_int64_t offset, int whence)
|
|||
|
||||
// set the file position in the actual file with the Q3 function
|
||||
errno = 0;
|
||||
Sys_FileSeek(stream->file, (long) stream->length + (long) offset);
|
||||
Sys_FileSeek(stream->file, (long) stream->startpos + (long) stream->length + (long) offset);
|
||||
|
||||
// something has gone wrong, so we return here
|
||||
if(errno != 0)
|
||||
|
@ -214,7 +214,7 @@ long S_OGG_Callback_tell(void *datasource)
|
|||
// snd_stream_t in the generic pointer
|
||||
stream = (snd_stream_t *) datasource;
|
||||
|
||||
return (long) Sys_FileTell(stream->file);
|
||||
return (long) Sys_FileTell(stream->file) - (long) stream->startpos;
|
||||
}
|
||||
|
||||
// the callback structure
|
||||
|
|
Loading…
Reference in a new issue