summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-01-21 13:22:59 +0000
committerfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-01-21 13:22:59 +0000
commit4643b6100a1eb073f983d73a9c07598041321434 (patch)
treeefeb6e7f904e9c97b1459ce8f069932369abc2a8 /libao2
parent2da6f4ed1e7a74a16bb3d998bef7bba703d11c08 (diff)
downloadmpv-4643b6100a1eb073f983d73a9c07598041321434.tar.bz2
mpv-4643b6100a1eb073f983d73a9c07598041321434.tar.xz
support immed flag, always initialize write_offset, min_free_space doesn't seem to be required anymore after Florian Dietrichs patches
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14556 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_dsound.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c
index 7c3ca479fe..d004decbab 100644
--- a/libao2/ao_dsound.c
+++ b/libao2/ao_dsound.c
@@ -114,7 +114,7 @@ static LPDIRECTSOUNDBUFFER hdspribuf = NULL; ///primary direct sound buffer
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 @@ static int init(int rate, int channels, int format, int flags)
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 @@ static void audio_resume()
/**
\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();
}