Commit 9a1fd919 authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/audio_output/*: ported the ALSA, aRts, esd and OSS modules to

    the latest aout3 changes.
parent d068701b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* alsa.c : alsa plugin for vlc * alsa.c : alsa plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: alsa.c,v 1.5 2002/08/19 21:31:11 massiot Exp $ * $Id: alsa.c,v 1.6 2002/08/19 23:07:30 sam Exp $
* *
* Authors: Henri Fallon <henri@videolan.org> - Original Author * Authors: Henri Fallon <henri@videolan.org> - Original Author
* Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API * Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
...@@ -88,8 +88,8 @@ static void ALSAFill ( aout_instance_t * ); ...@@ -88,8 +88,8 @@ static void ALSAFill ( aout_instance_t * );
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
add_category_hint( N_("Audio"), NULL ); add_category_hint( N_("ALSA"), NULL );
add_string( "alsa-device", NULL, NULL, N_("Name"), NULL ); add_string( "alsa-device", NULL, NULL, N_("device name"), NULL );
set_description( _("ALSA audio module") ); set_description( _("ALSA audio module") );
set_capability( "audio output", 50 ); set_capability( "audio output", 50 );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
...@@ -234,9 +234,8 @@ static int SetFormat( aout_instance_t * p_aout ) ...@@ -234,9 +234,8 @@ static int SetFormat( aout_instance_t * p_aout )
p_sys->b_can_sleek = VLC_TRUE; p_sys->b_can_sleek = VLC_TRUE;
i_format = SND_PCM_FORMAT_S16_LE; i_format = SND_PCM_FORMAT_S16_LE;
i_channels = 2; i_channels = 2;
p_aout->output.output.i_bytes_per_sec = p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->output.output.i_rate * AOUT_SPDIF_SIZE / p_aout->output.output.i_frame_length = ALSA_SPDIF_PERIOD_SIZE;
ALSA_SPDIF_PERIOD_SIZE;
break; break;
case AOUT_FMT_FIXED32: case AOUT_FMT_FIXED32:
default: default:
......
...@@ -159,8 +159,9 @@ static int SetFormat( aout_instance_t *p_aout ) ...@@ -159,8 +159,9 @@ static int SetFormat( aout_instance_t *p_aout )
/***************************************************************************** /*****************************************************************************
* Play: queue a buffer for playing by aRtsThread * Play: queue a buffer for playing by aRtsThread
*****************************************************************************/ *****************************************************************************/
static void Play( aout_instance_t *p_aout ); static void Play( aout_instance_t *p_aout )
{ {
;
} }
/***************************************************************************** /*****************************************************************************
...@@ -213,9 +214,8 @@ static int aRtsThread( aout_instance_t * p_aout ) ...@@ -213,9 +214,8 @@ static int aRtsThread( aout_instance_t * p_aout )
} }
else else
{ {
i_size = aout_FormatToByterate( &p_aout->output.output ) i_size = p_sys->i_size / p_aout->output.output.i_frame_length
* p_sys->i_size * p_aout->output.output.i_bytes_per_frame;
/ p_aout->output.output.i_rate;
p_bytes = alloca( i_size ); p_bytes = alloca( i_size );
memset( p_bytes, 0, i_size ); memset( p_bytes, 0, i_size );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* esd.c : EsounD module * esd.c : EsounD module
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: esd.c,v 1.7 2002/08/19 21:31:11 massiot Exp $ * $Id: esd.c,v 1.8 2002/08/19 23:07:30 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -147,10 +147,14 @@ static int SetFormat( aout_instance_t *p_aout ) ...@@ -147,10 +147,14 @@ static int SetFormat( aout_instance_t *p_aout )
* number of buffered samples, so I assume ESD_BUF_SIZE/2 */ * number of buffered samples, so I assume ESD_BUF_SIZE/2 */
p_sys->latency = p_sys->latency =
(mtime_t)( esd_get_latency( esd_open_sound(NULL) ) + ESD_BUF_SIZE/2 (mtime_t)( esd_get_latency( esd_open_sound(NULL) ) + ESD_BUF_SIZE/2
* aout_FormatToByterate( &p_aout->output.output ) * p_aout->output.output.i_bytes_per_frame
* p_aout->output.output.i_rate
/ p_aout->output.output.i_frame_length
/ ESD_DEFAULT_RATE ) / ESD_DEFAULT_RATE )
* (mtime_t)1000000 * (mtime_t)1000000
/ (mtime_t)aout_FormatToByterate( &p_aout->output.output ); / p_aout->output.output.i_bytes_per_frame
/ p_aout->output.output.i_rate
* p_aout->output.output.i_frame_length;
p_sys->b_initialized = VLC_TRUE; p_sys->b_initialized = VLC_TRUE;
...@@ -209,9 +213,9 @@ static int ESDThread( aout_instance_t * p_aout ) ...@@ -209,9 +213,9 @@ static int ESDThread( aout_instance_t * p_aout )
} }
else else
{ {
i_size = aout_FormatToByterate( &p_aout->output.output ) i_size = ESD_BUF_SIZE * 2
* ESD_BUF_SIZE * 2 / p_aout->output.output.i_frame_length
/ p_aout->output.output.i_rate; * p_aout->output.output.i_bytes_per_frame;
p_bytes = alloca( i_size ); p_bytes = alloca( i_size );
memset( p_bytes, 0, i_size ); memset( p_bytes, 0, i_size );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* file.c : audio output which writes the samples to a file * file.c : audio output which writes the samples to a file
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: file.c,v 1.6 2002/08/19 21:31:11 massiot Exp $ * $Id: file.c,v 1.7 2002/08/19 23:07:30 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -47,7 +47,7 @@ static void Play ( aout_instance_t * ); ...@@ -47,7 +47,7 @@ static void Play ( aout_instance_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
#define FORMAT_TEXT N_("Output format") #define FORMAT_TEXT N_("output format")
#define FORMAT_LONGTEXT N_("one of \"u8\", \"s8\", \"u16\", \"s16\"," \ #define FORMAT_LONGTEXT N_("one of \"u8\", \"s8\", \"u16\", \"s16\"," \
" \"u16_le\", \"s16_le\", \"u16_be\"," \ " \"u16_le\", \"s16_le\", \"u16_be\"," \
" \"s16_be\", \"fixed32\", \"float32\" or \"spdif\"") " \"s16_be\", \"fixed32\", \"float32\" or \"spdif\"")
...@@ -60,7 +60,7 @@ static int format_int[] = { AOUT_FMT_U8, AOUT_FMT_S8, AOUT_FMT_U16_NE, ...@@ -60,7 +60,7 @@ static int format_int[] = { AOUT_FMT_U8, AOUT_FMT_S8, AOUT_FMT_U16_NE,
AOUT_FMT_U16_BE, AOUT_FMT_S16_BE, AOUT_FMT_FIXED32, AOUT_FMT_U16_BE, AOUT_FMT_S16_BE, AOUT_FMT_FIXED32,
AOUT_FMT_FLOAT32, AOUT_FMT_SPDIF }; AOUT_FMT_FLOAT32, AOUT_FMT_SPDIF };
#define PATH_TEXT N_("Path of the output file") #define PATH_TEXT N_("path of the output file")
#define PATH_LONGTEXT N_("By default samples.raw") #define PATH_LONGTEXT N_("By default samples.raw")
vlc_module_begin(); vlc_module_begin();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* oss.c : OSS /dev/dsp module for vlc * oss.c : OSS /dev/dsp module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2002 VideoLAN * Copyright (C) 2000-2002 VideoLAN
* $Id: oss.c,v 1.11 2002/08/19 21:31:11 massiot Exp $ * $Id: oss.c,v 1.12 2002/08/19 23:07:30 sam Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -82,7 +82,7 @@ static int OSSThread ( aout_instance_t * ); ...@@ -82,7 +82,7 @@ static int OSSThread ( aout_instance_t * );
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
add_category_hint( N_("Audio"), NULL ); add_category_hint( N_("OSS"), NULL );
add_file( "dspdev", "/dev/dsp", NULL, N_("OSS dsp device"), NULL ); add_file( "dspdev", "/dev/dsp", NULL, N_("OSS dsp device"), NULL );
set_description( _("Linux OSS /dev/dsp module") ); set_description( _("Linux OSS /dev/dsp module") );
set_capability( "audio output", 100 ); set_capability( "audio output", 100 );
...@@ -132,6 +132,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -132,6 +132,7 @@ static int Open( vlc_object_t *p_this )
if( vlc_thread_create( p_aout, "aout", OSSThread, VLC_FALSE ) ) if( vlc_thread_create( p_aout, "aout", OSSThread, VLC_FALSE ) )
{ {
msg_Err( p_aout, "cannot create OSS thread (%s)", strerror(errno) ); msg_Err( p_aout, "cannot create OSS thread (%s)", strerror(errno) );
close( p_sys->i_fd );
free( psz_device ); free( psz_device );
free( p_sys ); free( p_sys );
return -1; return -1;
...@@ -309,14 +310,16 @@ static int OSSThread( aout_instance_t * p_aout ) ...@@ -309,14 +310,16 @@ static int OSSThread( aout_instance_t * p_aout )
* Order is important here, since GetBufInfo is believed to take * Order is important here, since GetBufInfo is believed to take
* more time than mdate(). */ * more time than mdate(). */
next_date = (mtime_t)GetBufInfo( p_aout ) * 1000000 next_date = (mtime_t)GetBufInfo( p_aout ) * 1000000
/ aout_FormatToByterate( &p_aout->output.output ); / p_aout->output.output.i_bytes_per_frame
/ p_aout->output.output.i_rate
* p_aout->output.output.i_frame_length;
next_date += mdate(); next_date += mdate();
p_buffer = aout_OutputNextBuffer( p_aout, next_date, 0 ); p_buffer = aout_OutputNextBuffer( p_aout, next_date, VLC_FALSE );
} }
else else
{ {
p_buffer = aout_OutputNextBuffer( p_aout, 0, 1 ); p_buffer = aout_OutputNextBuffer( p_aout, 0, VLC_TRUE );
} }
if ( p_buffer != NULL ) if ( p_buffer != NULL )
...@@ -326,9 +329,8 @@ static int OSSThread( aout_instance_t * p_aout ) ...@@ -326,9 +329,8 @@ static int OSSThread( aout_instance_t * p_aout )
} }
else else
{ {
i_size = aout_FormatToByterate( &p_aout->output.output ) i_size = FRAME_SIZE / p_aout->output.output.i_frame_length
* FRAME_SIZE * p_aout->output.output.i_bytes_per_frame;
/ p_aout->output.output.i_rate;
p_bytes = alloca( i_size ); p_bytes = alloca( i_size );
memset( p_bytes, 0, i_size ); memset( p_bytes, 0, i_size );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment