Update of /cvsroot/mplayer/main/libao2 In directory usw-pr-cvs1:/tmp/cvs-serv10721 Modified Files: ao_sdl.c Log Message: Better audio format handling. Index: ao_sdl.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_sdl.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** ao_sdl.c 2001/06/05 18:40:44 1.8 --- ao_sdl.c 2001/06/09 07:36:32 1.9 *************** *** 16,19 **** --- 16,20 ---- #include "audio_out.h" #include "audio_out_internal.h" + #include "afmt.h" #include "../libvo/fastmemcpy.h" *************** *** 47,51 **** #define BUFFSIZE 4096 ! #define NUM_BUFS 16 static unsigned char *buffer[NUM_BUFS]; --- 48,52 ---- #define BUFFSIZE 4096 ! #define NUM_BUFS 16 static unsigned char *buffer[NUM_BUFS]; *************** *** 133,137 **** --- 134,141 ---- void outputaudio(void *unused, Uint8 *stream, int len) { //SDL_MixAudio(stream, read_buffer(buffers, len), len, SDL_MIX_MAXVOLUME); + //if(!full_buffers) printf("SDL: Buffer underrun!\n"); + read_buffer(stream, len); + //printf("SDL: Full Buffers: %i\n", full_buffers); } *************** *** 155,164 **** /* The desired audio frequency in samples-per-second. */ aspec.freq = rate; - /* The desired audio format (see SDL_AudioSpec) */ - aspec.format = (format == 16) ? AUDIO_S16 : AUDIO_U8; - /* Number of channels (mono/stereo) */ aspec.channels = channels; --- 159,190 ---- + /* The desired audio format (see SDL_AudioSpec) */ + switch(format) { + case AFMT_U8: + aspec.format = AUDIO_U8; + break; + case AFMT_S16_LE: + aspec.format = AUDIO_S16LSB; + break; + case AFMT_S16_BE: + aspec.format = AUDIO_S16MSB; + break; + case AFMT_S8: + aspec.format = AUDIO_S8; + break; + case AFMT_U16_LE: + aspec.format = AUDIO_U16LSB; + break; + case AFMT_U16_BE: + aspec.format = AUDIO_U16MSB; + break; + default: + printf("SDL: Unsupported audio format: 0x%x.\n", format); + return 0; + } + /* The desired audio frequency in samples-per-second. */ aspec.freq = rate; /* Number of channels (mono/stereo) */ aspec.channels = channels; *************** *** 204,208 **** // stop playing and empty buffers (for seeking/pause) static void reset(){ ! /* Reset ring-buffer state */ buf_read=0; --- 230,236 ---- // stop playing and empty buffers (for seeking/pause) static void reset(){ ! ! //printf("SDL: reset called!\n"); ! /* Reset ring-buffer state */ buf_read=0; _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog