[MPlayer-cvslog] CVS: main/libao2 ao_dsound.c,1.11,1.12
Sascha Sommer CVS
syncmail at mplayerhq.hu
Tue Mar 15 17:29:20 CET 2005
CVS change done by Sascha Sommer CVS
Update of /cvsroot/mplayer/main/libao2
In directory mail:/var2/tmp/cvs-serv9729/libao2
Modified Files:
ao_dsound.c
Log Message:
get_space fix by Florian Dietrich <flodt8 at yahoo.de>
Index: ao_dsound.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_dsound.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ao_dsound.c 21 Jan 2005 13:22:59 -0000 1.11
+++ ao_dsound.c 15 Mar 2005 16:29:18 -0000 1.12
@@ -115,6 +115,9 @@
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 = 0; ///if the free space is below this value get_space() will return 0
+ ///there will always be at least this amout of free space to prevent
+ ///get_space() from returning wrong values when buffer is 100% full.
+ ///will be replaced with nBlockAlign in init()
static int device_num = 0; ///wanted device number
static GUID device; ///guid of the device
@@ -482,6 +485,7 @@
dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&wformat;
buffer_size = dsbdesc.dwBufferBytes;
write_offset = 0;
+ min_free_space = wformat.Format.nBlockAlign;
ao_data.outburst = wformat.Format.nBlockAlign * 512;
// create primary buffer and set its format
@@ -579,7 +583,7 @@
// write_offset is the postion where we actually write the data to
if(space > buffer_size)space -= buffer_size; // write_offset < play_offset
if(space < min_free_space)return 0;
- return space;
+ return space-min_free_space;
}
/**
More information about the MPlayer-cvslog
mailing list