[MPlayer-dev-eng] [RFC][PATCH 5/8] ao sdl: Remove deactivated code to use SDL_MixAudio

Alexander Strasser eclipse7 at gmx.net
Thu Apr 4 01:40:14 EEST 2024


The code probably wasn't actively used as the in the ao_sdl.c
it was deactivated directly by:

    #undef USE_SDL_INTERNAL_MIXER

So people had to actively edit the source code to use it.
---
 libao2/ao_sdl.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)

diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c
index 5c2c188c3..f583e770a 100644
--- a/libao2/ao_sdl.c
+++ b/libao2/ao_sdl.c
@@ -51,9 +51,6 @@ static const 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
 #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__AMIGAOS4__)
 #define SAMPLESIZE 2048
@@ -67,30 +64,16 @@ LIBAO_EXTERN(sdl)

 static AVFifoBuffer *buffer;

-#ifdef USE_SDL_INTERNAL_MIXER
-static unsigned char volume=SDL_MIX_MAXVOLUME;
-#endif
-
 static int write_buffer(unsigned char* data,int len){
   int free = av_fifo_space(buffer);
   if (len > free) len = free;
   return av_fifo_generic_write(buffer, data, len, NULL);
 }

-#ifdef USE_SDL_INTERNAL_MIXER
-static void mix_audio(void *dst, void *src, int len) {
-  SDL_MixAudio(dst, src, len, volume);
-}
-#endif
-
 static int read_buffer(unsigned char* data,int len){
   int buffered = av_fifo_size(buffer);
   if (len > buffered) len = buffered;
-#ifdef USE_SDL_INTERNAL_MIXER
-  av_fifo_generic_read(buffer, data, len, mix_audio);
-#else
   av_fifo_generic_read(buffer, data, len, NULL);
-#endif
   return len;
 }

@@ -99,24 +82,6 @@ static int read_buffer(unsigned char* data,int len){

 // 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:
-		{
-			ao_control_vol_t* vol = (ao_control_vol_t*)arg;
-			vol->left = vol->right = volume * 100 / SDL_MIX_MAXVOLUME;
-			return CONTROL_OK;
-		}
-		case AOCONTROL_SET_VOLUME:
-		{
-			int diff;
-			ao_control_vol_t* vol = (ao_control_vol_t*)arg;
-			diff = (vol->left+vol->right) / 2;
-			volume = diff * SDL_MIX_MAXVOLUME / 100;
-			return CONTROL_OK;
-		}
-	}
-#endif
 	return CONTROL_UNKNOWN;
 }

--


More information about the MPlayer-dev-eng mailing list