/*****************************************************************************
* aout_arts.c : aRts functions library
*****************************************************************************
- * Copyright (C) 2000 VideoLAN
+ * Copyright (C) 2001 VideoLAN
*
* Authors: Blindauer Emmanuel <manu@agat.net>
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
-#define MODULE_NAME arts
-#include "modules_inner.h"
-
-
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include "defs.h"
-
#include <errno.h> /* ENOMEM */
#include <fcntl.h> /* open(), O_WRONLY */
#include <string.h> /* strerror() */
#include <artsc.h>
-#include "config.h"
-#include "common.h" /* boolean_t, byte_t */
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
+#include <videolan/vlc.h>
#include "audio_output.h" /* aout_thread_t */
-#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
-#include "main.h"
-
-#include "modules.h"
-#include "modules_export.h"
-
/*****************************************************************************
* aout_sys_t: arts audio output method descriptor
*****************************************************************************
/*****************************************************************************
* 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 int aout_GetBufInfo ( aout_thread_t *p_aout, int i_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 );
*****************************************************************************/
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_close = aout_Close;
}
-/*****************************************************************************
- * aout_Probe: probes the audio device and return a score
- *****************************************************************************
- * This function tries to open the dps and returns a score to the plugin
- * manager so that it can
- *****************************************************************************/
-static int aout_Probe( probedata_t *p_data )
-{
- if( TestMethod( AOUT_METHOD_VAR, "arts" ) )
- {
- return( 999 );
- }
-
- /* We don't have to test anything -- if we managed to open this plugin,
- * it means we have the appropriate libs. */
- return( 50 );
-}
-
/*****************************************************************************
* aout_Open: initialize arts connection to server
*****************************************************************************/
static int aout_Open( aout_thread_t *p_aout )
{
int i_err = 0;
- p_aout->i_format = AOUT_FORMAT_DEFAULT;
- p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
- p_aout->l_rate = AOUT_RATE_DEFAULT;
+ /* Allocate structure */
+ p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
+ if( p_aout->p_sys == NULL )
+ {
+ intf_ErrMsg("error: %s", strerror(ENOMEM) );
+ return( 1 );
+ }
i_err = arts_init();
if (i_err < 0)
{
- fprintf(stderr, "arts_init error: %s\n", arts_error_text(i_err));
+ intf_ErrMsg( "aout error: arts_init (%s)", arts_error_text(i_err) );
+ free( p_aout->p_sys );
return(-1);
}
p_aout->p_sys->stream =
- arts_play_stream( p_aout->l_rate, 16, p_aout->i_channels, "vlc" );
+ arts_play_stream( p_aout->i_rate, 16, p_aout->i_channels, "vlc" );
return( 0 );
}
/* p_aout->i_latency = esd_get_latency(i_fd);*/
p_aout->i_latency = 0;
- intf_WarnMsg(2, "aout_arts_latency: %d",p_aout->i_latency);
+ //intf_WarnMsg( 5, "aout_arts_latency: %d",p_aout->i_latency);
return( 0 );
}
/*****************************************************************************
* aout_GetBufInfo: buffer status query
*****************************************************************************/
-static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
+static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit )
{
/* arbitrary value that should be changed */
- return( l_buffer_limit );
+ return( i_buffer_limit );
}
/*****************************************************************************
int i_err = arts_write( p_aout->p_sys->stream, buffer, i_size );
- if(i_err < 0)
+ if( i_err < 0 )
{
- fprintf(stderr, "arts_write error: %s\n", arts_error_text(i_err));
+ intf_ErrMsg( "aout error: arts_write (%s)", arts_error_text(i_err) );
}
}
static void aout_Close( aout_thread_t *p_aout )
{
arts_close_stream( p_aout->p_sys->stream );
+ free( p_aout->p_sys );
}