comparison decoders/skeleton.c @ 221:c9772a9f5271

Initial implementation or stubs for rewind method. Other cleanups.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 17 Jan 2002 20:53:53 +0000
parents 47cc2de2ae36
children c97be6e1bd27
comparison
equal deleted inserted replaced
220:ef72f3c490e7 221:c9772a9f5271
21 * FMT decoder for SDL_sound. 21 * FMT decoder for SDL_sound.
22 * 22 *
23 * This driver handles FMT audio data. Blahblahblah... The author should 23 * This driver handles FMT audio data. Blahblahblah... The author should
24 * have done a search and replace on "fmt" and "FMT" and changed this 24 * have done a search and replace on "fmt" and "FMT" and changed this
25 * comment. This is the default comment in the skeleton decoder file... 25 * comment. This is the default comment in the skeleton decoder file...
26 *
27 * None of this code, even the parts that LOOK right, have been compiled,
28 * so you cut-and-paste at your own risk.
26 * 29 *
27 * Please see the file COPYING in the source's root directory. 30 * Please see the file COPYING in the source's root directory.
28 * 31 *
29 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org) 32 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org)
30 */ 33 */
53 static int FMT_init(void); 56 static int FMT_init(void);
54 static void FMT_quit(void); 57 static void FMT_quit(void);
55 static int FMT_open(Sound_Sample *sample, const char *ext); 58 static int FMT_open(Sound_Sample *sample, const char *ext);
56 static void FMT_close(Sound_Sample *sample); 59 static void FMT_close(Sound_Sample *sample);
57 static Uint32 FMT_read(Sound_Sample *sample); 60 static Uint32 FMT_read(Sound_Sample *sample);
61 static int FMT_rewind(Sound_Sample *sample);
58 62
59 static const char *extensions_fmt[] = { "FMT", NULL }; 63 static const char *extensions_fmt[] = { "FMT", NULL };
60 const Sound_DecoderFunctions __Sound_DecoderFunctions_FMT = 64 const Sound_DecoderFunctions __Sound_DecoderFunctions_FMT =
61 { 65 {
62 { 66 {
64 "FMT audio format description", 68 "FMT audio format description",
65 "Ryan C. Gordon <icculus@clutteredmind.org>", 69 "Ryan C. Gordon <icculus@clutteredmind.org>",
66 "http://www.icculus.org/SDL_sound/" 70 "http://www.icculus.org/SDL_sound/"
67 }, 71 },
68 72
69 FMT_init, /* init() method */ 73 FMT_init, /* init() method */
70 FMT_quit, /* quit() method */ 74 FMT_quit, /* quit() method */
71 FMT_open, /* open() method */ 75 FMT_open, /* open() method */
72 FMT_close, /* close() method */ 76 FMT_close, /* close() method */
73 FMT_read /* read() method */ 77 FMT_read, /* read() method */
78 FMT_rewind /* rewind() method */
74 }; 79 };
75 80
76 81
77 static int FMT_init(void) 82 static int FMT_init(void)
78 { 83 {
141 (or whatever. retval == number of bytes you put in internal->buffer). 146 (or whatever. retval == number of bytes you put in internal->buffer).
142 147
143 return(retval); 148 return(retval);
144 } /* FMT_read */ 149 } /* FMT_read */
145 150
151
152 static int FMT_rewind(Sound_Sample *sample)
153 {
154 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
155
156 /* seek to the appropriate place... */
157 BAIL_IF_MACRO(SDL_RWseek(internal->rw, 0, SEEK_SET) != 0, ERR_IO_ERROR, 0);
158
159 (reset state as necessary.)
160
161 return(1); /* success. */
162 } /* FMT_rewind */
163
146 #endif /* SOUND_SUPPORTS_FMT */ 164 #endif /* SOUND_SUPPORTS_FMT */
147 165
148 166
149 /* end of fmt.c ... */ 167 /* end of fmt.c ... */
150 168