{
/* we got an end-of-stream. Feed it downstream & signal that we're done. */
hb_fifo_push( job->fifo_sync, 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->dest == PASSTHRUSUB )
+ {
+ hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
+ }
+ }
+
pv->busy &=~ 1;
return;
}
* video (we don't know its duration). On DVDs the final frame
* is often strange and dropping it seems to be a good idea. */
hb_fifo_push( job->fifo_sync, 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->dest == PASSTHRUSUB )
+ {
+ hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
+ }
+ }
pv->busy &=~ 1;
return;
}
/*
* Rewrite timestamps on subtitles that need it (on raw queue).
*/
- if( subtitle->source == CCSUB )
+ if( subtitle->source == CC608SUB ||
+ subtitle->source == CC708SUB )
{
/*
* Rewrite timestamps on subtitles that came from Closed Captions
*
* Bypass the sync fifo altogether.
*/
- if( sub->size == 0 || sub->start < cur->start )
+ if( sub->size <= 0 )
{
sub = hb_fifo_get( subtitle->fifo_raw );
- sub->start = pv->next_start;
hb_fifo_push( subtitle->fifo_out, sub );
- } else {
sub = NULL;
break;
+ } else {
+ /*
+ * Sync the subtitles to the incoming video, and use
+ * the matching converted video timestamp.
+ *
+ * Note that it doesn't appear that we need to convert
+ * timestamps, I guess that they were already correct,
+ * so just push them through for rendering.
+ *
+ */
+ if( sub->start < cur->start )
+ {
+ uint64_t duration;
+ duration = sub->stop - sub->start;
+ sub = hb_fifo_get( subtitle->fifo_raw );
+ hb_fifo_push( subtitle->fifo_out, sub );
+ } else {
+ sub = NULL;
+ break;
+ }
}
}
}