]> git.sesse.net Git - vlc/commitdiff
. un chti peu plus de synchro video, mais c'est pas encore �a
authorSam Hocevar <sam@videolan.org>
Mon, 24 Jan 2000 03:28:44 +0000 (03:28 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 24 Jan 2000 03:28:44 +0000 (03:28 +0000)
 . suppression des #include "X11/*" pour que �a compile sans X
 . alban, t'es mortel

17 files changed:
include/vlc.h
src/generic_decoder/generic_decoder.c
src/input/input.c
src/input/input_ctrl.c
src/input/input_psi.c
src/interface/control.c
src/interface/intf_cmd.c
src/interface/intf_ctrl.c
src/video_decoder/vdec_idct.c
src/video_decoder/vdec_motion.c
src/video_decoder/video_decoder.c
src/video_parser/video_fifo.c
src/video_parser/video_parser.c
src/video_parser/vpar_blocks.c
src/video_parser/vpar_headers.c
src/video_parser/vpar_motion.c
src/video_parser/vpar_synchro.c

index ea47bfb85e92855f5752258764642f28d8b6d6a2..5337ff4a852537fb9a6b574bd1620338f58f09ed 100644 (file)
 #include <sys/soundcard.h>
 #include <sys/uio.h>
 
+#ifdef VIDEO_X11
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #include <X11/extensions/XShm.h>
 #include <X11/extensions/xf86dga.h>
+#endif
 
 
 
index 3eed0ef88e52bafbafff22be78695e1e868abc3f..eecb901e762054c17b02f2e066bdbd087e1d14ed 100644 (file)
@@ -23,8 +23,6 @@
 #include <stdio.h>
 #include <netinet/in.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 01146df7df767ec89842ac6aaaddc00729ea948d..effc49daedd3afd18d3e5622e3db9cab92dec5f9 100644 (file)
 #include <sys/uio.h>                                               
 #include <string.h>
 
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
-#include <sys/soundcard.h>
-
 #include <stdlib.h>                            
 #include <stdio.h>
 #include <sys/ioctl.h>                                            
index 96505db00305e3743ed12bb9705b4e13fa36e775..3f3ac483bdf081e87017b1b9a0056c98fee07923 100644 (file)
@@ -20,9 +20,6 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
-#include <sys/soundcard.h>
 #include <netinet/in.h>                                              /* ntohs */
 
 #include "common.h"
index f6cf9e66376badbdfbd1c3a75e7ad99e0ccee9f0..9809473b4f7d605c2527ac68031e77767a7988d8 100644 (file)
@@ -21,8 +21,6 @@
 #include <string.h>
 #include <netinet/in.h>                                             
 #include <sys/soundcard.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "common.h"
 #include "config.h"
index f16bebe819f53dd952d137b40fdff8f19a633db8..5e74bb52f5bb9d0b3518099cd652863564148840 100644 (file)
@@ -17,8 +17,6 @@
 #include <netinet/in.h>
 #include <sys/soundcard.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h> 
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 7e08308b4de1c64c41cac3b85c06ab5aa1363011..af02111a27cbb100d766008bd9cfd88fb13f9ebd 100644 (file)
@@ -20,8 +20,6 @@
 #include <string.h>
 #include <sys/soundcard.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 6d919a333d8a0a7a23ac6d25f6f5fc1a7ad29191..1a4d70fa8a1341e72c834d86b5a3fbc6ae53f03b 100644 (file)
@@ -35,8 +35,6 @@
 #include <unistd.h>
 #include <sys/soundcard.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index a590a95d27334c74346f6c1a6724ed652fd2964f..da8c934b1c2082edcf04339d4aac36a35c39959d 100644 (file)
@@ -13,8 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 50258cadf63399c1573ee3f54899be0457321bc9..1fd1c30564e9ad2473752a5a2023e5677e6a69a8 100644 (file)
@@ -12,8 +12,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 0a7365e3437eb6da3b12bb6745f9fa4677e58676..06fa5f789ca116a3009767e18b2396f2038fc583 100644 (file)
@@ -16,8 +16,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 2e46d87db086607fa7e1b5dac40d85f11f66db93..5cb176b3c654c29f00fb3d087c34bc54b41ca7b9 100644 (file)
@@ -12,8 +12,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 64352796786a93b876d10881cb8115cfcf009f7a..3177681bb3fed8c35e9a337c49835f781b0b810e 100644 (file)
@@ -14,8 +14,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
@@ -235,7 +233,13 @@ static int InitThread( vpar_thread_t *p_vpar )
     /*
      * Initialize the synchro properties
      */
+    /* the fifo */
+    p_vpar->synchro.i_fifo_start = 0;
+    p_vpar->synchro.i_fifo_stop = 0;
+    /* the counter */
     p_vpar->synchro.modulo = 0;
+    /* mean decoding time - at least 100 ms */
+    p_vpar->synchro.decode_time = 500000;
     /* assume there were about 3 P and 6 B images between I's */
     p_vpar->synchro.current_p_count = 1;
     p_vpar->synchro.p_count_predict = 3;
index dd446d011e33a9f683139838e6c5b2f529170ef6..2ac9a0594514f7f3310cd2461b3f24e73a469b4a 100644 (file)
@@ -12,8 +12,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 310e11b868984af07b5d043e21f988bc05c74dd0..159f3dbca21ddbaa6046804a46b013c1a7182c89 100644 (file)
@@ -12,8 +12,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index 5bf6bbc65280f69abb6eb4c09b2596e688870120..dfd647505007edd24a881aecfe16522ebb6ac719 100644 (file)
@@ -14,8 +14,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
index cf3438c4856498aabeedeec873f0bfd9650267fc..a92079c041484b159ed5e5178bcc3c8017b86f00 100644 (file)
@@ -12,8 +12,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/uio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XShm.h>
 
 #include "config.h"
 #include "common.h"
@@ -51,8 +49,9 @@
 float vpar_SynchroUpdateTab( video_synchro_tab_t * tab, int count )
 {
        
-    tab->mean = ( tab->mean + 3 * count ) / 4;
-    tab->deviation = ( tab->deviation + 3 * abs (tab->mean - count) ) / 4;
+    tab->mean = ( tab->mean + MAX_COUNT * count ) / ( MAX_COUNT + 1 );
+    tab->deviation = ( tab->deviation + MAX_COUNT * abs (tab->mean - count) )
+                        / ( MAX_COUNT + 1 );
 
     return tab->deviation;
 }
@@ -78,11 +77,14 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
         case I_CODING_TYPE:
 
             /* update all the structures for P images */
+
+            /* period == 1 */
             optimal_deviation = vpar_SynchroUpdateTab(
                             &p_vpar->synchro.tab_p[0],
                             p_vpar->synchro.current_p_count);
             predict = p_vpar->synchro.tab_p[0].mean;
 
+            /* period == 2 */
             candidate_deviation = vpar_SynchroUpdateTab(
                             &p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)],
                             p_vpar->synchro.current_p_count);
