summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-26 09:21:07 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-26 09:21:07 +0000
commit309e81bcee08bef5fd0f0f3bb2e22bd0b1a4e282 (patch)
tree3df4c1ad0c7403db4192281f1f6c3b1abf6cec6e /libao2
parentba3c4568fb1ac38da3cc3b098434ac399ba7bb7d (diff)
downloadmpv-309e81bcee08bef5fd0f0f3bb2e22bd0b1a4e282.tar.bz2
mpv-309e81bcee08bef5fd0f0f3bb2e22bd0b1a4e282.tar.xz
make the internal sdl mixer optional, idea by Reimar Doffinger
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12674 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_sdl.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c
index c5687ae950..27393b4dd7 100644
--- a/libao2/ao_sdl.c
+++ b/libao2/ao_sdl.c
@@ -35,6 +35,9 @@ static ao_info_t info =
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_read=0;
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 @@ static int read_buffer(unsigned char* data,int len){
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 @@ static void setenv(const char *name, const char *val, int _xx)
// 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 @@ static int control(int cmd,void *arg){
return CONTROL_OK;
}
}
- return -1;
+#endif
+ return CONTROL_UNKNOWN;
}
// SDL Callback function