Commit 2f1be4f3 authored by Christophe Massiot's avatar Christophe Massiot

* 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.
parent eb93d56d
......@@ -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 <massiot@via.ecp.fr>
*
......@@ -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 ) );
......@@ -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 <massiot@via.ecp.fr>
*
......@@ -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 ) );
......@@ -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 *) ;
......
......@@ -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 )
{
......
......@@ -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 <sam@zoy.org>
*
......@@ -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 )
{
......
......@@ -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 <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -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 )
{
......
......@@ -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 <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -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 )
......
......@@ -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 <gbazin@netcourrier.com>
*
......@@ -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 );
}
......@@ -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 <colin@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -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 )
......
......@@ -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 <gbazin@netcourrier.com>
*
......@@ -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 )
......
......@@ -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 <massiot@via.ecp.fr>
*
......@@ -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;
......
......@@ -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; \
......
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