/*****************************************************************************
* aout_dsp.c : dsp functions library
*****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
+ * Copyright (C) 1999-2001 VideoLAN
+ * $Id: aout_dsp.c,v 1.20 2002/01/28 23:08:31 stef Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include "defs.h"
-
#include <errno.h> /* ENOMEM */
#include <fcntl.h> /* open(), O_WRONLY */
#include <sys/ioctl.h> /* ioctl() */
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
+#include <videolan/vlc.h>
+
#ifdef SYS_BSD
#include <machine/soundcard.h> /* SNDCTL_DSP_RESET, SNDCTL_DSP_SETFMT,
SNDCTL_DSP_STEREO, SNDCTL_DSP_SPEED, SNDCTL_DSP_GETOSPACE */
SNDCTL_DSP_STEREO, SNDCTL_DSP_SPEED, SNDCTL_DSP_GETOSPACE */
#endif
-#include "config.h"
-#include "common.h" /* boolean_t, byte_t */
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-
#include "audio_output.h" /* aout_thread_t */
-#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
-#include "main.h"
-
-#include "modules.h"
-
/*****************************************************************************
* aout_sys_t: dsp audio output method descriptor
*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
-void dsp_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
+ * aout_Probe: probe 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
+ * This function tries to open the DSP and returns a score to the plugin
+ * manager so that it can choose the most appropriate one.
*****************************************************************************/
static int aout_Probe( probedata_t *p_data )
{
/* Otherwise, there are good chances we can use this plugin, return 100. */
close( i_fd );
+
return( 100 );
}
/* Initialize some variables */
p_aout->psz_device = main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT );
- 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 );
/* Open the sound device */
- if( (p_aout->i_fd = open( p_aout->psz_device, O_WRONLY|O_NONBLOCK )) < 0 )
+ if( (p_aout->i_fd = open( p_aout->psz_device, O_WRONLY )) < 0 )
{
intf_ErrMsg( "aout error: can't open audio device (%s)",
p_aout->psz_device );
if( i_format != p_aout->i_format )
{
- intf_DbgMsg( "aout debug: audio output format not supported (%i)",
- p_aout->i_format );
+ intf_WarnMsg( 2, "aout warning: audio output format not supported (%i)",
+ p_aout->i_format );
p_aout->i_format = i_format;
}
if( b_stereo != p_aout->b_stereo )
{
- intf_DbgMsg( "aout debug: number of audio channels not supported (%i)",
- p_aout->i_channels );
+ intf_WarnMsg( 2, "aout warning: number of audio channels not supported (%i)",
+ p_aout->i_channels );
p_aout->b_stereo = b_stereo;
p_aout->i_channels = 1 + b_stereo;
}
if( l_rate != p_aout->l_rate )
{
- intf_DbgMsg( "aout debug: audio output rate not supported (%li)",
- p_aout->l_rate );
+ intf_WarnMsg( 1, "aout warning: audio output rate not supported (%li)",
+ p_aout->l_rate );
p_aout->l_rate = l_rate;
}