From 5a48476a05a18fbd5385aab24134c7d0c6b7b59d Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sat, 13 Jun 2009 17:40:29 +0000 Subject: libhb: fix forced foreign language scan issues - subtitles were not being added to list of subs to scan because the wrong config was being checked for the forced flag. needed to use job->select_subtitle_config instead of subtitle->config - scr code in reader was preventing the majority of subtitle packets from reaching decvobsub. made decvobsub more robust by adding ability to re-sync in the event of lost packets. made scr recovery initialize itself even in the event that it sees audio or subtitles before seeing video. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2526 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/decvobsub.c | 9 +++++++++ libhb/reader.c | 4 +++- libhb/work.c | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libhb/decvobsub.c b/libhb/decvobsub.c index 2a5ccab01..c4474f9aa 100644 --- a/libhb/decvobsub.c +++ b/libhb/decvobsub.c @@ -98,6 +98,15 @@ int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in, pv->pts = in->start; } } + else + { + // bad size, must have lost sync + // force re-sync + if ( pv->buf != NULL ) + hb_buffer_close( &pv->buf ); + pv->size_sub = 0; + } + } *buf_out = NULL; diff --git a/libhb/reader.c b/libhb/reader.c index ad0fe64dd..5dc30afe9 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -408,6 +408,8 @@ static void ReaderFunc( void * _r ) // packet of a stream we've never seen before. We // have no idea what the timing should be so toss // this buffer & wait for a stream we've already seen. + // add stream to list of streams we have seen + id_to_st( r, buf ); hb_buffer_close( &buf ); continue; } @@ -530,7 +532,7 @@ static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id ) subtitle = hb_list_item( title->list_subtitle, i ); if (id == subtitle->id) { subtitle->hits++; - if( !job->indepth_scan || subtitle->config.force ) + if( !job->indepth_scan || job->select_subtitle_config.force ) { /* * Pass the subtitles to be processed if we are not scanning, or if diff --git a/libhb/work.c b/libhb/work.c index b7cf32ae7..7ffb3ab3b 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -572,7 +572,7 @@ static void do_job( hb_job_t * job, int cpu_count ) subtitle->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); subtitle->fifo_out = hb_fifo_init( FIFO_CPU_MULT * cpu_count ); - if( (!job->indepth_scan || subtitle->config.force) && + if( (!job->indepth_scan || job->select_subtitle_config.force) && subtitle->source == VOBSUB ) { /* * Don't add threads for subtitles when we are scanning, unless -- cgit v1.2.3