comparison decoders/ogg.c @ 63:9669aa13d3e0

Changes in preparation for autoconf, and the RWops wrappers changed to be static.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 24 Sep 2001 23:32:29 +0000
parents cd91e1857b42
children 6d9fdec2f708
comparison
equal deleted inserted replaced
62:b13fafb976be 63:9669aa13d3e0
29 * 29 *
30 * Please see the file LICENSE in the source's root directory. 30 * Please see the file LICENSE in the source's root directory.
31 * 31 *
32 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org) 32 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org)
33 */ 33 */
34
35 #ifdef SOUND_SUPPORTS_OGG
34 36
35 #include <stdio.h> 37 #include <stdio.h>
36 #include <stdlib.h> 38 #include <stdlib.h>
37 #include <string.h> 39 #include <string.h>
38 #include <math.h> 40 #include <math.h>
43 #include "SDL_sound.h" 45 #include "SDL_sound.h"
44 46
45 #define __SDL_SOUND_INTERNAL__ 47 #define __SDL_SOUND_INTERNAL__
46 #include "SDL_sound_internal.h" 48 #include "SDL_sound_internal.h"
47 49
48 #if (!defined SOUND_SUPPORTS_OGG)
49 #error SOUND_SUPPORTS_OGG must be defined.
50 #endif
51
52 static int OGG_init(void); 50 static int OGG_init(void);
53 static void OGG_quit(void); 51 static void OGG_quit(void);
54 static int OGG_open(Sound_Sample *sample, const char *ext); 52 static int OGG_open(Sound_Sample *sample, const char *ext);
55 static void OGG_close(Sound_Sample *sample); 53 static void OGG_close(Sound_Sample *sample);
56 static Uint32 OGG_read(Sound_Sample *sample); 54 static Uint32 OGG_read(Sound_Sample *sample);
88 /* 86 /*
89 * These are callbacks from vorbisfile that let them read data from 87 * These are callbacks from vorbisfile that let them read data from
90 * a RWops... 88 * a RWops...
91 */ 89 */
92 90
93 size_t RWops_ogg_read(void *ptr, size_t size, size_t nmemb, void *datasource) 91 static size_t RWops_ogg_read(void *ptr, size_t size, size_t nmemb, void *datasource)
94 { 92 {
95 return((size_t) SDL_RWread((SDL_RWops *) datasource, ptr, size, nmemb)); 93 return((size_t) SDL_RWread((SDL_RWops *) datasource, ptr, size, nmemb));
96 } /* RWops_ogg_read */ 94 } /* RWops_ogg_read */
97 95
98 int RWops_ogg_seek(void *datasource, int64_t offset, int whence) 96 static int RWops_ogg_seek(void *datasource, int64_t offset, int whence)
99 { 97 {
100 return(SDL_RWseek((SDL_RWops *) datasource, offset, whence)); 98 return(SDL_RWseek((SDL_RWops *) datasource, offset, whence));
101 } /* RWops_ogg_seek */ 99 } /* RWops_ogg_seek */
102 100
103 int RWops_ogg_close(void *datasource) 101 static int RWops_ogg_close(void *datasource)
104 { 102 {
105 /* do nothing; SDL_sound will delete the RWops at a higher level. */ 103 /* do nothing; SDL_sound will delete the RWops at a higher level. */
106 return(0); /* this is success in fclose(), so I guess that's okay. */ 104 return(0); /* this is success in fclose(), so I guess that's okay. */
107 } /* RWops_ogg_close */ 105 } /* RWops_ogg_close */
108 106
109 long RWops_ogg_tell(void *datasource) 107 static long RWops_ogg_tell(void *datasource)
110 { 108 {
111 return((long) SDL_RWtell((SDL_RWops *) datasource)); 109 return((long) SDL_RWtell((SDL_RWops *) datasource));
112 } /* RWops_ogg_tell */ 110 } /* RWops_ogg_tell */
113 111
114 static const ov_callbacks RWops_ogg_callbacks = 112 static const ov_callbacks RWops_ogg_callbacks =
256 sample->flags |= SOUND_SAMPLEFLAG_EAGAIN; 254 sample->flags |= SOUND_SAMPLEFLAG_EAGAIN;
257 255
258 return((Uint32) rc); 256 return((Uint32) rc);
259 } /* OGG_read */ 257 } /* OGG_read */
260 258
259 #endif /* SOUND_SUPPORTS_OGG */
260
261
261 /* end of ogg.c ... */ 262 /* end of ogg.c ... */
262 263