X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=macosx%2FController.mm;h=f7e79c4844b3489dc014d297558b898b5d538754;hb=83588c143bb574905fc23be31d1ab3b99ba5e791;hp=faeb0ccb22ae3c7c2787d44b033810f4639ba630;hpb=4aee3bf7fa922e56b806f5939e1ce0f5e0f69ac2;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/macosx/Controller.mm b/macosx/Controller.mm index faeb0ccb..f7e79c48 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -719,7 +719,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It if( checkScanCount > currentScanCount ) { currentScanCount = checkScanCount; - [self writeToActivityLog:"currentScanCount received from fQueueEncodeLibhb"]; } //hb_state_t s; @@ -759,8 +758,25 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It case HB_STATE_WORKING: { NSMutableString * string; + NSString * pass_desc; /* Update text field */ - string = [NSMutableString stringWithFormat: NSLocalizedString( @"Encoding: pass %d of %d, %.2f %%", @"" ), p.job_cur, p.job_count, 100.0 * p.progress]; + if (p.job_cur == 1 && p.job_count > 1) + { + if ([[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SubtitleList"] && [[[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex]objectForKey:@"SubtitleList"] objectAtIndex:0] objectForKey:@"subtitleSourceTrackNum"] intValue] == 1) + { + pass_desc = @"(subtitle scan)"; + } + else + { + pass_desc = @""; + } + } + else + { + pass_desc = @""; + } + + string = [NSMutableString stringWithFormat: NSLocalizedString( @"Encoding: pass %d %@ of %d, %.2f %%", @"" ), p.job_cur, pass_desc, p.job_count, 100.0 * p.progress]; if( p.seconds > -1 ) { @@ -2908,6 +2924,24 @@ bool one_burned = FALSE; 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"]) + { + hb_subtitle_config_t sub_config; + + sub_config.offset = [[tempObject objectForKey:@"subtitleTrackSrtOffset"] intValue]; + + /* we need to srncpy file path and char code */ + strncpy(sub_config.src_filename, [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String], 128); + strncpy(sub_config.src_codeset, [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String], 40); + + sub_config.force = 0; + sub_config.dest = hb_subtitle_config_s::PASSTHRUSUB; + sub_config.default_track = def; + + hb_srt_add( job, &sub_config, [[tempObject objectForKey:@"subtitleTrackSrtLanguageIso3"] UTF8String]); + } + if (subt != NULL) { [self writeToActivityLog: "Setting Subtitle: %s", subt]; @@ -3424,6 +3458,27 @@ bool one_burned = FALSE; 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"]) + { + hb_subtitle_config_t sub_config; + + sub_config.offset = [[tempObject objectForKey:@"subtitleTrackSrtOffset"] intValue]; + + /* we need to srncpy file name and codeset */ + //sub_config.src_filename = [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String]; + strncpy(sub_config.src_filename, [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String], 128); + //sub_config.src_codeset = [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String]; + strncpy(sub_config.src_codeset, [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String], 40); + + sub_config.force = 0; + sub_config.dest = hb_subtitle_config_s::PASSTHRUSUB; + sub_config.default_track = def; + + hb_srt_add( job, &sub_config, [[tempObject objectForKey:@"subtitleTrackSrtLanguageIso3"] UTF8String]); + } + + if (subt != NULL) { [self writeToActivityLog: "Setting Subtitle: %s", subt]; @@ -5644,6 +5699,51 @@ the user is using "Custom" settings by determining the sender*/ //[self customSettingUsed: sender]; } +#pragma mark - + +- (IBAction) browseImportSrtFile: (id) sender +{ + + NSOpenPanel * panel; + + panel = [NSOpenPanel openPanel]; + [panel setAllowsMultipleSelection: NO]; + [panel setCanChooseFiles: YES]; + [panel setCanChooseDirectories: NO ]; + NSString * sourceDirectory; + if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastSrtImportDirectory"]) + { + sourceDirectory = [[NSUserDefaults standardUserDefaults] stringForKey:@"LastSrtImportDirectory"]; + } + else + { + sourceDirectory = @"~/Desktop"; + sourceDirectory = [sourceDirectory stringByExpandingTildeInPath]; + } + /* we open up the browse srt sheet here and call for browseImportSrtFileDone after the sheet is closed */ + NSArray *fileTypes = [NSArray arrayWithObjects:@"plist", @"srt", nil]; + [panel beginSheetForDirectory: sourceDirectory file: nil types: fileTypes + modalForWindow: fWindow modalDelegate: self + didEndSelector: @selector( browseImportSrtFileDone:returnCode:contextInfo: ) + contextInfo: sender]; +} + +- (void) browseImportSrtFileDone: (NSSavePanel *) sheet + returnCode: (int) returnCode contextInfo: (void *) contextInfo +{ + if( returnCode == NSOKButton ) + { + NSString *importSrtDirectory = [[sheet filename] stringByDeletingLastPathComponent]; + NSString *importSrtFilePath = [sheet filename]; + [[NSUserDefaults standardUserDefaults] setObject:importSrtDirectory forKey:@"LastSrtImportDirectory"]; + + /* now pass the string off to fSubtitlesDelegate to add the srt file to the dropdown */ + [fSubtitlesDelegate createSubtitleSrtTrack:importSrtFilePath]; + + [fSubtitlesTable reloadData]; + + } +} #pragma mark - #pragma mark Open New Windows