Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/lib/libossaudio Apply patches (requested by christos in t...
details: https://anonhg.NetBSD.org/src/rev/bc726c8a2e47
branches: netbsd-6
changeset: 774066:bc726c8a2e47
user: riz <riz%NetBSD.org@localhost>
date: Mon May 07 16:55:33 2012 +0000
description:
Apply patches (requested by christos in ticket #225):
lib/libossaudio/Makefile patch
lib/libossaudio/ossaudio.c patch
lib/libossaudio/soundcard.h patch
Fix compilation of ioctls without the 3rd argument in ossaudio.
[christos, ticket #225]
diffstat:
lib/libossaudio/Makefile | 4 ++-
lib/libossaudio/ossaudio.c | 67 +++++++++++++++++++++++++++-----------------
lib/libossaudio/soundcard.h | 24 ++++++----------
3 files changed, 53 insertions(+), 42 deletions(-)
diffs (250 lines):
diff -r b55d8d559295 -r bc726c8a2e47 lib/libossaudio/Makefile
--- a/lib/libossaudio/Makefile Mon May 07 16:52:03 2012 +0000
+++ b/lib/libossaudio/Makefile Mon May 07 16:55:33 2012 +0000
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.8 2009/03/12 13:52:47 wiz Exp $
+# $NetBSD: Makefile,v 1.8.8.1 2012/05/07 16:55:33 riz Exp $
+
+WARNS= 5
LIB= ossaudio
MAN= ossaudio.3
diff -r b55d8d559295 -r bc726c8a2e47 lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c Mon May 07 16:52:03 2012 +0000
+++ b/lib/libossaudio/ossaudio.c Mon May 07 16:55:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ossaudio.c,v 1.26 2011/09/13 19:10:18 christos Exp $ */
+/* $NetBSD: ossaudio.c,v 1.26.4.1 2012/05/07 16:55:33 riz 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.26.4.1 2012/05/07 16:55:33 riz Exp $");
/*
* This is an OSS (Linux) sound API emulator.
@@ -44,6 +44,7 @@
#include <sys/audioio.h>
#include <sys/stat.h>
#include <errno.h>
+#include <stdarg.h>
#include "soundcard.h"
#undef ioctl
@@ -59,15 +60,22 @@
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 @@
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 @@
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:
@@ -539,7 +549,7 @@
mixer_devinfo_t mi;
int i, j, e;
static struct {
- char *name;
+ const char *name;
int code;
} *dp, devs[] = {
{ AudioNmicrophone, SOUND_MIXER_MIC },
@@ -564,10 +574,10 @@
/* { AudioNmixerout, ?? },*/
{ 0, -1 }
};
- static struct audiodevinfo devcache = { 0 };
+ static struct audiodevinfo devcache = { .done = 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 @@
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 @@
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 @@
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 @@
mc.dev = di->devmap[n];
mc.type = AUDIO_MIXER_VALUE;
doread:
- mc.un.value.num_channels = di->stereomask & (1<<n) ? 2 : 1;
+ mc.un.value.num_channels =
+ di->stereomask & (1 << (u_int)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];
+ 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];
@@ -775,17 +789,18 @@
if (di->devmap[n] == -1)
return EINVAL;
idat = INTARG;
- l = FROM_OSSVOL( idat & 0xff);
+ l = FROM_OSSVOL((u_int)idat & 0xff);
r = FROM_OSSVOL(((u_int)idat >> 8) & 0xff);
mc.dev = di->devmap[n];
mc.type = AUDIO_MIXER_VALUE;
- if (di->stereomask & (1<<n)) {
+ if (di->stereomask & (1 << (u_int)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;
+ mc.un.value.level[AUDIO_MIXER_LEVEL_MONO] =
+ (l + r) / 2;
}
retval = ioctl(fd, AUDIO_MIXER_WRITE, &mc);
if (retval < 0)
@@ -799,7 +814,7 @@
return -1;
}
}
- INTARG = idat;
+ INTARG = (int)idat;
return 0;
}
@@ -811,7 +826,7 @@
setblocksize(int fd, struct audio_info *info)
{
struct audio_info set;
- int s;
+ size_t s;
if (info->blocksize & (info->blocksize-1)) {
for(s = 32; s < info->blocksize; s <<= 1)
diff -r b55d8d559295 -r bc726c8a2e47 lib/libossaudio/soundcard.h
--- a/lib/libossaudio/soundcard.h Mon May 07 16:52:03 2012 +0000
+++ b/lib/libossaudio/soundcard.h Mon May 07 16:55:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: soundcard.h,v 1.19 2011/09/06 01:20:18 jmcneill Exp $ */
+/* $NetBSD: soundcard.h,v 1.19.4.1 2012/05/07 16:55:33 riz Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -291,24 +291,18 @@
int size;
} buffmem_desc;
-#if 0
-/* This is what we'd like to have, but it causes prototype conflicts. */
#define ioctl _oss_ioctl
-#else
/*
- * XXX force inclusion of <sys/ioctl.h> before we redefine
- * ioctl() to avoid a prototype conflict.
- * Its multiple inclusion protection will keep this from
- * happening if it is pulled in later.
+ * If we already included <sys/ioctl.h>, then we define our own prototype,
+ * else we depend on <sys/ioctl.h> to do it for us. We do it this way, so
+ * that we don't define the prototype twice.
*/
+#ifndef _SYS_IOCTL_H_
#include <sys/ioctl.h>
-#define ioctl(x,y,z) _oss_ioctl(x,y,z)
+#else
+__BEGIN_DECLS
+int _oss_ioctl(int, unsigned long, ...);
+__END_DECLS
#endif
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int _oss_ioctl(int fd, unsigned long com, void *argp);
-__END_DECLS
-
#endif /* !_SOUNDCARD_H_ */
Home |
Main Index |
Thread Index |
Old Index