diff mpcommon.c @ 31558:a3a50df246f8

Move the subtitle pts handling code to demuxer.c This also fixes endpts using first->endpts instead of current->endpts and the move should avoid missing such fixes in the future by having all related code in one place.
author reimar
date Fri, 02 Jul 2010 21:14:42 +0000
parents 13ca93203358
children 631f813874f0
line wrap: on
line diff
--- a/mpcommon.c	Fri Jul 02 19:59:02 2010 +0000
+++ b/mpcommon.c	Fri Jul 02 21:14:42 2010 +0000
@@ -136,7 +136,7 @@
                 }
             } else {
                 // DVD sub
-                len = ds_get_packet_sub(d_dvdsub, (unsigned char**)&packet);
+                len = ds_get_packet_sub(d_dvdsub, (unsigned char**)&packet, NULL, NULL);
                 if (len > 0) {
                     // XXX This is wrong, sh_video->pts can be arbitrarily
                     // much behind demuxing position. Unfortunately using
@@ -171,12 +171,11 @@
         }
         if (d_dvdsub->non_interleaved)
             ds_get_next_pts(d_dvdsub);
-        while (d_dvdsub->first) {
-            double subpts = ds_get_next_pts(d_dvdsub);
-            if (subpts > curpts)
+        while (1) {
+            double subpts = curpts;
+            len = ds_get_packet_sub(d_dvdsub, &packet, &subpts, &endpts);
+            if (len < 0)
                 break;
-            endpts = d_dvdsub->first->endpts;
-            len = ds_get_packet_sub(d_dvdsub, &packet);
             if (type == 'm') {
                 if (len < 2) continue;
                 len = FFMIN(len - 2, AV_RB16(packet));