]> git.sesse.net Git - vlc/blobdiff - plugins/alsa/aout_alsa.c
* Ported Glide and MGA plugins to the new module API. MGA never worked,
[vlc] / plugins / alsa / aout_alsa.c
index cf6f064f9a2177560cdcde256a05b5d5c2ff2bbb..f7a1b93d28ac09648708e9b2a4eb7894b9c13938 100644 (file)
@@ -22,6 +22,7 @@
  *****************************************************************************/
 
 #define MODULE_NAME alsa
+#include "modules_inner.h"
 
 /*****************************************************************************
  * Preamble
@@ -41,6 +42,7 @@
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "threads.h"
 #include "mtime.h"
+#include "tests.h"
 
 #include "audio_output.h"                                   /* aout_thread_t */
 
@@ -48,9 +50,6 @@
 #include "main.h"
 
 #include "modules.h"
-#include "modules_inner.h"
-
-
 
 typedef struct alsa_device_s
 {
@@ -84,21 +83,19 @@ static void    aout_Play        ( aout_thread_t *p_aout,
                                           byte_t *buffer, int i_size );
 static void    aout_Close       ( aout_thread_t *p_aout );
 
-
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
  *****************************************************************************/
-void aout_getfunctions( function_list_t * p_function_list )
+void _M( aout_getfunctions )( function_list_t * p_function_list )
 {
-    p_function_list->p_probe = aout_Probe;
-    p_function_list->functions.aout.p_open = aout_Open;
-    p_function_list->functions.aout.p_setformat = aout_SetFormat;
-    p_function_list->functions.aout.p_getbufinfo = aout_GetBufInfo;
-    p_function_list->functions.aout.p_play = aout_Play;
-    p_function_list->functions.aout.p_close = aout_Close;
+    p_function_list->pf_probe = aout_Probe;
+    p_function_list->functions.aout.pf_open = aout_Open;
+    p_function_list->functions.aout.pf_setformat = aout_SetFormat;
+    p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo;
+    p_function_list->functions.aout.pf_play = aout_Play;
+    p_function_list->functions.aout.pf_close = aout_Close;
 }
-    
 
 /*****************************************************************************
  * aout_Probe: probes the audio device and return a score
@@ -127,9 +124,7 @@ static int aout_Probe( probedata_t *p_data )
         return ( 0 );
     }
 
-    /* Otherwise, we may think it'll work */ 
-
-    /* Close */
+    /* Close it */
     i_close_return = snd_pcm_close ( local_sys.p_alsa_handle );
     
     if( i_close_return )
@@ -137,10 +132,16 @@ static int aout_Probe( probedata_t *p_data )
         intf_ErrMsg( "Error closing alsa device in aout_probe; exit=%i",
                      i_close_return );
         intf_ErrMsg( "This means : %s",snd_strerror( i_close_return ) );
+        return( 0 );
     }
     
+    if( TestMethod( AOUT_METHOD_VAR, "alsa" ) )
+    {
+        return( 999 );
+    }
+
     /* And return score */
-    return( 100 );
+    return( 50 );
 }    
 
 /*****************************************************************************
@@ -148,7 +149,6 @@ static int aout_Probe( probedata_t *p_data )
  *****************************************************************************
  * This function opens an alsa device, through the alsa API
  *****************************************************************************/
-
 static int aout_Open( aout_thread_t *p_aout )
 {
 
@@ -195,8 +195,7 @@ static int aout_Open( aout_thread_t *p_aout )
  * This function prepares the device, sets the rate, format, the mode
  * ("play as soon as you have data"), and buffer information.
  *****************************************************************************/
-
-int aout_SetFormat( aout_thread_t *p_aout )
+static int aout_SetFormat( aout_thread_t *p_aout )
 {
     
     int i_set_param_returns;
@@ -288,7 +287,7 @@ int aout_SetFormat( aout_thread_t *p_aout )
  * of data to play, it switches to the "underrun" status. It has to
  * be flushed and re-prepared
  *****************************************************************************/
-long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
+static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
 {
     snd_pcm_channel_status_t alsa_channel_status;
     int i_alsa_get_status_returns;
@@ -333,7 +332,7 @@ long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
  *****************************************************************************
  * Plays a sample using the snd_pcm_write function from the alsa API
  *****************************************************************************/
-void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
+static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
 {
     int i_write_returns;
 
@@ -350,7 +349,7 @@ void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
 /*****************************************************************************
  * aout_Close : close the Alsa device
  *****************************************************************************/
-void aout_Close( aout_thread_t *p_aout )
+static void aout_Close( aout_thread_t *p_aout )
 {
     int i_close_returns;
 
@@ -365,3 +364,4 @@ void aout_Close( aout_thread_t *p_aout )
     
     intf_DbgMsg( "Alsa plugin : Alsa device closed");
 }
+