diff options
-rw-r--r-- | libhb/common.h | 1 | ||||
-rw-r--r-- | libhb/dvdnav.c | 2 | ||||
-rw-r--r-- | libhb/hb.h | 2 | ||||
-rw-r--r-- | libhb/work.c | 51 |
4 files changed, 25 insertions, 31 deletions
diff --git a/libhb/common.h b/libhb/common.h index e6d056628..ccd065c15 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -248,7 +248,6 @@ struct hb_job_s int indepth_scan; hb_subtitle_config_t select_subtitle_config; - hb_subtitle_t ** select_subtitle; char * native_language; int angle; // dvd angle to encode diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index 2a161d4d0..063498c32 100644 --- a/libhb/dvdnav.c +++ b/libhb/dvdnav.c @@ -842,7 +842,7 @@ static int hb_dvdnav_start( hb_dvd_t * e, hb_title_t *title, int c ) } d->title = t; d->stopped = 0; - d->chapter = c; + d->chapter = 0; return 1; } diff --git a/libhb/hb.h b/libhb/hb.h index 080d9795e..234d4b502 100644 --- a/libhb/hb.h +++ b/libhb/hb.h @@ -79,6 +79,8 @@ typedef struct hb_interjob_s int render_dropped; /* frames droped by telecine */ int vrate; /* initial assigned vrate */ int vrate_base; /* initial assigned vrate_base */ + + hb_subtitle_t *select_subtitle; /* foreign language scan subtitle */ } hb_interjob_t; hb_interjob_t * hb_interjob_get( hb_handle_t * ); diff --git a/libhb/work.c b/libhb/work.c index 7ffb3ab3b..4f2050224 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -382,6 +382,7 @@ static void do_job( hb_job_t * job, int cpu_count ) hb_title_t * title; int i, j; hb_work_object_t * w; + hb_interjob_t * interjob; hb_audio_t * audio; hb_subtitle_t * subtitle; @@ -393,6 +394,7 @@ static void do_job( hb_job_t * job, int cpu_count ) unsigned int subtitle_hit = 0; title = job->title; + interjob = hb_interjob_get( job->h ); if( job->pass == 2 && !job->cfr ) { @@ -505,7 +507,8 @@ static void do_job( hb_job_t * job, int cpu_count ) /* * Look for the scanned subtitle in the existing subtitle list */ - if ( !job->indepth_scan && job->select_subtitle && *(job->select_subtitle) ) + if ( !job->indepth_scan && interjob->select_subtitle && + ( job->pass == 0 || job->pass == 2 ) ) { /* * Disable forced subtitles if we didn't find any in the scan @@ -513,10 +516,10 @@ static void do_job( hb_job_t * job, int cpu_count ) * * select_subtitle implies that we did a scan. */ - if( (*job->select_subtitle)->config.force && - (*job->select_subtitle)->forced_hits == 0 ) + if( interjob->select_subtitle->config.force && + interjob->select_subtitle->forced_hits == 0 ) { - (*job->select_subtitle)->config.force = 0; + interjob->select_subtitle->config.force = 0; } for( i=0; i < hb_list_count(title->list_subtitle); i++ ) { @@ -530,17 +533,16 @@ static void do_job( hb_job_t * job, int cpu_count ) * * select_subtitle implies that we did a scan. */ - if( (*job->select_subtitle)->id == subtitle->id ) + if( interjob->select_subtitle->id == subtitle->id ) { - *subtitle = *(*job->select_subtitle); - free( *job->select_subtitle ); - free( job->select_subtitle ); - job->select_subtitle = NULL; + *subtitle = *(interjob->select_subtitle); + free( interjob->select_subtitle ); + interjob->select_subtitle = NULL; } } } - if( job->select_subtitle ) + if( interjob->select_subtitle ) { /* * Its not in the existing list @@ -549,16 +551,10 @@ static void do_job( hb_job_t * job, int cpu_count ) * add the subtitle that we found on the first pass for use in this * pass. */ - hb_list_add( title->list_subtitle, *job->select_subtitle ); - free( job->select_subtitle ); - job->select_subtitle = NULL; + hb_list_add( title->list_subtitle, interjob->select_subtitle ); + interjob->select_subtitle = NULL; } } - else if ( !job->indepth_scan && job->select_subtitle ) - { - free( job->select_subtitle ); - job->select_subtitle = NULL; - } for( i=0; i < hb_list_count(title->list_subtitle); i++ ) @@ -1045,20 +1041,17 @@ cleanup: } } - if( job->select_subtitle ) + if( job->indepth_scan ) { - if( job->indepth_scan ) + for( i=0; i < hb_list_count( title->list_subtitle ); i++ ) { - for( i=0; i < hb_list_count( title->list_subtitle ); i++ ) + subtitle = hb_list_item( title->list_subtitle, i ); + if( subtitle->id == subtitle_hit ) { - subtitle = hb_list_item( title->list_subtitle, i ); - if( subtitle->id == subtitle_hit ) - { - subtitle->config = job->select_subtitle_config; - hb_list_rem( title->list_subtitle, subtitle ); - *job->select_subtitle = subtitle; - break; - } + subtitle->config = job->select_subtitle_config; + hb_list_rem( title->list_subtitle, subtitle ); + interjob->select_subtitle = subtitle; + break; } } } |