mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-13 00:34:11 +00:00
snd_mp3.c: leave Z_ alone and allocate libmad decoding buffers (ca. 64kb)
on the system memory. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@471 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
3ea2addc76
commit
1b6fdd2b3d
1 changed files with 16 additions and 3 deletions
|
@ -505,7 +505,17 @@ static snd_stream_t *S_MP3_CodecOpenStream (const char *filename)
|
||||||
if (!stream)
|
if (!stream)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#if 0 /*defined(CODECS_USE_ZONE)*/
|
||||||
stream->priv = Z_Malloc(sizeof(mp3_priv_t));
|
stream->priv = Z_Malloc(sizeof(mp3_priv_t));
|
||||||
|
#else
|
||||||
|
stream->priv = calloc(1, sizeof(mp3_priv_t));
|
||||||
|
if (!stream->priv)
|
||||||
|
{
|
||||||
|
S_CodecUtilClose(&stream);
|
||||||
|
Con_Printf("Insufficient memory for MP3 audio\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mp3_startread(stream) < 0)
|
if (mp3_startread(stream) < 0)
|
||||||
{
|
{
|
||||||
|
@ -527,19 +537,22 @@ static int S_MP3_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||||
static void S_MP3_CodecCloseStream (snd_stream_t *stream)
|
static void S_MP3_CodecCloseStream (snd_stream_t *stream)
|
||||||
{
|
{
|
||||||
mp3_stopread(stream);
|
mp3_stopread(stream);
|
||||||
|
#if 0 /*defined(CODECS_USE_ZONE)*/
|
||||||
Z_Free(stream->priv);
|
Z_Free(stream->priv);
|
||||||
|
#else
|
||||||
|
free(stream->priv);
|
||||||
|
#endif
|
||||||
S_CodecUtilClose(&stream);
|
S_CodecUtilClose(&stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int S_MP3_CodecRewindStream (snd_stream_t *stream)
|
static int S_MP3_CodecRewindStream (snd_stream_t *stream)
|
||||||
{
|
{
|
||||||
#if 0
|
/*
|
||||||
mp3_stopread(stream);
|
mp3_stopread(stream);
|
||||||
FS_rewind(&stream->fh);
|
FS_rewind(&stream->fh);
|
||||||
return mp3_startread(stream);
|
return mp3_startread(stream);
|
||||||
#else
|
*/
|
||||||
return mp3_madseek(stream, 0);
|
return mp3_madseek(stream, 0);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_codec_t mp3_codec =
|
snd_codec_t mp3_codec =
|
||||||
|
|
Loading…
Reference in a new issue