comparison libao2/ao_oss.c @ 12145:99798c3cdb93

uninit immed flag
author alex
date Tue, 06 Apr 2004 17:55:36 +0000
parents 4e8f8efb6906
children 94ba609e53f7
comparison
equal deleted inserted replaced
12144:1226e0cbb04b 12145:99798c3cdb93
261 261
262 return 1; 262 return 1;
263 } 263 }
264 264
265 // close audio device 265 // close audio device
266 static void uninit(){ 266 static void uninit(int immed){
267 if(audio_fd == -1) return; 267 if(audio_fd == -1) return;
268 #ifdef SNDCTL_DSP_SYNC
269 // to get the buffer played
270 if (!immed)
271 ioctl(audio_fd, SNDCTL_DSP_SYNC, NULL);
272 #endif
268 #ifdef SNDCTL_DSP_RESET 273 #ifdef SNDCTL_DSP_RESET
269 ioctl(audio_fd, SNDCTL_DSP_RESET, NULL); 274 if (immed)
275 ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
270 #endif 276 #endif
271 close(audio_fd); 277 close(audio_fd);
272 audio_fd = -1; 278 audio_fd = -1;
273 } 279 }
274 280
275 // stop playing and empty buffers (for seeking/pause) 281 // stop playing and empty buffers (for seeking/pause)
276 static void reset(){ 282 static void reset(){
277 uninit(); 283 uninit(1);
278 audio_fd=open(dsp, O_WRONLY); 284 audio_fd=open(dsp, O_WRONLY);
279 if(audio_fd < 0){ 285 if(audio_fd < 0){
280 mp_msg(MSGT_AO,MSGL_ERR,"\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno)); 286 mp_msg(MSGT_AO,MSGL_ERR,"\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
281 return; 287 return;
282 } 288 }
298 } 304 }
299 305
300 // stop playing, keep buffers (for pause) 306 // stop playing, keep buffers (for pause)
301 static void audio_pause() 307 static void audio_pause()
302 { 308 {
303 uninit(); 309 uninit(1);
304 } 310 }
305 311
306 // resume playing, after audio_pause() 312 // resume playing, after audio_pause()
307 static void audio_resume() 313 static void audio_resume()
308 { 314 {