]> git.sesse.net Git - vlc/commitdiff
* ./modules/audio_output/alsa.c: Woody ALSA compilation fix.
authorSam Hocevar <sam@videolan.org>
Mon, 3 Feb 2003 00:39:42 +0000 (00:39 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 3 Feb 2003 00:39:42 +0000 (00:39 +0000)
configure.ac.in
modules/audio_output/alsa.c

index c0a5495b417da29c68afea401fc308a188bc815e..fc0c8c18ce6ad440911476c9acc9291a41da0bda 100644 (file)
@@ -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 <alsa/asoundlib.h>],
+          [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
index a8d2c28e35234948d141b1125a85d4a9770931dc..8d4c78ff481a932394951180bd6d16542586a28e 100644 (file)
@@ -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 <henri@videolan.org> - Original Author
  *          Jeffrey Baker <jwbaker@acm.org> - 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 ) );