Add AUDIO_ENCODING_AC3 encoding type.diff -r1.22 -r1.23 src/sys/dev/auconv.c
(jmcneill)
--- src/sys/dev/Attic/auconv.c 2009/01/03 03:43:21 1.22
+++ src/sys/dev/Attic/auconv.c 2011/09/06 01:16:44 1.23
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: auconv.c,v 1.22 2009/01/03 03:43:21 yamt Exp $ */ | 1 | /* $NetBSD: auconv.c,v 1.23 2011/09/06 01:16:44 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
33 | * SUCH DAMAGE. | 33 | * SUCH DAMAGE. | |
34 | * | 34 | * | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.22 2009/01/03 03:43:21 yamt Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.23 2011/09/06 01:16:44 jmcneill Exp $"); | |
39 | 39 | |||
40 | #include <sys/types.h> | 40 | #include <sys/types.h> | |
41 | #include <sys/audioio.h> | 41 | #include <sys/audioio.h> | |
42 | #include <sys/device.h> | 42 | #include <sys/device.h> | |
43 | #include <sys/errno.h> | 43 | #include <sys/errno.h> | |
44 | #include <sys/malloc.h> | 44 | #include <sys/malloc.h> | |
45 | #include <sys/null.h> | 45 | #include <sys/null.h> | |
46 | #include <sys/systm.h> | 46 | #include <sys/systm.h> | |
47 | #include <dev/audio_if.h> | 47 | #include <dev/audio_if.h> | |
48 | #include <dev/auconv.h> | 48 | #include <dev/auconv.h> | |
49 | #include <dev/mulaw.h> | 49 | #include <dev/mulaw.h> | |
50 | #include <machine/limits.h> | 50 | #include <machine/limits.h> | |
51 | #ifndef _KERNEL | 51 | #ifndef _KERNEL | |
@@ -195,27 +195,28 @@ static const struct conv_table alaw_tabl | @@ -195,27 +195,28 @@ static const struct conv_table alaw_tabl | |||
195 | alaw_to_linear8, linear8_to_alaw}, | 195 | alaw_to_linear8, linear8_to_alaw}, | |
196 | {AUDIO_ENCODING_ULINEAR_LE, 8, 8, | 196 | {AUDIO_ENCODING_ULINEAR_LE, 8, 8, | |
197 | alaw_to_linear8, linear8_to_alaw}, | 197 | alaw_to_linear8, linear8_to_alaw}, | |
198 | {0, 0, 0, NULL, NULL}}; | 198 | {0, 0, 0, NULL, NULL}}; | |
199 | #endif | 199 | #endif | |
200 | #ifdef AUCONV_DEBUG | 200 | #ifdef AUCONV_DEBUG | |
201 | static const char *encoding_dbg_names[] = { | 201 | static const char *encoding_dbg_names[] = { | |
202 | "none", AudioEmulaw, AudioEalaw, "pcm16", | 202 | "none", AudioEmulaw, AudioEalaw, "pcm16", | |
203 | "pcm8", AudioEadpcm, AudioEslinear_le, AudioEslinear_be, | 203 | "pcm8", AudioEadpcm, AudioEslinear_le, AudioEslinear_be, | |
204 | AudioEulinear_le, AudioEulinear_be, | 204 | AudioEulinear_le, AudioEulinear_be, | |
205 | AudioEslinear, AudioEulinear, | 205 | AudioEslinear, AudioEulinear, | |
206 | AudioEmpeg_l1_stream, AudioEmpeg_l1_packets, | 206 | AudioEmpeg_l1_stream, AudioEmpeg_l1_packets, | |
207 | AudioEmpeg_l1_system, AudioEmpeg_l2_stream, | 207 | AudioEmpeg_l1_system, AudioEmpeg_l2_stream, | |
208 | AudioEmpeg_l2_packets, AudioEmpeg_l2_system | 208 | AudioEmpeg_l2_packets, AudioEmpeg_l2_system, | |
209 | AudioEac3 | |||
209 | }; | 210 | }; | |
210 | #endif | 211 | #endif | |
211 | 212 | |||
212 | void | 213 | void | |
213 | stream_filter_set_fetcher(stream_filter_t *this, stream_fetcher_t *p) | 214 | stream_filter_set_fetcher(stream_filter_t *this, stream_fetcher_t *p) | |
214 | { | 215 | { | |
215 | this->prev = p; | 216 | this->prev = p; | |
216 | } | 217 | } | |
217 | 218 | |||
218 | void | 219 | void | |
219 | stream_filter_set_inputbuffer(stream_filter_t *this, audio_stream_t *stream) | 220 | stream_filter_set_inputbuffer(stream_filter_t *this, audio_stream_t *stream) | |
220 | { | 221 | { | |
221 | this->src = stream; | 222 | this->src = stream; | |
@@ -815,27 +816,27 @@ auconv_exact_match(const struct audio_fo | @@ -815,27 +816,27 @@ auconv_exact_match(const struct audio_fo | |||
815 | if (!AUFMT_IS_VALID(&formats[i])) | 816 | if (!AUFMT_IS_VALID(&formats[i])) | |
816 | continue; | 817 | continue; | |
817 | if ((formats[i].mode & mode) == 0) | 818 | if ((formats[i].mode & mode) == 0) | |
818 | continue; | 819 | continue; | |
819 | f_enc = auconv_normalize_encoding(formats[i].encoding, | 820 | f_enc = auconv_normalize_encoding(formats[i].encoding, | |
820 | formats[i].precision); | 821 | formats[i].precision); | |
821 | DPRINTF(("%s: format[%d] normalized: %s\n", | 822 | DPRINTF(("%s: format[%d] normalized: %s\n", | |
822 | __func__, i, encoding_dbg_names[f_enc])); | 823 | __func__, i, encoding_dbg_names[f_enc])); | |
823 | if (f_enc != enc) | 824 | if (f_enc != enc) | |
824 | continue; | 825 | continue; | |
825 | /** | 826 | /** | |
826 | * XXX we need encoding-dependent check. | 827 | * XXX we need encoding-dependent check. | |
827 | * XXX Is to check precision/channels meaningful for | 828 | * XXX Is to check precision/channels meaningful for | |
828 | * MPEG encodings? | 829 | * MPEG/AC3 encodings? | |
829 | */ | 830 | */ | |
830 | if (formats[i].validbits != param->validbits) | 831 | if (formats[i].validbits != param->validbits) | |
831 | continue; | 832 | continue; | |
832 | if (formats[i].precision != param->precision) | 833 | if (formats[i].precision != param->precision) | |
833 | continue; | 834 | continue; | |
834 | if (formats[i].channels != param->channels) | 835 | if (formats[i].channels != param->channels) | |
835 | continue; | 836 | continue; | |
836 | if (!auconv_is_supported_rate(&formats[i], | 837 | if (!auconv_is_supported_rate(&formats[i], | |
837 | param->sample_rate)) | 838 | param->sample_rate)) | |
838 | continue; | 839 | continue; | |
839 | return i; | 840 | return i; | |
840 | } | 841 | } | |
841 | return -1; | 842 | return -1; | |
@@ -1026,26 +1027,27 @@ auconv_create_encodings(const struct aud | @@ -1026,26 +1027,27 @@ auconv_create_encodings(const struct aud | |||
1026 | } | 1027 | } | |
1027 | #endif | 1028 | #endif | |
1028 | break; | 1029 | break; | |
1029 | 1030 | |||
1030 | case AUDIO_ENCODING_ULAW: | 1031 | case AUDIO_ENCODING_ULAW: | |
1031 | case AUDIO_ENCODING_ALAW: | 1032 | case AUDIO_ENCODING_ALAW: | |
1032 | case AUDIO_ENCODING_ADPCM: | 1033 | case AUDIO_ENCODING_ADPCM: | |
1033 | case AUDIO_ENCODING_MPEG_L1_STREAM: | 1034 | case AUDIO_ENCODING_MPEG_L1_STREAM: | |
1034 | case AUDIO_ENCODING_MPEG_L1_PACKETS: | 1035 | case AUDIO_ENCODING_MPEG_L1_PACKETS: | |
1035 | case AUDIO_ENCODING_MPEG_L1_SYSTEM: | 1036 | case AUDIO_ENCODING_MPEG_L1_SYSTEM: | |
1036 | case AUDIO_ENCODING_MPEG_L2_STREAM: | 1037 | case AUDIO_ENCODING_MPEG_L2_STREAM: | |
1037 | case AUDIO_ENCODING_MPEG_L2_PACKETS: | 1038 | case AUDIO_ENCODING_MPEG_L2_PACKETS: | |
1038 | case AUDIO_ENCODING_MPEG_L2_SYSTEM: | 1039 | case AUDIO_ENCODING_MPEG_L2_SYSTEM: | |
1040 | case AUDIO_ENCODING_AC3: | |||
1039 | ADD_ENCODING(formats[i].encoding, | 1041 | ADD_ENCODING(formats[i].encoding, | |
1040 | formats[i].precision, 0); | 1042 | formats[i].precision, 0); | |
1041 | break; | 1043 | break; | |
1042 | 1044 | |||
1043 | case AUDIO_ENCODING_SLINEAR: | 1045 | case AUDIO_ENCODING_SLINEAR: | |
1044 | case AUDIO_ENCODING_ULINEAR: | 1046 | case AUDIO_ENCODING_ULINEAR: | |
1045 | case AUDIO_ENCODING_LINEAR: | 1047 | case AUDIO_ENCODING_LINEAR: | |
1046 | case AUDIO_ENCODING_LINEAR8: | 1048 | case AUDIO_ENCODING_LINEAR8: | |
1047 | default: | 1049 | default: | |
1048 | printf("%s: invalid encoding value " | 1050 | printf("%s: invalid encoding value " | |
1049 | "for audio_format: %d\n", | 1051 | "for audio_format: %d\n", | |
1050 | __func__, formats[i].encoding); | 1052 | __func__, formats[i].encoding); | |
1051 | break; | 1053 | break; | |
@@ -1065,27 +1067,28 @@ auconv_create_encodings(const struct aud | @@ -1065,27 +1067,28 @@ auconv_create_encodings(const struct aud | |||
1065 | * a sub-routine for auconv_create_encodings() | 1067 | * a sub-routine for auconv_create_encodings() | |
1066 | */ | 1068 | */ | |
1067 | static int | 1069 | static int | |
1068 | auconv_add_encoding(int enc, int prec, int flags, | 1070 | auconv_add_encoding(int enc, int prec, int flags, | |
1069 | struct audio_encoding_set **buf, int *capacity) | 1071 | struct audio_encoding_set **buf, int *capacity) | |
1070 | { | 1072 | { | |
1071 | static const char *encoding_names[] = { | 1073 | static const char *encoding_names[] = { | |
1072 | NULL, AudioEmulaw, AudioEalaw, NULL, | 1074 | NULL, AudioEmulaw, AudioEalaw, NULL, | |
1073 | NULL, AudioEadpcm, AudioEslinear_le, AudioEslinear_be, | 1075 | NULL, AudioEadpcm, AudioEslinear_le, AudioEslinear_be, | |
1074 | AudioEulinear_le, AudioEulinear_be, | 1076 | AudioEulinear_le, AudioEulinear_be, | |
1075 | AudioEslinear, AudioEulinear, | 1077 | AudioEslinear, AudioEulinear, | |
1076 | AudioEmpeg_l1_stream, AudioEmpeg_l1_packets, | 1078 | AudioEmpeg_l1_stream, AudioEmpeg_l1_packets, | |
1077 | AudioEmpeg_l1_system, AudioEmpeg_l2_stream, | 1079 | AudioEmpeg_l1_system, AudioEmpeg_l2_stream, | |
1078 | AudioEmpeg_l2_packets, AudioEmpeg_l2_system | 1080 | AudioEmpeg_l2_packets, AudioEmpeg_l2_system, | |
1081 | AudioEac3 | |||
1079 | }; | 1082 | }; | |
1080 | struct audio_encoding_set *set; | 1083 | struct audio_encoding_set *set; | |
1081 | struct audio_encoding_set *new_buf; | 1084 | struct audio_encoding_set *new_buf; | |
1082 | audio_encoding_t *e; | 1085 | audio_encoding_t *e; | |
1083 | int i; | 1086 | int i; | |
1084 | 1087 | |||
1085 | set = *buf; | 1088 | set = *buf; | |
1086 | /* already has the same encoding? */ | 1089 | /* already has the same encoding? */ | |
1087 | e = set->items; | 1090 | e = set->items; | |
1088 | for (i = 0; i < set->size; i++, e++) { | 1091 | for (i = 0; i < set->size; i++, e++) { | |
1089 | if (e->encoding == enc && e->precision == prec) { | 1092 | if (e->encoding == enc && e->precision == prec) { | |
1090 | /* overwrite EMULATED flag */ | 1093 | /* overwrite EMULATED flag */ | |
1091 | if ((e->flags & AUDIO_ENCODINGFLAG_EMULATED) | 1094 | if ((e->flags & AUDIO_ENCODINGFLAG_EMULATED) |
--- src/sys/dev/Attic/audio.c 2010/11/20 18:03:49 1.252
+++ src/sys/dev/Attic/audio.c 2011/09/06 01:16:44 1.253
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: audio.c,v 1.252 2010/11/20 18:03:49 tsutsui Exp $ */ | 1 | /* $NetBSD: audio.c,v 1.253 2011/09/06 01:16:44 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1991-1993 Regents of the University of California. | 4 | * Copyright (c) 1991-1993 Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -51,27 +51,27 @@ | @@ -51,27 +51,27 @@ | |||
51 | * generated. | 51 | * generated. | |
52 | * | 52 | * | |
53 | * If you try to set both play and record mode on a half-duplex | 53 | * If you try to set both play and record mode on a half-duplex | |
54 | * device, playing takes precedence. | 54 | * device, playing takes precedence. | |
55 | */ | 55 | */ | |
56 | 56 | |||
57 | /* | 57 | /* | |
58 | * Todo: | 58 | * Todo: | |
59 | * - Add softaudio() isr processing for wakeup, poll, signals, | 59 | * - Add softaudio() isr processing for wakeup, poll, signals, | |
60 | * and silence fill. | 60 | * and silence fill. | |
61 | */ | 61 | */ | |
62 | 62 | |||
63 | #include <sys/cdefs.h> | 63 | #include <sys/cdefs.h> | |
64 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.252 2010/11/20 18:03:49 tsutsui Exp $"); | 64 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.253 2011/09/06 01:16:44 jmcneill Exp $"); | |
65 | 65 | |||
66 | #include "audio.h" | 66 | #include "audio.h" | |
67 | #if NAUDIO > 0 | 67 | #if NAUDIO > 0 | |
68 | 68 | |||
69 | #include <sys/param.h> | 69 | #include <sys/param.h> | |
70 | #include <sys/ioctl.h> | 70 | #include <sys/ioctl.h> | |
71 | #include <sys/fcntl.h> | 71 | #include <sys/fcntl.h> | |
72 | #include <sys/vnode.h> | 72 | #include <sys/vnode.h> | |
73 | #include <sys/select.h> | 73 | #include <sys/select.h> | |
74 | #include <sys/poll.h> | 74 | #include <sys/poll.h> | |
75 | #include <sys/malloc.h> | 75 | #include <sys/malloc.h> | |
76 | #include <sys/proc.h> | 76 | #include <sys/proc.h> | |
77 | #include <sys/systm.h> | 77 | #include <sys/systm.h> | |
@@ -1835,26 +1835,27 @@ audio_fill_silence(struct audio_params * | @@ -1835,26 +1835,27 @@ audio_fill_silence(struct audio_params * | |||
1835 | switch (params->encoding) { | 1835 | switch (params->encoding) { | |
1836 | case AUDIO_ENCODING_ULAW: | 1836 | case AUDIO_ENCODING_ULAW: | |
1837 | auzero0 = 0x7f; | 1837 | auzero0 = 0x7f; | |
1838 | break; | 1838 | break; | |
1839 | case AUDIO_ENCODING_ALAW: | 1839 | case AUDIO_ENCODING_ALAW: | |
1840 | auzero0 = 0x55; | 1840 | auzero0 = 0x55; | |
1841 | break; | 1841 | break; | |
1842 | case AUDIO_ENCODING_MPEG_L1_STREAM: | 1842 | case AUDIO_ENCODING_MPEG_L1_STREAM: | |
1843 | case AUDIO_ENCODING_MPEG_L1_PACKETS: | 1843 | case AUDIO_ENCODING_MPEG_L1_PACKETS: | |
1844 | case AUDIO_ENCODING_MPEG_L1_SYSTEM: | 1844 | case AUDIO_ENCODING_MPEG_L1_SYSTEM: | |
1845 | case AUDIO_ENCODING_MPEG_L2_STREAM: | 1845 | case AUDIO_ENCODING_MPEG_L2_STREAM: | |
1846 | case AUDIO_ENCODING_MPEG_L2_PACKETS: | 1846 | case AUDIO_ENCODING_MPEG_L2_PACKETS: | |
1847 | case AUDIO_ENCODING_MPEG_L2_SYSTEM: | 1847 | case AUDIO_ENCODING_MPEG_L2_SYSTEM: | |
1848 | case AUDIO_ENCODING_AC3: | |||
1848 | case AUDIO_ENCODING_ADPCM: /* is this right XXX */ | 1849 | case AUDIO_ENCODING_ADPCM: /* is this right XXX */ | |
1849 | case AUDIO_ENCODING_SLINEAR_LE: | 1850 | case AUDIO_ENCODING_SLINEAR_LE: | |
1850 | case AUDIO_ENCODING_SLINEAR_BE: | 1851 | case AUDIO_ENCODING_SLINEAR_BE: | |
1851 | auzero0 = 0;/* fortunately this works for any number of bits */ | 1852 | auzero0 = 0;/* fortunately this works for any number of bits */ | |
1852 | break; | 1853 | break; | |
1853 | case AUDIO_ENCODING_ULINEAR_LE: | 1854 | case AUDIO_ENCODING_ULINEAR_LE: | |
1854 | case AUDIO_ENCODING_ULINEAR_BE: | 1855 | case AUDIO_ENCODING_ULINEAR_BE: | |
1855 | if (params->precision > 8) { | 1856 | if (params->precision > 8) { | |
1856 | nfill = (params->precision + NBBY - 1)/ NBBY; | 1857 | nfill = (params->precision + NBBY - 1)/ NBBY; | |
1857 | auzero0 = 0x80; | 1858 | auzero0 = 0x80; | |
1858 | auzero1 = 0; | 1859 | auzero1 = 0; | |
1859 | } else | 1860 | } else | |
1860 | auzero0 = 0x80; | 1861 | auzero0 = 0x80; | |
@@ -2962,26 +2963,27 @@ audio_check_params(struct audio_params * | @@ -2962,26 +2963,27 @@ audio_check_params(struct audio_params * | |||
2962 | if (p->precision == 8 && p->encoding == AUDIO_ENCODING_SLINEAR_BE) | 2963 | if (p->precision == 8 && p->encoding == AUDIO_ENCODING_SLINEAR_BE) | |
2963 | p->encoding = AUDIO_ENCODING_SLINEAR_LE; | 2964 | p->encoding = AUDIO_ENCODING_SLINEAR_LE; | |
2964 | if (p->precision == 8 && p->encoding == AUDIO_ENCODING_ULINEAR_BE) | 2965 | if (p->precision == 8 && p->encoding == AUDIO_ENCODING_ULINEAR_BE) | |
2965 | p->encoding = AUDIO_ENCODING_ULINEAR_LE; | 2966 | p->encoding = AUDIO_ENCODING_ULINEAR_LE; | |
2966 | if (p->validbits > p->precision) | 2967 | if (p->validbits > p->precision) | |
2967 | return EINVAL; | 2968 | return EINVAL; | |
2968 | break; | 2969 | break; | |
2969 | case AUDIO_ENCODING_MPEG_L1_STREAM: | 2970 | case AUDIO_ENCODING_MPEG_L1_STREAM: | |
2970 | case AUDIO_ENCODING_MPEG_L1_PACKETS: | 2971 | case AUDIO_ENCODING_MPEG_L1_PACKETS: | |
2971 | case AUDIO_ENCODING_MPEG_L1_SYSTEM: | 2972 | case AUDIO_ENCODING_MPEG_L1_SYSTEM: | |
2972 | case AUDIO_ENCODING_MPEG_L2_STREAM: | 2973 | case AUDIO_ENCODING_MPEG_L2_STREAM: | |
2973 | case AUDIO_ENCODING_MPEG_L2_PACKETS: | 2974 | case AUDIO_ENCODING_MPEG_L2_PACKETS: | |
2974 | case AUDIO_ENCODING_MPEG_L2_SYSTEM: | 2975 | case AUDIO_ENCODING_MPEG_L2_SYSTEM: | |
2976 | case AUDIO_ENCODING_AC3: | |||
2975 | break; | 2977 | break; | |
2976 | default: | 2978 | default: | |
2977 | return EINVAL; | 2979 | return EINVAL; | |
2978 | } | 2980 | } | |
2979 | 2981 | |||
2980 | /* sanity check # of channels*/ | 2982 | /* sanity check # of channels*/ | |
2981 | if (p->channels < 1 || p->channels > AUDIO_MAX_CHANNELS) | 2983 | if (p->channels < 1 || p->channels > AUDIO_MAX_CHANNELS) | |
2982 | return EINVAL; | 2984 | return EINVAL; | |
2983 | 2985 | |||
2984 | return 0; | 2986 | return 0; | |
2985 | } | 2987 | } | |
2986 | 2988 | |||
2987 | int | 2989 | int |
--- src/sys/sys/audioio.h 2009/09/29 15:58:54 1.33
+++ src/sys/sys/audioio.h 2011/09/06 01:16:43 1.34
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: audioio.h,v 1.33 2009/09/29 15:58:54 sborrill Exp $ */ | 1 | /* $NetBSD: audioio.h,v 1.34 2011/09/06 01:16:43 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1991-1993 Regents of the University of California. | 4 | * Copyright (c) 1991-1993 Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -122,26 +122,27 @@ typedef struct audio_offset { | @@ -122,26 +122,27 @@ typedef struct audio_offset { | |||
122 | #define AUDIO_ENCODING_ADPCM 5 /* adaptive differential PCM */ | 122 | #define AUDIO_ENCODING_ADPCM 5 /* adaptive differential PCM */ | |
123 | #define AUDIO_ENCODING_SLINEAR_LE 6 | 123 | #define AUDIO_ENCODING_SLINEAR_LE 6 | |
124 | #define AUDIO_ENCODING_SLINEAR_BE 7 | 124 | #define AUDIO_ENCODING_SLINEAR_BE 7 | |
125 | #define AUDIO_ENCODING_ULINEAR_LE 8 | 125 | #define AUDIO_ENCODING_ULINEAR_LE 8 | |
126 | #define AUDIO_ENCODING_ULINEAR_BE 9 | 126 | #define AUDIO_ENCODING_ULINEAR_BE 9 | |
127 | #define AUDIO_ENCODING_SLINEAR 10 | 127 | #define AUDIO_ENCODING_SLINEAR 10 | |
128 | #define AUDIO_ENCODING_ULINEAR 11 | 128 | #define AUDIO_ENCODING_ULINEAR 11 | |
129 | #define AUDIO_ENCODING_MPEG_L1_STREAM 12 | 129 | #define AUDIO_ENCODING_MPEG_L1_STREAM 12 | |
130 | #define AUDIO_ENCODING_MPEG_L1_PACKETS 13 | 130 | #define AUDIO_ENCODING_MPEG_L1_PACKETS 13 | |
131 | #define AUDIO_ENCODING_MPEG_L1_SYSTEM 14 | 131 | #define AUDIO_ENCODING_MPEG_L1_SYSTEM 14 | |
132 | #define AUDIO_ENCODING_MPEG_L2_STREAM 15 | 132 | #define AUDIO_ENCODING_MPEG_L2_STREAM 15 | |
133 | #define AUDIO_ENCODING_MPEG_L2_PACKETS 16 | 133 | #define AUDIO_ENCODING_MPEG_L2_PACKETS 16 | |
134 | #define AUDIO_ENCODING_MPEG_L2_SYSTEM 17 | 134 | #define AUDIO_ENCODING_MPEG_L2_SYSTEM 17 | |
135 | #define AUDIO_ENCODING_AC3 18 | |||
135 | 136 | |||
136 | typedef struct audio_encoding { | 137 | typedef struct audio_encoding { | |
137 | int index; | 138 | int index; | |
138 | char name[MAX_AUDIO_DEV_LEN]; | 139 | char name[MAX_AUDIO_DEV_LEN]; | |
139 | int encoding; | 140 | int encoding; | |
140 | int precision; | 141 | int precision; | |
141 | int flags; | 142 | int flags; | |
142 | #define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */ | 143 | #define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */ | |
143 | } audio_encoding_t; | 144 | } audio_encoding_t; | |
144 | 145 | |||
145 | /* | 146 | /* | |
146 | * Balance settings. | 147 | * Balance settings. | |
147 | */ | 148 | */ | |
@@ -315,22 +316,23 @@ typedef struct mixer_ctrl { | @@ -315,22 +316,23 @@ typedef struct mixer_ctrl { | |||
315 | #define AudioEadpcm "adpcm" | 316 | #define AudioEadpcm "adpcm" | |
316 | #define AudioEslinear "slinear" | 317 | #define AudioEslinear "slinear" | |
317 | #define AudioEslinear_le "slinear_le" | 318 | #define AudioEslinear_le "slinear_le" | |
318 | #define AudioEslinear_be "slinear_be" | 319 | #define AudioEslinear_be "slinear_be" | |
319 | #define AudioEulinear "ulinear" | 320 | #define AudioEulinear "ulinear" | |
320 | #define AudioEulinear_le "ulinear_le" | 321 | #define AudioEulinear_le "ulinear_le" | |
321 | #define AudioEulinear_be "ulinear_be" | 322 | #define AudioEulinear_be "ulinear_be" | |
322 | #define AudioEmpeg_l1_stream "mpeg_l1_stream" | 323 | #define AudioEmpeg_l1_stream "mpeg_l1_stream" | |
323 | #define AudioEmpeg_l1_packets "mpeg_l1_packets" | 324 | #define AudioEmpeg_l1_packets "mpeg_l1_packets" | |
324 | #define AudioEmpeg_l1_system "mpeg_l1_system" | 325 | #define AudioEmpeg_l1_system "mpeg_l1_system" | |
325 | #define AudioEmpeg_l2_stream "mpeg_l2_stream" | 326 | #define AudioEmpeg_l2_stream "mpeg_l2_stream" | |
326 | #define AudioEmpeg_l2_packets "mpeg_l2_packets" | 327 | #define AudioEmpeg_l2_packets "mpeg_l2_packets" | |
327 | #define AudioEmpeg_l2_system "mpeg_l2_system" | 328 | #define AudioEmpeg_l2_system "mpeg_l2_system" | |
329 | #define AudioEac3 "ac3" | |||
328 | 330 | |||
329 | #define AudioCinputs "inputs" | 331 | #define AudioCinputs "inputs" | |
330 | #define AudioCoutputs "outputs" | 332 | #define AudioCoutputs "outputs" | |
331 | #define AudioCrecord "record" | 333 | #define AudioCrecord "record" | |
332 | #define AudioCmonitor "monitor" | 334 | #define AudioCmonitor "monitor" | |
333 | #define AudioCequalization "equalization" | 335 | #define AudioCequalization "equalization" | |
334 | #define AudioCmodem "modem" | 336 | #define AudioCmodem "modem" | |
335 | 337 | |||
336 | #endif /* !_SYS_AUDIOIO_H_ */ | 338 | #endif /* !_SYS_AUDIOIO_H_ */ |