Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add support for AFMT_AC3
details: https://anonhg.NetBSD.org/src/rev/6efb7d2fdd04
branches: trunk
changeset: 769295:6efb7d2fdd04
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Sep 06 01:19:34 2011 +0000
description:
Add support for AFMT_AC3
diffstat:
lib/libossaudio/ossaudio.c | 16 ++++++++++++++--
lib/libossaudio/soundcard.h | 3 ++-
sys/compat/ossaudio/ossaudio.c | 16 ++++++++++++++--
sys/compat/ossaudio/ossaudiovar.h | 3 ++-
4 files changed, 32 insertions(+), 6 deletions(-)
diffs (136 lines):
diff -r 63bf4d090f91 -r 6efb7d2fdd04 lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c Tue Sep 06 01:17:48 2011 +0000
+++ b/lib/libossaudio/ossaudio.c Tue Sep 06 01:19:34 2011 +0000
@@ -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;
}
diff -r 63bf4d090f91 -r 6efb7d2fdd04 lib/libossaudio/soundcard.h
--- a/lib/libossaudio/soundcard.h Tue Sep 06 01:17:48 2011 +0000
+++ b/lib/libossaudio/soundcard.h Tue Sep 06 01:19:34 2011 +0000
@@ -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 0x00000080
#define AFMT_U16_BE 0x00000100
#define AFMT_MPEG 0x00000200
+#define AFMT_AC3 0x00000400
#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
#define SOUND_PCM_READ_BITS _IOR ('P', 5, int)
#define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int)
diff -r 63bf4d090f91 -r 6efb7d2fdd04 sys/compat/ossaudio/ossaudio.c
--- a/sys/compat/ossaudio/ossaudio.c Tue Sep 06 01:17:48 2011 +0000
+++ b/sys/compat/ossaudio/ossaudio.c Tue Sep 06 01:19:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ossaudio.c,v 1.65 2009/08/22 23:31:16 christos Exp $ */
+/* $NetBSD: ossaudio.c,v 1.66 2011/09/06 01:19:34 jmcneill 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.65 2009/08/22 23:31:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.66 2011/09/06 01:19:34 jmcneill Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -352,6 +352,12 @@
tmpinfo.play.encoding =
tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_BE;
break;
+ case OSS_AFMT_AC3:
+ tmpinfo.play.precision =
+ tmpinfo.record.precision = 16;
+ tmpinfo.play.encoding =
+ tmpinfo.record.encoding = AUDIO_ENCODING_AC3;
+ break;
default:
DPRINTF(("%s: SNDCTL_DSP_SETFMT bad fmt %d\n",
__func__, idat));
@@ -408,6 +414,9 @@
case AUDIO_ENCODING_ADPCM:
idat = OSS_AFMT_IMA_ADPCM;
break;
+ case AUDIO_ENCODING_AC3:
+ idat = OSS_AFMT_AC3;
+ break;
default:
DPRINTF(("%s: SOUND_PCM_READ_BITS bad encoding %d\n",
__func__, tmpinfo.play.encoding));
@@ -583,6 +592,9 @@
case AUDIO_ENCODING_ADPCM:
idat |= OSS_AFMT_IMA_ADPCM;
break;
+ case AUDIO_ENCODING_AC3:
+ idat |= OSS_AFMT_AC3;
+ break;
default:
DPRINTF(("%s: SNDCTL_DSP_GETFMTS unknown %d\n",
__func__, tmpenc.encoding));
diff -r 63bf4d090f91 -r 6efb7d2fdd04 sys/compat/ossaudio/ossaudiovar.h
--- a/sys/compat/ossaudio/ossaudiovar.h Tue Sep 06 01:17:48 2011 +0000
+++ b/sys/compat/ossaudio/ossaudiovar.h Tue Sep 06 01:19:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ossaudiovar.h,v 1.15 2008/04/28 20:23:45 martin Exp $ */
+/* $NetBSD: ossaudiovar.h,v 1.16 2011/09/06 01:19:34 jmcneill Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -99,6 +99,7 @@
#define OSS_AFMT_U16_LE 0x00000080 /* Little endian U16 */
#define OSS_AFMT_U16_BE 0x00000100 /* Big endian U16 */
#define OSS_AFMT_MPEG 0x00000200 /* MPEG (2) audio */
+#define OSS_AFMT_AC3 0x00000400 /* Dolby Digital AC3 */
/* Mixer defines */
#define OSS_SOUND_MIXER_FIRST 0
Home |
Main Index |
Thread Index |
Old Index