[MPlayer-cvslog] r28853 - trunk/libao2/ao_win32.c

reimar subversion at mplayerhq.hu
Fri Mar 6 19:50:50 CET 2009


Author: reimar
Date: Fri Mar  6 19:50:50 2009
New Revision: 28853

Log:
Always write full buffers in ao_win32, except for the last block.

Modified:
   trunk/libao2/ao_win32.c

Modified: trunk/libao2/ao_win32.c
==============================================================================
--- trunk/libao2/ao_win32.c	Fri Mar  6 17:27:31 2009	(r28852)
+++ trunk/libao2/ao_win32.c	Fri Mar  6 19:50:50 2009	(r28853)
@@ -172,6 +172,7 @@ static int init(int rate,int channels,in
 	ao_data.bps=channels*rate;
 	if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8)
 	  ao_data.bps*=2;
+	ao_data.outburst = BUFFER_SIZE;
 	if(ao_data.buffersize==-1)
 	{
 		ao_data.buffersize=af_fmt2bits(format)/8;
@@ -298,22 +299,18 @@ static int write_waveOutBuffer(unsigned 
     //unprepare the header if it is prepared
 	if(current->dwFlags & WHDR_PREPARED) 
            waveOutUnprepareHeader(hWaveOut, current, sizeof(WAVEHDR));
-	x=BUFFER_SIZE-buf_write_pos;          
+	x=BUFFER_SIZE;          
     if(x>len) x=len;                   
     fast_memcpy(current->lpData+buf_write_pos,data+len2,x); 
-    if(buf_write_pos==0)full_buffers++;
+    full_buffers++;
     len2+=x; len-=x;                 
-	buffered_bytes+=x; buf_write_pos+=x; 
+	buffered_bytes+=x;
 	//prepare header and write data to device
-	current->dwBufferLength = buf_write_pos;
+	current->dwBufferLength = x;
 	waveOutPrepareHeader(hWaveOut, current, sizeof(WAVEHDR));
 	waveOutWrite(hWaveOut, current, sizeof(WAVEHDR));
     
-	if(buf_write_pos>=BUFFER_SIZE){        //buffer is full find next
-       // block is full, find next!
        buf_write=(buf_write+1)%BUFFER_COUNT;  
-	   buf_write_pos=0;                 
-    }                                 
   }
   return len2;
 }



More information about the MPlayer-cvslog mailing list