diff decoders/speex.c @ 510:1841bdcf2122

Completely unacceptable hack for Speex rewinding.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 31 Mar 2006 07:20:09 +0000
parents 6bd7ca7d218b
children 2df1f5c62d38
line wrap: on
line diff
--- a/decoders/speex.c	Sat Dec 17 18:49:41 2005 +0000
+++ b/decoders/speex.c	Fri Mar 31 07:20:09 2006 +0000
@@ -419,7 +419,16 @@
 
 static int SPEEX_rewind(Sound_Sample *sample)
 {
-    /* !!! FIXME */ return(0);
+    Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
+    /*
+     * !!! FIXME: This is really unacceptable; state should be reset and
+     * !!! FIXME:  the RWops should be pointed to the start of the data
+     * !!! FIXME:  to decode. The below kludge adds unneeded overhead and
+     * !!! FIXME:  risk of failure.
+     */
+    BAIL_IF_MACRO(SDL_RWseek(internal->rw, 0, SEEK_SET) != 0, ERR_IO_ERROR, 0);
+    SPEEX_close(sample);
+    return(SPEEX_open(sample, "SPX"));
 } /* SPEEX_rewind */