]> granicus.if.org Git - handbrake/commitdiff
Fix another subtitle interleaving botch - for mkv's we want the subtitle in the clust...
authorvan <vanj.hb@gmail.com>
Sat, 9 May 2009 20:49:00 +0000 (20:49 +0000)
committervan <vanj.hb@gmail.com>
Sat, 9 May 2009 20:49:00 +0000 (20:49 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2409 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/muxcommon.c

index 4d64b76f4d60199c3af1a3c93c4ac3f1d9b2cc05..ea01043768e3a168ed02838c0df3dab873eae539 100644 (file)
@@ -141,6 +141,12 @@ static hb_buffer_t *mf_pull( hb_track_t *track )
     return b;
 }
 
+static hb_buffer_t *mf_peek( hb_track_t *track )
+{
+    return track->mf.out == track->mf.in ?
+                NULL : track->mf.fifo[track->mf.out & (track->mf.flen - 1)];
+}
+
 static void MoveToInternalFifos( hb_mux_t *mux )
 {
     int i;
@@ -188,18 +194,12 @@ static void OutputTrackChunk( hb_mux_t *mux, hb_track_t *track, hb_mux_object_t
 {
     hb_buffer_t *buf;
 
-    while ( ( buf = mf_pull( track ) ) != NULL )
+    while ( ( buf = mf_peek( track ) ) != NULL && buf->start < mux->pts )
     {
-        m->mux( m, track->mux_data, buf );
+        m->mux( m, track->mux_data, mf_pull( track ) );
         track->frames += 1;
         track->bytes  += buf->size;
-
-        uint64_t pts = buf->stop;
         hb_buffer_close( &buf );
-        if ( pts >= mux->pts )
-        {
-            break;
-        }
     }
 }