/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h> /* ENOMEM */
-#include <fcntl.h> /* open(), O_WRONLY */
-#include <sys/ioctl.h> /* ioctl() */
-#include <unistd.h> /* write(), close() */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <errno.h> /* ENOMEM */
+#include <fcntl.h> /* open(), O_WRONLY */
+#include <sys/ioctl.h> /* ioctl() */
+#include <unistd.h> /* write(), close() */
+
+#include <vlc_common.h>
#include <vlc_plugin.h>
#ifdef HAVE_ALLOCA_H
static void Close ( vlc_object_t * );
static void Play ( aout_instance_t * );
-static int OSSThread ( aout_instance_t * );
+static void* OSSThread ( vlc_object_t * );
static mtime_t BufferDuration( aout_instance_t * p_aout );
"are completely filled (the sound gets heavily hashed). If you have one " \
"of these drivers, then you need to enable this option." )
-vlc_module_begin();
- set_shortname( "OSS" );
- set_description( N_("UNIX OSS audio output") );
+vlc_module_begin ()
+ set_shortname( "OSS" )
+ set_description( N_("UNIX OSS audio output") )
- set_category( CAT_AUDIO );
- set_subcategory( SUBCAT_AUDIO_AOUT );
- add_file( "dspdev", "/dev/dsp", aout_FindAndRestart,
- N_("OSS DSP device"), NULL, false );
- add_bool( "oss-buggy", 0, NULL, BUGGY_TEXT, BUGGY_LONGTEXT, true );
+ set_category( CAT_AUDIO )
+ set_subcategory( SUBCAT_AUDIO_AOUT )
+ add_file( "oss-audio-device", "/dev/dsp", aout_FindAndRestart,
+ N_("OSS DSP device"), NULL, false )
+ add_deprecated_alias( "dspdev" ) /* deprecated since 0.9.3 */
+ add_bool( "oss-buggy", 0, NULL, BUGGY_TEXT, BUGGY_LONGTEXT, true )
- set_capability( "audio output", 100 );
- add_shortcut( "oss" );
- set_callbacks( Open, Close );
-vlc_module_end();
+ set_capability( "audio output", 100 )
+ add_shortcut( "oss" )
+ set_callbacks( Open, Close )
+vlc_module_end ()
/*****************************************************************************
* Probe: probe the audio device for available formats and channels
/* Allocate structure */
p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) );
if( p_sys == NULL )
- {
- msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM;
- }
/* Get device name */
- if( (psz_device = config_GetPsz( p_aout, "dspdev" )) == NULL )
+ if( (psz_device = config_GetPsz( p_aout, "oss-audio-device" )) == NULL )
{
msg_Err( p_aout, "no audio device specified (maybe /dev/dsp?)" );
free( p_sys );
if( p_sys->i_fd < 0 )
{
msg_Err( p_aout, "cannot open audio device (%s)", psz_device );
+ free( psz_device );
free( p_sys );
return VLC_EGENERIC;
}
/* Create OSS thread and wait for its readiness. */
if( vlc_thread_create( p_aout, "aout", OSSThread,
- VLC_THREAD_PRIORITY_OUTPUT, false ) )
+ VLC_THREAD_PRIORITY_OUTPUT ) )
{
msg_Err( p_aout, "cannot create OSS thread (%m)" );
close( p_sys->i_fd );
/*****************************************************************************
* OSSThread: asynchronous thread used to DMA the data to the device
*****************************************************************************/
-static int OSSThread( aout_instance_t * p_aout )
+static void* OSSThread( vlc_object_t *p_this )
{
+ aout_instance_t * p_aout = (aout_instance_t*)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
mtime_t next_date = 0;
+ int canc = vlc_savecancel ();
- while ( !p_aout->b_die )
+ while ( vlc_object_alive (p_aout) )
{
aout_buffer_t * p_buffer = NULL;
int i_tmp, i_size;
}
}
- while( !p_aout->b_die && ! ( p_buffer =
+ while( vlc_object_alive (p_aout) && ! ( p_buffer =
aout_OutputNextBuffer( p_aout, next_date, true ) ) )
{
msleep( 1000 );
}
}
- return VLC_SUCCESS;
+ vlc_restorecancel (canc);
+ return NULL;
}