Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/audio/record convert the host (non _LE or _BE) encod...
details: https://anonhg.NetBSD.org/src/rev/501d40a89a32
branches: trunk
changeset: 522008:501d40a89a32
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Feb 10 13:16:08 2002 +0000
description:
convert the host (non _LE or _BE) encodings we can, as well. fixes part
of PR#12809...
diffstat:
usr.bin/audio/record/record.c | 42 ++++++++++++++++++++++++++++++++++--------
1 files changed, 34 insertions(+), 8 deletions(-)
diffs (78 lines):
diff -r 36489c0af7e7 -r 501d40a89a32 usr.bin/audio/record/record.c
--- a/usr.bin/audio/record/record.c Sun Feb 10 13:15:08 2002 +0000
+++ b/usr.bin/audio/record/record.c Sun Feb 10 13:16:08 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: record.c,v 1.24 2002/02/05 00:17:27 augustss Exp $ */
+/* $NetBSD: record.c,v 1.25 2002/02/10 13:16:08 mrg Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@@ -321,35 +321,61 @@
static sun_audioheader auh;
int sunenc, oencoding = encoding;
- if (encoding == AUDIO_ENCODING_ULINEAR_LE) {
+ switch (encoding) {
+ case AUDIO_ENCODING_ULINEAR_LE:
+#if BYTE_ORDER == LITTLE_ENDIAN
+ case AUDIO_ENCODING_ULINEAR:
+#endif
if (precision == 16)
conv_func = swap_bytes;
else if (precision == 32)
conv_func = swap_bytes32;
if (conv_func)
encoding = AUDIO_ENCODING_SLINEAR_BE;
- } else if (encoding == AUDIO_ENCODING_ULINEAR_BE) {
+ break;
+
+ case AUDIO_ENCODING_ULINEAR_BE:
+#if BYTE_ORDER == BIG_ENDIAN
+ case AUDIO_ENCODING_ULINEAR:
+#endif
if (precision == 16)
conv_func = change_sign16_be;
else if (precision == 32)
conv_func = change_sign32_be;
if (conv_func)
encoding = AUDIO_ENCODING_SLINEAR_BE;
- } else if (encoding == AUDIO_ENCODING_SLINEAR_LE) {
+ break;
+
+ case AUDIO_ENCODING_SLINEAR_LE:
+#if BYTE_ORDER == LITTLE_ENDIAN
+ case AUDIO_ENCODING_SLINEAR:
+#endif
if (precision == 16)
conv_func = change_sign16_swap_bytes_le;
else if (precision == 32)
conv_func = change_sign32_swap_bytes_le;
if (conv_func)
encoding = AUDIO_ENCODING_SLINEAR_BE;
+ break;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ case AUDIO_ENCODING_SLINEAR:
+ encoding = AUDIO_ENCODING_SLINEAR_BE;
+ break;
+#endif
}
/* if we can't express this as a Sun header, don't write any */
if (audio_encoding_to_sun(encoding, precision, &sunenc) != 0) {
- if (!qflag && !warned)
- warnx("failed to convert to sun encoding from %d:%d; "
- "Sun audio header not written",
- oencoding, precision);
+ if (!qflag && !warned) {
+ const char *s = audio_enc_from_val(oencoding);
+
+ if (s == NULL)
+ s = "(unknown)";
+ warnx("failed to convert to sun encoding from %s "
+ "(precision %d);\nSun audio header not written",
+ s, precision);
+ }
conv_func = 0;
warned = 1;
return -1;
Home |
Main Index |
Thread Index |
Old Index