From 26832b94e629a5848443e5c762ae3f9407b148d1 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 3 Feb 2003 00:39:42 +0000 Subject: [PATCH] * ./modules/audio_output/alsa.c: Woody ALSA compilation fix. --- configure.ac.in | 5 +++++ modules/audio_output/alsa.c | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/configure.ac.in b/configure.ac.in index c0a5495b41..fc0c8c18ce 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -2143,6 +2143,11 @@ AC_ARG_ENABLE(alsa, AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") if test "x${have_alsa}" = "xtrue" then + AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API + #define ALSA_PCM_NEW_SW_PARAMS_API + #include ], + [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }], + AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4)) PLUGINS="${PLUGINS} alsa" LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl" else diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c index a8d2c28e35..8d4c78ff48 100644 --- a/modules/audio_output/alsa.c +++ b/modules/audio_output/alsa.c @@ -2,7 +2,7 @@ * alsa.c : alsa plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: alsa.c,v 1.20 2003/01/17 23:59:18 sam Exp $ + * $Id: alsa.c,v 1.21 2003/02/03 00:39:42 sam Exp $ * * Authors: Henri Fallon - Original Author * Jeffrey Baker - Port to ALSA 1.0 API @@ -432,8 +432,13 @@ static int Open( vlc_object_t *p_this ) } /* Set rate. */ +#ifdef HAVE_ALSA_NEW_API if ( ( i_snd_rc = snd_pcm_hw_params_set_rate_near( p_sys->p_snd_pcm, p_hw, &p_aout->output.output.i_rate, NULL ) ) < 0 ) +#else + if ( ( i_snd_rc = snd_pcm_hw_params_set_rate_near( p_sys->p_snd_pcm, p_hw, + p_aout->output.output.i_rate, NULL ) ) < 0 ) +#endif { msg_Err( p_aout, "unable to set sample rate (%s)", snd_strerror( i_snd_rc ) ); @@ -441,8 +446,13 @@ static int Open( vlc_object_t *p_this ) } /* Set buffer size. */ +#ifdef HAVE_ALSA_NEW_API if ( ( i_snd_rc = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, p_hw, &i_buffer_size ) ) < 0 ) +#else + if ( ( i_snd_rc = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, + p_hw, i_buffer_size ) ) < 0 ) +#endif { msg_Err( p_aout, "unable to set buffer size (%s)", snd_strerror( i_snd_rc ) ); @@ -450,8 +460,13 @@ static int Open( vlc_object_t *p_this ) } /* Set period size. */ +#ifdef HAVE_ALSA_NEW_API if ( ( i_snd_rc = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, p_hw, &i_period_size, NULL ) ) < 0 ) +#else + if ( ( i_snd_rc = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, + p_hw, i_period_size, NULL ) ) < 0 ) +#endif { msg_Err( p_aout, "unable to set period size (%s)", snd_strerror( i_snd_rc ) ); @@ -467,8 +482,13 @@ static int Open( vlc_object_t *p_this ) goto error; } +#ifdef HAVE_ALSA_NEW_API if( ( i_snd_rc = snd_pcm_hw_params_get_period_time( p_hw, &p_sys->i_period_time, NULL ) ) < 0 ) +#else + if( ( p_sys->i_period_time = + snd_pcm_hw_params_get_period_time( p_hw, NULL ) ) < 0 ) +#endif { msg_Err( p_aout, "unable to get period time (%s)", snd_strerror( i_snd_rc ) ); -- 2.39.2