Mercurial > SDL_sound_CoreAudio
annotate extra_rwops.h @ 562:7e08477b0fc1
MP3 decoder upgrade work.
Ripped out SMPEG and mpglib support, replaced it with "mpg123.c" and libmpg123.
libmpg123 is a much better version of mpglib, so it should solve all the
problems about MP3's not seeking, or most modern MP3's not playing at all,
etc. Since you no longer have to make a tradeoff with SMPEG for features, and
SMPEG is basically rotting, I removed it from the project.
There is still work to be done with libmpg123...there are MMX, 3DNow, SSE,
Altivec, etc decoders which we don't have enabled at the moment, and the
build system could use some work to make this compile more cleanly, etc.
Still: huge win.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 30 Jan 2009 02:44:47 -0500 |
parents | 2e8907ff98e9 |
children |
rev | line source |
---|---|
8 | 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 * Some extra RWops that are needed or are just handy to have. | |
22 * | |
552
2e8907ff98e9
Replaced references to COPYING with references to LICENSE.txt ...
Ryan C. Gordon <icculus@icculus.org>
parents:
526
diff
changeset
|
23 * Please see the file LICENSE.txt in the source's root directory. |
8 | 24 * |
526
2df1f5c62d38
Updated my email address.
Ryan C. Gordon <icculus@icculus.org>
parents:
490
diff
changeset
|
25 * This file written by Ryan C. Gordon. (icculus@icculus.org) |
8 | 26 */ |
27 | |
28 #ifndef _INCLUDE_EXTRA_RWOPS_H_ | |
29 #define _INCLUDE_EXTRA_RWOPS_H_ | |
30 | |
31 #include "SDL.h" | |
32 | |
33 #ifdef __cplusplus | |
34 extern "C" { | |
35 #endif | |
36 | |
37 /* | |
38 * The Reference Counter RWops... | |
39 * | |
40 * This wraps another RWops with a reference counter. When you create a | |
41 * reference counter RWops, it sets a counter to one. Everytime you call | |
42 * RWops_RWRefCounter_new(), that's RWops's counter increments by one. | |
43 * Everytime you call that RWops's close() method, the counter decrements | |
44 * by one. If the counter hits zero, the original RWops's close() method | |
45 * is called, and the reference counting wrapper deletes itself. The read, | |
46 * write, and seek methods just pass through to the original. | |
47 * | |
48 * This is handy if you have two libraries (in the original case, SDL_sound | |
49 * and SMPEG), who both want an SDL_RWops, and both want to close it when | |
50 * they are finished. This resolves that contention. The user creates a | |
51 * RWops, passes it to SDL_sound, which wraps it in a reference counter and | |
52 * increments the number of references, and passes the wrapped RWops to | |
53 * SMPEG. SMPEG "closes" this wrapped RWops when the MP3 has finished | |
54 * playing, and SDL_sound then closes it, too. This second closing removes | |
55 * the last reference, and the RWops is smoothly destructed. | |
56 */ | |
57 | |
58 /* Return a SDL_RWops that is a reference counting wrapper of (rw). */ | |
59 SDL_RWops *RWops_RWRefCounter_new(SDL_RWops *rw); | |
60 | |
61 /* Increment a reference counting RWops's refcount by one. */ | |
62 void RWops_RWRefCounter_addRef(SDL_RWops *rw); | |
63 | |
485
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
64 |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
65 /* |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
66 * RWops pooling. This is to reduce malloc() pressure for audio that is |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
67 * placed into Sound_Samples over and over again. |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
68 */ |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
69 |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
70 /* Call this first. */ |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
71 int RWops_pooled_init(void); |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
72 |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
73 /* Call this last. */ |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
74 int RWops_pooled_deinit(void); |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
75 |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
76 /* Get a new RWops, allocating if needed. */ |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
77 SDL_RWops *RWops_pooled_alloc(void); |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
78 |
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
79 /* Return a RWops to the pool for reuse. */ |
490 | 80 void RWops_pooled_free(SDL_RWops *rw); |
485
137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
Ryan C. Gordon <icculus@icculus.org>
parents:
184
diff
changeset
|
81 |
8 | 82 #ifdef __cplusplus |
83 } | |
84 #endif | |
85 | |
86 #endif /* !defined _INCLUDE_EXTRA_RWOPS_H_ */ | |
87 | |
88 /* end of extra_rwops.h ... */ | |
89 |