X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=macosx%2FController.mm;h=f7e79c4844b3489dc014d297558b898b5d538754;hb=83588c143bb574905fc23be31d1ab3b99ba5e791;hp=bb1e77623818f04676de1a77aa3fe2b85a606f27;hpb=c6ee1c86d0be0551e7dde85009f0812813c059ee;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/macosx/Controller.mm b/macosx/Controller.mm index bb1e7762..f7e79c48 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -559,7 +559,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It **********************************************************************/ - (void) UpdateDockIcon: (float) progress { - NSImage * icon; NSData * tiff; NSBitmapImageRep * bmp; uint32_t * pen; @@ -569,17 +568,14 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It int row_start, row_end; int i, j; - /* Get application original icon */ - icon = [NSImage imageNamed: @"NSApplicationIcon"]; - if( progress < 0.0 || progress > 1.0 ) { - [NSApp setApplicationIconImage: icon]; + [NSApp setApplicationIconImage: fApplicationIcon]; return; } /* Get it in a raw bitmap form */ - tiff = [icon TIFFRepresentationUsingCompression: + tiff = [fApplicationIcon TIFFRepresentationUsingCompression: NSTIFFCompressionNone factor: 1.0]; bmp = [NSBitmapImageRep imageRepWithData: tiff]; @@ -628,7 +624,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* Now update the dock icon */ tiff = [bmp TIFFRepresentationUsingCompression: NSTIFFCompressionNone factor: 1.0]; - icon = [[NSImage alloc] initWithData: tiff]; + NSImage* icon = [[NSImage alloc] initWithData: tiff]; [NSApp setApplicationIconImage: icon]; [icon release]; } @@ -723,7 +719,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It if( checkScanCount > currentScanCount ) { currentScanCount = checkScanCount; - [self writeToActivityLog:"currentScanCount received from fQueueEncodeLibhb"]; } //hb_state_t s; @@ -763,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 ) { @@ -1443,7 +1455,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It - (IBAction)showAboutPanel:(id)sender { - //[NSApp orderFrontStandardAboutPanel:sender]; NSMutableDictionary* d = [[NSMutableDictionary alloc] initWithObjectsAndKeys: fApplicationIcon, @"ApplicationIcon", nil ]; @@ -2867,7 +2878,7 @@ bool one_burned = FALSE; /* NOTE: Currently foreign language search is borked for preview. * Commented out but left in for initial commit. */ - /* + [self writeToActivityLog: "Foreign Language Search: %d", 1]; job->indepth_scan = 1; @@ -2877,12 +2888,16 @@ bool one_burned = FALSE; { job->select_subtitle_config.dest = hb_subtitle_config_s::PASSTHRUSUB; } + else + { + job->select_subtitle_config.dest = hb_subtitle_config_s::RENDERSUB; + } job->select_subtitle_config.force = force; job->select_subtitle_config.default_track = def; } - */ + } else @@ -2909,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]; @@ -3425,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]; @@ -5645,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 @@ -6122,7 +6221,16 @@ return YES; } else { - [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) - [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; + /* Since theora's qp value goes up from left to right, we can just set the slider float value */ + if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA) + { + [fVidQualitySlider setFloatValue:[[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; + } + else + { + /* since ffmpeg and x264 use an "inverted" slider (lower qp/rf values indicate a higher quality) we invert the value on the slider */ + [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] + [fVidQualitySlider minValue]) - [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; + } } [self videoMatrixChanged:nil];