From d0adb5b72b26ae5dfa2d553e0162c3b53c6a905a Mon Sep 17 00:00:00 2001 From: Rodeo Date: Mon, 14 May 2012 15:36:17 +0000 Subject: 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 --- libhb/hb.c | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'libhb/hb.c') 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 ) ); } } } -- cgit v1.2.3