CVS: main/libao2 afmt.h,NONE,1.1 ao_alsa5.c,1.4,1.5 ao_alsa9.c,1.1,1.2 ao_oss.c,1.4,1.5 ao_sun.c,1.1,1.2 audio_out.c,1.7,1.8
Update of /cvsroot/mplayer/main/libao2 In directory usw-pr-cvs1:/tmp/cvs-serv30729 Modified Files: ao_alsa5.c ao_alsa9.c ao_oss.c ao_sun.c audio_out.c Added Files: afmt.h Log Message: fixed AFMT_ stuff (inclue afmt.h) --- NEW FILE --- /* Defines that AFMT_ stuff */ #ifdef HAVE_SYS_SOUNDCARD_H #include <sys/soundcard.h> /* For AFMT_* on linux */ #endif /* standard, old OSS audio formats */ #ifndef AFMT_MU_LAW # 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 */ #endif #ifndef AFMT_MPEG # define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ #endif #ifndef AFMT_AC3 # define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ #endif /* 32 bit formats (MSB aligned) formats */ #ifndef AFMT_S32_LE # define AFMT_S32_LE 0x00001000 # define AFMT_S32_BE 0x00002000 #endif Index: ao_alsa5.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_alsa5.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** ao_alsa5.c 2001/06/08 13:35:24 1.4 --- ao_alsa5.c 2001/06/08 23:31:06 1.5 *************** *** 8,12 **** #include <errno.h> - #include <sys/soundcard.h> /* AFMT_* */ #include <sys/asoundlib.h> --- 8,11 ---- *************** *** 15,18 **** --- 14,18 ---- #include "audio_out.h" #include "audio_out_internal.h" + #include "afmt.h" extern int verbose; Index: ao_alsa9.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_alsa9.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ao_alsa9.c 2001/06/07 15:43:47 1.1 --- ao_alsa9.c 2001/06/08 23:31:06 1.2 *************** *** 6,10 **** #include <errno.h> - #include <sys/soundcard.h> /* AFMT_* */ #include <sys/asoundlib.h> --- 6,9 ---- *************** *** 13,16 **** --- 12,16 ---- #include "audio_out.h" #include "audio_out_internal.h" + #include "afmt.h" extern int verbose; Index: ao_oss.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_oss.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** ao_oss.c 2001/06/05 18:40:44 1.4 --- ao_oss.c 2001/06/08 23:31:06 1.5 *************** *** 14,17 **** --- 14,18 ---- #include "audio_out.h" #include "audio_out_internal.h" + //#include "afmt.h" static ao_info_t info = Index: ao_sun.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_sun.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ao_sun.c 2001/06/06 19:10:47 1.1 --- ao_sun.c 2001/06/08 23:31:06 1.2 *************** *** 17,20 **** --- 17,21 ---- #include "audio_out.h" #include "audio_out_internal.h" + #include "afmt.h" static ao_info_t info = *************** *** 47,50 **** --- 48,72 ---- static int audio_fd=-1; + // convert an OSS audio format specification into a sun audio encoding + static int oss2sunfmt(int oss_format) + { + switch (oss_format){ + case AFMT_MU_LAW: + return AUDIO_ENCODING_ULAW; + case AFMT_A_LAW: + return AUDIO_ENCODING_ALAW; + case AFMT_S16_LE: + return AUDIO_ENCODING_LINEAR; + case AFMT_U8: + return AUDIO_ENCODING_LINEAR8; + #ifdef AUDIO_ENCODING_DVI // Missing on NetBSD... + case AFMT_IMA_ADPCM: + return AUDIO_ENCODING_DVI; + #endif + default: + return AUDIO_ENCODING_NONE; + } + } + // to set/get/query special features/parameters static int control(int cmd,int arg){ *************** *** 77,82 **** AUDIO_INITINFO(&info); ! 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; --- 99,104 ---- AUDIO_INITINFO(&info); ! info.play.encoding = oss2sunfmt(ao_format = format); ! info.play.precision = (format==AFMT_S16_LE? AUDIO_PRECISION_16:AUDIO_PRECISION_8); info.play.channels = ao_channels = channels; --ao_channels; *************** *** 85,92 **** info.play.eof = 0; if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0) ! printf("audio_setup: your card doesn't support %d Hz samplerate\n",rate); ! byte_per_sec = (channels ! * (format==AUDIO_ENCODING_LINEAR ? 16 : 8) ! * rate); ao_outburst=byte_per_sec > 100000 ? 16384 : 8192; queued_bursts = 0; --- 107,112 ---- info.play.eof = 0; if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0) ! printf("audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate\n",channels,audio_out_format_name(format),rate); ! byte_per_sec = (channels * info.play.precision * rate); ao_outburst=byte_per_sec > 100000 ? 16384 : 8192; queued_bursts = 0; *************** *** 114,117 **** --- 134,139 ---- } #ifdef __svr4__ + // remove the 0 bytes from the above ao_buffersize measurement from the + // audio driver's STREAMS queue ioctl(audio_fd, I_FLUSH, FLUSHW); #endif *************** *** 133,136 **** --- 155,159 ---- #ifdef __svr4__ + // throw away buffered data in the audio driver's STREAMS queue ioctl(audio_fd, I_FLUSH, FLUSHW); #endif *************** *** 145,150 **** AUDIO_INITINFO(&info); ! 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; --- 168,173 ---- AUDIO_INITINFO(&info); ! info.play.encoding = oss2sunfmt(ao_format); ! info.play.precision = (ao_format==AFMT_S16_LE? AUDIO_PRECISION_16:AUDIO_PRECISION_8); info.play.channels = ao_channels+1; info.play.sample_rate = ao_samplerate; Index: audio_out.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/audio_out.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** audio_out.c 2001/06/07 13:06:03 1.7 --- audio_out.c 2001/06/08 23:31:06 1.8 *************** *** 3,26 **** #include "../config.h" - #include "audio_out.h" ! ! #include <sys/soundcard.h> /* AFMT_* */ ! ! #ifndef SOUNCARD_H ! # 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: --- 3,8 ---- #include "../config.h" #include "audio_out.h" ! #include "afmt.h" // there are some globals: *************** *** 100,107 **** case AFMT_MPEG: return("MPEG (2) audio"); case AFMT_S32_LE: ! return("Signed 32-bit (Little-Endian"); case AFMT_S32_BE: ! return("Signed 32-bit (Big-Endian"); } return("Unknown"); --- 82,95 ---- case AFMT_MPEG: return("MPEG (2) audio"); + // the following two formats are not available with old linux kernel + // headers (e.g. in 2.2.16) + #ifdef AFMT_S32_LE case AFMT_S32_LE: ! return("Signed 32-bit (Little-Endian)"); ! #endif ! #ifdef AFMT_S32_BE case AFMT_S32_BE: ! return("Signed 32-bit (Big-Endian)"); ! #endif } return("Unknown"); _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
participants (1)
-
GEREOFFY