]> git.sesse.net Git - vlc/commitdiff
Use audio desync as initial audio-delay value.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 29 Sep 2008 18:52:32 +0000 (20:52 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 30 Sep 2008 20:22:33 +0000 (22:22 +0200)
include/vlc_aout.h
src/audio_output/dec.c
src/input/input.c
src/input/var.c

index dbe1102bfd85506f73c7f54686742e7195b30783..02edb385440e23721ca5e1a20ac297929d40586b 100644 (file)
@@ -290,9 +290,6 @@ struct aout_input_t
     int                     i_last_input_rate;
     /* internal caching delay from input */
     int                     i_pts_delay;
-    /* desynchronisation delay request by the user */
-    int                     i_desync;
-
 };
 
 /** an output stream for the audio output */
index 3ca6da1726b07091686c3484f3454ad34d9e1e7b..808e70ca78e27ec7a58c0f28490be718e8d5eca9 100644 (file)
@@ -155,21 +155,18 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
     aout_unlock_input_fifos( p_aout );
 
     aout_unlock_mixer( p_aout );
-    p_input->i_desync = var_CreateGetInteger( p_this, "audio-desync" ) * 1000;
 
     p_input_thread = (input_thread_t *)vlc_object_find( p_this,
                                            VLC_OBJECT_INPUT, FIND_PARENT );
     if( p_input_thread )
     {
         p_input->i_pts_delay = p_input_thread->i_pts_delay;
-        p_input->i_pts_delay += p_input->i_desync;
         p_input->p_input_thread = p_input_thread;
         vlc_object_release( p_input_thread );
     }
     else
     {
         p_input->i_pts_delay = DEFAULT_PTS_DELAY;
-        p_input->i_pts_delay += p_input->i_desync;
         p_input->p_input_thread = NULL;
     }
 
@@ -335,10 +332,6 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
         return 0;
     }
 
-    /* Apply the desynchronisation requested by the user */
-    p_buffer->start_date += p_input->i_desync;
-    p_buffer->end_date += p_input->i_desync;
-
     if ( p_buffer->start_date > mdate() + p_input->i_pts_delay +
          AOUT_MAX_ADVANCE_TIME )
     {
index 2c7b7467b729877d28a703eaf4a0140dca5e54ad..9e39fee535edb846b647248ea2ff9ce8a92d8bbb 100644 (file)
@@ -925,7 +925,8 @@ static void InitTitle( input_thread_t * p_input )
     /* If the desynchronisation requested by the user is < 0, we need to
      * cache more data. */
     var_Get( p_input, "audio-desync", &val );
-    if( val.i_int < 0 ) p_input->i_pts_delay -= (val.i_int * 1000);
+    if( val.i_int < 0 )
+        p_input->i_pts_delay -= (val.i_int * 1000);
 
     /* Update cr_average depending on the caching */
     p_input->p->input.i_cr_average *= (10 * p_input->i_pts_delay / 200000);
index 22ad2ad5c39cc25775f6ace28c7f01f6af383930..b44757f6e816692d86b44d322066be461a7062c2 100644 (file)
@@ -188,7 +188,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
 
     /* Delay */
     var_Create( p_input, "audio-delay", VLC_VAR_TIME );
-    val.i_time = 0;
+    val.i_time = INT64_C(1000) * var_GetInteger( p_input, "audio-desync" );
     var_Change( p_input, "audio-delay", VLC_VAR_SETVALUE, &val, NULL );
     var_Create( p_input, "spu-delay", VLC_VAR_TIME );
     val.i_time = 0;
@@ -770,15 +770,17 @@ static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
 
     if( !strcmp( psz_cmd, "audio-delay" ) )
     {
-        /*Change i_pts_delay to make sure es are decoded in time*/
-        if (newval.i_int < 0 || oldval.i_int < 0 )
+        /* Change i_pts_delay to make sure es are decoded in time */
+        ifnewval.i_int < 0 || oldval.i_int < 0 )
         {
             p_input->i_pts_delay -= newval.i_int - oldval.i_int;
         }
         input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval );
     }
     else if( !strcmp( psz_cmd, "spu-delay" ) )
+    {
         input_ControlPush( p_input, INPUT_CONTROL_SET_SPU_DELAY, &newval );
+    }
     return VLC_SUCCESS;
 }