Mercurial > mplayer.hg
comparison libao2/ao_sdl.c @ 14245:815f03b7cee5
removing AFMT_ dependancy
author | alex |
---|---|
date | Mon, 27 Dec 2004 17:30:15 +0000 |
parents | a92101a7eb49 |
children | cb5fbade8a5c |
comparison
equal
deleted
inserted
replaced
14244:9b03ad0254ae | 14245:815f03b7cee5 |
---|---|
18 #include "mp_msg.h" | 18 #include "mp_msg.h" |
19 #include "help_mp.h" | 19 #include "help_mp.h" |
20 | 20 |
21 #include "audio_out.h" | 21 #include "audio_out.h" |
22 #include "audio_out_internal.h" | 22 #include "audio_out_internal.h" |
23 #include "afmt.h" | 23 #include "libaf/af_format.h" |
24 #include <SDL.h> | 24 #include <SDL.h> |
25 #include "osdep/timer.h" | 25 #include "osdep/timer.h" |
26 | 26 |
27 #include "libvo/fastmemcpy.h" | 27 #include "libvo/fastmemcpy.h" |
28 | 28 |
179 SDL_AudioSpec aspec, obtained; | 179 SDL_AudioSpec aspec, obtained; |
180 | 180 |
181 /* Allocate ring-buffer memory */ | 181 /* Allocate ring-buffer memory */ |
182 buffer = (unsigned char *) malloc(BUFFSIZE); | 182 buffer = (unsigned char *) malloc(BUFFSIZE); |
183 | 183 |
184 mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); | 184 // mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); |
185 | 185 |
186 if(ao_subdevice) { | 186 if(ao_subdevice) { |
187 setenv("SDL_AUDIODRIVER", ao_subdevice, 1); | 187 setenv("SDL_AUDIODRIVER", ao_subdevice, 1); |
188 mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_DriverInfo, ao_subdevice); | 188 mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_DriverInfo, ao_subdevice); |
189 } | 189 } |
191 ao_data.channels=channels; | 191 ao_data.channels=channels; |
192 ao_data.samplerate=rate; | 192 ao_data.samplerate=rate; |
193 ao_data.format=format; | 193 ao_data.format=format; |
194 | 194 |
195 ao_data.bps=channels*rate; | 195 ao_data.bps=channels*rate; |
196 if(format != AFMT_U8 && format != AFMT_S8) | 196 if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) |
197 ao_data.bps*=2; | 197 ao_data.bps*=2; |
198 | 198 |
199 /* The desired audio format (see SDL_AudioSpec) */ | 199 /* The desired audio format (see SDL_AudioSpec) */ |
200 switch(format) { | 200 switch(format) { |
201 case AFMT_U8: | 201 case AF_FORMAT_U8: |
202 aspec.format = AUDIO_U8; | 202 aspec.format = AUDIO_U8; |
203 break; | 203 break; |
204 case AFMT_S16_LE: | 204 case AF_FORMAT_S16_LE: |
205 aspec.format = AUDIO_S16LSB; | 205 aspec.format = AUDIO_S16LSB; |
206 break; | 206 break; |
207 case AFMT_S16_BE: | 207 case AF_FORMAT_S16_BE: |
208 aspec.format = AUDIO_S16MSB; | 208 aspec.format = AUDIO_S16MSB; |
209 break; | 209 break; |
210 case AFMT_S8: | 210 case AF_FORMAT_S8: |
211 aspec.format = AUDIO_S8; | 211 aspec.format = AUDIO_S8; |
212 break; | 212 break; |
213 case AFMT_U16_LE: | 213 case AF_FORMAT_U16_LE: |
214 aspec.format = AUDIO_U16LSB; | 214 aspec.format = AUDIO_U16LSB; |
215 break; | 215 break; |
216 case AFMT_U16_BE: | 216 case AF_FORMAT_U16_BE: |
217 aspec.format = AUDIO_U16MSB; | 217 aspec.format = AUDIO_U16MSB; |
218 break; | 218 break; |
219 default: | 219 default: |
220 aspec.format = AUDIO_S16LSB; | 220 aspec.format = AUDIO_S16LSB; |
221 ao_data.format = AFMT_S16_LE; | 221 ao_data.format = AF_FORMAT_S16_LE; |
222 mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, format); | 222 mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, format); |
223 } | 223 } |
224 | 224 |
225 /* The desired audio frequency in samples-per-second. */ | 225 /* The desired audio frequency in samples-per-second. */ |
226 aspec.freq = rate; | 226 aspec.freq = rate; |
254 ao_data.channels=obtained.channels; | 254 ao_data.channels=obtained.channels; |
255 ao_data.samplerate=obtained.freq; | 255 ao_data.samplerate=obtained.freq; |
256 | 256 |
257 switch(obtained.format) { | 257 switch(obtained.format) { |
258 case AUDIO_U8 : | 258 case AUDIO_U8 : |
259 ao_data.format = AFMT_U8; | 259 ao_data.format = AF_FORMAT_U8; |
260 break; | 260 break; |
261 case AUDIO_S16LSB : | 261 case AUDIO_S16LSB : |
262 ao_data.format = AFMT_S16_LE; | 262 ao_data.format = AF_FORMAT_S16_LE; |
263 break; | 263 break; |
264 case AUDIO_S16MSB : | 264 case AUDIO_S16MSB : |
265 ao_data.format = AFMT_S16_BE; | 265 ao_data.format = AF_FORMAT_S16_BE; |
266 break; | 266 break; |
267 case AUDIO_S8 : | 267 case AUDIO_S8 : |
268 ao_data.format = AFMT_S8; | 268 ao_data.format = AF_FORMAT_S8; |
269 break; | 269 break; |
270 case AUDIO_U16LSB : | 270 case AUDIO_U16LSB : |
271 ao_data.format = AFMT_U16_LE; | 271 ao_data.format = AF_FORMAT_U16_LE; |
272 break; | 272 break; |
273 case AUDIO_U16MSB : | 273 case AUDIO_U16MSB : |
274 ao_data.format = AFMT_U16_BE; | 274 ao_data.format = AF_FORMAT_U16_BE; |
275 break; | 275 break; |
276 default: | 276 default: |
277 mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, obtained.format); | 277 mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, obtained.format); |
278 return 0; | 278 return 0; |
279 } | 279 } |