pv->common = calloc( 1, sizeof( hb_sync_common_t ) );
pv->common->ref++;
pv->common->mutex = hb_lock_init();
- pv->common->audio_pts_thresh = 0;
+ pv->common->audio_pts_thresh = -1;
pv->common->next_frame = hb_cond_init();
pv->common->pts_count = 1;
if ( job->frame_to_start || job->pts_to_start )
/* Initialize libsamplerate for every audio track we have */
if ( ! job->indepth_scan )
{
- for( i = 0; i < hb_list_count( title->list_audio ) && i < 8; i++ )
+ for( i = 0; i < hb_list_count( title->list_audio ); i++ )
{
InitAudio( job, pv->common, i );
}
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;
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;
cur->start = sync->next_start;
cur->stop = cur->start + 90000. / ((double)job->vrate / (double)job->vrate_base);
+ /* Make sure last frame is reflected in frame count */
+ pv->common->count_frames++;
+
/* Push the frame to the renderer */
hb_fifo_push( job->fifo_sync, cur );
sync->cur = NULL;
*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;
}
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;
}
*/
if( subtitle->source == CC608SUB ||
subtitle->source == CC708SUB ||
- subtitle->source == SRTSUB )
+ subtitle->source == SRTSUB ||
+ subtitle->source == UTF8SUB ||
+ subtitle->source == TX3GSUB ||
+ subtitle->source == SSASUB)
{
/*
* Rewrite timestamps on subtitles that came from Closed Captions
sub->stop = sub2->start;
}
- // hb_log("0x%x: video seq: %lld subtitle sequence: %lld",
+ // hb_log("0x%x: video seq: %"PRId64" subtitle sequence: %"PRId64,
// sub, cur->sequence, sub->sequence);
if( sub->sequence > cur->sequence )
hb_lock( pv->common->mutex );
while ( !pv->common->start_found )
{
+ if ( pv->common->audio_pts_thresh < 0 )
+ {
+ // I would initialize this in hb_sync_init, but
+ // job->pts_to_start can be modified by reader
+ // after hb_sync_init is called.
+ pv->common->audio_pts_thresh = job->pts_to_start;
+ }
if ( buf->start < pv->common->audio_pts_thresh )
{
hb_buffer_close( &buf );