comparison libao2/ao_sdl.c @ 1038:b36fb1ae4b53

applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
author arpi_esp
date Tue, 05 Jun 2001 18:40:44 +0000
parents dfa641c44d4a
children aecab161d8d6
comparison
equal deleted inserted replaced
1037:2767682b85de 1038:b36fb1ae4b53
9 * Thanks to Arpi for nice ringbuffer-code! 9 * Thanks to Arpi for nice ringbuffer-code!
10 * 10 *
11 */ 11 */
12 12
13 #include <stdio.h> 13 #include <stdio.h>
14 #include <stdlib.h>
14 15
15 #include "audio_out.h" 16 #include "audio_out.h"
16 #include "audio_out_internal.h" 17 #include "audio_out_internal.h"
17 18
18 #include "../libvo/fastmemcpy.h" 19 #include "../libvo/fastmemcpy.h"
54 static unsigned int buf_read_pos=0; 55 static unsigned int buf_read_pos=0;
55 static unsigned int buf_write_pos=0; 56 static unsigned int buf_write_pos=0;
56 57
57 static int full_buffers=0; 58 static int full_buffers=0;
58 static int buffered_bytes=0; 59 static int buffered_bytes=0;
60
59 61
60 static int write_buffer(unsigned char* data,int len){ 62 static int write_buffer(unsigned char* data,int len){
61 int len2=0; 63 int len2=0;
62 int x; 64 int x;
63 while(len>0){ 65 while(len>0){
103 #include <SDL11/SDL.h> 105 #include <SDL11/SDL.h>
104 #else 106 #else
105 #include <SDL/SDL.h> 107 #include <SDL/SDL.h>
106 #endif 108 #endif
107 109
110 #if defined(sun) && defined(__svr4__)
111 /* setenv is missing on solaris */
112 static void setenv(const char *name, const char *val, int _xx)
113 {
114 int len = strlen(name) + strlen(val) + 2;
115 char *env = malloc(len);
116
117 if (env != NULL) {
118 strcpy(env, name);
119 strcat(env, "=");
120 strcat(env, val);
121 putenv(env);
122 }
123 }
124 #endif
125
126
108 // to set/get/query special features/parameters 127 // to set/get/query special features/parameters
109 static int control(int cmd,int arg){ 128 static int control(int cmd,int arg){
110 return -1; 129 return -1;
111 } 130 }
112 131
194 full_buffers=0; 213 full_buffers=0;
195 buffered_bytes=0; 214 buffered_bytes=0;
196 215
197 } 216 }
198 217
218 // stop playing, keep buffers (for pause)
219 static void audio_pause()
220 {
221 // for now, just call reset();
222 reset();
223 }
224
225 // resume playing, after audio_pause()
226 static void audio_resume()
227 {
228 }
229
230
199 // return: how many bytes can be played without blocking 231 // return: how many bytes can be played without blocking
200 static int get_space(){ 232 static int get_space(){
201 return (NUM_BUFS-full_buffers)*BUFFSIZE - buf_write_pos; 233 return (NUM_BUFS-full_buffers)*BUFFSIZE - buf_write_pos;
202 } 234 }
203 235