[vlc-commits] ALSA: fallback to another sample format where needed
Rémi Denis-Courmont
git at videolan.org
Tue Sep 27 22:40:36 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep 27 23:37:54 2011 +0300| [21a4aa0e1fd2f7499161d35074cea68770cb6b82] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=21a4aa0e1fd2f7499161d35074cea68770cb6b82
---
modules/audio_output/alsa.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index b72e45a..1d1bfa3 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -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;
}
More information about the vlc-commits
mailing list