Mercurial > SDL_sound_CoreAudio
annotate decoders/mp3.c @ 254:a73c51c12452
Memory access fixes.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 11 Feb 2002 07:04:06 +0000 |
parents | d3dc34315ac7 |
children |
rev | line source |
---|---|
14 | 1 /* |
2 * SDL_sound -- An abstract sound format decoding API. | |
3 * Copyright (C) 2001 Ryan C. Gordon. | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2.1 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Lesser General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Lesser General Public | |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 */ | |
19 | |
20 /* | |
21 * MPEG-1 Layer 3, or simply, "MP3", decoder for SDL_sound. | |
22 * | |
23 * This driver handles all those highly compressed songs you stole through | |
24 * Napster. :) It depends on the SMPEG library for decoding, which can | |
25 * be grabbed from: http://www.lokigames.com/development/smpeg.php3 | |
26 * | |
192
5b311ffabe45
Changed decoder's URL to point to Loki's SMPEG development page.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
27 * This should also be able to extract the audio stream from an MPEG movie. |
5b311ffabe45
Changed decoder's URL to point to Loki's SMPEG development page.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
28 * |
184
47cc2de2ae36
Changed reference to "LICENSE" file to "COPYING".
Ryan C. Gordon <icculus@icculus.org>
parents:
149
diff
changeset
|
29 * Please see the file COPYING in the source's root directory. |
14 | 30 * |
31 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org) | |
32 */ | |
33 | |
106
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
34 #if HAVE_CONFIG_H |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
35 # include <config.h> |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
36 #endif |
100
6d9fdec2f708
added config.h, added --enable-debug flag, various other changes to the build system
fingolfin
parents:
96
diff
changeset
|
37 |
104
103cfcb3c014
Updated to fix build system problem.
Ryan C. Gordon <icculus@icculus.org>
parents:
100
diff
changeset
|
38 #ifdef SOUND_SUPPORTS_MP3 |
103cfcb3c014
Updated to fix build system problem.
Ryan C. Gordon <icculus@icculus.org>
parents:
100
diff
changeset
|
39 |
14 | 40 #include <stdio.h> |
41 #include <stdlib.h> | |
42 #include <string.h> | |
43 #include <assert.h> | |
44 | |
106
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
45 #include "SDL_sound.h" |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
46 |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
47 #define __SDL_SOUND_INTERNAL__ |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
48 #include "SDL_sound_internal.h" |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
49 |
14 | 50 #include "smpeg.h" |
51 #include "extra_rwops.h" | |
52 | |
53 | |
46
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
54 static int MP3_init(void); |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
55 static void MP3_quit(void); |
14 | 56 static int MP3_open(Sound_Sample *sample, const char *ext); |
57 static void MP3_close(Sound_Sample *sample); | |
58 static Uint32 MP3_read(Sound_Sample *sample); | |
221
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
59 static int MP3_rewind(Sound_Sample *sample); |
14 | 60 |
149
1df5c106504e
Decoders can now list multiple file extensions.
Ryan C. Gordon <icculus@icculus.org>
parents:
106
diff
changeset
|
61 static const char *extensions_smpeg[] = { "MP3", "MPEG", "MPG", NULL }; |
14 | 62 const Sound_DecoderFunctions __Sound_DecoderFunctions_MP3 = |
63 { | |
64 { | |
149
1df5c106504e
Decoders can now list multiple file extensions.
Ryan C. Gordon <icculus@icculus.org>
parents:
106
diff
changeset
|
65 extensions_smpeg, |
14 | 66 "MPEG-1 Layer 3 audio through SMPEG", |
67 "Ryan C. Gordon <icculus@clutteredmind.org>", | |
192
5b311ffabe45
Changed decoder's URL to point to Loki's SMPEG development page.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
68 "http://www.lokigames.com/development/smpeg.php3" |
14 | 69 }, |
70 | |
221
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
71 MP3_init, /* init() method */ |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
72 MP3_quit, /* quit() method */ |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
73 MP3_open, /* open() method */ |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
74 MP3_close, /* close() method */ |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
75 MP3_read, /* read() method */ |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
76 MP3_rewind /* rewind() method */ |
14 | 77 }; |
78 | |
46
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
79 |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
80 static int MP3_init(void) |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
81 { |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
82 return(1); /* always succeeds. */ |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
83 } /* MP3_init */ |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
84 |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
85 |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
86 static void MP3_quit(void) |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
87 { |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
88 /* it's a no-op. */ |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
89 } /* MP3_quit */ |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
90 |
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
91 |
14 | 92 static __inline__ void output_version(void) |
93 { | |
94 static int first_time = 1; | |
95 | |
96 if (first_time) | |
97 { | |
98 SMPEG_version v; | |
99 SMPEG_VERSION(&v); | |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
100 SNDDBG(("MP3: Compiled against SMPEG v%d.%d.%d.\n", |
14 | 101 v.major, v.minor, v.patch)); |
102 first_time = 0; | |
103 } /* if */ | |
104 } /* output_version */ | |
105 | |
106 | |
107 static int MP3_open(Sound_Sample *sample, const char *ext) | |
108 { | |
109 SMPEG *smpeg; | |
110 SMPEG_Info smpeg_info; | |
111 SDL_AudioSpec spec; | |
112 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
113 SDL_RWops *refCounter; | |
114 | |
115 output_version(); | |
116 | |
46
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
117 /* |
96 | 118 * If I understand things correctly, MP3 files don't really have any |
119 * magic header we can check for. The MP3 player is expected to just | |
120 * pick the first thing that looks like a valid frame and start | |
121 * playing from there. | |
122 * | |
123 * So here's what we do: If the caller insists that this is really | |
124 * MP3 we'll take his word for it. Otherwise, use the same test as | |
125 * SDL_mixer does and check if the stream starts with something that | |
126 * looks like a frame. | |
127 * | |
128 * A frame begins with 11 bits of frame sync (all bits must be set), | |
129 * followed by a two-bit MPEG Audio version ID: | |
130 * | |
131 * 00 - MPEG Version 2.5 (later extension of MPEG 2) | |
132 * 01 - reserved | |
133 * 10 - MPEG Version 2 (ISO/IEC 13818-3) | |
134 * 11 - MPEG Version 1 (ISO/IEC 11172-3) | |
135 * | |
136 * Apparently we don't handle MPEG Version 2.5. | |
46
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
137 */ |
96 | 138 if (__Sound_strcasecmp(ext, "MP3") != 0) |
46
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
139 { |
96 | 140 Uint8 mp3_magic[2]; |
141 | |
142 if (SDL_RWread(internal->rw, mp3_magic, sizeof (mp3_magic), 1) != 1) | |
143 { | |
144 Sound_SetError("MP3: Could not read MP3 magic."); | |
145 return(0); | |
146 } /*if */ | |
147 | |
148 if (mp3_magic[0] != 0xFF || (mp3_magic[1] & 0xF0) != 0xF0) | |
149 { | |
150 Sound_SetError("MP3: Not an MP3 stream."); | |
151 return(0); | |
152 } /* if */ | |
153 | |
154 /* !!! FIXME: If the seek fails, we'll probably miss a frame */ | |
155 SDL_RWseek(internal->rw, -sizeof (mp3_magic), SEEK_CUR); | |
156 } /* if */ | |
46
6e13fcc178da
No longer grabs non-MP3 streams. Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
28
diff
changeset
|
157 |
14 | 158 refCounter = RWops_RWRefCounter_new(internal->rw); |
159 if (refCounter == NULL) | |
160 { | |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
161 SNDDBG(("MP3: Failed to create reference counting RWops.\n")); |
14 | 162 return(0); |
163 } /* if */ | |
164 | |
165 /* replace original RWops. This is safe. Honest. :) */ | |
166 internal->rw = refCounter; | |
167 | |
168 /* | |
169 * increment the refcount, since SMPEG will nuke the RWops if it can't | |
170 * accept the contained data... | |
171 */ | |
172 RWops_RWRefCounter_addRef(refCounter); | |
173 smpeg = SMPEG_new_rwops(refCounter, &smpeg_info, 0); | |
174 | |
175 if (SMPEG_error(smpeg)) | |
176 { | |
177 Sound_SetError(SMPEG_error(smpeg)); | |
178 SMPEG_delete(smpeg); | |
179 return(0); | |
180 } /* if */ | |
181 | |
182 if (!smpeg_info.has_audio) | |
183 { | |
184 Sound_SetError("MP3: No audio stream found in data."); | |
185 SMPEG_delete(smpeg); | |
186 return(0); | |
187 } /* if */ | |
188 | |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
189 SNDDBG(("MP3: Accepting data stream.\n")); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
190 SNDDBG(("MP3: has_audio == {%s}.\n", smpeg_info.has_audio ? "TRUE" : "FALSE")); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
191 SNDDBG(("MP3: has_video == {%s}.\n", smpeg_info.has_video ? "TRUE" : "FALSE")); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
192 SNDDBG(("MP3: width == (%d).\n", smpeg_info.width)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
193 SNDDBG(("MP3: height == (%d).\n", smpeg_info.height)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
194 SNDDBG(("MP3: current_frame == (%d).\n", smpeg_info.current_frame)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
195 SNDDBG(("MP3: current_fps == (%f).\n", smpeg_info.current_fps)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
196 SNDDBG(("MP3: audio_string == [%s].\n", smpeg_info.audio_string)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
197 SNDDBG(("MP3: audio_current_frame == (%d).\n", smpeg_info.audio_current_frame)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
198 SNDDBG(("MP3: current_offset == (%d).\n", smpeg_info.current_offset)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
199 SNDDBG(("MP3: total_size == (%d).\n", smpeg_info.total_size)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
200 SNDDBG(("MP3: current_time == (%f).\n", smpeg_info.current_time)); |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
54
diff
changeset
|
201 SNDDBG(("MP3: total_time == (%f).\n", smpeg_info.total_time)); |
14 | 202 |
203 SMPEG_enablevideo(smpeg, 0); | |
204 SMPEG_enableaudio(smpeg, 1); | |
205 SMPEG_loop(smpeg, 0); | |
206 | |
207 SMPEG_wantedSpec(smpeg, &spec); | |
96 | 208 |
54
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
209 /* |
96 | 210 * One of the MP3s I tried wouldn't work unless I added this line |
54
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
211 * to tell SMPEG that yes, it may have the spec it wants. |
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
212 */ |
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
213 SMPEG_actualSpec(smpeg, &spec); |
14 | 214 sample->actual.format = spec.format; |
215 sample->actual.rate = spec.freq; | |
216 sample->actual.channels = spec.channels; | |
217 sample->flags = SOUND_SAMPLEFLAG_NONE; | |
218 internal->decoder_private = smpeg; | |
219 | |
220 SMPEG_play(smpeg); | |
221 return(1); | |
222 } /* MP3_open */ | |
223 | |
224 | |
225 static void MP3_close(Sound_Sample *sample) | |
226 { | |
227 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
228 SMPEG_delete((SMPEG *) internal->decoder_private); | |
229 } /* MP3_close */ | |
230 | |
231 | |
232 static Uint32 MP3_read(Sound_Sample *sample) | |
233 { | |
234 Uint32 retval; | |
235 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
236 SMPEG *smpeg = (SMPEG *) internal->decoder_private; | |
237 | |
54
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
238 /* |
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
239 * We have to clear the buffer because apparently SMPEG_playAudio() |
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
240 * will mix the decoded audio with whatever's already in it. Nasty. |
6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
Ryan C. Gordon <icculus@icculus.org>
parents:
46
diff
changeset
|
241 */ |
231
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
242 memset(internal->buffer, '\0', internal->buffer_size); |
14 | 243 retval = SMPEG_playAudio(smpeg, internal->buffer, internal->buffer_size); |
244 if (retval < internal->buffer_size) | |
245 { | |
246 char *errMsg = SMPEG_error(smpeg); | |
247 if (errMsg == NULL) | |
248 sample->flags |= SOUND_SAMPLEFLAG_EOF; | |
249 else | |
250 { | |
251 Sound_SetError(errMsg); | |
252 sample->flags |= SOUND_SAMPLEFLAG_ERROR; | |
253 } /* else */ | |
254 } /* if */ | |
255 | |
256 return(retval); | |
257 } /* MP3_read */ | |
258 | |
221
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
259 |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
260 static int MP3_rewind(Sound_Sample *sample) |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
261 { |
231
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
262 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
263 SMPEG *smpeg = (SMPEG *) internal->decoder_private; |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
264 SMPEGstatus status; |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
265 |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
266 /* |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
267 * SMPEG_rewind() really means "stop and rewind", so we may have to |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
268 * restart it afterwards. |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
269 */ |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
270 status = SMPEG_status(smpeg); |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
271 SMPEG_rewind(smpeg); |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
272 if (status == SMPEG_PLAYING) |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
273 SMPEG_play(smpeg); |
d3dc34315ac7
Rewind method implemented by Torbj�rn.
Ryan C. Gordon <icculus@icculus.org>
parents:
221
diff
changeset
|
274 return(1); |
221
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
275 } /* MP3_rewind */ |
c9772a9f5271
Initial implementation or stubs for rewind method. Other cleanups.
Ryan C. Gordon <icculus@icculus.org>
parents:
192
diff
changeset
|
276 |
64
40006625142a
Changes in preparation of autoconf support.
Ryan C. Gordon <icculus@icculus.org>
parents:
62
diff
changeset
|
277 #endif /* SOUND_SUPPORTS_MP3 */ |
40006625142a
Changes in preparation of autoconf support.
Ryan C. Gordon <icculus@icculus.org>
parents:
62
diff
changeset
|
278 |
14 | 279 /* end of mp3.c ... */ |
280 |