提交 b6c9c940 编写于 作者: M Michael Walle 提交者: malc

ossaudio: add endianness support for VoiceIn

Signed-off-by: NMichael Walle <michael@walle.cc>
Signed-off-by: Nmalc <av1474@comtv.ru>
上级 d43ffce1
......@@ -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:
if (endianness) {
return AFMT_S16_BE;
}
else {
return AFMT_S16_LE;
}
case AUD_FMT_U16:
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册