]> git.sesse.net Git - vlc/blobdiff - plugins/dummy/aout_dummy.c
* Fixed the BeOS compile typo.
[vlc] / plugins / dummy / aout_dummy.c
index fb87e151c24c82949871dd91442bf275918aa3de..6e4a6f8e32a56b26a91bf6d840e583a5ba537afa 100644 (file)
@@ -1,9 +1,10 @@
 /*****************************************************************************
  * aout_dummy.c : dummy audio output plugin
  *****************************************************************************
- * Copyright (C) 2000 VideoLAN
+ * Copyright (C) 2000, 2001 VideoLAN
+ * $Id: aout_dummy.c,v 1.11 2001/05/30 17:03:12 sam Exp $
  *
- * Authors:
+ * Authors: Samuel Hocevar <sam@zoy.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,6 +21,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define MODULE_NAME dummy
+#include "modules_inner.h"
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "threads.h"
 #include "mtime.h"
-#include "plugins.h"
+#include "tests.h"
 
 #include "audio_output.h"                                   /* aout_thread_t */
 
 #include "main.h"
 
+#include "modules.h"
+#include "modules_export.h"
+
 /*****************************************************************************
  * vout_dummy_t: dummy video output method descriptor
  *****************************************************************************
 typedef struct aout_sys_s
 {
 
-
 } aout_sys_t;
 
 /*****************************************************************************
- * aout_DummyOpen: opens a dummy audio device
+ * Local prototypes.
  *****************************************************************************/
-int aout_DummyOpen( aout_thread_t *p_aout )
-{
-    /* Initialize some variables */
-    p_aout->i_format = AOUT_FORMAT_DEFAULT;
-    p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
-    p_aout->l_rate     = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
-
-    return( 0 );
-}
+static int     aout_Probe       ( probedata_t *p_data );
+static int     aout_Open        ( aout_thread_t *p_aout );
+static int     aout_SetFormat   ( aout_thread_t *p_aout );
+static long    aout_GetBufInfo  ( aout_thread_t *p_aout, long l_buffer_info );
+static void    aout_Play        ( aout_thread_t *p_aout,
+                                  byte_t *buffer, int i_size );
+static void    aout_Close       ( aout_thread_t *p_aout );
 
 /*****************************************************************************
- * aout_DummyReset: fake reset
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
  *****************************************************************************/
-int aout_DummyReset( aout_thread_t *p_aout )
+void _M( aout_getfunctions )( function_list_t * p_function_list )
 {
-    return( 0 );
+    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_DummySetFormat: pretends to set the dsp output format
+ * aout_Probe: probe the audio device and return a score
  *****************************************************************************/
-int aout_DummySetFormat( aout_thread_t *p_aout )
+static int aout_Probe( probedata_t *p_data )
 {
-    return( 0 );
+    if( TestMethod( AOUT_METHOD_VAR, "dummy" ) )
+    {
+        return( 999 );
+    }
+
+    /* The dummy plugin always works but give it the lower possible score */
+    return( 1 );
 }
 
 /*****************************************************************************
- * aout_DummySetChannels: pretends to set stereo or mono mode
+ * aout_Open: opens a dummy audio device
  *****************************************************************************/
-int aout_DummySetChannels( aout_thread_t *p_aout )
+static int aout_Open( aout_thread_t *p_aout )
 {
+    /* Initialize some variables */
+    p_aout->i_format = AOUT_FORMAT_DEFAULT;
+    p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
+                                                  AOUT_STEREO_DEFAULT );
+    p_aout->l_rate     =     main_GetIntVariable( AOUT_RATE_VAR,
+                                                  AOUT_RATE_DEFAULT );
+
     return( 0 );
 }
 
 /*****************************************************************************
- * aout_DummySetRate: pretends to set audio output rate
+ * aout_SetFormat: pretends to set the dsp output format
  *****************************************************************************/
-int aout_DummySetRate( aout_thread_t *p_aout )
+static int aout_SetFormat( aout_thread_t *p_aout )
 {
     return( 0 );
 }
 
 /*****************************************************************************
- * aout_DummyGetBufInfo: returns available bytes in buffer
+ * aout_GetBufInfo: returns available bytes in buffer
  *****************************************************************************/
-long aout_DummyGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
+static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
 {
     return( sizeof(s16) * l_buffer_limit + 1 ); /* value big enough to sleep */
 }
 
 /*****************************************************************************
- * aout_DummyPlaySamples: pretends to play a sound
+ * aout_Play: pretends to play a sound
  *****************************************************************************/
-void aout_DummyPlaySamples( 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 )
 {
+    ;
 }
 
 /*****************************************************************************
- * aout_DummyClose: closes the dummy audio device
+ * aout_Close: closes the dummy audio device
  *****************************************************************************/
-void aout_DummyClose( aout_thread_t *p_aout )
+static void aout_Close( aout_thread_t *p_aout )
 {
     ;
 }