From: Christophe Massiot Date: Wed, 14 Aug 2002 00:43:52 +0000 (+0000) Subject: * Added a third argument to aout_OutputNextBuffer. In case the buffer X-Git-Tag: 0.5.0~1084 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2f1be4f3e563c2bcfe8b51bda25ce804546f8748;p=vlc * Added a third argument to aout_OutputNextBuffer. In case the buffer received does not start exactly at the given date, it indicates if the output plug-in is able to compensate for the drift (for instance on startup, or with S/PDIF packets), or if we need the aout core to resample the coming buffers. It is currently unimplemented. --- diff --git a/include/aout_internal.h b/include/aout_internal.h index 3355ff3d28..f12595006a 100644 --- a/include/aout_internal.h +++ b/include/aout_internal.h @@ -2,7 +2,7 @@ * aout_internal.h : internal defines for audio output ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: aout_internal.h,v 1.4 2002/08/14 00:23:59 massiot Exp $ + * $Id: aout_internal.h,v 1.5 2002/08/14 00:43:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -267,4 +267,5 @@ int aout_OutputNew( aout_instance_t * p_aout, audio_sample_format_t * p_format ); void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer ); void aout_OutputDelete( aout_instance_t * p_aout ); +VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t, vlc_bool_t ) ); diff --git a/include/audio_output.h b/include/audio_output.h index addf857056..19a8878c42 100644 --- a/include/audio_output.h +++ b/include/audio_output.h @@ -2,7 +2,7 @@ * audio_output.h : audio output interface ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: audio_output.h,v 1.58 2002/08/14 00:23:59 massiot Exp $ + * $Id: audio_output.h,v 1.59 2002/08/14 00:43:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -132,6 +132,3 @@ VLC_EXPORT( int, aout_FormatToByterate, ( audio_sample_format_t * p_format ) ); VLC_EXPORT( aout_input_t *, __aout_InputNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) ); VLC_EXPORT( void, aout_InputDelete, ( aout_instance_t *, aout_input_t * ) ); -/* From output.c : */ -VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t ) ); - diff --git a/include/vlc_symbols.h b/include/vlc_symbols.h index 4074523c8c..c2fa2fdbf7 100644 --- a/include/vlc_symbols.h +++ b/include/vlc_symbols.h @@ -3,7 +3,7 @@ struct module_symbols_t { aout_buffer_t * (* aout_BufferNew_inner) ( aout_instance_t *, aout_input_t *, size_t ) ; - aout_buffer_t * (* aout_OutputNextBuffer_inner) ( aout_instance_t *, mtime_t ) ; + aout_buffer_t * (* aout_OutputNextBuffer_inner) ( aout_instance_t *, mtime_t, vlc_bool_t ) ; aout_input_t * (* __aout_InputNew_inner) ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) ; aout_instance_t * (* __aout_NewInstance_inner) ( vlc_object_t * ) ; char * (* __config_GetPsz_inner) (vlc_object_t *, const char *) ; diff --git a/modules/audio_output/arts.c b/modules/audio_output/arts.c index c00d85f40f..80c176900b 100644 --- a/modules/audio_output/arts.c +++ b/modules/audio_output/arts.c @@ -205,7 +205,7 @@ static int aRtsThread( aout_instance_t * p_aout ) /* Get the presentation date of the next write() operation. It * is equal to the current date + latency */ - p_buffer = aout_OutputNextBuffer( p_aout, mdate() + p_sys->latency ); + p_buffer = aout_OutputNextBuffer( p_aout, mdate() + p_sys->latency, 0 ); if ( p_buffer != NULL ) { diff --git a/modules/audio_output/esd.c b/modules/audio_output/esd.c index 4db499ecd7..24d5364943 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.4 2002/08/14 00:23:59 massiot Exp $ + * $Id: esd.c,v 1.5 2002/08/14 00:43:52 massiot Exp $ * * Authors: Samuel Hocevar * @@ -201,7 +201,7 @@ static int ESDThread( aout_instance_t * p_aout ) /* Get the presentation date of the next write() operation. It * is equal to the current date + buffered samples + esd latency */ - p_buffer = aout_OutputNextBuffer( p_aout, mdate() + p_sys->latency ); + p_buffer = aout_OutputNextBuffer( p_aout, mdate() + p_sys->latency, 0 ); if ( p_buffer != NULL ) { diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c index 7e1f67d205..5c66b0e33a 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.9 2002/08/14 00:23:59 massiot Exp $ + * $Id: oss.c,v 1.10 2002/08/14 00:43:52 massiot Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -293,7 +293,6 @@ static int OSSThread( aout_instance_t * p_aout ) while ( !p_aout->b_die ) { aout_buffer_t * p_buffer; - mtime_t next_date = 0; int i_tmp, i_size; byte_t * p_bytes; @@ -305,6 +304,7 @@ static int OSSThread( aout_instance_t * p_aout ) if ( p_aout->output.output.i_format != AOUT_FMT_SPDIF ) { + mtime_t next_date = 0; /* Get the presentation date of the next write() operation. It * is equal to the current date + duration of buffered samples. * Order is important here, since GetBufInfo is believed to take @@ -312,9 +312,13 @@ static int OSSThread( aout_instance_t * p_aout ) next_date = (mtime_t)GetBufInfo( p_aout ) * 1000000 / aout_FormatToByterate( &p_aout->output.output ); next_date += mdate(); - } - p_buffer = aout_OutputNextBuffer( p_aout, next_date ); + p_buffer = aout_OutputNextBuffer( p_aout, next_date, 0 ); + } + else + { + p_buffer = aout_OutputNextBuffer( p_aout, 0, 1 ); + } if ( p_buffer != NULL ) { diff --git a/modules/audio_output/sdl.c b/modules/audio_output/sdl.c index a370282915..6224bf3f5c 100644 --- a/modules/audio_output/sdl.c +++ b/modules/audio_output/sdl.c @@ -2,7 +2,7 @@ * sdl.c : SDL audio output plugin for vlc ***************************************************************************** * Copyright (C) 2000-2002 VideoLAN - * $Id: sdl.c,v 1.1 2002/08/13 11:59:36 sam Exp $ + * $Id: sdl.c,v 1.2 2002/08/14 00:43:52 massiot Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -155,7 +155,7 @@ static void SDLCallback( void * _p_aout, byte_t * p_stream, int i_len ) { aout_instance_t * p_aout = (aout_instance_t *)_p_aout; /* FIXME : take into account SDL latency instead of mdate() */ - aout_buffer_t * p_buffer = aout_OutputNextBuffer( p_aout, mdate() ); + aout_buffer_t * p_buffer = aout_OutputNextBuffer( p_aout, mdate(), 0 ); if ( i_len != FRAME_SIZE * sizeof(s16) * p_aout->output.output.i_channels ) diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c index 552f1b2e85..10468294cd 100644 --- a/modules/audio_output/waveout.c +++ b/modules/audio_output/waveout.c @@ -2,7 +2,7 @@ * waveout.c : Windows waveOut plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: waveout.c,v 1.2 2002/08/10 18:17:06 gbazin Exp $ + * $Id: waveout.c,v 1.3 2002/08/14 00:43:52 massiot Exp $ * * Authors: Gildas Bazin * @@ -311,7 +311,7 @@ static void CALLBACK WaveOutCallback( HWAVEOUT h_waveout, UINT uMsg, aout_BufferFree( (aout_buffer_t *)p_waveheader->dwUser ); /* FIXME : take into account WaveOut latency instead of mdate() */ - p_buffer = aout_OutputNextBuffer( p_aout, mdate() ); + p_buffer = aout_OutputNextBuffer( p_aout, mdate(), 0 ); PlayWaveOut( p_aout, h_waveout, p_waveheader, p_buffer ); } diff --git a/modules/gui/macosx/aout.m b/modules/gui/macosx/aout.m index bb586781ba..c56b5a5dc0 100644 --- a/modules/gui/macosx/aout.m +++ b/modules/gui/macosx/aout.m @@ -2,7 +2,7 @@ * aout.m: CoreAudio output plugin ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: aout.m,v 1.3 2002/08/12 22:48:18 massiot Exp $ + * $Id: aout.m,v 1.4 2002/08/14 00:43:52 massiot Exp $ * * Authors: Colin Delacroix * Jon Lech Johansen @@ -241,7 +241,7 @@ static OSStatus IOCallback( AudioDeviceID inDevice, current_date = p_sys->clock_diff + AudioConvertHostTimeToNanos(host_time.mHostTime) / 1000; - p_buffer = aout_OutputNextBuffer( p_aout, current_date ); + p_buffer = aout_OutputNextBuffer( p_aout, current_date, 0 ); /* move data into output data buffer */ if ( p_buffer != NULL ) diff --git a/modules/video_output/directx/aout.c b/modules/video_output/directx/aout.c index 1198e02161..e654a6fa73 100644 --- a/modules/video_output/directx/aout.c +++ b/modules/video_output/directx/aout.c @@ -2,7 +2,7 @@ * aout.c: Windows DirectX audio output method ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: aout.c,v 1.3 2002/08/12 09:34:15 sam Exp $ + * $Id: aout.c,v 1.4 2002/08/14 00:43:52 massiot Exp $ * * Authors: Gildas Bazin * @@ -560,7 +560,7 @@ static void DirectSoundThread( notification_thread_t *p_notif ) } /* FIXME : take into account DirectSound latency instead of mdate() */ - p_buffer = aout_OutputNextBuffer( p_aout, mdate() ); + p_buffer = aout_OutputNextBuffer( p_aout, mdate(), 0 ); /* Now do the actual memcpy into the circular buffer */ if ( l_bytes1 != p_notif->i_buffer_size ) diff --git a/src/audio_output/output.c b/src/audio_output/output.c index bde793c5b2..94604d3ae5 100644 --- a/src/audio_output/output.c +++ b/src/audio_output/output.c @@ -2,7 +2,7 @@ * output.c : internal management of output streams for the audio output ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: output.c,v 1.5 2002/08/14 00:23:59 massiot Exp $ + * $Id: output.c,v 1.6 2002/08/14 00:43:52 massiot Exp $ * * Authors: Christophe Massiot * @@ -168,8 +168,8 @@ void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) * do it by itself. S/PDIF outputs should always set b_can_sleek = 1. *****************************************************************************/ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout, - mtime_t start_date /*, - vlc_bool_t b_can_sleek */ ) + mtime_t start_date , + vlc_bool_t b_can_sleek ) { aout_buffer_t * p_buffer; diff --git a/src/misc/modules_plugin.h b/src/misc/modules_plugin.h index 6d7368d47c..d00c6cac4a 100644 --- a/src/misc/modules_plugin.h +++ b/src/misc/modules_plugin.h @@ -179,6 +179,7 @@ static const char * module_error( char *psz_buffer ) * STORE_SYMBOLS: store known symbols into p_symbols for plugin access. *****************************************************************************/ #define STORE_SYMBOLS( p_symbols ) \ + (p_symbols)->aout_OutputNextBuffer_inner = aout_OutputNextBuffer; \ (p_symbols)->__aout_NewInstance_inner = __aout_NewInstance; \ (p_symbols)->aout_DeleteInstance_inner = aout_DeleteInstance; \ (p_symbols)->aout_BufferNew_inner = aout_BufferNew; \ @@ -187,7 +188,6 @@ static const char * module_error( char *psz_buffer ) (p_symbols)->aout_FormatToByterate_inner = aout_FormatToByterate; \ (p_symbols)->__aout_InputNew_inner = __aout_InputNew; \ (p_symbols)->aout_InputDelete_inner = aout_InputDelete; \ - (p_symbols)->aout_OutputNextBuffer_inner = aout_OutputNextBuffer; \ (p_symbols)->__config_GetInt_inner = __config_GetInt; \ (p_symbols)->__config_PutInt_inner = __config_PutInt; \ (p_symbols)->__config_GetFloat_inner = __config_GetFloat; \