summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_alsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/out/ao_alsa.c')
-rw-r--r--audio/out/ao_alsa.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index c344f6f20e..52f410cf5e 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -100,7 +100,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
long get_vol, set_vol;
float f_multi;
- if (AF_FORMAT_IS_IEC61937(ao->format))
+ if (AF_FORMAT_IS_SPECIAL(ao->format))
return CONTROL_FALSE;
//allocate simple id
@@ -218,9 +218,6 @@ static const int mp_to_alsa_format[][2] = {
{AF_FORMAT_S24,
MP_SELECT_LE_BE(SND_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_S24_3BE)},
{AF_FORMAT_FLOAT, SND_PCM_FORMAT_FLOAT},
- {AF_FORMAT_AC3, SND_PCM_FORMAT_S16},
- {AF_FORMAT_IEC61937, SND_PCM_FORMAT_S16},
- {AF_FORMAT_MPEG2, SND_PCM_FORMAT_MPEG},
{AF_FORMAT_UNKNOWN, SND_PCM_FORMAT_UNKNOWN},
};
@@ -403,7 +400,15 @@ static int init(struct ao *ao)
err = snd_pcm_hw_params_any(p->alsa, alsa_hwparams);
CHECK_ALSA_ERROR("Unable to get initial parameters");
- p->alsa_fmt = find_alsa_format(ao->format);
+ if (AF_FORMAT_IS_IEC61937(ao->format)) {
+ if (ao->format == AF_FORMAT_S_MP3) {
+ p->alsa_fmt = SND_PCM_FORMAT_MPEG;
+ } else {
+ p->alsa_fmt = SND_PCM_FORMAT_S16;
+ }
+ } else {
+ p->alsa_fmt = find_alsa_format(ao->format);
+ }
if (p->alsa_fmt == SND_PCM_FORMAT_UNKNOWN) {
p->alsa_fmt = SND_PCM_FORMAT_S16;
ao->format = AF_FORMAT_S16;
@@ -411,15 +416,12 @@ static int init(struct ao *ao)
err = snd_pcm_hw_params_test_format(p->alsa, alsa_hwparams, p->alsa_fmt);
if (err < 0) {
+ if (AF_FORMAT_IS_IEC61937(ao->format))
+ CHECK_ALSA_ERROR("Unable to set IEC61937 format");
MP_INFO(ao, "Format %s is not supported by hardware, trying default.\n",
af_fmt_to_str(ao->format));
p->alsa_fmt = SND_PCM_FORMAT_S16;
- if (AF_FORMAT_IS_AC3(ao->format))
- ao->format = AF_FORMAT_AC3;
- else if (AF_FORMAT_IS_IEC61937(ao->format))
- ao->format = AF_FORMAT_IEC61937;
- else
- ao->format = AF_FORMAT_S16;
+ ao->format = AF_FORMAT_S16;
}
err = snd_pcm_hw_params_set_format(p->alsa, alsa_hwparams, p->alsa_fmt);