aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2014-09-23 21:04:37 +0200
committerGravatar wm4 <wm4@nowhere>2014-09-23 23:09:25 +0200
commitb745c2d0050468580aec0a4e12aec854fefd1796 (patch)
tree0df9a9f56b339cabc68376840b4d283b848acdf8 /stream
parent5b5a3d0c469fa5e282b60eb9ac2b7e4414640d80 (diff)
audio: drop swapped-endian audio formats
Until now, the audio chain could handle both little endian and big endian formats. This actually doesn't make much sense, since the audio API and the HW will most likely prefer native formats. Or at the very least, it should be trivial for audio drivers to do the byte swapping themselves. From now on, the audio chain contains native-endian formats only. All AOs and some filters are adjusted. af_convertsignendian.c is now wrongly named, but the filter name is adjusted. In some cases, the audio infrastructure was reused on the demuxer side, but that is relatively easy to rectify. This is a quite intrusive and radical change. It's possible that it will break some things (especially if they're obscure or not Linux), so watch out for regressions. It's probably still better to do it the bulldozer way, since slow transition and researching foreign platforms would take a lot of time and effort.
Diffstat (limited to 'stream')
-rw-r--r--stream/ai_alsa1x.c4
-rw-r--r--stream/ai_oss.c4
-rw-r--r--stream/ai_sndio.c2
-rw-r--r--stream/tvi_v4l2.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c
index bf36443dfe..c279505221 100644
--- a/stream/ai_alsa1x.c
+++ b/stream/ai_alsa1x.c
@@ -51,7 +51,7 @@ int ai_alsa_setup(audio_in_t *ai)
return -1;
}
- err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE);
+ err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16);
if (err < 0) {
MP_ERR(ai, "Sample format not available.\n");
return -1;
@@ -122,7 +122,7 @@ int ai_alsa_setup(audio_in_t *ai)
snd_pcm_dump(ai->alsa.handle, ai->alsa.log);
}
- ai->alsa.bits_per_sample = snd_pcm_format_physical_width(SND_PCM_FORMAT_S16_LE);
+ ai->alsa.bits_per_sample = snd_pcm_format_physical_width(SND_PCM_FORMAT_S16);
ai->alsa.bits_per_frame = ai->alsa.bits_per_sample * ai->channels;
ai->blocksize = ai->alsa.chunk_size * ai->alsa.bits_per_frame / 8;
ai->samplesize = ai->alsa.bits_per_sample;
diff --git a/stream/ai_oss.c b/stream/ai_oss.c
index b7a7988bde..98477d10f3 100644
--- a/stream/ai_oss.c
+++ b/stream/ai_oss.c
@@ -100,10 +100,10 @@ int ai_oss_init(audio_in_t *ai)
ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETFMTS, &ioctl_param));
MP_VERBOSE(ai, "Supported formats: %x\n", ioctl_param);
- if (!(ioctl_param & AFMT_S16_LE))
+ if (!(ioctl_param & AFMT_S16_NE))
MP_ERR(ai, "unsupported format\n");
- ioctl_param = AFMT_S16_LE;
+ ioctl_param = AFMT_S16_NE;
MP_VERBOSE(ai, "ioctl dsp setfmt: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETFMT, &ioctl_param));
if (err < 0) {
diff --git a/stream/ai_sndio.c b/stream/ai_sndio.c
index dc3c66279d..2bb47955a4 100644
--- a/stream/ai_sndio.c
+++ b/stream/ai_sndio.c
@@ -15,7 +15,7 @@ int ai_sndio_setup(audio_in_t *ai)
par.bits = 16;
par.sig = 1;
- par.le = 1;
+ par.le = SIO_LE_NATIVE;
par.rchan = ai->req_channels;
par.rate = ai->req_samplerate;
par.appbufsz = ai->req_samplerate; /* 1 sec */
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 13067b8cab..f2ec84d4cf 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -922,7 +922,7 @@ static int do_control(priv_t *priv, int cmd, void *arg)
case TVI_CONTROL_AUD_GET_FORMAT:
init_audio(priv);
if (!priv->audio_initialized) return TVI_CONTROL_FALSE;
- *(int *)arg = AF_FORMAT_S16_LE;
+ *(int *)arg = AF_FORMAT_S16;
MP_VERBOSE(priv, "%s: get audio format: %d\n",
info.short_name, *(int *)arg);
return TVI_CONTROL_TRUE;