@@ -92,6 +94,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
                 predict = p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)].mean;
             }
 
+            /* period == 3 */
             candidate_deviation = vpar_SynchroUpdateTab(
                             &p_vpar->synchro.tab_p[3 + (p_vpar->synchro.modulo % 3)],
                             p_vpar->synchro.current_p_count);
@@ -106,11 +109,14 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
 
 
             /* update all the structures for B images */
+
+            /* period == 1 */
             optimal_deviation = vpar_SynchroUpdateTab(
                             &p_vpar->synchro.tab_b[0],
                             p_vpar->synchro.current_b_count);
             predict = p_vpar->synchro.tab_b[0].mean;
 
+            /* period == 2 */
             candidate_deviation = vpar_SynchroUpdateTab(
                             &p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)],
                             p_vpar->synchro.current_b_count);
@@ -120,6 +126,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
                 predict = p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)].mean;
             }
 
+            /* period == 3 */
             candidate_deviation = vpar_SynchroUpdateTab(
                             &p_vpar->synchro.tab_b[3 + (p_vpar->synchro.modulo % 3)],
                             p_vpar->synchro.current_b_count);
@@ -148,16 +155,16 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
     static int meuh = 1;
     static int truc = 0;
 //    return( 1 );
-//    if( i_coding_type == 1 )
-//        meuh = 0;
-//    if( i_coding_type == 2 )
-//        meuh++;
+    if( i_coding_type == 1 )
+        meuh = 1;
+    if( i_coding_type == 2 )
+        meuh++;
     truc++;
     if( truc == 3 )
     {
        // while(1);
     }
-    return( i_coding_type == I_CODING_TYPE || (i_coding_type == P_CODING_TYPE && meuh == 1) );
+    return( i_coding_type == I_CODING_TYPE || (i_coding_type == P_CODING_TYPE) && (meuh == 2));
     intf_DbgMsg("vpar debug: synchro image %i - modulo is %i\n", i_coding_type, p_vpar->synchro.modulo);
     intf_DbgMsg("vpar debug: synchro predict P %e - predict B %e\n", p_vpar->synchro.p_count_predict, p_vpar->synchro.b_count_predict);
 
@@ -171,6 +178,8 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
 void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
                         int i_structure )
 {
+    //fprintf ( stderr, "trashing type %i\n", p_vpar->picture.i_coding_type );
+    
     vpar_SynchroUpdateStructures (p_vpar, i_coding_type);
 
 }
@@ -181,7 +190,16 @@ void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
 void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
                             int i_structure )
 {
+    //fprintf ( stderr, "decoding type %i\n", p_vpar->picture.i_coding_type );
+
     vpar_SynchroUpdateStructures (p_vpar, i_coding_type);
+
+    p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].decode_date = mdate();
+    p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].i_image_type
+        = i_coding_type;
+    p_vpar->synchro.i_fifo_stop = (p_vpar->synchro.i_fifo_stop + 1) & 0xf;
+
+    fprintf ( stderr, "%i images in synchro fifo\n", ( p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start ) & 0xf );
 }
 
 /*****************************************************************************
@@ -189,12 +207,35 @@ void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
  *****************************************************************************/
 void vpar_SynchroEnd( vpar_thread_t * p_vpar )
 {
-    
-//    return mdate() + 700000;
+    mtime_t * p_decode_time;
+
+    fprintf ( stderr, "type %i decoding time was %lli\n",
+        p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type,
+       ( mdate()
+           - p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].decode_date )
+           / (( p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start ) & 0xf ));
+
+    p_vpar->synchro.decode_time =
+        ( (p_vpar->synchro.decode_time * 3) + (mdate()
+            - p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].decode_date)
+            / (( p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start)
+          & 0xf) ) >> 2;
+
+    p_vpar->synchro.i_fifo_start = (p_vpar->synchro.i_fifo_start + 1) & 0xf;
 }
 
+/*****************************************************************************
+ * vpar_SynchroDate : When an image has been decoded, ask for its date
+ *****************************************************************************/
 mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
 {
-    return mdate() + 700000;
+    decoder_fifo_t * fifo;
+    mtime_t displaydate;
+
+    fifo = p_vpar->bit_stream.p_decoder_fifo;
+    displaydate = fifo->buffer[fifo->i_start]->i_pts;
+
+    if (displaydate) fprintf(stderr, "displaying type %i at %lli, (time %lli, delta %lli)\n", p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type, displaydate, mdate() + 1000000, displaydate - mdate() - 1000000);
+    return displaydate;
 }