aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2011-01-08 17:53:29 +0100
committermalc <av1474@comtv.ru>2011-01-09 03:05:24 +0300
commitb6c9c9401c2f9eaf3ef93770c258d819ede7e11a (patch)
treec5ac991c0cd95c330d6efc996181ea4b61a5576c /audio
parentd43ffce14023df871d6065eb864d1f41eb441f37 (diff)
ossaudio: add endianness support for VoiceIn
Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: malc <av1474@comtv.ru>
Diffstat (limited to 'audio')
-rw-r--r--audio/ossaudio.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 42bffaeafd..d7a55e5441 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,20 @@ 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 +526,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 +692,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;