From: Michael Walle <michael@walle.cc>
To: qemu-devel@nongnu.org
Cc: Michael Walle <michael@walle.cc>
Subject: [Qemu-devel] [PATCH 1/2] ossaudio: add endianness support for VoiceIn
Date: Sat, 8 Jan 2011 17:53:29 +0100 [thread overview]
Message-ID: <1294505610-20187-1-git-send-email-michael@walle.cc> (raw)
In-Reply-To: <alpine.LNX.2.00.1101081938570.1684@linmac>
Signed-off-by: Michael Walle <michael@walle.cc>
---
audio/ossaudio.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 42bffae..cfa8f99 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -161,7 +161,7 @@ static int oss_write (SWVoiceOut *sw, void *buf, int len)
return audio_pcm_sw_write (sw, buf, len);
}
-static int aud_to_ossfmt (audfmt_e fmt)
+static int aud_to_ossfmt (audfmt_e fmt, int endianness)
{
switch (fmt) {
case AUD_FMT_S8:
@@ -171,10 +171,18 @@ static int aud_to_ossfmt (audfmt_e fmt)
return AFMT_U8;
case AUD_FMT_S16:
- return AFMT_S16_LE;
+ if (endianness) {
+ return AFMT_S16_BE;
+ } else {
+ return AFMT_S16_LE;
+ }
case AUD_FMT_U16:
- return AFMT_U16_LE;
+ if (endianness) {
+ return AFMT_U16_BE;
+ } else {
+ return AFMT_U16_LE;
+ }
default:
dolog ("Internal logic error: Bad audio format %d\n", fmt);
@@ -516,7 +524,7 @@ static int oss_init_out (HWVoiceOut *hw, struct audsettings *as)
oss->fd = -1;
- req.fmt = aud_to_ossfmt (as->fmt);
+ req.fmt = aud_to_ossfmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.fragsize = conf.fragsize;
@@ -682,7 +690,7 @@ static int oss_init_in (HWVoiceIn *hw, struct audsettings *as)
oss->fd = -1;
- req.fmt = aud_to_ossfmt (as->fmt);
+ req.fmt = aud_to_ossfmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.fragsize = conf.fragsize;
--
1.7.2.3
next prev parent reply other threads:[~2011-01-08 16:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-08 15:28 [Qemu-devel] [PATCH 1/2] ossaudio: add endianness support for VoiceIn Michael Walle
2011-01-08 15:28 ` [Qemu-devel] [PATCH 2/2] alsaaudio: " Michael Walle
2011-01-08 16:42 ` [Qemu-devel] Re: [PATCH 1/2] ossaudio: " malc
2011-01-08 16:53 ` Michael Walle [this message]
2011-01-09 0:07 ` malc
2011-01-08 16:53 ` [Qemu-devel] [PATCH 2/2] alsaaudio: " Michael Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1294505610-20187-1-git-send-email-michael@walle.cc \
--to=michael@walle.cc \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).