[Mplayer-cvslog] CVS: main/libao2 ao_sdl.c,1.31,1.32
Alex Beregszaszi
syncmail at mplayerhq.hu
Sat Jun 26 11:21:09 CEST 2004
CVS change done by Alex Beregszaszi
Update of /cvsroot/mplayer/main/libao2
In directory mail:/var2/tmp/cvs-serv21633
Modified Files:
ao_sdl.c
Log Message:
make the internal sdl mixer optional, idea by Reimar Doffinger
Index: ao_sdl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_sdl.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ao_sdl.c 7 May 2004 16:12:30 -0000 1.31
+++ ao_sdl.c 26 Jun 2004 09:21:07 -0000 1.32
@@ -35,6 +35,9 @@
LIBAO_EXTERN(sdl)
+// turn this on if you want to use the slower SDL_MixAudio
+#undef USE_SDL_INTERNAL_MIXER
+
// Samplesize used by the SDLlib AudioSpec struct
#ifdef WIN32
#define SAMPLESIZE 2048
@@ -53,7 +56,9 @@
static unsigned int buf_write=0;
static unsigned int buf_read_pos=0;
static unsigned int buf_write_pos=0;
+#ifdef USE_SDL_INTERNAL_MIXER
static unsigned char volume=SDL_MIX_MAXVOLUME;
+#endif
static int full_buffers=0;
static int buffered_bytes=0;
@@ -87,7 +92,11 @@
x=BUFFSIZE-buf_read_pos;
if(x>len) x=len;
if (x>buffered_bytes) x=buffered_bytes;
+#ifdef USE_SDL_INTERNAL_MIXER
SDL_MixAudio(data+len2,buffer[buf_read]+buf_read_pos,x,volume);
+#else
+ memcpy(data+len2,buffer[buf_read]+buf_read_pos,x);
+#endif
len2+=x; len-=x;
buffered_bytes-=x; buf_read_pos+=x;
if(buf_read_pos>=BUFFSIZE){
@@ -121,6 +130,7 @@
// to set/get/query special features/parameters
static int control(int cmd,void *arg){
+#ifdef USE_SDL_INTERNAL_MIXER
switch (cmd) {
case AOCONTROL_GET_VOLUME:
{
@@ -137,7 +147,8 @@
return CONTROL_OK;
}
}
- return -1;
+#endif
+ return CONTROL_UNKNOWN;
}
// SDL Callback function
More information about the MPlayer-cvslog
mailing list