Commit 5d8bdd3f authored by Gildas Bazin's avatar Gildas Bazin

* src/audio_output/dec.c: moved the audio desync option out of p_vlc so it can be modified on a per input basis.
parent 21567c21
......@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.40 2003/03/06 23:10:11 gbazin Exp $
* $Id: aout_internal.h,v 1.41 2003/10/27 21:54:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -169,8 +169,15 @@ struct aout_input_t
/* If b_error == 1, there is no input pipeline. */
vlc_bool_t b_error;
/* Did we just change the output format ? (expect buffer inconsistencies) */
/* Did we just change the output format? (expect buffer inconsistencies) */
vlc_bool_t b_changed;
/* internal caching delay from input */
int i_pts_delay;
/* desynchronisation delay request by the user */
int i_desync;
};
/*****************************************************************************
......@@ -236,8 +243,6 @@ struct aout_instance_t
/* Output plug-in */
aout_output_t output;
int i_pts_delay; /* internal caching */
};
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* dec.c : audio output API towards decoders
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: dec.c,v 1.11 2003/07/31 23:14:32 massiot Exp $
* $Id: dec.c,v 1.12 2003/10/27 21:54:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -49,6 +49,7 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
{
aout_input_t * p_input;
input_thread_t * p_input_thread;
vlc_value_t val;
/* We can only be called by the decoder, so no need to lock
* p_input->lock. */
......@@ -82,14 +83,8 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
{
int i;
if ( var_Type( p_aout, "audio-device" ) != 0 )
{
var_Destroy( p_aout, "audio-device" );
}
if ( var_Type( p_aout, "audio-channels" ) != 0 )
{
var_Destroy( p_aout, "audio-channels" );
}
/* Recreate the output using the new format. */
if ( aout_OutputNew( p_aout, p_format ) < 0 )
......@@ -129,18 +124,22 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
vlc_mutex_unlock( &p_aout->mixer_lock );
var_Create( p_this, "audio-desync", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, "audio-desync", &val );
p_input->i_desync = val.i_int * 1000;
p_input_thread = (input_thread_t *)vlc_object_find( p_this,
VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input_thread )
{
p_aout->i_pts_delay = p_input_thread->i_pts_delay;
p_aout->i_pts_delay += p_aout->p_vlc->i_desync;
p_input->i_pts_delay = p_input_thread->i_pts_delay;
p_input->i_pts_delay += p_input->i_desync;
vlc_object_release( p_input_thread );
}
else
{
p_aout->i_pts_delay = DEFAULT_PTS_DELAY;
p_aout->i_pts_delay += p_aout->p_vlc->i_desync;
p_input->i_pts_delay = DEFAULT_PTS_DELAY;
p_input->i_pts_delay += p_input->i_desync;
}
return p_input;
......@@ -300,10 +299,10 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
}
/* Apply the desynchronisation requested by the user */
p_buffer->start_date += p_aout->p_vlc->i_desync;
p_buffer->end_date += p_aout->p_vlc->i_desync;
p_buffer->start_date += p_input->i_desync;
p_buffer->end_date += p_input->i_desync;
if ( p_buffer->start_date > mdate() + p_aout->i_pts_delay +
if ( p_buffer->start_date > mdate() + p_input->i_pts_delay +
AOUT_MAX_ADVANCE_TIME )
{
msg_Warn( p_aout, "received buffer in the future ("I64Fd")",
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.99 2003/10/26 12:46:55 sigmunau Exp $
* $Id: libvlc.c,v 1.100 2003/10/27 21:54:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -512,7 +512,6 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
msg_Flush( p_vlc );
/* p_vlc initialization. FIXME ? */
p_vlc->i_desync = config_GetInt( p_vlc, "desync" ) * (mtime_t)1000;
#if defined( __i386__ )
if( !config_GetInt( p_vlc, "mmx" ) )
......
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.96 2003/10/12 23:28:36 hartman Exp $
* $Id: libvlc.h,v 1.97 2003/10/27 21:54:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -596,12 +596,12 @@ vlc_module_begin();
#if !defined( SYS_DARWIN )
add_bool( "hq-resampling", 1, NULL, AOUT_RESAMP_TEXT, AOUT_RESAMP_LONGTEXT, VLC_TRUE );
#endif
add_integer( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT, VLC_TRUE );
add_bool( "spdif", 0, NULL, SPDIF_TEXT, SPDIF_LONGTEXT, VLC_FALSE );
#if 0
add_bool( "headphone-opt", 0, NULL, HEADPHONE_TEXT,
HEADPHONE_LONGTEXT, VLC_FALSE );
#endif
add_integer( "audio-desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT, VLC_TRUE );
add_string("audio-filter",0,NULL,AUDIO_FILTER_TEXT,
AUDIO_FILTER_LONGTEXT,VLC_FALSE);
......
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