[MPlayer-dev-eng] [PATCH] vobsub missing subs

ubitux ubitux at gmail.com
Tue Apr 13 18:10:42 CEST 2010


Oups I just put the bad extension, it's a diff of course.

-- 
ubitux
-------------- next part --------------
Index: vobsub.c
===================================================================
--- vobsub.c	(revision 31035)
+++ vobsub.c	(working copy)
@@ -326,6 +326,8 @@
     return rar_tell(mpeg->stream);
 }
 
+static int has_to_be_merged = 0;
+
 static int mpeg_run(mpeg_t *mpeg)
 {
     unsigned int len, idx, version;
@@ -333,6 +335,7 @@
     /* Goto start of a packet, it starts with 0x000001?? */
     const unsigned char wanted[] = { 0, 0, 1 };
     unsigned char buf[5];
+    static int padding_was_here = 1;
 
     mpeg->aid = -1;
     mpeg->packet_size = 0;
@@ -368,10 +371,13 @@
                 return -1;
         } else
             abort();
+        if (!padding_was_here)
+            has_to_be_merged = 1;
         break;
     case 0xbd:                  /* packet */
         if (rar_read(buf, 2, 1, mpeg->stream) != 1)
             return -1;
+        padding_was_here = 0;
         len = buf[0] << 8 | buf[1];
         idx = mpeg_tell(mpeg);
         c = rar_getc(mpeg->stream);
@@ -454,6 +460,7 @@
         len = buf[0] << 8 | buf[1];
         if (len > 0 && rar_seek(mpeg->stream, len, SEEK_CUR))
             return -1;
+        padding_was_here = 1;
         break;
     default:
         if (0xc0 <= buf[3] && buf[3] < 0xf0) {
@@ -1026,6 +1033,11 @@
                                             last_pts_diff = pkt->pts100 - mpg->pts;
                                         else
                                             pkt->pts100 = mpg->pts;
+                                        if (has_to_be_merged) {
+                                            packet_t *last = &queue->packets[queue->current_index - 1];
+                                            pkt->pts100 = last->pts100;
+                                            has_to_be_merged = 0;
+                                        }
                                         /* FIXME: should not use mpg_sub internal informations, make a copy */
                                         pkt->data = mpg->packet;
                                         pkt->size = mpg->packet_size;
Index: spudec.c
===================================================================
--- spudec.c	(revision 31035)
+++ spudec.c	(working copy)
@@ -533,12 +533,6 @@
       mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUasm: packet too short\n");
       return;
   }
-#if 0
-  if ((spu->packet_pts + 10000) < pts100) {
-    // [cb] too long since last fragment: force new packet
-    spu->packet_offset = 0;
-  }
-#endif
   spu->packet_pts = pts100;
   if (spu->packet_offset == 0) {
     unsigned int len2 = get_be16(packet);


More information about the MPlayer-dev-eng mailing list