]> git.sesse.net Git - vlc/blobdiff - src/input/decoder_synchro.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / input / decoder_synchro.c
index b88230ee13fdbe00a8c5cb3fe87cd768aa3c3268..f6a35bd6558fcb6fd9887a53cd6ad9f13ad74ede 100644 (file)
@@ -116,8 +116,8 @@ struct decoder_synchro_t
 
     /* */
     int             i_frame_rate;
-    bool      b_no_skip;
-    bool      b_quiet;
+    bool            b_no_skip;
+    bool            b_quiet;
 
     /* date of the beginning of the decoding of the current picture */
     mtime_t         decoding_start;
@@ -130,7 +130,7 @@ struct decoder_synchro_t
     unsigned int    pi_meaningful[4];            /* number of durations read */
 
     /* render_time filled by SynchroChoose() */
-    int i_render_time;
+    int             i_render_time;
 
     /* stream context */
     int             i_nb_ref;                /* Number of reference pictures */
@@ -166,8 +166,8 @@ decoder_synchro_t * decoder_SynchroInit( decoder_t *p_dec, int i_frame_rate )
         return NULL;
 
     p_synchro->p_dec = p_dec;
-    p_synchro->b_no_skip = !config_GetInt( p_dec, "skip-frames" );
-    p_synchro->b_quiet = config_GetInt( p_dec, "quiet-synchro" );
+    p_synchro->b_no_skip = !var_InheritBool( p_dec, "skip-frames" );
+    p_synchro->b_quiet = var_InheritBool( p_dec, "quiet-synchro" );
 
     /* We use a fake stream pattern, which is often right. */
     p_synchro->i_n_p = p_synchro->i_eta_p = DEFAULT_NB_P;
@@ -215,7 +215,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
                                     + p_synchro->i_render_time)
 #define S (*p_synchro)
     mtime_t         now, period;
-    mtime_t         pts = 0;
+    mtime_t         pts;
     bool      b_decode = 0;
     int       i_current_rate;
 
@@ -251,8 +251,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
             pts = decoder_GetDisplayDate( p_synchro->p_dec, S.current_pts ) + period * (S.i_n_b + 2);
         }
 
-        if( (1 + S.i_n_p * (S.i_n_b + 1)) * period >
-                S.p_tau[I_CODING_TYPE] )
+        if( (1 + S.i_n_p * (S.i_n_b + 1)) * period > S.p_tau[I_CODING_TYPE] )
         {
             b_decode = 1;
         }
@@ -260,6 +259,9 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
         {
             b_decode = (pts - now) > (TAU_PRIME(I_CODING_TYPE) + DELTA);
         }
+        if( pts <= VLC_TS_INVALID )
+            b_decode = 1;
+
         if( !b_decode && !p_synchro->b_quiet )
         {
             msg_Warn( p_synchro->p_dec,
@@ -308,6 +310,8 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
         {
             b_decode = 0;
         }
+        if( p_synchro->i_nb_ref >= 1 && pts <= VLC_TS_INVALID )
+            b_decode = 1;
         break;
 
     case B_CODING_TYPE:
@@ -325,6 +329,9 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
         {
             b_decode = 0;
         }
+        if( p_synchro->i_nb_ref >= 2 && pts <= VLC_TS_INVALID )
+            b_decode = 1;
+        break;
     }
 
     if( !b_decode )