diff options
author | Niels Provos <provos@cvs.openbsd.org> | 1998-05-01 09:23:01 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 1998-05-01 09:23:01 +0000 |
commit | 3ff623bb4b46f039dee23f0d128f90746ce869fb (patch) | |
tree | beee7affca26f6cf76c9a53e25da7fe5adb624ca | |
parent | 74547d6b881a3617cfe28ed0b6080021824543dc (diff) |
libossaudio from NetBSD mostly by Lennart Augustsson <augustss@cs.chalmers.se>
-rw-r--r-- | lib/libossaudio/Makefile | 15 | ||||
-rw-r--r-- | lib/libossaudio/ossaudio.3 | 76 | ||||
-rw-r--r-- | lib/libossaudio/ossaudio.c | 699 | ||||
-rw-r--r-- | lib/libossaudio/shlib_version | 5 | ||||
-rw-r--r-- | lib/libossaudio/soundcard.h | 284 |
5 files changed, 1079 insertions, 0 deletions
diff --git a/lib/libossaudio/Makefile b/lib/libossaudio/Makefile new file mode 100644 index 00000000000..533af44a147 --- /dev/null +++ b/lib/libossaudio/Makefile @@ -0,0 +1,15 @@ +# $OpenBSD: Makefile,v 1.1 1998/05/01 09:23:00 provos Exp $ +# $NetBSD: Makefile,v 1.5 1998/04/13 14:18:45 lukem Exp $ + +LIB= ossaudio +MAN= ossaudio.3 + +SRCS= ossaudio.c + +CPPFLAGS+= -I${.CURDIR} + +INCS= soundcard.h +INCSDIR=/usr/include + +.include <bsd.lib.mk> + diff --git a/lib/libossaudio/ossaudio.3 b/lib/libossaudio/ossaudio.3 new file mode 100644 index 00000000000..71fd3810be8 --- /dev/null +++ b/lib/libossaudio/ossaudio.3 @@ -0,0 +1,76 @@ +.\" $OpenBSD: ossaudio.3,v 1.1 1998/05/01 09:23:00 provos Exp $ +.\" $NetBSD: ossaudio.3,v 1.6 1998/02/05 18:52:19 perry Exp $ +.\" +.\" Copyright (c) 1997 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 16, 1997 +.Dt OSSAUDIO 3 +.Os OpenBSD +.Sh NAME +.Nm ossaudio +.Nd OSS audio emulation +.Sh LIBRARY +.Lb libossaudio +.Sh SYNOPSIS +.Fd #include <soundcard.h> +.Sh DESCRIPTION +The +.Nm +library provides an emulation of the OSS (Linux) audio +interface. +.Pp +Use the native interface for new programs and the emulation +library only for porting programs. +.Sh SEE ALSO +.Xr audio 4 +.Sh BUGS +The emulation uses an #define for +.Va ioctl() +so some obscure programs +can fail to compile. +.Pp +The emulation is incomplete. +.Pp +The emulation only covers +.Va ioctl() , +there are other differences as well. E.g., on a write +that would block in non-blocking mode Linux returns +.Dv EINTR +whereas +.Ox 2.3 +returns +.Dv EWOULDBLOCK . +.Sh HISTORY +The +.Nm +library first appeared in +.Nx 1.3 . diff --git a/lib/libossaudio/ossaudio.c b/lib/libossaudio/ossaudio.c new file mode 100644 index 00000000000..9b9b7215847 --- /dev/null +++ b/lib/libossaudio/ossaudio.c @@ -0,0 +1,699 @@ +/* $OpenBSD: ossaudio.c,v 1.1 1998/05/01 09:23:00 provos Exp $ */ +/* $NetBSD: ossaudio.c,v 1.5 1998/03/23 00:39:18 augustss Exp $ */ + +/* + * Copyright (c) 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This is an OSS (Linux) sound API emulator. + * It provides the essentials of the API. + */ + +/* XXX This file is essentially the same as sys/compat/ossaudio.c. + * With some preprocessor magic it could be the same file. + */ + +#include <string.h> +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/audioio.h> +#include <sys/stat.h> +#include <errno.h> + +#include "soundcard.h" +#undef ioctl + +#define GET_DEV(com) ((com) & 0xff) + +#define TO_OSSVOL(x) ((x) * 100 / 255) +#define FROM_OSSVOL(x) ((x) * 255 / 100) + +static struct audiodevinfo *getdevinfo(int); + +static void setblocksize(int, struct audio_info *); + +static int audio_ioctl(int, unsigned long, void *); +static int mixer_ioctl(int, unsigned long, void *); + +#define INTARG (*(int*)argp) + +int +_oss_ioctl(int fd, unsigned long com, void *argp) +{ + if (IOCGROUP(com) == 'P') + return audio_ioctl(fd, com, argp); + else if (IOCGROUP(com) == 'M') + return mixer_ioctl(fd, com, argp); + else + return ioctl(fd, com, argp); +} + +static int +audio_ioctl(int fd, unsigned long com, void *argp) +{ + + struct audio_info tmpinfo; + struct audio_offset tmpoffs; + struct audio_buf_info bufinfo; + struct count_info cntinfo; + struct audio_encoding tmpenc; + u_int u; + int idat, idata; + int retval; + + switch (com) { + case SNDCTL_DSP_RESET: + retval = ioctl(fd, AUDIO_FLUSH, 0); + if (retval < 0) + return retval; + break; + case SNDCTL_DSP_SYNC: + case SNDCTL_DSP_POST: + retval = ioctl(fd, AUDIO_DRAIN, 0); + if (retval < 0) + return retval; + break; + case SNDCTL_DSP_SPEED: + AUDIO_INITINFO(&tmpinfo); + tmpinfo.play.sample_rate = + tmpinfo.record.sample_rate = INTARG; + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); + /* fall into ... */ + case SOUND_PCM_READ_RATE: + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + if (retval < 0) + return retval; + INTARG = tmpinfo.play.sample_rate; + break; + case SNDCTL_DSP_STEREO: + AUDIO_INITINFO(&tmpinfo); + tmpinfo.play.channels = + tmpinfo.record.channels = INTARG ? 2 : 1; + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + if (retval < 0) + return retval; + INTARG = tmpinfo.play.channels - 1; + break; + case SNDCTL_DSP_GETBLKSIZE: + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + if (retval < 0) + return retval; + setblocksize(fd, &tmpinfo); + INTARG = tmpinfo.blocksize; + break; + case SNDCTL_DSP_SETFMT: + AUDIO_INITINFO(&tmpinfo); + switch (INTARG) { + case AFMT_MU_LAW: + tmpinfo.play.precision = + tmpinfo.record.precision = 8; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_ULAW; + break; + case AFMT_A_LAW: + tmpinfo.play.precision = + tmpinfo.record.precision = 8; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_ALAW; + break; + case AFMT_U8: + tmpinfo.play.precision = + tmpinfo.record.precision = 8; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR; + break; + case AFMT_S8: + tmpinfo.play.precision = + tmpinfo.record.precision = 8; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR; + break; + case AFMT_S16_LE: + tmpinfo.play.precision = + tmpinfo.record.precision = 16; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR_LE; + break; + case AFMT_S16_BE: + tmpinfo.play.precision = + tmpinfo.record.precision = 16; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR_BE; + break; + case AFMT_U16_LE: + tmpinfo.play.precision = + tmpinfo.record.precision = 16; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_LE; + break; + case AFMT_U16_BE: + tmpinfo.play.precision = + tmpinfo.record.precision = 16; + tmpinfo.play.encoding = + tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_BE; + break; + default: + return EINVAL; + } + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); + /* fall into ... */ + case SOUND_PCM_READ_BITS: + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + if (retval < 0) + return retval; + switch (tmpinfo.play.encoding) { + case AUDIO_ENCODING_ULAW: + idat = AFMT_MU_LAW; + break; + case AUDIO_ENCODING_ALAW: + idat = AFMT_A_LAW; + break; + case AUDIO_ENCODING_SLINEAR_LE: + if (tmpinfo.play.precision == 16) + idat = AFMT_S16_LE; + else + idat = AFMT_S8; + break; + case AUDIO_ENCODING_SLINEAR_BE: + if (tmpinfo.play.precision == 16) + idat = AFMT_S16_BE; + else + idat = AFMT_S8; + break; + case AUDIO_ENCODING_ULINEAR_LE: + if (tmpinfo.play.precision == 16) + idat = AFMT_U16_LE; + else + idat = AFMT_U8; + break; + case AUDIO_ENCODING_ULINEAR_BE: + if (tmpinfo.play.precision == 16) + idat = AFMT_U16_BE; + else + idat = AFMT_U8; + break; + case AUDIO_ENCODING_ADPCM: + idat = AFMT_IMA_ADPCM; + break; + } + INTARG = idat; + break; + case SNDCTL_DSP_CHANNELS: + AUDIO_INITINFO(&tmpinfo); + tmpinfo.play.channels = + tmpinfo.record.channels = INTARG; + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); + /* fall into ... */ + case SOUND_PCM_READ_CHANNELS: + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + if (retval < 0) + return retval; + INTARG = tmpinfo.play.channels; + break; + case SOUND_PCM_WRITE_FILTER: + case SOUND_PCM_READ_FILTER: + errno = EINVAL; + return -1; /* XXX unimplemented */ + case SNDCTL_DSP_SUBDIVIDE: + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + if (retval < 0) + return retval; + setblocksize(fd, &tmpinfo); + idat = INTARG; + if (idat == 0) + idat = tmpinfo.play.buffer_size / tmpinfo.blocksize; + idat = (tmpinfo.play.buffer_size / idat) & -4; + AUDIO_INITINFO(&tmpinfo); + tmpinfo.blocksize = idat; + retval = ioctl(fd, AUDIO_SETINFO, &tmpinfo); + if (retval < 0) + return retval; + INTARG = tmpinfo.play.buffer_size / tmpinfo.blocksize; + break; + case SNDCTL_DSP_SETFRAGMENT: + AUDIO_INITINFO(&tmpinfo); + idat = INTARG; + if ((idat & 0xffff) < 4 || (idat & 0xffff) > 17) + return EINVAL; + tmpinfo.blocksize = 1 << (idat & 0xffff); + tmpinfo.hiwat = (idat >> 16) & 0x7fff; + if (tmpinfo.hiwat == 0) /* 0 means set to max */ + tmpinfo.hiwat = 65536; + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + if (retval < 0) + return retval; + u = tmpinfo.blocksize; + for(idat = 0; u; idat++, u >>= 1) + ; + idat |= (tmpinfo.hiwat & 0x7fff) << 16; + INTARG = idat; + break; + case SNDCTL_DSP_GETFMTS: + for(idat = 0, tmpenc.index = 0; + ioctl(fd, AUDIO_GETENC, &tmpenc) == 0; + tmpenc.index++) { + if (tmpenc.flags & AUDIO_ENCODINGFLAG_EMULATED) + continue; /* Don't report emulated modes */ + switch(tmpenc.encoding) { + case AUDIO_ENCODING_ULAW: + idat |= AFMT_MU_LAW; + break; + case AUDIO_ENCODING_ALAW: + idat |= AFMT_A_LAW; + break; + case AUDIO_ENCODING_SLINEAR: + idat |= AFMT_S8; + break; + case AUDIO_ENCODING_SLINEAR_LE: + if (tmpenc.precision == 16) + idat |= AFMT_S16_LE; + else + idat |= AFMT_S8; + break; + case AUDIO_ENCODING_SLINEAR_BE: + if (tmpenc.precision == 16) + idat |= AFMT_S16_BE; + else + idat |= AFMT_S8; + break; + case AUDIO_ENCODING_ULINEAR: + idat |= AFMT_U8; + break; + case AUDIO_ENCODING_ULINEAR_LE: + if (tmpenc.precision == 16) + idat |= AFMT_U16_LE; + else + idat |= AFMT_U8; + break; + case AUDIO_ENCODING_ULINEAR_BE: + if (tmpenc.precision == 16) + idat |= AFMT_U16_BE; + else + idat |= AFMT_U8; + break; + case AUDIO_ENCODING_ADPCM: + idat |= AFMT_IMA_ADPCM; + break; + default: + break; + } + } + INTARG = idat; + break; + case SNDCTL_DSP_GETOSPACE: + case SNDCTL_DSP_GETISPACE: + retval = ioctl(fd, AUDIO_GETINFO, (caddr_t)&tmpinfo); + if (retval < 0) + return retval; + setblocksize(fd, &tmpinfo); + bufinfo.fragsize = tmpinfo.blocksize; + bufinfo.fragments = /* XXX */ + bufinfo.fragstotal = tmpinfo.play.buffer_size / bufinfo.fragsize; + bufinfo.bytes = tmpinfo.play.buffer_size; + *(struct audio_buf_info *)argp = bufinfo; + break; + case SNDCTL_DSP_NONBLOCK: + idat = 1; + retval = ioctl(fd, FIONBIO, &idat); + if (retval < 0) + return retval; + break; + case SNDCTL_DSP_GETCAPS: + retval = ioctl(fd, AUDIO_GETPROPS, (caddr_t)&idata); + if (retval < 0) + return retval; + idat = DSP_CAP_TRIGGER; /* pretend we have trigger */ + if (idata & AUDIO_PROP_FULLDUPLEX) + idat |= DSP_CAP_DUPLEX; + if (idata & AUDIO_PROP_MMAP) + idat |= DSP_CAP_MMAP; + INTARG = idat; + break; +#if 0 + case SNDCTL_DSP_GETTRIGGER: + retval = ioctl(fd, AUDIO_GETINFO, (caddr_t)&tmpinfo); + if (retval < 0) + return retval; + idat = (tmpinfo.play.pause ? 0 : PCM_ENABLE_OUTPUT) | + (tmpinfo.record.pause ? 0 : PCM_ENABLE_INPUT); + retval = copyout(&idat, SCARG(uap, data), sizeof idat); + if (retval < 0) + return retval; + break; + case SNDCTL_DSP_SETTRIGGER: + AUDIO_INITINFO(&tmpinfo); + retval = copyin(SCARG(uap, data), &idat, sizeof idat); + if (retval < 0) + return retval; + tmpinfo.play.pause = (idat & PCM_ENABLE_OUTPUT) == 0; + tmpinfo.record.pause = (idat & PCM_ENABLE_INPUT) == 0; + (void) ioctl(fd, AUDIO_SETINFO, (caddr_t)&tmpinfo); + retval = copyout(&idat, SCARG(uap, data), sizeof idat); + if (retval < 0) + return retval; + break; +#else + case SNDCTL_DSP_GETTRIGGER: + case SNDCTL_DSP_SETTRIGGER: + /* XXX Do nothing for now. */ + INTARG = PCM_ENABLE_OUTPUT; + break; +#endif + case SNDCTL_DSP_GETIPTR: + retval = ioctl(fd, AUDIO_GETIOFFS, &tmpoffs); + if (retval < 0) + return retval; + cntinfo.bytes = tmpoffs.samples; + cntinfo.blocks = tmpoffs.deltablks; + cntinfo.ptr = tmpoffs.offset; + *(struct count_info *)argp = cntinfo; + break; + case SNDCTL_DSP_GETOPTR: + retval = ioctl(fd, AUDIO_GETOOFFS, &tmpoffs); + if (retval < 0) + return retval; + cntinfo.bytes = tmpoffs.samples; + cntinfo.blocks = tmpoffs.deltablks; + cntinfo.ptr = tmpoffs.offset; + *(struct count_info *)argp = cntinfo; + break; + case SNDCTL_DSP_MAPINBUF: + case SNDCTL_DSP_MAPOUTBUF: + case SNDCTL_DSP_SETSYNCRO: + case SNDCTL_DSP_SETDUPLEX: + case SNDCTL_DSP_PROFILE: + errno = EINVAL; + return -1; /* XXX unimplemented */ + default: + errno = EINVAL; + return -1; + } + + return 0; +} + + +/* If the NetBSD mixer device should have more than 32 devices + * some will not be available to Linux */ +#define NETBSD_MAXDEVS 32 +struct audiodevinfo { + int done; + dev_t dev; + int16_t devmap[SOUND_MIXER_NRDEVICES], + rdevmap[NETBSD_MAXDEVS]; + u_long devmask, recmask, stereomask; + u_long caps, source; +}; + +/* + * Collect the audio device information to allow faster + * emulation of the Linux mixer ioctls. Cache the information + * to eliminate the overhead of repeating all the ioctls needed + * to collect the information. + */ +static struct audiodevinfo * +getdevinfo(int fd) +{ + mixer_devinfo_t mi; + int i; + static struct { + char *name; + int code; + } *dp, devs[] = { + { AudioNmicrophone, SOUND_MIXER_MIC }, + { AudioNline, SOUND_MIXER_LINE }, + { AudioNcd, SOUND_MIXER_CD }, + { AudioNdac, SOUND_MIXER_PCM }, + { AudioNrecord, SOUND_MIXER_IMIX }, + { AudioNmaster, SOUND_MIXER_VOLUME }, + { AudioNtreble, SOUND_MIXER_TREBLE }, + { AudioNbass, SOUND_MIXER_BASS }, + { AudioNspeaker, SOUND_MIXER_SPEAKER }, +/* { AudioNheadphone, ?? },*/ + { AudioNoutput, SOUND_MIXER_OGAIN }, + { AudioNinput, SOUND_MIXER_IGAIN }, +/* { AudioNmaster, SOUND_MIXER_SPEAKER },*/ +/* { AudioNstereo, ?? },*/ +/* { AudioNmono, ?? },*/ + { AudioNfmsynth, SOUND_MIXER_SYNTH }, +/* { AudioNwave, SOUND_MIXER_PCM },*/ + { AudioNmidi, SOUND_MIXER_SYNTH }, +/* { AudioNmixerout, ?? },*/ + { 0, -1 } + }; + static struct audiodevinfo devcache = { 0 }; + struct audiodevinfo *di = &devcache; + struct stat sb; + + /* Figure out what device it is so we can check if the + * cached data is valid. + */ + if (fstat(fd, &sb) < 0) + return 0; + if (di->done && di->dev == sb.st_dev) + return di; + + di->done = 1; + di->dev = sb.st_dev; + di->devmask = 0; + di->recmask = 0; + di->stereomask = 0; + di->source = -1; + di->caps = 0; + for(i = 0; i < SOUND_MIXER_NRDEVICES; i++) + di->devmap[i] = -1; + for(i = 0; i < NETBSD_MAXDEVS; i++) + di->rdevmap[i] = -1; + for(i = 0; i < NETBSD_MAXDEVS; i++) { + mi.index = i; + if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) < 0) + break; + switch(mi.type) { + case AUDIO_MIXER_VALUE: + for(dp = devs; dp->name; dp++) + if (strcmp(dp->name, mi.label.name) == 0) + break; + if (dp->code >= 0) { + di->devmap[dp->code] = i; + di->rdevmap[i] = dp->code; + di->devmask |= 1 << dp->code; + if (mi.un.v.num_channels == 2) + di->stereomask |= 1 << dp->code; + } + break; + case AUDIO_MIXER_ENUM: + if (strcmp(mi.label.name, AudioNsource) == 0) { + int j; + di->source = i; + for(j = 0; j < mi.un.e.num_mem; j++) + di->recmask |= 1 << di->rdevmap[mi.un.e.member[j].ord]; + di->caps = SOUND_CAP_EXCL_INPUT; + } + break; + case AUDIO_MIXER_SET: + if (strcmp(mi.label.name, AudioNsource) == 0) { + int j; + di->source = i; + for(j = 0; j < mi.un.s.num_mem; j++) { + int k, mask = mi.un.s.member[j].mask; + if (mask) { + for(k = 0; !(mask & 1); mask >>= 1, k++) + ; + di->recmask |= 1 << di->rdevmap[k]; + } + } + } + break; + } + } + return di; +} + +int +mixer_ioctl(int fd, unsigned long com, void *argp) +{ + struct audiodevinfo *di; + mixer_ctrl_t mc; + int idat; + int i; + int retval; + int l, r, n; + + di = getdevinfo(fd); + if (di == 0) + return -1; + + switch (com) { + case SOUND_MIXER_READ_RECSRC: + if (di->source == -1) + return EINVAL; + mc.dev = di->source; + if (di->caps & SOUND_CAP_EXCL_INPUT) { + mc.type = AUDIO_MIXER_ENUM; + retval = ioctl(fd, AUDIO_MIXER_READ, &mc); + if (retval < 0) + return retval; + idat = 1 << di->rdevmap[mc.un.ord]; + } else { + int k; + unsigned int mask; + mc.type = AUDIO_MIXER_SET; + retval = ioctl(fd, AUDIO_MIXER_READ, &mc); + if (retval < 0) + return retval; + idat = 0; + for(mask = mc.un.mask, k = 0; mask; mask >>= 1, k++) + if (mask & 1) + idat |= 1 << di->rdevmap[k]; + } + break; + case SOUND_MIXER_READ_DEVMASK: + idat = di->devmask; + break; + case SOUND_MIXER_READ_RECMASK: + idat = di->recmask; + break; + case SOUND_MIXER_READ_STEREODEVS: + idat = di->stereomask; + break; + case SOUND_MIXER_READ_CAPS: + idat = di->caps; + break; + case SOUND_MIXER_WRITE_RECSRC: + case SOUND_MIXER_WRITE_R_RECSRC: + if (di->source == -1) + return EINVAL; + mc.dev = di->source; + idat = INTARG; + if (di->caps & SOUND_CAP_EXCL_INPUT) { + mc.type = AUDIO_MIXER_ENUM; + for(i = 0; i < SOUND_MIXER_NRDEVICES; i++) + if (idat & (1 << i)) + break; + if (i >= SOUND_MIXER_NRDEVICES || + di->devmap[i] == -1) + return EINVAL; + mc.un.ord = di->devmap[i]; + } else { + mc.type = AUDIO_MIXER_SET; + mc.un.mask = 0; + for(i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (idat & (1 << i)) { + if (di->devmap[i] == -1) + return EINVAL; + mc.un.mask |= 1 << di->devmap[i]; + } + } + } + return ioctl(fd, AUDIO_MIXER_WRITE, &mc); + default: + if (MIXER_READ(SOUND_MIXER_FIRST) <= com && + com < MIXER_READ(SOUND_MIXER_NRDEVICES)) { + n = GET_DEV(com); + if (di->devmap[n] == -1) + return EINVAL; + mc.dev = di->devmap[n]; + mc.type = AUDIO_MIXER_VALUE; + doread: + mc.un.value.num_channels = di->stereomask & (1<<n) ? 2 : 1; + retval = ioctl(fd, AUDIO_MIXER_READ, &mc); + if (retval < 0) + return retval; + if (mc.type != AUDIO_MIXER_VALUE) + return EINVAL; + if (mc.un.value.num_channels != 2) { + l = r = mc.un.value.level[AUDIO_MIXER_LEVEL_MONO]; + } else { + l = mc.un.value.level[AUDIO_MIXER_LEVEL_LEFT]; + r = mc.un.value.level[AUDIO_MIXER_LEVEL_RIGHT]; + } + idat = TO_OSSVOL(l) | (TO_OSSVOL(r) << 8); + break; + } else if ((MIXER_WRITE_R(SOUND_MIXER_FIRST) <= com && + com < MIXER_WRITE_R(SOUND_MIXER_NRDEVICES)) || + (MIXER_WRITE(SOUND_MIXER_FIRST) <= com && + com < MIXER_WRITE(SOUND_MIXER_NRDEVICES))) { + n = GET_DEV(com); + if (di->devmap[n] == -1) + return EINVAL; + idat = INTARG; + l = FROM_OSSVOL( idat & 0xff); + r = FROM_OSSVOL((idat >> 8) & 0xff); + mc.dev = di->devmap[n]; + mc.type = AUDIO_MIXER_VALUE; + if (di->stereomask & (1<<n)) { + mc.un.value.num_channels = 2; + mc.un.value.level[AUDIO_MIXER_LEVEL_LEFT] = l; + mc.un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = r; + } else { + mc.un.value.num_channels = 1; + mc.un.value.level[AUDIO_MIXER_LEVEL_MONO] = (l+r)/2; + } + retval = ioctl(fd, AUDIO_MIXER_WRITE, &mc); + if (retval < 0) + return retval; + if (MIXER_WRITE(SOUND_MIXER_FIRST) <= com && + com < MIXER_WRITE(SOUND_MIXER_NRDEVICES)) + return 0; + goto doread; + } else { + errno = EINVAL; + return -1; + } + } + INTARG = idat; + return 0; +} + +/* + * Check that the blocksize is a power of 2 as OSS wants. + * If not, set it to be. + */ +static void +setblocksize(int fd, struct audio_info *info) +{ + struct audio_info set; + int s; + + if (info->blocksize & (info->blocksize-1)) { + for(s = 32; s < info->blocksize; s <<= 1) + ; + AUDIO_INITINFO(&set); + set.blocksize = s; + ioctl(fd, AUDIO_SETINFO, &set); + ioctl(fd, AUDIO_GETINFO, info); + } +} + diff --git a/lib/libossaudio/shlib_version b/lib/libossaudio/shlib_version new file mode 100644 index 00000000000..775b406a106 --- /dev/null +++ b/lib/libossaudio/shlib_version @@ -0,0 +1,5 @@ +# $OpenBSD: shlib_version,v 1.1 1998/05/01 09:23:00 provos Exp $ +# $NetBSD: shlib_version,v 1.4 1998/01/05 07:41:13 perry Exp $ +# +major=0 +minor=0 diff --git a/lib/libossaudio/soundcard.h b/lib/libossaudio/soundcard.h new file mode 100644 index 00000000000..23fe0fac839 --- /dev/null +++ b/lib/libossaudio/soundcard.h @@ -0,0 +1,284 @@ +/* $OpenBSD: soundcard.h,v 1.1 1998/05/01 09:23:00 provos Exp $ */ +/* $NetBSD: soundcard.h,v 1.4 1997/10/29 20:23:27 augustss Exp $ */ + +/* + * Copyright (c) 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * WARNING! WARNING! + * This is an OSS (Linux) audio emulator. + * Use the Native NetBSD API for developing new code, and this + * only for compiling Linux programs. + */ + +#ifndef _soundcard_h_ +#define _soundcard_h_ + +#define SOUND_VERSION 0x030000 + +#define SNDCTL_DSP_RESET _IO ('P', 0) +#define SNDCTL_DSP_SYNC _IO ('P', 1) +#define SNDCTL_DSP_SPEED _IOWR('P', 2, int) +#define SOUND_PCM_READ_RATE _IOR ('P', 2, int) +#define SNDCTL_DSP_STEREO _IOWR('P', 3, int) +#define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int) +#define SNDCTL_DSP_SETFMT _IOWR('P', 5, int) +#define AFMT_QUERY 0x00000000 +#define AFMT_MU_LAW 0x00000001 +#define AFMT_A_LAW 0x00000002 +#define AFMT_IMA_ADPCM 0x00000004 +#define AFMT_U8 0x00000008 +#define AFMT_S16_LE 0x00000010 +#define AFMT_S16_BE 0x00000020 +#define AFMT_S8 0x00000040 +#define AFMT_U16_LE 0x00000080 +#define AFMT_U16_BE 0x00000100 +#define AFMT_MPEG 0x00000200 +#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT +#define SOUND_PCM_READ_BITS _IOR ('P', 5, int) +#define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int) +#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS +#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int) +#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int) +#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int) +#define SNDCTL_DSP_POST _IO ('P', 8) +#define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int) +#define SNDCTL_DSP_SETFRAGMENT _IOWR('P', 10, int) +#define SNDCTL_DSP_GETFMTS _IOR ('P', 11, int) +#define SNDCTL_DSP_GETOSPACE _IOR ('P',12, struct audio_buf_info) +#define SNDCTL_DSP_GETISPACE _IOR ('P',13, struct audio_buf_info) +#define SNDCTL_DSP_NONBLOCK _IO ('P',14) +#define SNDCTL_DSP_GETCAPS _IOR ('P',15, int) +# define DSP_CAP_REVISION 0x000000ff +# define DSP_CAP_DUPLEX 0x00000100 +# define DSP_CAP_REALTIME 0x00000200 +# define DSP_CAP_BATCH 0x00000400 +# define DSP_CAP_COPROC 0x00000800 +# define DSP_CAP_TRIGGER 0x00001000 +# define DSP_CAP_MMAP 0x00002000 +#define SNDCTL_DSP_GETTRIGGER _IOR ('P', 16, int) +#define SNDCTL_DSP_SETTRIGGER _IOW ('P', 16, int) +# define PCM_ENABLE_INPUT 0x00000001 +# define PCM_ENABLE_OUTPUT 0x00000002 +#define SNDCTL_DSP_GETIPTR _IOR ('P', 17, struct count_info) +#define SNDCTL_DSP_GETOPTR _IOR ('P', 18, struct count_info) +#define SNDCTL_DSP_MAPINBUF _IOR ('P', 19, struct buffmem_desc) +#define SNDCTL_DSP_MAPOUTBUF _IOR ('P', 20, struct buffmem_desc) +#define SNDCTL_DSP_SETSYNCRO _IO ('P', 21) +#define SNDCTL_DSP_SETDUPLEX _IO ('P', 22) +#define SNDCTL_DSP_PROFILE _IOW ('P', 23, int) +#define APF_NORMAL 0 +#define APF_NETWORK 1 +#define APF_CPUINTENS 2 + +/* Need native 16 bit format which depends on byte order */ +/* XXX This isn't really a good way, but I don't want to + * include all of endian.h because it contains a lot + * junk symbols. [augustss] + */ +#define _POSIX_SOURCE /* avoid dragging in a lot of junk */ +#include <machine/endian.h> +#if _QUAD_LOWWORD == 0 +#define AFMT_S16_NE AFMT_S16_LE +#else +#define AFMT_S16_NE AFMT_S16_BE +#endif + + +/* Aliases */ +#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT +#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED +#define SOUND_PCM_POST SNDCTL_DSP_POST +#define SOUND_PCM_RESET SNDCTL_DSP_RESET +#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC +#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE +#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT +#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS +#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT +#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE +#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE +#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK +#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS +#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER +#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER +#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO +#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR +#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR +#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF +#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF + +/* Mixer defines */ +#define SOUND_MIXER_FIRST 0 +#define SOUND_MIXER_NRDEVICES 25 + +#define SOUND_MIXER_VOLUME 0 +#define SOUND_MIXER_BASS 1 +#define SOUND_MIXER_TREBLE 2 +#define SOUND_MIXER_SYNTH 3 +#define SOUND_MIXER_PCM 4 +#define SOUND_MIXER_SPEAKER 5 +#define SOUND_MIXER_LINE 6 +#define SOUND_MIXER_MIC 7 +#define SOUND_MIXER_CD 8 +#define SOUND_MIXER_IMIX 9 +#define SOUND_MIXER_ALTPCM 10 +#define SOUND_MIXER_RECLEV 11 +#define SOUND_MIXER_IGAIN 12 +#define SOUND_MIXER_OGAIN 13 +#define SOUND_MIXER_LINE1 14 +#define SOUND_MIXER_LINE2 15 +#define SOUND_MIXER_LINE3 16 +#define SOUND_MIXER_DIGITAL1 17 +#define SOUND_MIXER_DIGITAL2 18 +#define SOUND_MIXER_DIGITAL3 19 +#define SOUND_MIXER_PHONEIN 20 +#define SOUND_MIXER_PHONEOUT 21 +#define SOUND_MIXER_VIDEO 22 +#define SOUND_MIXER_RADIO 23 +#define SOUND_MIXER_MONITOR 24 + +#define SOUND_ONOFF_MIN 28 +#define SOUND_ONOFF_MAX 30 + +#define SOUND_MIXER_NONE 31 + +#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ + "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ + "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ + "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} + +#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ + "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ + "line1", "line2", "line3", "dig1", "dig2", "dig3", \ + "phin", "phout", "video", "radio", "monitor"} + +#define SOUND_MIXER_RECSRC 0xff +#define SOUND_MIXER_DEVMASK 0xfe +#define SOUND_MIXER_RECMASK 0xfd +#define SOUND_MIXER_CAPS 0xfc +#define SOUND_CAP_EXCL_INPUT 1 +#define SOUND_MIXER_STEREODEVS 0xfb + +#define MIXER_READ(dev) _IOR('M', dev, int) + +#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) +#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) +#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) +#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) +#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) + +#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) +#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) +#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) +#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) +#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) +#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) +#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) +#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) +#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) + +#define MIXER_WRITE(dev) _IOW ('M', dev, int) +#define MIXER_WRITE_R(dev) _IOWR('M', dev, int) + +#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) +#define SOUND_MIXER_WRITE_R_RECSRC MIXER_WRITE_R(SOUND_MIXER_RECSRC) + +#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) +#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) +#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) +#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) +#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) +#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) +#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) +#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) +#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) + +#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) +#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) +#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) +#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) +#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) +#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) +#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) +#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) +#define SOUND_MASK_CD (1 << SOUND_MIXER_CD) +#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) +#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) +#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) +#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) +#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) +#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) +#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) +#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) + +#define OSS_GETVERSION _IOR ('M', 118, int) + +typedef struct audio_buf_info { + int fragments; + int fragstotal; + int fragsize; + int bytes; +} audio_buf_info; + +typedef struct count_info { + int bytes; + int blocks; + int ptr; +} count_info; + +typedef struct buffmem_desc { + unsigned int *buffer; + int size; +} buffmem_desc; + +#define ioctl(fd, com, argp) _oss_ioctl(fd, com, argp) + +int _oss_ioctl(int fd, unsigned long com, void *argp); + +#endif |