- hb_buffer_t * sub2;
- while( ( sub = hb_fifo_see( pv->subtitle->fifo_raw ) ) )
- {
- /* If two subtitles overlap, make the first one stop
- when the second one starts */
- sub2 = hb_fifo_see2( pv->subtitle->fifo_raw );
- if( sub2 && sub->stop > sub2->start )
- sub->stop = sub2->start;
-
- // hb_log("0x%x: video seq: %lld subtitle sequence: %lld",
- // sub, cur->sequence, sub->sequence);
-
- if( sub->sequence > cur->sequence )
- {
- /*
- * The video is behind where we are, so wait until
- * it catches up to the same reader point on the
- * DVD. Then our PTS should be in the same region
- * as the video.
- */
- sub = NULL;
- break;
- }
-
- if( sub->stop > cur->start ) {
- /*
- * The stop time is in the future, so fall through
- * and we'll deal with it in the next block of
- * code.
- */
- break;
- }
-
- /*
- * The subtitle is older than this picture, trash it
- */
- sub = hb_fifo_get( pv->subtitle->fifo_raw );
- hb_buffer_close( &sub );
- }