[MPlayer-dev-eng] [PATCH] aos should respect immed uninit flag

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Feb 17 17:05:40 CET 2005


Hi,
this patch has been lurking quite some time under
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=165 .
What do you think of it? Can it be applied? As-is or any corrections
needed?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libao2/ao_alsa.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_alsa.c,v
retrieving revision 1.10
diff -u -r1.10 ao_alsa.c
--- libao2/ao_alsa.c	7 Dec 2004 02:24:15 -0000	1.10
+++ libao2/ao_alsa.c	19 Dec 2004 14:35:49 -0000
@@ -741,6 +741,9 @@
   if (alsa_handler) {
     int err;
 
+    if (!immed)
+      snd_pcm_drain(alsa_handler);
+
     if (!ao_noblock) {
       if ((err = snd_pcm_drop(alsa_handler)) < 0)
 	{
Index: libao2/ao_dsound.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_dsound.c,v
retrieving revision 1.5
diff -u -r1.5 ao_dsound.c
--- libao2/ao_dsound.c	8 Dec 2004 09:52:55 -0000	1.5
+++ libao2/ao_dsound.c	19 Dec 2004 14:35:51 -0000
@@ -495,6 +495,7 @@
 */
 static void uninit(int immed)
 {
+	if (immed)
 	reset();
 	DestroyBuffer();
 	UninitDirectSound();
Index: libao2/ao_nas.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_nas.c,v
retrieving revision 1.16
diff -u -r1.16 ao_nas.c
--- libao2/ao_nas.c	7 Dec 2004 02:24:15 -0000	1.16
+++ libao2/ao_nas.c	19 Dec 2004 14:35:52 -0000
@@ -481,6 +481,7 @@
 	mp_msg(MSGT_AO, MSGL_DBG3, "ao_nas: uninit()\n");
 
 	nas_data->expect_underrun = 1;
+	if (!immed)
 	while (nas_data->state != AuStateStop) usleep(1000);
 	nas_data->stop_thread = 1;
 	pthread_join(nas_data->event_thread, NULL);
Index: libao2/ao_sdl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_sdl.c,v
retrieving revision 1.38
diff -u -r1.38 ao_sdl.c
--- libao2/ao_sdl.c	7 Dec 2004 02:24:15 -0000	1.38
+++ libao2/ao_sdl.c	19 Dec 2004 14:35:53 -0000
@@ -293,8 +293,7 @@
 static void uninit(int immed){
 	mp_msg(MSGT_AO,MSGL_V,"SDL: Audio Subsystem shutting down!\n");
 	if (!immed)
-	while(buf_free() < BUFFSIZE - CHUNK_SIZE)
-		usec_sleep(50000);
+	  usec_sleep(get_delay() * 1000 * 1000);
 	SDL_CloseAudio();
 	SDL_QuitSubSystem(SDL_INIT_AUDIO);
 }
Index: libao2/ao_sgi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_sgi.c,v
retrieving revision 1.8
diff -u -r1.8 ao_sgi.c
--- libao2/ao_sgi.c	7 Dec 2004 02:24:15 -0000	1.8
+++ libao2/ao_sgi.c	19 Dec 2004 14:35:54 -0000
@@ -126,6 +126,7 @@
   mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_Uninit);
 
   if (ao_port) {
+    if (!immed)
     while(alGetFilled(ao_port) > 0) sginap(1);  
     alClosePort(ao_port);
     alFreeConfig(ao_config);


More information about the MPlayer-dev-eng mailing list