summaryrefslogtreecommitdiffstats
path: root/libhb/sync.c
diff options
context:
space:
mode:
authortiter <[email protected]>2006-02-22 19:32:43 +0000
committertiter <[email protected]>2006-02-22 19:32:43 +0000
commit59fdec6de410480ca0b9eb7bb9b7e37a6ddc1384 (patch)
tree1c8a9cff6be5a3ac200dc671c3ab029c69299341 /libhb/sync.c
parentf2d6457b5e4951bf5cc8d4d005e5ef82b5e6eda9 (diff)
Fix for missing subtitles
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@28 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/sync.c')
-rw-r--r--libhb/sync.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index e0530a03a..866f872b5 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -307,10 +307,19 @@ static int SyncVideo( hb_work_object_t * w )
/* Look for a subtitle for this frame */
if( w->subtitle )
{
- /* Trash subtitles older than this picture */
- while( ( sub = hb_fifo_see( w->subtitle->fifo_raw ) ) &&
- sub->stop < cur->start )
+ hb_buffer_t * sub2;
+ while( ( sub = hb_fifo_see( w->subtitle->fifo_raw ) ) )
{
+ /* If two subtitles overlap, make the first one stop
+ when the second one starts */
+ sub2 = hb_fifo_see2( w->subtitle->fifo_raw );
+ if( sub2 && sub->stop > sub2->start )
+ sub->stop = sub2->start;
+
+ if( sub->stop > cur->start )
+ break;
+
+ /* The subtitle is older than this picture, trash it */
sub = hb_fifo_get( w->subtitle->fifo_raw );
hb_buffer_close( &sub );
}