From 9a1fd919019c36a4bf85e5366dce96e5f83d9596 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 19 Aug 2002 23:07:30 +0000 Subject: [PATCH] * ./modules/audio_output/*: ported the ALSA, aRts, esd and OSS modules to the latest aout3 changes. --- modules/audio_output/alsa.c | 11 +++++------ modules/audio_output/arts.c | 8 ++++---- modules/audio_output/esd.c | 16 ++++++++++------ modules/audio_output/file.c | 6 +++--- modules/audio_output/oss.c | 18 ++++++++++-------- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c index a8da821ac3..7718a4e744 100644 --- a/modules/audio_output/alsa.c +++ b/modules/audio_output/alsa.c @@ -2,7 +2,7 @@ * alsa.c : alsa plugin for vlc ***************************************************************************** * 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 - Original Author * Jeffrey Baker - Port to ALSA 1.0 API @@ -88,8 +88,8 @@ static void ALSAFill ( aout_instance_t * ); * Module descriptor *****************************************************************************/ vlc_module_begin(); - add_category_hint( N_("Audio"), NULL ); - add_string( "alsa-device", NULL, NULL, N_("Name"), NULL ); + add_category_hint( N_("ALSA"), NULL ); + add_string( "alsa-device", NULL, NULL, N_("device name"), NULL ); set_description( _("ALSA audio module") ); set_capability( "audio output", 50 ); set_callbacks( Open, Close ); @@ -234,9 +234,8 @@ static int SetFormat( aout_instance_t * p_aout ) p_sys->b_can_sleek = VLC_TRUE; i_format = SND_PCM_FORMAT_S16_LE; i_channels = 2; - p_aout->output.output.i_bytes_per_sec = - p_aout->output.output.i_rate * AOUT_SPDIF_SIZE / - ALSA_SPDIF_PERIOD_SIZE; + p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE; + p_aout->output.output.i_frame_length = ALSA_SPDIF_PERIOD_SIZE; break; case AOUT_FMT_FIXED32: default: diff --git a/modules/audio_output/arts.c b/modules/audio_output/arts.c index 19f5a8149f..e92dd3ae79 100644 --- a/modules/audio_output/arts.c +++ b/modules/audio_output/arts.c @@ -159,8 +159,9 @@ static int SetFormat( aout_instance_t *p_aout ) /***************************************************************************** * 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 ) } else { - i_size = aout_FormatToByterate( &p_aout->output.output ) - * p_sys->i_size - / p_aout->output.output.i_rate; + i_size = p_sys->i_size / p_aout->output.output.i_frame_length + * p_aout->output.output.i_bytes_per_frame; p_bytes = alloca( i_size ); memset( p_bytes, 0, i_size ); } diff --git a/modules/audio_output/esd.c b/modules/audio_output/esd.c index 33e91c45ff..cbf8130117 100644 --- a/modules/audio_output/esd.c +++ b/modules/audio_output/esd.c @@ -2,7 +2,7 @@ * esd.c : EsounD module ***************************************************************************** * 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 * @@ -147,10 +147,14 @@ static int SetFormat( aout_instance_t *p_aout ) * number of buffered samples, so I assume ESD_BUF_SIZE/2 */ p_sys->latency = (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 ) * (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; @@ -209,9 +213,9 @@ static int ESDThread( aout_instance_t * p_aout ) } else { - i_size = aout_FormatToByterate( &p_aout->output.output ) - * ESD_BUF_SIZE * 2 - / p_aout->output.output.i_rate; + i_size = ESD_BUF_SIZE * 2 + / p_aout->output.output.i_frame_length + * p_aout->output.output.i_bytes_per_frame; p_bytes = alloca( i_size ); memset( p_bytes, 0, i_size ); } diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c index 564aa0336e..cd5ddfbb06 100644 --- a/modules/audio_output/file.c +++ b/modules/audio_output/file.c @@ -2,7 +2,7 @@ * file.c : audio output which writes the samples to a file ***************************************************************************** * 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 * @@ -47,7 +47,7 @@ static void Play ( aout_instance_t * ); /***************************************************************************** * Module descriptor *****************************************************************************/ -#define FORMAT_TEXT N_("Output format") +#define FORMAT_TEXT N_("output format") #define FORMAT_LONGTEXT N_("one of \"u8\", \"s8\", \"u16\", \"s16\"," \ " \"u16_le\", \"s16_le\", \"u16_be\"," \ " \"s16_be\", \"fixed32\", \"float32\" or \"spdif\"") @@ -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_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") vlc_module_begin(); diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c index 7e2e1f21b6..fbb166fb60 100644 --- a/modules/audio_output/oss.c +++ b/modules/audio_output/oss.c @@ -2,7 +2,7 @@ * oss.c : OSS /dev/dsp module for vlc ***************************************************************************** * 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 * Samuel Hocevar @@ -82,7 +82,7 @@ static int OSSThread ( aout_instance_t * ); * Module descriptor *****************************************************************************/ 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 ); set_description( _("Linux OSS /dev/dsp module") ); set_capability( "audio output", 100 ); @@ -132,6 +132,7 @@ static int Open( vlc_object_t *p_this ) if( vlc_thread_create( p_aout, "aout", OSSThread, VLC_FALSE ) ) { msg_Err( p_aout, "cannot create OSS thread (%s)", strerror(errno) ); + close( p_sys->i_fd ); free( psz_device ); free( p_sys ); return -1; @@ -309,14 +310,16 @@ static int OSSThread( aout_instance_t * p_aout ) * Order is important here, since GetBufInfo is believed to take * more time than mdate(). */ 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(); - p_buffer = aout_OutputNextBuffer( p_aout, next_date, 0 ); + p_buffer = aout_OutputNextBuffer( p_aout, next_date, VLC_FALSE ); } else { - p_buffer = aout_OutputNextBuffer( p_aout, 0, 1 ); + p_buffer = aout_OutputNextBuffer( p_aout, 0, VLC_TRUE ); } if ( p_buffer != NULL ) @@ -326,9 +329,8 @@ static int OSSThread( aout_instance_t * p_aout ) } else { - i_size = aout_FormatToByterate( &p_aout->output.output ) - * FRAME_SIZE - / p_aout->output.output.i_rate; + i_size = FRAME_SIZE / p_aout->output.output.i_frame_length + * p_aout->output.output.i_bytes_per_frame; p_bytes = alloca( i_size ); memset( p_bytes, 0, i_size ); } -- 2.39.2