CVS: main/libao2 Makefile,1.4,1.5 ao_alsa5.c,1.1,1.2 ao_null.c,1.2,1.3 ao_oss.c,1.3,1.4 ao_sdl.c,1.7,1.8 audio_out.c,1.5,1.6 audio_out.h,1.1,1.2 audio_out_internal.h,1.1,1.2
Update of /cvsroot/mplayer/main/libao2 In directory usw-pr-cvs1:/tmp/cvs-serv7869/libao2 Modified Files: Makefile ao_alsa5.c ao_null.c ao_oss.c ao_sdl.c audio_out.c audio_out.h audio_out_internal.h Log Message: applied solaris8/netbsd/other fixes patch by Jürgen Keil <jk@tools.de> Index: Makefile =================================================================== RCS file: /cvsroot/mplayer/main/libao2/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Makefile 2001/06/04 21:00:47 1.4 --- Makefile 2001/06/05 18:40:44 1.5 *************** *** 5,12 **** # TODO: moveout ao_sdl.c so it's only used when SDL is detected ! SRCS=audio_out.c ao_oss.c ao_null.c $(OPTIONAL_SRCS) OBJS=$(SRCS:.c=.o) ! CFLAGS = $(OPTFLAGS) -I. -I.. # -I/usr/X11R6/include/ --- 5,12 ---- # TODO: moveout ao_sdl.c so it's only used when SDL is detected ! SRCS=audio_out.c ao_null.c $(OPTIONAL_SRCS) OBJS=$(SRCS:.c=.o) ! CFLAGS = $(OPTFLAGS) -I. -I.. $(SDL_INC) # -I/usr/X11R6/include/ Index: ao_alsa5.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_alsa5.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ao_alsa5.c 2001/06/04 17:42:09 1.1 --- ao_alsa5.c 2001/06/05 18:40:44 1.2 *************** *** 266,269 **** --- 266,281 ---- } + /* stop playing, keep buffers (for pause) */ + static void audio_pause() + { + /* for now, just call reset(); */ + reset(); + } + + /* resume playing, after audio_pause() */ + static void audio_resume() + { + } + /* plays 'len' bytes of 'data' Index: ao_null.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_null.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ao_null.c 2001/06/04 19:33:28 1.2 --- ao_null.c 2001/06/05 18:40:44 1.3 *************** *** 47,50 **** --- 47,62 ---- } + // stop playing, keep buffers (for pause) + static void audio_pause() + { + // for now, just call reset(); + reset(); + } + + // resume playing, after audio_pause() + static void audio_resume() + { + } + // return: how many bytes can be played without blocking static int get_space(){ Index: ao_oss.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_oss.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ao_oss.c 2001/06/05 02:26:56 1.3 --- ao_oss.c 2001/06/05 18:40:44 1.4 *************** *** 8,16 **** #include <sys/stat.h> #include <fcntl.h> - #ifdef __sun - #include <sys/audioio.h> - #else #include <sys/soundcard.h> - #endif #include "../config.h" --- 8,12 ---- *************** *** 37,47 **** // ao_buffersize - #ifdef __sun - static char *dsp="/dev/audio"; - static int queued_bursts = 0; - #else static char *dsp="/dev/dsp"; static audio_buf_info zz; - #endif static int audio_fd=-1; --- 33,38 ---- *************** *** 70,89 **** } - #ifdef __sun - { - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - ioctl(audio_fd, AUDIO_DRAIN, 0); - info.play.encoding = ao_format = format; - info.play.precision = (format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8); - info.play.channels = ao_channels = channels; - --ao_channels; - info.play.sample_rate = ao_samplerate = rate; - if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0) - printf("audio_setup: your card doesn't support %d Hz samplerate\n",rate); - ao_outburst=8192; - queued_bursts = 0; - } - #else ao_format=format; ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format); --- 61,64 ---- *************** *** 113,117 **** ao_outburst=zz.fragsize; } - #endif if(ao_buffersize==-1){ --- 88,91 ---- *************** *** 136,142 **** return 0; } - #ifdef __sun - ioctl(audio_fd, AUDIO_DRAIN, 0); - #endif #endif } --- 110,113 ---- *************** *** 162,185 **** } - #ifdef __sun - { - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - ioctl(audio_fd, AUDIO_DRAIN, 0); - info.play.encoding = ao_format; - info.play.precision = (ao_format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8); - info.play.channels = ao_channels+1; - info.play.sample_rate = ao_samplerate; - ioctl (audio_fd, AUDIO_SETINFO, &info); - queued_bursts = 0; - } - #else ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format); ioctl (audio_fd, SNDCTL_DSP_STEREO, &ao_channels); ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_samplerate); - #endif } // return: how many bytes can be played without blocking static int get_space(){ --- 133,155 ---- } ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format); ioctl (audio_fd, SNDCTL_DSP_STEREO, &ao_channels); ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_samplerate); } + // stop playing, keep buffers (for pause) + static void audio_pause() + { + // for now, just call reset(); + reset(); + } + + // resume playing, after audio_pause() + static void audio_resume() + { + } + + // return: how many bytes can be played without blocking static int get_space(){ *************** *** 205,216 **** #endif - #ifdef __sun - { - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - if(queued_bursts - info.play.eof > 2) - return 0; - } - #endif return ao_outburst; } --- 175,178 ---- *************** *** 222,231 **** len/=ao_outburst; len=write(audio_fd,data,len*ao_outburst); - #ifdef __sun - if(len>0) { - queued_bursts ++; - write(audio_fd,data,0); - } - #endif return len; } --- 184,187 ---- *************** *** 235,246 **** // return: how many unplayed bytes are in the buffer static int get_delay(){ - #ifdef __sun - { - int q; - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - return (queued_bursts - info.play.eof) * ao_outburst; - } - #else if(audio_delay_method==2){ // --- 191,194 ---- *************** *** 257,261 **** } return ao_buffersize; - #endif } --- 205,208 ---- Index: ao_sdl.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_sdl.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** ao_sdl.c 2001/06/04 14:56:32 1.7 --- ao_sdl.c 2001/06/05 18:40:44 1.8 *************** *** 12,15 **** --- 12,16 ---- #include <stdio.h> + #include <stdlib.h> #include "audio_out.h" *************** *** 58,61 **** --- 59,63 ---- static int buffered_bytes=0; + static int write_buffer(unsigned char* data,int len){ int len2=0; *************** *** 106,109 **** --- 108,128 ---- #endif + #if defined(sun) && defined(__svr4__) + /* setenv is missing on solaris */ + static void setenv(const char *name, const char *val, int _xx) + { + int len = strlen(name) + strlen(val) + 2; + char *env = malloc(len); + + if (env != NULL) { + strcpy(env, name); + strcat(env, "="); + strcat(env, val); + putenv(env); + } + } + #endif + + // to set/get/query special features/parameters static int control(int cmd,int arg){ *************** *** 196,199 **** --- 215,231 ---- } + + // stop playing, keep buffers (for pause) + static void audio_pause() + { + // for now, just call reset(); + reset(); + } + + // resume playing, after audio_pause() + static void audio_resume() + { + } + // return: how many bytes can be played without blocking Index: audio_out.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/audio_out.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** audio_out.c 2001/06/05 10:37:50 1.5 --- audio_out.c 2001/06/05 18:40:44 1.6 *************** *** 6,11 **** --- 6,34 ---- #include "audio_out.h" + #ifdef USE_OSS_AUDIO #include <sys/soundcard.h> /* AFMT_* */ + #endif + + + #ifndef AFMT_U8 + # define AFMT_MU_LAW 0x00000001 + # define AFMT_A_LAW 0x00000002 + # define AFMT_IMA_ADPCM 0x00000004 + # define AFMT_U8 0x00000008 + # define AFMT_S16_LE 0x00000010 /* Little endian signed + 16*/ + # define AFMT_S16_BE 0x00000020 /* Big endian signed 16 + */ + # define AFMT_S8 0x00000040 + # define AFMT_U16_LE 0x00000080 /* Little endian U16 */ + # define AFMT_U16_BE 0x00000100 /* Big endian U16 */ + # define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ + + /* 32 bit formats (MSB aligned) formats */ + # define AFMT_S32_LE 0x00001000 + # define AFMT_S32_BE 0x00002000 + #endif + // there are some globals: int ao_samplerate=0; *************** *** 16,20 **** --- 39,45 ---- int ao_buffersize=-1; + #ifdef USE_OSS_AUDIO extern ao_functions_t audio_out_oss; + #endif //extern ao_functions_t audio_out_ossold; extern ao_functions_t audio_out_null; *************** *** 33,40 **** --- 58,70 ---- extern ao_functions_t audio_out_sdl; #endif + #ifdef USE_SUN_AUDIO + extern ao_functions_t audio_out_sun; + #endif ao_functions_t* audio_out_drivers[] = { + #ifdef USE_OSS_AUDIO &audio_out_oss, + #endif &audio_out_null, #ifdef HAVE_ALSA5 *************** *** 51,54 **** --- 81,87 ---- #ifdef HAVE_SDL &audio_out_sdl, + #endif + #ifdef USE_SUN_AUDIO + &audio_out_sun, #endif NULL Index: audio_out.h =================================================================== RCS file: /cvsroot/mplayer/main/libao2/audio_out.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** audio_out.h 2001/06/02 23:25:43 1.1 --- audio_out.h 2001/06/05 18:40:44 1.2 *************** *** 44,47 **** --- 44,55 ---- int (*get_delay)(); + /* + */ + void (*pause)(); + + /* + */ + void (*resume)(); + } ao_functions_t; Index: audio_out_internal.h =================================================================== RCS file: /cvsroot/mplayer/main/libao2/audio_out_internal.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** audio_out_internal.h 2001/06/02 23:25:43 1.1 --- audio_out_internal.h 2001/06/05 18:40:44 1.2 *************** *** 9,12 **** --- 9,14 ---- static int play(void* data,int len,int flags); static int get_delay(); + static void audio_pause(); + static void audio_resume(); #define LIBAO_EXTERN(x) ao_functions_t audio_out_##x =\ *************** *** 19,23 **** get_space,\ play,\ ! get_delay\ }; --- 21,27 ---- get_space,\ play,\ ! get_delay,\ ! audio_pause,\ ! audio_resume\ }; _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
participants (1)
-
GEREOFFY