Commit 21a4aa0e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

ALSA: fallback to another sample format where needed

This path should only be used when a non-plug device is forced.
parent 283d6e72
......@@ -367,9 +367,19 @@ static int Open (vlc_object_t *obj)
/* Set sample format */
val = snd_pcm_hw_params_set_format (pcm, hw, pcm_format);
if (val < 0)
if (val == 0)
;
else if (pcm_format != SND_PCM_FORMAT_FLOAT
&& snd_pcm_hw_params_set_format (pcm, hw, SND_PCM_FORMAT_FLOAT) == 0)
fourcc = VLC_CODEC_FL32;
else if (pcm_format != SND_PCM_FORMAT_S32
&& snd_pcm_hw_params_set_format (pcm, hw, SND_PCM_FORMAT_S32) == 0)
fourcc = VLC_CODEC_S32N;
else if (pcm_format != SND_PCM_FORMAT_S16
&& snd_pcm_hw_params_set_format (pcm, hw, SND_PCM_FORMAT_S16) == 0)
fourcc = VLC_CODEC_S16N;
else
{
/* TODO: fallback to FL32 / S16N */
msg_Err (aout, "cannot set sample format: %s", snd_strerror (val));
goto error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment