[MPlayer-cvslog] CVS: main/libao2 ao_dsound.c,1.10,1.11

Sascha Sommer CVS syncmail at mplayerhq.hu
Fri Jan 21 14:23:01 CET 2005


CVS change done by Sascha Sommer CVS

Update of /cvsroot/mplayer/main/libao2
In directory mail:/var2/tmp/cvs-serv18429/libao2

Modified Files:
	ao_dsound.c 
Log Message:
support immed flag, always initialize write_offset, min_free_space doesn't seem to be required anymore after Florian Dietrichs patches

Index: ao_dsound.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_dsound.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ao_dsound.c	12 Jan 2005 22:00:02 -0000	1.10
+++ ao_dsound.c	21 Jan 2005 13:22:59 -0000	1.11
@@ -114,7 +114,7 @@
 static LPDIRECTSOUNDBUFFER hdsbuf = NULL; ///secondary direct sound buffer (stream buffer)
 static int buffer_size = 0;               ///size in bytes of the direct sound buffer   
 static int write_offset = 0;              ///offset of the write cursor in the direct sound buffer
-static int min_free_space = 4096;         ///if the free space is below this value get_space() will return 0
+static int min_free_space = 0;            ///if the free space is below this value get_space() will return 0
 static int device_num = 0;                ///wanted device number
 static GUID device;                       ///guid of the device 
 
@@ -481,6 +481,7 @@
 	dsbdesc.dwBufferBytes = ao_data.buffersize;
 	dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&wformat;
 	buffer_size = dsbdesc.dwBufferBytes;
+	write_offset = 0;
 	ao_data.outburst = wformat.Format.nBlockAlign * 512;
 
 	// create primary buffer and set its format
@@ -546,11 +547,17 @@
 
 /** 
 \brief close audio device
-\param immed stop playback immediately, currently not supported
+\param immed stop playback immediately
 */
 static void uninit(int immed)
 {
-	reset();
+	if(immed)reset();
+	else{
+		DWORD status;
+		IDirectSoundBuffer_Play(hdsbuf, 0, 0, 0);
+		while(!IDirectSoundBuffer_GetStatus(hdsbuf,&status) && (status&DSBSTATUS_PLAYING))
+			usec_sleep(20000);
+	}
 	DestroyBuffer();
 	UninitDirectSound();
 }




More information about the MPlayer-cvslog mailing list