X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=macosx%2FController.m;h=a744ad21c824aaa117b5153805a125d933466491;hb=92a6427d5319576aa5717018afd09a639dab7e36;hp=7fbd5f28022a1f4fa5e967cc730015ca583ed22a;hpb=7c5de680aa66988f2465b0870312f2976019a634;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/macosx/Controller.m b/macosx/Controller.m index 7fbd5f28..a744ad21 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1858,6 +1858,14 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It } [fSrcDVD2Field setStringValue:browsedSourceDisplayName]; + // use the correct extension based on the container + int format = [fDstFormatPopUp indexOfSelectedItem]; + char *ext = "mp4"; + if (format == 1) + { + ext = "mkv"; + } + /* If its a queue rescan for edit, get the queue item output path */ /* if not, its a new source scan. */ /* Check to see if the last destination has been set,use if so, if not, use Desktop */ @@ -1868,12 +1876,18 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It else if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"]) { [fDstFile2Field setStringValue: [NSString stringWithFormat: - @"%@/%@.mp4", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[browsedSourceDisplayName stringByDeletingPathExtension]]]; + @"%@/%@.%s", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[browsedSourceDisplayName stringByDeletingPathExtension],ext]]; } else { [fDstFile2Field setStringValue: [NSString stringWithFormat: - @"%@/Desktop/%@.mp4", NSHomeDirectory(),[browsedSourceDisplayName stringByDeletingPathExtension]]]; + @"%@/Desktop/%@.%s", NSHomeDirectory(),[browsedSourceDisplayName stringByDeletingPathExtension],ext]]; + } + + // set m4v extension if necessary - do not override user-specified .mp4 extension + if (format == 0 && applyQueueToScan != YES) + { + [self autoSetM4vExtension: sender]; } /* See if this is the main feature according to libhb */ @@ -1883,8 +1897,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It } [fSrcTitlePopUp addItemWithTitle: [NSString - stringWithFormat: @"%s %d - %02dh%02dm%02ds", - title->name,title->index, title->hours, title->minutes, + stringWithFormat: @"%@ %d - %02dh%02dm%02ds", + currentSource, title->index, title->hours, title->minutes, title->seconds]]; } @@ -2091,13 +2105,17 @@ fWorkingCount = 0; /* Set the queue status field in the main window */ NSMutableString * string; - if (fPendingCount == 1) + if (fPendingCount == 0) + { + string = [NSMutableString stringWithFormat: NSLocalizedString( @"No encode pending", @"" )]; + } + else if (fPendingCount == 1) { string = [NSMutableString stringWithFormat: NSLocalizedString( @"%d encode pending", @"" ), fPendingCount]; } else { - string = [NSMutableString stringWithFormat: NSLocalizedString( @"%d encode(s) pending", @"" ), fPendingCount]; + string = [NSMutableString stringWithFormat: NSLocalizedString( @"%d encodes pending", @"" ), fPendingCount]; } [fQueueStatus setStringValue:string]; } @@ -2118,7 +2136,7 @@ fWorkingCount = 0; { nextPendingFound = YES; nextPendingIndex = [QueueFileArray indexOfObject: tempObject]; - [self writeToActivityLog: "getNextPendingQueueIndex next pending encod index is:%d", nextPendingIndex]; + [self writeToActivityLog: "getNextPendingQueueIndex next pending encode index is:%d", nextPendingIndex]; } i++; } @@ -2574,9 +2592,9 @@ fWorkingCount = 0; [self writeToActivityLog: "scanning specifically for title: %d", scanTitleNum]; } - /* We use our advance pref to determine how many previews to scan */ - int hb_num_previews = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PreviewsNumber"] intValue]; - hb_scan( fQueueEncodeLibhb, [path UTF8String], scanTitleNum, hb_num_previews, 0 , 0 ); + /* Only scan 10 previews before an encode - additional previews are only useful for autocrop and static previews, + * which are already taken care of at this point */ + hb_scan( fQueueEncodeLibhb, [path UTF8String], scanTitleNum, 10, 0, 0 ); } } @@ -2683,8 +2701,10 @@ fWorkingCount = 0; fqueueEditRescanItemNum = selectedQueueItem; [self writeToActivityLog: "rescanQueueItemToMainWindow: Re-scanning queue item at index:%d",fqueueEditRescanItemNum]; applyQueueToScan = YES; + /* Make sure we release the display name before reassigning it */ + [browsedSourceDisplayName release]; /* Set the browsedSourceDisplayName for showNewScan */ - browsedSourceDisplayName = [[QueueFileArray objectAtIndex:fqueueEditRescanItemNum] objectForKey:@"SourceName"]; + browsedSourceDisplayName = [[[QueueFileArray objectAtIndex:fqueueEditRescanItemNum] objectForKey:@"SourceName"] retain]; [self performScan:scanPath scanTitleNum:scanTitleNum]; } @@ -3158,8 +3178,10 @@ bool one_burned = FALSE; 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); + strncpy(sub_config.src_filename, [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String], 255); + sub_config.src_filename[255] = 0; + strncpy(sub_config.src_codeset, [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String], 39); + sub_config.src_codeset[39] = 0; sub_config.force = 0; sub_config.dest = PASSTHRUSUB; @@ -3183,6 +3205,13 @@ bool one_burned = FALSE; 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 ); @@ -3672,13 +3701,20 @@ bool one_burned = FALSE; { sub_config.dest = PASSTHRUSUB; } - else if ( burned && subt->format == PICTURESUB ) + else if ( burned ) { // Only allow one subtitle to be burned into the video 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 ); @@ -3993,8 +4029,9 @@ bool one_burned = FALSE; NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent]; [[NSUserDefaults standardUserDefaults] setObject:destinationDirectory forKey:@"LastDestinationDirectory"]; + currentQueueEncodeIndex = [self getNextPendingQueueIndex]; [self performNewQueueScan:[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SourcePath"] scanTitleNum:[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"TitleNumber"]intValue]]; - + } } @@ -4447,15 +4484,7 @@ bool one_burned = FALSE; switch( format ) { case 0: - /*Get Default MP4 File Extension*/ - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0) - { - ext = "m4v"; - } - else - { - ext = "mp4"; - } + [self autoSetM4vExtension: nil]; /* Add additional video encoders here */ menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@"H.264 (x264)" action: NULL keyEquivalent: @""]; [menuItem setTag: HB_VCODEC_X264]; @@ -4533,22 +4562,23 @@ bool one_burned = FALSE; { if ( [fDstFormatPopUp indexOfSelectedItem] ) return; - + NSString * extension = @"mp4"; - - BOOL anyCodecAC3 = [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3]; - if (YES == anyCodecAC3 || - [fCreateChapterMarkers state] == NSOnState || - [[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0 ) + + BOOL anyCodecAC3 = [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3] || [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3_PASS]; + + if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @".m4v"] || + ((YES == anyCodecAC3 || [fCreateChapterMarkers state] == NSOnState) && + [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @"Auto"] )) { extension = @"m4v"; } - + if( [extension isEqualTo: [[fDstFile2Field stringValue] pathExtension]] ) return; else [fDstFile2Field setStringValue: [NSString stringWithFormat:@"%@.%@", - [[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]]; + [[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]]; } /* Method to determine if we should change the UI @@ -4765,6 +4795,12 @@ the user is using "Custom" settings by determining the sender*/ { [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", sliderRfInverse]]; } + /* Show a warning if x264 and rf 0 which is lossless */ + if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_X264 && sliderRfInverse == 0.0) + { + [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f (Warning: Lossless)", sliderRfInverse]]; + } + [self customSettingUsed: sender]; }