diff options
author | Rodeo <[email protected]> | 2012-05-14 15:36:17 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-05-14 15:36:17 +0000 |
commit | d0adb5b72b26ae5dfa2d553e0162c3b53c6a905a (patch) | |
tree | b6c4f9f12f0ba6389d76536b73a76c8e2bf62e26 /libhb | |
parent | ed6b38f56041302de83b6d94d8002336d58af1d3 (diff) |
libhb: include subtitles in all passes. When doing 2-pass, we want to send the same input to the video encoder in both passes, which requires including subtitles in case one has to be burned-in.
Update Foreign Audio Search to work with the new behavior.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4677 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/hb.c | 39 | ||||
-rw-r--r-- | libhb/work.c | 37 |
2 files changed, 25 insertions, 51 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index d79939d86..a80d8ffd7 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -1531,19 +1531,11 @@ void hb_add( hb_handle_t * h, hb_job_t * job ) } title_copy->video_codec_name = strdup( title->video_codec_name ); - /* - * The following code is confusing, there are two ways in which - * we select subtitles and it depends on whether this is single or - * two pass mode. - * - * subtitle_scan may be enabled, in which case the first pass - * scans all subtitles of that language. The second pass does not - * select any because they are set at the end of the first pass. + /* If we're doing Foreign Audio Search, copy all subtitles matching the first + * audio track language we find in the audio list. * - * We may have manually selected a subtitle, in which case that is - * selected in the first pass of a single pass, or the second of a - * two pass. - */ + * Otherwise, copy all subtitles found in the input job (which can be manually + * selected by the user, or added after the Foreign Audio Search pass). */ memset( audio_lang, 0, sizeof( audio_lang ) ); if( job->indepth_scan ) @@ -1565,30 +1557,23 @@ void hb_add( hb_handle_t * h, hb_job_t * job ) if( strcmp( subtitle->iso639_2, audio_lang ) == 0 && hb_subtitle_can_force( subtitle->source ) ) { - /* Matched subtitle language with audio language, so - * add this to our list to scan. + /* Matched subtitle language with audio language, so add this to + * our list to scan. * - * We will update the subtitle list on the second pass - * later after the first pass has completed. */ + * We will update the subtitle list on the next pass later, after + * the subtitle scan pass has completed. */ hb_list_add( title_copy->list_subtitle, hb_subtitle_copy( subtitle ) ); } } } else { - /* - * Not doing a subtitle scan in this pass, but maybe we are in the - * first pass? - */ - if( job->pass != 1 ) + /* Copy all subtitles from the input job to title_copy/job_copy. */ + for( i = 0; i < hb_list_count( job->list_subtitle ); i++ ) { - /* Copy all subtitles from the input job to title_copy/job_copy. */ - for( i = 0; i < hb_list_count( job->list_subtitle ); i++ ) + if( ( subtitle = hb_list_item( job->list_subtitle, i ) ) ) { - if( ( subtitle = hb_list_item( job->list_subtitle, i ) ) ) - { - hb_list_add( title_copy->list_subtitle, hb_subtitle_copy( subtitle ) ); - } + hb_list_add( title_copy->list_subtitle, hb_subtitle_copy( subtitle ) ); } } } diff --git a/libhb/work.c b/libhb/work.c index 415e250c5..ae836288e 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -545,17 +545,12 @@ static void do_job( hb_job_t * job ) hb_log( "starting job" ); - /* - * Look for the scanned subtitle in the existing subtitle list - * select_subtitle implies that we did a scan. - */ - if ( !job->indepth_scan && interjob->select_subtitle && - ( job->pass == 0 || job->pass == 2 ) ) + /* Look for the scanned subtitle in the existing subtitle list + * select_subtitle implies that we did a scan. */ + if( !job->indepth_scan && interjob->select_subtitle ) { - /* - * Disable forced subtitles if we didn't find any in the scan - * so that we display normal subtitles instead. - */ + /* Disable forced subtitles if we didn't find any in the scan, so that + * we display normal subtitles instead. */ if( interjob->select_subtitle->config.force && interjob->select_subtitle->forced_hits == 0 ) { @@ -565,11 +560,9 @@ static void do_job( hb_job_t * job ) { if( ( subtitle = hb_list_item( title->list_subtitle, i ) ) ) { - /* - * Remove the scanned subtitle from the subtitle list if - * it would result in an identical duplicate subtitle track - * or an emty track (forced and no forced hits). - */ + /* Remove the scanned subtitle from the subtitle list if + * it would result in an identical duplicate subtitle track + * or an emty track (forced and no forced hits). */ if( ( interjob->select_subtitle->id == subtitle->id ) && ( ( subtitle->config.force && interjob->select_subtitle->forced_hits == 0 ) || ( subtitle->config.force == interjob->select_subtitle->config.force ) ) ) @@ -591,17 +584,13 @@ static void do_job( hb_job_t * job ) } } - /* - * Add the subtitle that we found on the first pass for use in this - * pass. + /* Add the subtitle that we found on the subtitle scan pass. * - * Make sure it's the first subtitle in the list so that is is the - * first burned subtitle (explicitly or after sanitizing) - which - * should ensures that it doesn't get dropped. - */ + * Make sure it's the first subtitle in the list so that it becomes the + * first burned subtitle (explicitly or after sanitizing) - which should + * ensure that it doesn't get dropped. */ interjob->select_subtitle->out_track = 1; - hb_list_insert( title->list_subtitle, 0, interjob->select_subtitle ); - interjob->select_subtitle = NULL; + hb_list_insert( title->list_subtitle, 0, hb_subtitle_copy( interjob->select_subtitle ) ); } if ( !job->indepth_scan ) |