diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.m | 115 | ||||
-rw-r--r-- | macosx/HBSubtitles.m | 20 |
2 files changed, 55 insertions, 80 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index 53a64b9d6..88a146ae0 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -3185,28 +3185,6 @@ bool one_burned = FALSE; } else { - - /* for the actual source tracks, we must subtract the non source entries so - * that the menu index matches the source subtitle_list index for convenience */ - if (i == 0) - { - /* for the first track, the source tracks start at menu index 2 ( None is 0, - * Foreign Language Search is 1) so subtract 2 */ - subtitle = subtitle - 2; - } - else - { - /* for all other tracks, the source tracks start at menu index 1 (None is 0) - * so subtract 1. */ - - subtitle = subtitle - 1; - } - - /* We are setting a source subtitle so access the source subtitle info */ - hb_subtitle_t * subt; - - subt = (hb_subtitle_t *)hb_list_item(title->list_subtitle, subtitle); - /* if we are getting the subtitles from an external srt file */ if ([[tempObject objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"]) { @@ -3225,35 +3203,48 @@ bool one_burned = FALSE; sub_config.default_track = def; hb_srt_add( job, &sub_config, [[tempObject objectForKey:@"subtitleTrackSrtLanguageIso3"] UTF8String]); + continue; } - if (subt != NULL) + /* for the actual source tracks, we must subtract the non source entries so + * that the menu index matches the source subtitle_list index for convenience */ + if( i == 0 ) + { + /* for the first track, the source tracks start at menu index 2 ( None is 0, + * Foreign Language Search is 1) so subtract 2 */ + subtitle = subtitle - 2; + } + else + { + /* for all other tracks, the source tracks start at menu index 1 (None is 0) + * so subtract 1. */ + subtitle = subtitle - 1; + } + + /* We are setting a source subtitle so access the source subtitle info */ + hb_subtitle_t * subt = (hb_subtitle_t *) hb_list_item( title->list_subtitle, subtitle ); + + if( subt != NULL ) { hb_subtitle_config_t sub_config = subt->config; - if ( !burned && subt->format == PICTURESUB ) + if( !burned && hb_subtitle_can_pass( subt->source, job->mux ) ) { sub_config.dest = PASSTHRUSUB; } - else if ( burned && subt->format == PICTURESUB ) + else if( hb_subtitle_can_burn( subt->source ) ) { // Only allow one subtitle to be burned into the video - if (one_burned) + if( one_burned ) continue; one_burned = TRUE; - } - - /* Besides VOBSUBS we can also burn in SSA text subs */ - if (subt->source == SSASUB && burned) - { sub_config.dest = RENDERSUB; } sub_config.force = force; sub_config.default_track = def; hb_subtitle_add( job, &sub_config, subtitle ); - } - + } } } i++; @@ -3724,28 +3715,6 @@ bool one_burned = FALSE; } else { - - /* for the actual source tracks, we must subtract the non source entries so - * that the menu index matches the source subtitle_list index for convenience */ - if (i == 0) - { - /* for the first track, the source tracks start at menu index 2 ( None is 0, - * Foreign Language Search is 1) so subtract 2 */ - subtitle = subtitle - 2; - } - else - { - /* for all other tracks, the source tracks start at menu index 1 (None is 0) - * so subtract 1. */ - - subtitle = subtitle - 1; - } - - /* We are setting a source subtitle so access the source subtitle info */ - hb_subtitle_t * subt; - - subt = (hb_subtitle_t *)hb_list_item(title->list_subtitle, subtitle); - /* if we are getting the subtitles from an external srt file */ if ([[tempObject objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"]) { @@ -3764,36 +3733,48 @@ bool one_burned = FALSE; sub_config.default_track = def; hb_srt_add( job, &sub_config, [[tempObject objectForKey:@"subtitleTrackSrtLanguageIso3"] UTF8String]); + continue; + } + + /* for the actual source tracks, we must subtract the non source entries so + * that the menu index matches the source subtitle_list index for convenience */ + if( i == 0 ) + { + /* for the first track, the source tracks start at menu index 2 ( None is 0, + * Foreign Language Search is 1) so subtract 2 */ + subtitle = subtitle - 2; + } + else + { + /* for all other tracks, the source tracks start at menu index 1 (None is 0) + * so subtract 1. */ + subtitle = subtitle - 1; } + /* We are setting a source subtitle so access the source subtitle info */ + hb_subtitle_t * subt = (hb_subtitle_t *) hb_list_item( title->list_subtitle, subtitle ); - if (subt != NULL) + if( subt != NULL ) { hb_subtitle_config_t sub_config = subt->config; - if ( !burned && subt->format == PICTURESUB ) + if( !burned && hb_subtitle_can_pass( subt->source, job->mux ) ) { sub_config.dest = PASSTHRUSUB; } - else if ( burned ) + else if( hb_subtitle_can_burn( subt->source ) ) { // Only allow one subtitle to be burned into the video - if (one_burned) + if( one_burned ) continue; one_burned = TRUE; - } - - /* Besides VOBSUBS we can also burn in SSA text subs */ - if (subt->source == SSASUB && burned) - { sub_config.dest = RENDERSUB; } - + sub_config.force = force; sub_config.default_track = def; hb_subtitle_add( job, &sub_config, subtitle ); - } - + } } } i++; diff --git a/macosx/HBSubtitles.m b/macosx/HBSubtitles.m index 1d0c45ae6..f84749303 100644 --- a/macosx/HBSubtitles.m +++ b/macosx/HBSubtitles.m @@ -3,18 +3,10 @@ This file is part of the HandBrake source code. Homepage: <http://handbrake.fr/>. It may be used under the terms of the GNU General Public License. */ -// #import "HBSubtitles.h" #include "hb.h" - - - - - - - @implementation HBSubtitles - (id)init { @@ -285,8 +277,8 @@ subtitle = (hb_subtitle_t *) hb_list_item( fTitle->list_subtitle, i ); sub_config = subtitle->config; - int canBeBurnedIn = subtitle->source == VOBSUB || subtitle->source == SSASUB; - int supportsForcedFlags = subtitle->source == VOBSUB; + int canBeBurnedIn = hb_subtitle_can_burn( subtitle->source ); + int supportsForcedFlags = hb_subtitle_can_force( subtitle->source ); /* create a dictionary of source subtitle information to store in our array */ NSMutableDictionary *newSubtitleSourceTrack = [[NSMutableDictionary alloc] init]; @@ -294,7 +286,7 @@ [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:i] forKey:@"sourceTrackNum"]; /* Human-readable representation of subtitle->source */ NSString *subSourceName = [NSString stringWithUTF8String:hb_subsource_name( subtitle->source )]; - NSString *bitmapOrText = subtitle->source == PICTURESUB ? @"Bitmap" : @"Text"; + NSString *bitmapOrText = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text"; /* Subtitle Source track name */ NSString *popupName = [NSString stringWithFormat:@"%d - %@ - (%@) (%@)",i,[NSString stringWithUTF8String:subtitle->lang],bitmapOrText,subSourceName]; [newSubtitleSourceTrack setObject:popupName forKey:@"sourceTrackName"]; @@ -769,7 +761,9 @@ */ if (container == HB_MUX_MP4 && [anObject intValue] != 0) { - if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:[NSString stringWithUTF8String:hb_subsource_name( VOBSUB )]]) + NSString *subtitleSourceTrackType = [[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"]; + if ([subtitleSourceTrackType isEqualToString:[NSString stringWithUTF8String:hb_subsource_name( VOBSUB )]] || + [subtitleSourceTrackType isEqualToString:[NSString stringWithUTF8String:hb_subsource_name( PGSSUB )]]) { /* lets see if there are currently any burned in subs specified */ NSEnumerator *enumerator = [subtitleArray objectEnumerator]; @@ -783,7 +777,7 @@ } } /* if we have no current vobsub set to burn it in ... burn it in by default */ - if(!subtrackBurnedInFound) + if (!subtrackBurnedInFound) { [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1] forKey:@"subtitleTrackBurned"]; /* Burned In and Default are mutually exclusive */ |