/*****************************************************************************
* 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
* 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_SysOpen: opens a dummy audio device
+ * Local prototypes.
*****************************************************************************/
-int aout_SysOpen( aout_thread_t *p_aout )
-{
- /* Initialize some variables */
- p_aout->i_format = AOUT_DEFAULT_FORMAT;
- 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_SysReset: fake reset
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
*****************************************************************************/
-int aout_SysReset( 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_SysSetFormat: pretends to set the dsp output format
+ * aout_Probe: probe the audio device and return a score
*****************************************************************************/
-int aout_SysSetFormat( 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_SysSetChannels: pretends to set stereo or mono mode
+ * aout_Open: opens a dummy audio device
*****************************************************************************/
-int aout_SysSetChannels( 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_SysSetRate: pretends to set audio output rate
+ * aout_SetFormat: pretends to set the dsp output format
*****************************************************************************/
-int aout_SysSetRate( aout_thread_t *p_aout )
+static int aout_SetFormat( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
- * aout_SysGetBufInfo: returns available bytes in buffer
+ * aout_GetBufInfo: returns available bytes in buffer
*****************************************************************************/
-long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
+static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{
- return( 2 * l_buffer_limit ); /* value big enough to sleep */
+ return( sizeof(s16) * l_buffer_limit + 1 ); /* value big enough to sleep */
}
/*****************************************************************************
- * aout_SysPlaySamples: pretends to play a sound
+ * aout_Play: pretends to play a sound
*****************************************************************************/
-void aout_SysPlaySamples( 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_SysClose: closes the dummy audio device
+ * aout_Close: closes the dummy audio device
*****************************************************************************/
-void aout_SysClose( aout_thread_t *p_aout )
+static void aout_Close( aout_thread_t *p_aout )
{
;
}