]> git.sesse.net Git - vlc/commitdiff
. synchro qui marchouille de plus en plus
authorSam Hocevar <sam@videolan.org>
Wed, 26 Jan 2000 01:25:21 +0000 (01:25 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 26 Jan 2000 01:25:21 +0000 (01:25 +0000)
src/video_parser/vpar_synchro.c

index 51a7541fb0f3b52e138d5b29ba3f7362f48170d6..6c8dfa11d3616a0157082b4ddf6063b1c3d8da42 100644 (file)
@@ -183,14 +183,31 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
 boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
                               int i_structure )
 {
+    mtime_t i_delay =
+        p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_pts - mdate();
+    
+    if ( i_coding_type == B_CODING_TYPE )
+        return (0);
 
-    if( p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_decode_date + ((p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start) & 0xf) * p_vpar->synchro.i_mean_decode_time > mdate() )
+    if( i_delay > 300000 )
+    {      
+        return (1);
+    }
+    else if( i_delay > 150000 )
     {
-        //fprintf( stderr, "chooser : we are à la bourre !\n");
-        return( i_coding_type == I_CODING_TYPE );
+        return ( i_coding_type == I_CODING_TYPE
+                    || i_coding_type == P_CODING_TYPE );
+    }
+    else if( i_delay > 100000 )
+    {      
+        return ( i_coding_type == I_CODING_TYPE );
+    }
+    else
+    {      
+        //fprintf( stderr, "chooser : we are à la bourre - trashing a %i\n", i_coding_type);
+        //return ( i_coding_type == I_CODING_TYPE );
+        return (0);
     }
-
-    return( i_coding_type == I_CODING_TYPE || (i_coding_type == P_CODING_TYPE));
 
 }
 
@@ -241,17 +258,14 @@ void vpar_SynchroEnd( vpar_thread_t * p_vpar )
  *****************************************************************************/
 mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
 {
-    decoder_fifo_t * fifo;
     mtime_t i_displaydate;
-    mtime_t i_delay;
+    static mtime_t i_delta = 0;
 
     i_displaydate =
-        p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_decode_date;
-    /* this value should be removed */
-    i_displaydate += 500000;
-    i_delay = i_displaydate - mdate();
+        p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_pts;
     
-    //fprintf(stderr, "displaying type %i with delay %lli)\n", p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type, i_delay);
+    //fprintf(stderr, "displaying type %i with delay %lli and delta %lli\n", p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type, i_displaydate - mdate(), i_displaydate - i_delta);
+    i_delta = i_displaydate;
 
     return i_displaydate;
 }