+ }
+
+ 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.
+ */
+
+ /*
+ * There is a valid subtitle, is it time to display it?
+ */
+ if( sub->stop > sub->start)
+ {
+ /*
+ * Normal subtitle which ends after it starts,
+ * check to see that the current video is between
+ * the start and end.
+ */
+ if( cur->start > sub->start &&
+ cur->start < sub->stop )
+ {
+ /*
+ * We should be playing this, so leave the
+ * subtitle in place.
+ *
+ * fall through to display
+ */
+ if( ( sub->stop - sub->start ) < ( 2 * 90000 ) )
+ {
+ /*
+ * Subtitle is on for less than three
+ * seconds, extend the time that it is
+ * displayed to make it easier to read.
+ * Make it 3 seconds or until the next
+ * subtitle is displayed.
+ *
+ * This is in response to Indochine which
+ * only displays subs for 1 second -
+ * too fast to read.
+ */
+ sub->stop = sub->start + ( 2 * 90000 );
+
+ sub2 = hb_fifo_see2( subtitle->fifo_raw );
+
+ if( sub2 && sub->stop > sub2->start )
+ {
+ sub->stop = sub2->start;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Defer until the play point is within
+ * the subtitle
+ */
+ sub = NULL;
+ }
+ }
+ else
+ {
+ /*
+ * The end of the subtitle is less than the start,
+ * this is a sign of a PTS discontinuity.
+ */
+ if( sub->start > cur->start )
+ {
+ /*
+ * we haven't reached the start time yet, or
+ * we have jumped backwards after having
+ * already started this subtitle.
+ */
+ if( cur->start < sub->stop )
+ {
+ /*
+ * We have jumped backwards and so should
+ * continue displaying this subtitle.
+ *
+ * fall through to display.
+ */
+ }
+ else
+ {
+ /*
+ * Defer until the play point is
+ * within the subtitle
+ */
+ sub = NULL;
+ }
+ } else {
+ /*
+ * Play this subtitle as the start is
+ * greater than our video point.
+ *
+ * fall through to display/
+ */
+ }
+ }
+ break;
+ }
+ else
+ {
+
+ /*
+ * The subtitle is older than this picture, trash it
+ */
+ sub = hb_fifo_get( subtitle->fifo_raw );
+ hb_buffer_close( &sub );
+ }