Commit 721c7207 authored by Gildas Bazin's avatar Gildas Bazin


* We now make sure the aout plugin buffers always contain between
AOUT_BUFFER_DURATION/2 and AOUT_BUFFER_DURATION*3/2 worth of audio.
This should solve the audio buffer underruns.

* fix for the bug in input when filename contains a '@' character.

* simplified the win32 specific changes to the input parser. ( I think
we can safely assume that no access plugin name will have a length of
one character)
parent 1e105908
......@@ -2,7 +2,7 @@
* audio_output.h : audio output thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_output.h,v 1.43 2002/02/24 22:06:50 sam Exp $
* $Id: audio_output.h,v 1.44 2002/03/04 22:18:25 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -158,7 +158,6 @@ typedef struct aout_thread_s
/* The size of the audio output buffer is kept in audio units, as this is
* the only unit that is common with every audio decoder and audio fifo */
int i_units;
int i_msleep;
/* date is the moment where the first audio unit of the output buffer
* will be played */
......
......@@ -8,7 +8,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.129 2002/03/04 02:50:18 stef Exp $
* $Id: input_dvd.c,v 1.130 2002/03/04 22:18:25 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -256,20 +256,27 @@ static int DVDRewind( input_thread_t * p_input )
static int DVDOpen( struct input_thread_s *p_input )
{
struct stat stat_info;
char * psz_parser = p_input->psz_name;
char * psz_device = p_input->psz_name;
char * psz_orig;
char * psz_parser;
char * psz_device;
char * psz_raw;
char * psz_next;
dvdcss_handle dvdhandle;
thread_dvd_data_t * p_dvd;
input_area_t * p_area;
boolean_t b_need_free = 0;
boolean_t b_options = 0;
int i_title = 1;
int i_chapter = 1;
int i_angle = 1;
int i;
psz_orig = psz_parser = psz_device = strdup( p_input->psz_name );
if( !psz_orig )
{
return( -1 );
}
/* Parse input string :
* [device][@rawdevice][@[title][,[chapter][,angle]]] */
while( *psz_parser && *psz_parser != '@' )
......@@ -349,7 +356,6 @@ static int DVDOpen( struct input_thread_s *p_input )
if( !*psz_device )
{
psz_device = config_GetPszVariable( INPUT_DVD_DEVICE_VAR );
b_need_free = 1;
}
if( stat( psz_device, &stat_info ) == -1 )
......@@ -412,10 +418,11 @@ static int DVDOpen( struct input_thread_s *p_input )
*/
dvdhandle = dvdcss_open( psz_device );
if( b_need_free )
{
/* free allocated strings */
if( psz_device != psz_orig )
free( psz_device );
}
free( psz_orig );
if( dvdhandle == NULL )
{
......
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_dvdread.c,v 1.25 2002/03/04 01:53:56 stef Exp $
* $Id: input_dvdread.c,v 1.26 2002/03/04 22:18:25 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -236,19 +236,25 @@ static int DvdReadRewind( input_thread_t * p_input )
*****************************************************************************/
static int DvdReadOpen( struct input_thread_s *p_input )
{
char * psz_parser = p_input->psz_name;
char * psz_source = p_input->psz_name;
char * psz_orig;
char * psz_parser;
char * psz_source;
char * psz_next;
struct stat stat_info;
thread_dvd_data_t * p_dvd;
dvd_reader_t * p_dvdread;
input_area_t * p_area;
boolean_t b_need_free = 0;
int i_title = 1;
int i_chapter = 1;
int i_angle = 1;
int i;
psz_orig = psz_parser = psz_source = strdup( p_input->psz_name );
if( !psz_orig )
{
return( -1 );
}
while( *psz_parser && *psz_parser != '@' )
{
psz_parser++;
......@@ -279,7 +285,6 @@ static int DvdReadOpen( struct input_thread_s *p_input )
if( !*psz_source )
{
psz_source = config_GetPszVariable( INPUT_DVD_DEVICE_VAR );
b_need_free = 1;
}
if( stat( psz_source, &stat_info ) == -1 )
......@@ -303,10 +308,10 @@ static int DvdReadOpen( struct input_thread_s *p_input )
p_dvdread = DVDOpen( psz_source );
if( b_need_free )
{
free( psz_source );
}
/* free allocated strings */
if( psz_source != psz_orig )
free( psz_device );
free( psz_orig );
if( ! p_dvdread )
{
......
......@@ -2,7 +2,7 @@
* aout_pcm.c: PCM audio output functions
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: aout_pcm.c,v 1.2 2002/02/27 22:57:10 sam Exp $
* $Id: aout_pcm.c,v 1.3 2002/03/04 22:18:25 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -147,10 +147,13 @@ void aout_PCMThread( aout_thread_t * p_aout )
break;
}
if ( i_units > i_buffer_limit )
{
msleep( p_aout->i_msleep );
}
/* Sleep until there is only AOUT_BUFFER_DURATION/2 worth of audio
* left to play in the aout plugin, then we can start refill the
* plugin's buffer */
if( i_units > (i_buffer_limit/2) )
msleep( (i_units - i_buffer_limit/2) * AOUT_BUFFER_DURATION
/ i_buffer_limit );
}
vlc_mutex_lock( &p_aout->fifos_lock );
......
......@@ -2,7 +2,7 @@
* audio_output.c : audio output thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio_output.c,v 1.80 2002/02/27 22:57:10 sam Exp $
* $Id: audio_output.c,v 1.81 2002/03/04 22:18:25 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -194,7 +194,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
* AOUT_BUFFER_DURATION is given in microseconds, the output rate is given
* in Hz, that's why we need to divide by 10^6 microseconds (1 second) */
p_aout->i_units = (s64)p_aout->i_rate * AOUT_BUFFER_DURATION / 1000000;
p_aout->i_msleep = AOUT_BUFFER_DURATION;
/* Make pf_aout_thread point to the right thread function, and compute the
* byte size of the audio output buffer */
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.158 2002/03/04 01:53:56 stef Exp $
* $Id: main.c,v 1.159 2002/03/04 22:18:25 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -887,7 +887,8 @@ static void Usage( const char *psz_module_name )
if( !strcmp( "main", p_module->psz_name ) )
intf_Msg( "\nPlaylist items:"
"\n *.mpg, *.vob \tPlain MPEG-1/2 files"
"\n dvd:<device>[@<raw device>] \tDVD device"
"\n [dvd:][device][@raw_device][@[title][,[chapter][,angle]]]"
"\n \tDVD device"
"\n vcd:<device> \tVCD device"
"\n udpstream:[<server>[:<server port>]][@[<bind address>]"
"[:<bind port>]]"
......
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