Mercurial > SDL_sound_CoreAudio
changeset 400:9d0b5ec9cc26
FIXME cleanups.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 11 Jul 2002 05:28:52 +0000 |
parents | e435bdcad552 |
children | c42ac9ee2ce4 |
files | SDL_sound.c decoders/aiff.c decoders/flac.c decoders/mpglib/interface.c decoders/mpglib/layer3.c |
diffstat | 5 files changed, 35 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/SDL_sound.c Thu Jul 11 05:28:33 2002 +0000 +++ b/SDL_sound.c Thu Jul 11 05:28:52 2002 +0000 @@ -506,8 +506,6 @@ * Ask the specified decoder to handle the data in (rw), and if * so, construct the Sound_Sample. Otherwise, try to wind (rw)'s stream * back to where it was, and return false. - * - * !!! FIXME: This is big, ugly, nasty, and smelly. */ static int init_sample(const Sound_DecoderFunctions *funcs, Sound_Sample *sample, const char *ext, @@ -515,7 +513,7 @@ { Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; Sound_AudioInfo desired; - int pos = SDL_RWtell(internal->rw); /* !!! FIXME: Int? Really? */ + int pos = SDL_RWtell(internal->rw); /* fill in the funcs for this decoder... */ sample->decoder = &funcs->info;
--- a/decoders/aiff.c Thu Jul 11 05:28:33 2002 +0000 +++ b/decoders/aiff.c Thu Jul 11 05:28:52 2002 +0000 @@ -279,7 +279,6 @@ ssnd->blockSize = SDL_SwapBE32(ssnd->blockSize); /* Leave the SDL_RWops position indicator at the start of the samples */ - /* !!! FIXME: Int? Really? */ if (SDL_RWseek(rw, (int) ssnd->offset, SEEK_CUR) == -1) return(0);
--- a/decoders/flac.c Thu Jul 11 05:28:33 2002 +0000 +++ b/decoders/flac.c Thu Jul 11 05:28:52 2002 +0000 @@ -370,7 +370,7 @@ void *client_data) { flac_t *f = (flac_t *) client_data; - int pos; /* !!! FIXME: int? Really? */ + int pos; pos = SDL_RWtell(f->rw); @@ -406,7 +406,7 @@ void *client_data) { flac_t *f = (flac_t *) client_data; - int pos; /* !!! FIXME: int? Really? */ + int pos; /* Maybe we could check for SOUND_SAMPLEFLAG_EOF here instead? */ pos = SDL_RWtell(f->rw); @@ -513,30 +513,33 @@ internal->decoder_private = f; d_init(decoder); -#if !SOUND_SUPPORTS_SEEKABLE_FLAC + sample->flags = SOUND_SAMPLEFLAG_NONE; + +#if SOUND_SUPPORTS_SEEKABLE_FLAC + + pos = SDL_RWtell(f->rw); + if (SDL_RWseek(f->rw, 0, SEEK_END) > 0) + { + f->stream_length = SDL_RWtell(f->rw); + if (SDL_RWseek(f->rw, pos, SEEK_SET) == -1) + { + free_flac(f); + BAIL_MACRO(ERR_IO_ERROR, 0); + } /* if */ + sample->flags = SOUND_SAMPLEFLAG_CANSEEK; + } /* if */ + +#else + /* * Annoyingly, the rewind method will put the FLAC decoder in a state * where it expects to read metadata, so we have to set this marker * before the metadata block. */ f->data_offset = SDL_RWtell(f->rw); + #endif - sample->flags = SOUND_SAMPLEFLAG_NONE; - -#if SOUND_SUPPORTS_SEEKABLE_FLAC - /* - * FIXME?: For the seekable stream decoder to work, we need to know - * the length of the stream. This is so ugly... - */ - pos = SDL_RWtell(f->rw); - if (SDL_RWseek(f->rw, 0, SEEK_END)) - { - f->stream_length = SDL_RWtell(f->rw); - SDL_RWseek(f->rw, pos, SEEK_SET); - sample->flags = SOUND_SAMPLEFLAG_CANSEEK; - } /* if */ -#endif /* * If we are not sure this is a FLAC stream, check for the STREAMINFO
--- a/decoders/mpglib/interface.c Thu Jul 11 05:28:33 2002 +0000 +++ b/decoders/mpglib/interface.c Thu Jul 11 05:28:52 2002 +0000 @@ -226,8 +226,9 @@ { unsigned char *bsbufold; if(mp->fsizeold < 0 && backstep > 0) { - /* FIXME: need formatting: %ld!\n",backstep); */ - BAIL_MACRO("MPGLIB: Can't step back!", MP3_ERR); + char err[128]; + snprintf(err, sizeof (err), "MPGLIB: Can't step back! %ld!", backstep); + BAIL_MACRO(err, MP3_ERR); } bsbufold = mp->bsspace[mp->bsnum] + 512; wordpointer -= backstep;
--- a/decoders/mpglib/layer3.c Thu Jul 11 05:28:33 2002 +0000 +++ b/decoders/mpglib/layer3.c Thu Jul 11 05:28:52 2002 +0000 @@ -954,8 +954,11 @@ if(part2remain > 0) getbits(part2remain); else if(part2remain < 0) { - /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain);*/ - BAIL_MACRO("MPGLIB: Can't rewind stream!", 1); /* -> error */ + char err[128]; + snprintf(err, sizeof (err), + "MPGLIB: Can't rewind stream by %d bits!", + -part2remain); + BAIL_MACRO(err, 1); /* -> error */ } return 0; } @@ -1365,8 +1368,11 @@ if(part2remain > 0 ) getbits(part2remain); else if(part2remain < 0) { - /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain);*/ - BAIL_MACRO("MPGLIB: Can't rewind stream!", 1); /* -> error */ + char err[128]; + snprintf(err, sizeof (err), + "MPGLIB: Can't rewind stream by %d bits!", + -part2remain); + BAIL_MACRO(err, 1); /* -> error */ } return 0; }