qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] ossaudio: add endianness support for VoiceIn
@ 2011-01-08 15:28 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
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Walle @ 2011-01-08 15:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Walle

Signed-off-by: Michael Walle <michael@walle.cc>
---
 audio/ossaudio.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 42bffae..5a56aa8 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,16 @@ 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 +522,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 +688,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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-01-09  0:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [Qemu-devel] " Michael Walle
2011-01-09  0:07     ` [Qemu-devel] " malc
2011-01-08 16:53   ` [Qemu-devel] [PATCH 2/2] alsaaudio: " Michael Walle

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).