CVS commit: src/lib/libossaudio
Module Name:src Committed By: christos Date: Fri May 4 11:48:12 UTC 2012 Modified Files: src/lib/libossaudio: ossaudio.c soundcard.h Log Message: - match regular ioctl prototype (3rd argument is optional) - fix lint issues To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/libossaudio/ossaudio.c cvs rdiff -u -r1.19 -r1.20 src/lib/libossaudio/soundcard.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libossaudio/ossaudio.c diff -u src/lib/libossaudio/ossaudio.c:1.26 src/lib/libossaudio/ossaudio.c:1.27 --- src/lib/libossaudio/ossaudio.c:1.26 Tue Sep 13 15:10:18 2011 +++ src/lib/libossaudio/ossaudio.c Fri May 4 07:48:12 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ossaudio.c,v 1.26 2011/09/13 19:10:18 christos Exp $ */ +/* $NetBSD: ossaudio.c,v 1.27 2012/05/04 11:48:12 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: ossaudio.c,v 1.26 2011/09/13 19:10:18 christos Exp $); +__RCSID($NetBSD: ossaudio.c,v 1.27 2012/05/04 11:48:12 christos Exp $); /* * This is an OSS (Linux) sound API emulator. @@ -44,6 +44,7 @@ __RCSID($NetBSD: ossaudio.c,v 1.26 2011 #include sys/audioio.h #include sys/stat.h #include errno.h +#include stdarg.h #include soundcard.h #undef ioctl @@ -59,15 +60,22 @@ static void setblocksize(int, struct aud static int audio_ioctl(int, unsigned long, void *); static int mixer_ioctl(int, unsigned long, void *); -static int opaque_to_enum(struct audiodevinfo *di, audio_mixer_name_t *label, int opq); -static int enum_to_ord(struct audiodevinfo *di, int enm); -static int enum_to_mask(struct audiodevinfo *di, int enm); +static int opaque_to_enum(struct audiodevinfo *, audio_mixer_name_t *, int); +static int enum_to_ord(struct audiodevinfo *, int); +static int enum_to_mask(struct audiodevinfo *, int); #define INTARG (*(int*)argp) int -_oss_ioctl(int fd, unsigned long com, void *argp) +_oss_ioctl(int fd, unsigned long com, ...) { + va_list ap; + void *argp; + + va_start(ap, com); + argp = va_arg(ap, void *); + va_end(ap); + if (IOCGROUP(com) == 'P') return audio_ioctl(fd, com, argp); else if (IOCGROUP(com) == 'M') @@ -352,10 +360,11 @@ audio_ioctl(int fd, unsigned long com, v return retval; setblocksize(fd, tmpinfo); bufinfo.fragsize = tmpinfo.blocksize; - bufinfo.fragments = tmpinfo.hiwat - - (tmpinfo.play.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize; + bufinfo.fragments = tmpinfo.hiwat - (tmpinfo.play.seek + + tmpinfo.blocksize - 1) / tmpinfo.blocksize; bufinfo.fragstotal = tmpinfo.hiwat; - bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek; + bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize + - tmpinfo.play.seek; *(struct audio_buf_info *)argp = bufinfo; break; case SNDCTL_DSP_GETISPACE: @@ -364,10 +373,11 @@ audio_ioctl(int fd, unsigned long com, v return retval; setblocksize(fd, tmpinfo); bufinfo.fragsize = tmpinfo.blocksize; - bufinfo.fragments = tmpinfo.hiwat - - (tmpinfo.record.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize; + bufinfo.fragments = tmpinfo.hiwat - (tmpinfo.record.seek + + tmpinfo.blocksize - 1) / tmpinfo.blocksize; bufinfo.fragstotal = tmpinfo.hiwat; - bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.record.seek; + bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize + - tmpinfo.record.seek; *(struct audio_buf_info *)argp = bufinfo; break; case SNDCTL_DSP_NONBLOCK: @@ -567,7 +577,7 @@ getdevinfo(int fd) static struct audiodevinfo devcache = { 0 }; struct audiodevinfo *di = devcache; struct stat sb; - int mlen, dlen; + size_t mlen, dlen; /* Figure out what device it is so we can check if the * cached data is valid. @@ -604,7 +614,8 @@ getdevinfo(int fd) mlen = strlen(mi.label.name); if (dlen mlen mi.label.name[mlen-dlen-1] == '.' - strcmp(dp-name, mi.label.name + mlen - dlen) == 0) + strcmp(dp-name, +mi.label.name + mlen - dlen) == 0) break; } if (dp-code = 0) { @@ -658,10 +669,10 @@ mixer_ioctl(int fd, unsigned long com, v struct mixer_info *omi; struct audio_device adev; mixer_ctrl_t mc; - int idat; + u_long idat, n; int i; int retval; - int l, r, n, error, e; + int l, r, error, e; idat = 0; di = getdevinfo(fd); @@ -739,7 +750,8 @@ mixer_ioctl(int fd, unsigned long com, v if (idat (1 i)) { if (di-devmap[i] == -1) return EINVAL; - mc.un.mask |= enum_to_mask(di, di-devmap[i]); + mc.un.mask |= + enum_to_mask(di, di-devmap[i]); } } } @@ -753,14 +765,16 @@ mixer_ioctl(int fd, unsigned long com, v mc.dev = di-devmap[n]; mc.type = AUDIO_MIXER_VALUE; doread: - mc.un.value.num_channels = di-stereomask (1n) ? 2 : 1; + mc.un.value.num_channels = + di-stereomask (1 (u_int)n) ?
CVS commit: src/lib/libossaudio
Module Name:src Committed By: christos Date: Fri May 4 11:48:12 UTC 2012 Modified Files: src/lib/libossaudio: ossaudio.c soundcard.h Log Message: - match regular ioctl prototype (3rd argument is optional) - fix lint issues To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/libossaudio/ossaudio.c cvs rdiff -u -r1.19 -r1.20 src/lib/libossaudio/soundcard.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libossaudio
Module Name:src Committed By: christos Date: Tue Sep 13 19:10:18 UTC 2011 Modified Files: src/lib/libossaudio: ossaudio.c Log Message: fix non-portable shift. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/libossaudio/ossaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libossaudio/ossaudio.c diff -u src/lib/libossaudio/ossaudio.c:1.25 src/lib/libossaudio/ossaudio.c:1.26 --- src/lib/libossaudio/ossaudio.c:1.25 Mon Sep 5 21:20:18 2011 +++ src/lib/libossaudio/ossaudio.c Tue Sep 13 15:10:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ossaudio.c,v 1.25 2011/09/06 01:20:18 jmcneill Exp $ */ +/* $NetBSD: ossaudio.c,v 1.26 2011/09/13 19:10:18 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: ossaudio.c,v 1.25 2011/09/06 01:20:18 jmcneill Exp $); +__RCSID($NetBSD: ossaudio.c,v 1.26 2011/09/13 19:10:18 christos Exp $); /* * This is an OSS (Linux) sound API emulator. @@ -776,7 +776,7 @@ return EINVAL; idat = INTARG; l = FROM_OSSVOL( idat0xff); - r = FROM_OSSVOL((idat 8) 0xff); + r = FROM_OSSVOL(((u_int)idat 8) 0xff); mc.dev = di-devmap[n]; mc.type = AUDIO_MIXER_VALUE; if (di-stereomask (1n)) {
CVS commit: src/lib/libossaudio
Module Name:src Committed By: christos Date: Tue Sep 13 19:10:18 UTC 2011 Modified Files: src/lib/libossaudio: ossaudio.c Log Message: fix non-portable shift. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/libossaudio/ossaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libossaudio
Module Name:src Committed By: jmcneill Date: Tue Sep 6 01:20:18 UTC 2011 Modified Files: src/lib/libossaudio: ossaudio.c soundcard.h Log Message: Add support for AFMT_AC3 To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/lib/libossaudio/ossaudio.c cvs rdiff -u -r1.18 -r1.19 src/lib/libossaudio/soundcard.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libossaudio/ossaudio.c diff -u src/lib/libossaudio/ossaudio.c:1.24 src/lib/libossaudio/ossaudio.c:1.25 --- src/lib/libossaudio/ossaudio.c:1.24 Mon Apr 28 20:23:01 2008 +++ src/lib/libossaudio/ossaudio.c Tue Sep 6 01:20:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ossaudio.c,v 1.24 2008/04/28 20:23:01 martin Exp $ */ +/* $NetBSD: ossaudio.c,v 1.25 2011/09/06 01:20:18 jmcneill Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: ossaudio.c,v 1.24 2008/04/28 20:23:01 martin Exp $); +__RCSID($NetBSD: ossaudio.c,v 1.25 2011/09/06 01:20:18 jmcneill Exp $); /* * This is an OSS (Linux) sound API emulator. @@ -185,6 +185,12 @@ tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_BE; break; + case AFMT_AC3: + tmpinfo.play.precision = + tmpinfo.record.precision = 16; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_AC3; + break; default: return EINVAL; } @@ -228,6 +234,9 @@ case AUDIO_ENCODING_ADPCM: idat = AFMT_IMA_ADPCM; break; + case AUDIO_ENCODING_AC3: + idat = AFMT_AC3; + break; } INTARG = idat; break; @@ -328,6 +337,9 @@ case AUDIO_ENCODING_ADPCM: idat |= AFMT_IMA_ADPCM; break; + case AUDIO_ENCODING_AC3: +idat |= AFMT_AC3; +break; default: break; } Index: src/lib/libossaudio/soundcard.h diff -u src/lib/libossaudio/soundcard.h:1.18 src/lib/libossaudio/soundcard.h:1.19 --- src/lib/libossaudio/soundcard.h:1.18 Mon Apr 28 20:23:01 2008 +++ src/lib/libossaudio/soundcard.h Tue Sep 6 01:20:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: soundcard.h,v 1.18 2008/04/28 20:23:01 martin Exp $ */ +/* $NetBSD: soundcard.h,v 1.19 2011/09/06 01:20:18 jmcneill Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -59,6 +59,7 @@ #define AFMT_U16_LE 0x0080 #define AFMT_U16_BE 0x0100 #define AFMT_MPEG 0x0200 +#define AFMT_AC3 0x0400 #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT #define SOUND_PCM_READ_BITS _IOR ('P', 5, int) #define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int)