Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src Pull up following revision(s) (requested by isaki in tick...
details: https://anonhg.NetBSD.org/src/rev/0fbd3d7bf87a
branches: netbsd-9
changeset: 462819:0fbd3d7bf87a
user: martin <martin%NetBSD.org@localhost>
date: Tue Nov 19 11:01:27 2019 +0000
description:
Pull up following revision(s) (requested by isaki in ticket #446):
lib/libossaudio/ossaudio.c: revision 1.37
lib/libossaudio/ossaudio.c: revision 1.38
sys/compat/ossaudio/ossaudio.c: revision 1.77
sys/compat/ossaudio/ossaudio.c: revision 1.78
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
Fix PR lib/54667.
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.
Use record field for recording even on
SNDCTL_DSP_STEREO, SNDCTL_DSP_SETFMT, and SNDCTL_DSP_CHANNELS.
diffstat:
lib/libossaudio/ossaudio.c | 36 ++++++++++++++++++++++--------------
sys/compat/ossaudio/ossaudio.c | 28 ++++++++++++++++++----------
2 files changed, 40 insertions(+), 24 deletions(-)
diffs (224 lines):
diff -r ad303c284148 -r 0fbd3d7bf87a lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c Tue Nov 19 10:58:30 2019 +0000
+++ b/lib/libossaudio/ossaudio.c Tue Nov 19 11:01:27 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ossaudio.c,v 1.36 2019/02/02 04:52:16 isaki Exp $ */
+/* $NetBSD: ossaudio.c,v 1.36.2.1 2019/11/19 11:01:27 martin Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: ossaudio.c,v 1.36 2019/02/02 04:52:16 isaki Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.36.2.1 2019/11/19 11:01:27 martin Exp $");
/*
* This is an OSS (Linux) sound API emulator.
@@ -57,6 +57,10 @@
#define TO_OSSVOL(x) (((x) * 100 + 127) / 255)
#define FROM_OSSVOL(x) ((((x) > 100 ? 100 : (x)) * 255 + 50) / 100)
+#define GETPRINFO(info, name) \
+ (((info)->mode == AUMODE_RECORD) \
+ ? (info)->record.name : (info)->play.name)
+
static struct audiodevinfo *getdevinfo(int);
static void setblocksize(int, struct audio_info *);
@@ -104,6 +108,8 @@
char version[32] = "4.01";
char license[16] = "NetBSD";
u_int u;
+ u_int encoding;
+ u_int precision;
int idat, idata;
int retval;
int i;
@@ -134,7 +140,7 @@
retval = ioctl(fd, AUDIO_GETBUFINFO, &tmpinfo);
if (retval < 0)
return retval;
- INTARG = tmpinfo.play.sample_rate;
+ INTARG = GETPRINFO(&tmpinfo, sample_rate);
break;
case SNDCTL_DSP_STEREO:
AUDIO_INITINFO(&tmpinfo);
@@ -144,7 +150,7 @@
retval = ioctl(fd, AUDIO_GETBUFINFO, &tmpinfo);
if (retval < 0)
return retval;
- INTARG = tmpinfo.play.channels - 1;
+ INTARG = GETPRINFO(&tmpinfo, channels) - 1;
break;
case SNDCTL_DSP_GETBLKSIZE:
retval = ioctl(fd, AUDIO_GETBUFINFO, &tmpinfo);
@@ -243,7 +249,9 @@
retval = ioctl(fd, AUDIO_GETBUFINFO, &tmpinfo);
if (retval < 0)
return retval;
- switch (tmpinfo.play.encoding) {
+ encoding = GETPRINFO(&tmpinfo, encoding);
+ precision = GETPRINFO(&tmpinfo, precision);
+ switch (encoding) {
case AUDIO_ENCODING_ULAW:
idat = AFMT_MU_LAW;
break;
@@ -251,33 +259,33 @@
idat = AFMT_A_LAW;
break;
case AUDIO_ENCODING_SLINEAR_LE:
- if (tmpinfo.play.precision == 32)
+ if (precision == 32)
idat = AFMT_S32_LE;
- else if (tmpinfo.play.precision == 24)
+ else if (precision == 24)
idat = AFMT_S24_LE;
- else if (tmpinfo.play.precision == 16)
+ else if (precision == 16)
idat = AFMT_S16_LE;
else
idat = AFMT_S8;
break;
case AUDIO_ENCODING_SLINEAR_BE:
- if (tmpinfo.play.precision == 32)
+ if (precision == 32)
idat = AFMT_S32_BE;
- else if (tmpinfo.play.precision == 24)
+ else if (precision == 24)
idat = AFMT_S24_BE;
- else if (tmpinfo.play.precision == 16)
+ else if (precision == 16)
idat = AFMT_S16_BE;
else
idat = AFMT_S8;
break;
case AUDIO_ENCODING_ULINEAR_LE:
- if (tmpinfo.play.precision == 16)
+ if (precision == 16)
idat = AFMT_U16_LE;
else
idat = AFMT_U8;
break;
case AUDIO_ENCODING_ULINEAR_BE:
- if (tmpinfo.play.precision == 16)
+ if (precision == 16)
idat = AFMT_U16_BE;
else
idat = AFMT_U8;
@@ -303,7 +311,7 @@
retval = ioctl(fd, AUDIO_GETBUFINFO, &tmpinfo);
if (retval < 0)
return retval;
- INTARG = tmpinfo.play.channels;
+ INTARG = GETPRINFO(&tmpinfo, channels);
break;
case SOUND_PCM_WRITE_FILTER:
case SOUND_PCM_READ_FILTER:
diff -r ad303c284148 -r 0fbd3d7bf87a sys/compat/ossaudio/ossaudio.c
--- a/sys/compat/ossaudio/ossaudio.c Tue Nov 19 10:58:30 2019 +0000
+++ b/sys/compat/ossaudio/ossaudio.c Tue Nov 19 11:01:27 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ossaudio.c,v 1.74.4.1 2019/09/13 06:25:26 martin Exp $ */
+/* $NetBSD: ossaudio.c,v 1.74.4.2 2019/11/19 11:01:27 martin Exp $ */
/*-
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.74.4.1 2019/09/13 06:25:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.74.4.2 2019/11/19 11:01:27 martin Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -59,6 +59,10 @@
#define TO_OSSVOL(x) (((x) * 100 + 127) / 255)
#define FROM_OSSVOL(x) ((((x) > 100 ? 100 : (x)) * 255 + 50) / 100)
+#define GETPRINFO(info, name) \
+ (((info)->mode == AUMODE_RECORD) \
+ ? (info)->record.name : (info)->play.name)
+
static struct audiodevinfo *getdevinfo(file_t *);
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);
@@ -177,6 +181,8 @@
struct oss_count_info cntinfo;
struct audio_encoding tmpenc;
u_int u;
+ u_int encoding;
+ u_int precision;
int idat, idata;
int error = 0;
int (*ioctlf)(file_t *, u_long, void *);
@@ -238,7 +244,7 @@
__func__, error));
goto out;
}
- idat = tmpinfo.play.sample_rate;
+ idat = GETPRINFO(&tmpinfo, sample_rate);
DPRINTF(("%s: SNDCTL_PCM_READ_RATE < %d\n", __func__, idat));
error = copyout(&idat, SCARG(uap, data), sizeof idat);
if (error) {
@@ -269,7 +275,7 @@
__func__, error));
goto out;
}
- idat = tmpinfo.play.channels - 1;
+ idat = GETPRINFO(&tmpinfo, channels) - 1;
error = copyout(&idat, SCARG(uap, data), sizeof idat);
if (error) {
DPRINTF(("%s: SNDCTL_DSP_STEREO %d = %d\n",
@@ -380,7 +386,9 @@
__func__, error));
goto out;
}
- switch (tmpinfo.play.encoding) {
+ encoding = GETPRINFO(&tmpinfo, encoding);
+ precision = GETPRINFO(&tmpinfo, precision);
+ switch (encoding) {
case AUDIO_ENCODING_ULAW:
idat = OSS_AFMT_MU_LAW;
break;
@@ -388,25 +396,25 @@
idat = OSS_AFMT_A_LAW;
break;
case AUDIO_ENCODING_SLINEAR_LE:
- if (tmpinfo.play.precision == 16)
+ if (precision == 16)
idat = OSS_AFMT_S16_LE;
else
idat = OSS_AFMT_S8;
break;
case AUDIO_ENCODING_SLINEAR_BE:
- if (tmpinfo.play.precision == 16)
+ if (precision == 16)
idat = OSS_AFMT_S16_BE;
else
idat = OSS_AFMT_S8;
break;
case AUDIO_ENCODING_ULINEAR_LE:
- if (tmpinfo.play.precision == 16)
+ if (precision == 16)
idat = OSS_AFMT_U16_LE;
else
idat = OSS_AFMT_U8;
break;
case AUDIO_ENCODING_ULINEAR_BE:
- if (tmpinfo.play.precision == 16)
+ if (precision == 16)
idat = OSS_AFMT_U16_BE;
else
idat = OSS_AFMT_U8;
@@ -457,7 +465,7 @@
__func__, error));
goto out;
}
- idat = tmpinfo.play.channels;
+ idat = GETPRINFO(&tmpinfo, channels);
DPRINTF(("%s: SOUND_PCM_READ_CHANNELS < %d\n", __func__, idat));
error = copyout(&idat, SCARG(uap, data), sizeof idat);
if (error) {
Home |
Main Index |
Thread Index |
Old Index