Mercurial > SDL_sound_CoreAudio
diff decoders/mpglib/interface.c @ 279:52b9f37998db
Removed global state variable; should be thread safe now.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 14 Mar 2002 16:38:59 +0000 |
parents | 9e7f9e09ea0e |
children | ad4c8f34136a |
line wrap: on
line diff
--- a/decoders/mpglib/interface.c Thu Mar 14 16:38:32 2002 +0000 +++ b/decoders/mpglib/interface.c Thu Mar 14 16:38:59 2002 +0000 @@ -11,7 +11,7 @@ #include "mpglib_sdlsound.h" /* Global mp .. it's a hack */ -struct mpstr *gmp; +/*struct mpstr *gmp;*/ BOOL InitMP3(struct mpstr *mp) @@ -158,8 +158,6 @@ { int len; - gmp = mp; - if(osize < 4608) { Sound_SetError("MPGLIB: Not enough output space for decoding!"); return MP3_ERR; @@ -217,13 +215,13 @@ getbits(16); switch(mp->fr.lay) { case 1: - do_layer1(&mp->fr,(unsigned char *) out,done); + do_layer1(&mp->fr,(unsigned char *) out,done,mp); break; case 2: - do_layer2(&mp->fr,(unsigned char *) out,done); + do_layer2(&mp->fr,(unsigned char *) out,done,mp); break; case 3: - do_layer3(&mp->fr,(unsigned char *) out,done); + do_layer3(&mp->fr,(unsigned char *) out,done,mp); break; } @@ -233,17 +231,17 @@ return MP3_OK; } -int set_pointer(long backstep) +int set_pointer(long backstep, struct mpstr *mp) { unsigned char *bsbufold; - if(gmp->fsizeold < 0 && backstep > 0) { + if(mp->fsizeold < 0 && backstep > 0) { Sound_SetError("MPGLIB: Can't step back!"); /* FIXME: need formatting: %ld!\n",backstep); */ return MP3_ERR; } - bsbufold = gmp->bsspace[gmp->bsnum] + 512; + bsbufold = mp->bsspace[mp->bsnum] + 512; wordpointer -= backstep; if (backstep) - memcpy(wordpointer,bsbufold+gmp->fsizeold-backstep,backstep); + memcpy(wordpointer,bsbufold+mp->fsizeold-backstep,backstep); bitindex = 0; return MP3_OK; }