/*****************************************************************************
* aout_dummy.c : dummy audio output plugin
*****************************************************************************
- * Copyright (C) 2000 VideoLAN
+ * Copyright (C) 2000, 2001 VideoLAN
*
- * 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
* 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"
+
/*****************************************************************************
* 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.
+ *****************************************************************************/
+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 );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void _M( aout_getfunctions )( function_list_t * p_function_list )
+{
+ 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: probe the audio device and return a score
+ *****************************************************************************/
+static int aout_Probe( probedata_t *p_data )
+{
+ if( TestMethod( AOUT_METHOD_VAR, "dummy" ) )
+ {
+ return( 999 );
+ }
+
+ /* The dummy plugin always works but give it the lower possible score */
+ return( 1 );
+}
+
+/*****************************************************************************
+ * aout_Open: opens a dummy audio device
*****************************************************************************/
-int aout_DummyOpen( 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 );
+ 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_DummySetFormat: pretends to set the dsp output format
+ * aout_SetFormat: pretends to set the dsp output format
*****************************************************************************/
-int aout_DummySetFormat( 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_DummyPlay: pretends to play a sound
+ * aout_Play: pretends to play a sound
*****************************************************************************/
-void aout_DummyPlay( 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 )
{
;
}