* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
-#define MODULE_NAME qnx
-#include "modules_inner.h"
-
/*****************************************************************************
* Preamble
*****************************************************************************/
-
-#include "defs.h"
-
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h> /* "intf_msg.h" */
#include <sys/asoundlib.h>
-#include "common.h" /* boolean_t, byte_t */
-#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
+#include <videolan/vlc.h>
#include "audio_output.h" /* aout_thread_t */
-#include "modules.h"
-#include "modules_export.h"
-
typedef struct aout_sys_s
{
snd_pcm_t * p_pcm_handle;
/*****************************************************************************
* 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 make its choice.
- *****************************************************************************/
-static int aout_Probe( probedata_t *p_data )
-{
- int i_ret;
- aout_sys_t adev;
-
- /* open audio device */
- if( ( i_ret = snd_pcm_open_preferred( &adev.p_pcm_handle,
- &adev.i_card, &adev.i_device,
- SND_PCM_OPEN_PLAYBACK ) ) < 0 )
- {
- intf_WarnMsg( 2, "aout error: unable to open audio device (%s)",
- snd_strerror( i_ret ) );
- return( 0 );
- }
-
- /* close audio device */
- if( ( i_ret = snd_pcm_close( adev.p_pcm_handle ) ) < 0 )
- {
- intf_WarnMsg( 2, "aout error: unable to close audio device (%s)",
- snd_strerror( i_ret ) );
- return( 0 );
- }
-
- if( TestMethod( AOUT_METHOD_VAR, "qnx" ) )
- {
- return( 999 );
- }
-
- /* return score */
- return( 50 );
-}
-
/*****************************************************************************
* aout_Open : creates a handle and opens an alsa device
*****************************************************************************
return( 1 );
}
- /* initialize */
- p_aout->i_format = AOUT_FORMAT_DEFAULT;
- p_aout->i_channels = main_GetIntVariable( AOUT_STEREO_VAR,
- AOUT_STEREO_DEFAULT ) + 1;
- p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR,
- AOUT_RATE_DEFAULT );
-
/* open audio device */
if( ( i_ret = snd_pcm_open_preferred( &p_aout->p_sys->p_pcm_handle,
&p_aout->p_sys->i_card,
{
intf_ErrMsg( "aout error: unable to open audio device (%s)",
snd_strerror( i_ret ) );
+ free( p_aout->p_sys );
return( 1 );
}
intf_ErrMsg( "aout error: unable to disable mmap (%s)",
snd_strerror( i_ret ) );
aout_Close( p_aout );
+ free( p_aout->p_sys );
return( 1 );
}
pp.buf.block.frags_min = 1;
pp.format.interleave = 1;
- pp.format.rate = p_aout->l_rate;
+ pp.format.rate = p_aout->i_rate;
pp.format.voices = p_aout->i_channels;
switch( p_aout->i_format )
}
pp.buf.block.frag_size =
- (((s64)p_aout->l_rate * AOUT_BUFFER_DURATION) / 1000000) *
+ (((s64)p_aout->i_rate * AOUT_BUFFER_DURATION) / 1000000) *
p_aout->i_channels * i_bytes_per_sample;
/* set parameters */
return( 1 );
}
- p_aout->i_latency = 0;
-
return( 0 );
}
* of data to play, it switches to the "underrun" status. It has to
* be flushed and re-prepared
*****************************************************************************/
-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 )
{
int i_ret;
snd_pcm_channel_status_t status;