comparison decoders/skeleton.c @ 306:c97be6e1bd27

Added framework for Sound_Seek() support.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 21 Apr 2002 18:39:47 +0000
parents c9772a9f5271
children cbb15ecf423a
comparison
equal deleted inserted replaced
305:c345a40a8a99 306:c97be6e1bd27
57 static void FMT_quit(void); 57 static void FMT_quit(void);
58 static int FMT_open(Sound_Sample *sample, const char *ext); 58 static int FMT_open(Sound_Sample *sample, const char *ext);
59 static void FMT_close(Sound_Sample *sample); 59 static void FMT_close(Sound_Sample *sample);
60 static Uint32 FMT_read(Sound_Sample *sample); 60 static Uint32 FMT_read(Sound_Sample *sample);
61 static int FMT_rewind(Sound_Sample *sample); 61 static int FMT_rewind(Sound_Sample *sample);
62 static int FMT_seek(Sound_Sample *sample, Uint32 ms);
62 63
63 static const char *extensions_fmt[] = { "FMT", NULL }; 64 static const char *extensions_fmt[] = { "FMT", NULL };
64 const Sound_DecoderFunctions __Sound_DecoderFunctions_FMT = 65 const Sound_DecoderFunctions __Sound_DecoderFunctions_FMT =
65 { 66 {
66 { 67 {
73 FMT_init, /* init() method */ 74 FMT_init, /* init() method */
74 FMT_quit, /* quit() method */ 75 FMT_quit, /* quit() method */
75 FMT_open, /* open() method */ 76 FMT_open, /* open() method */
76 FMT_close, /* close() method */ 77 FMT_close, /* close() method */
77 FMT_read, /* read() method */ 78 FMT_read, /* read() method */
78 FMT_rewind /* rewind() method */ 79 FMT_rewind, /* rewind() method */
80 FMT_seek /* seek() method */
79 }; 81 };
80 82
81 83
82 static int FMT_init(void) 84 static int FMT_init(void)
83 { 85 {
159 (reset state as necessary.) 161 (reset state as necessary.)
160 162
161 return(1); /* success. */ 163 return(1); /* success. */
162 } /* FMT_rewind */ 164 } /* FMT_rewind */
163 165
166
167 static int FMT_seek(Sound_Sample *sample, Uint32 ms)
168 {
169 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
170
171 /* seek to the appropriate place... */
172 BAIL_IF_MACRO(SDL_RWseek(internal->rw, 0, SEEK_SET) != 0, ERR_IO_ERROR, 0);
173
174 (set state as necessary.)
175
176 return(1); /* success. */
177 } /* FMT_seek */
178
179
164 #endif /* SOUND_SUPPORTS_FMT */ 180 #endif /* SOUND_SUPPORTS_FMT */
165 181
166 182
167 /* end of fmt.c ... */ 183 /* end of fmt.c ... */
168 184