parent
1276aa62cd
commit
01556256fa
|
@ -226,6 +226,8 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
|
||||||
stream->codec = codec;
|
stream->codec = codec;
|
||||||
stream->file = hnd;
|
stream->file = hnd;
|
||||||
stream->length = length;
|
stream->length = length;
|
||||||
|
stream->startpos = Sys_FileTell(hnd);
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ typedef struct snd_stream_s
|
||||||
snd_info_t info;
|
snd_info_t info;
|
||||||
int length;
|
int length;
|
||||||
int pos;
|
int pos;
|
||||||
|
int startpos;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
} snd_stream_t;
|
} 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
|
// set the file position in the actual file with the Q3 function
|
||||||
errno = 0;
|
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
|
// something has gone wrong, so we return here
|
||||||
if(errno != 0)
|
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
|
// set the file position in the actual file with the Q3 function
|
||||||
errno = 0;
|
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
|
// something has gone wrong, so we return here
|
||||||
if(errno != 0)
|
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
|
// set the file position in the actual file with the Q3 function
|
||||||
errno = 0;
|
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
|
// something has gone wrong, so we return here
|
||||||
if(errno != 0)
|
if(errno != 0)
|
||||||
|
@ -214,7 +214,7 @@ long S_OGG_Callback_tell(void *datasource)
|
||||||
// snd_stream_t in the generic pointer
|
// snd_stream_t in the generic pointer
|
||||||
stream = (snd_stream_t *) datasource;
|
stream = (snd_stream_t *) datasource;
|
||||||
|
|
||||||
return (long) Sys_FileTell(stream->file);
|
return (long) Sys_FileTell(stream->file) - (long) stream->startpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the callback structure
|
// the callback structure
|
||||||
|
|
Loading…
Reference in New Issue