OSDN Git Service

fix a problem with point-to-point (and live preview) when there are subtitles
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 21 Apr 2010 18:37:20 +0000 (18:37 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 21 Apr 2010 18:37:20 +0000 (18:37 +0000)
end of stream markers were not being put in the fifo for subtitles when
the end point was reached, causing a hang.

git-svn-id: svn://localhost/HandBrake/trunk@3248 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/sync.c

index f4be8c6..1f6581e 100644 (file)
@@ -281,7 +281,10 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
                 subtitle = hb_list_item( job->list_subtitle, i );
                 if( subtitle->config.dest == PASSTHRUSUB )
                 {
-                    hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
+                    if( subtitle->source == VOBSUB ) 
+                        hb_fifo_push( subtitle->fifo_sync, hb_buffer_init( 0 ) );
+                    else
+                        hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
                 }
             }
             return HB_WORK_DONE;
@@ -365,7 +368,10 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
                 subtitle = hb_list_item( job->list_subtitle, i );
                 if( subtitle->config.dest == PASSTHRUSUB )
                 {
-                    hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
+                    if( subtitle->source == VOBSUB ) 
+                        hb_fifo_push( subtitle->fifo_sync, hb_buffer_init( 0 ) );
+                    else
+                        hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
                 }
             }
             return HB_WORK_DONE;
@@ -423,6 +429,21 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
         *buf_out = hb_buffer_init( 0 );
         hb_log( "sync: reached %d frames, exiting early",
                 pv->common->count_frames );
+
+        /*
+         * Push through any subtitle EOFs in case they were not synced through.
+         */
+        for( i = 0; i < hb_list_count( job->list_subtitle ); i++)
+        {
+            subtitle = hb_list_item( job->list_subtitle, i );
+            if( subtitle->config.dest == PASSTHRUSUB )
+            {
+                if( subtitle->source == VOBSUB ) 
+                    hb_fifo_push( subtitle->fifo_sync, hb_buffer_init( 0 ) );
+                else
+                    hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
+            }
+        }
         return HB_WORK_DONE;
     }
 
@@ -436,6 +457,21 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
         hb_buffer_close( &sync->cur );
         hb_buffer_close( &next );
         *buf_out = hb_buffer_init( 0 );
+
+        /*
+         * Push through any subtitle EOFs in case they were not synced through.
+         */
+        for( i = 0; i < hb_list_count( job->list_subtitle ); i++)
+        {
+            subtitle = hb_list_item( job->list_subtitle, i );
+            if( subtitle->config.dest == PASSTHRUSUB )
+            {
+                if( subtitle->source == VOBSUB ) 
+                    hb_fifo_push( subtitle->fifo_sync, hb_buffer_init( 0 ) );
+                else
+                    hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
+            }
+        }
         return HB_WORK_DONE;
     }