changeset 18009:fb7888812f13

Add workarounds for old prerelease versions of alsa-lib 0.9.0 that did not allow reading the buffer boundary value.
author cladisch
date Fri, 31 Mar 2006 09:28:37 +0000
parents 0334b2fb1a39
children e087229c5002
files libao2/ao_alsa.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Fri Mar 31 06:22:51 2006 +0000
+++ b/libao2/ao_alsa.c	Fri Mar 31 09:28:37 2006 +0000
@@ -638,11 +638,15 @@
 	       snd_strerror(err));
 	return 0;
       }
+#if SND_LIB_VERSION >= 0x000901
       if ((err = snd_pcm_sw_params_get_boundary(alsa_swparams, &boundary)) < 0) {
 	mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to get boundary: %s\n",
 	       snd_strerror(err));
 	return 0;
       }
+#else
+      boundary = 0x7fffffff;
+#endif
       /* start playing when one period has been written */
       if ((err = snd_pcm_sw_params_set_start_threshold(alsa_handler, alsa_swparams, chunk_size)) < 0) {
 	mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set start threshold: %s\n",
@@ -655,12 +659,14 @@
 	       snd_strerror(err));
 	return 0;
       }
+#if SND_LIB_VERSION >= 0x000901
       /* play silence when there is an underrun */
       if ((err = snd_pcm_sw_params_set_silence_size(alsa_handler, alsa_swparams, boundary)) < 0) {
 	mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set silence size: %s\n",
 	       snd_strerror(err));
 	return 0;
       }
+#endif
       if ((err = snd_pcm_sw_params(alsa_handler, alsa_swparams)) < 0) {
 	mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set sw-parameters: %s\n",
 	       snd_strerror(err));