diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 7 | ||||
-rw-r--r-- | macosx/Controller.mm | 723 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.xib | 147 | ||||
-rw-r--r-- | macosx/HBPresets.h | 11 | ||||
-rw-r--r-- | macosx/HBPresets.m | 581 |
5 files changed, 836 insertions, 633 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 60f6ce0d0..2c6f0d1cd 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -215,6 +215,7 @@ BOOL fIsDragging; IBOutlet NSTextField * fPresetNewDesc; IBOutlet NSPopUpButton * fPresetNewPicSettingsPopUp; IBOutlet NSButton * fPresetNewPicFiltersCheck; + IBOutlet NSButton * fPresetNewFolderCheck; IBOutlet NSTextField * fPresetSelectedDisplay; NSString * AppSupportDirectory; @@ -224,8 +225,10 @@ BOOL fIsDragging; NSMutableDictionary * chosenPreset; int curUserPresetChosenNum; - int presetHbDefault; // this is 1 in "Default" preset key - int presetUserDefault;// this is 2 in "Default" preset key + NSMutableDictionary *presetHbDefault; // this is 1 in "Default" preset key + NSMutableDictionary *presetUserDefault;// this is 2 in "Default" preset key + NSMutableDictionary *presetUserDefaultParent; + NSMutableDictionary *presetUserDefaultParentParent; int presetCurrentBuiltInCount; // keeps track of the current number of built in presets IBOutlet NSPanel * fAddPresetPanel; /* new NSOutline View for the presets */ diff --git a/macosx/Controller.mm b/macosx/Controller.mm index ac4bd7780..452372fac 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -4714,35 +4714,112 @@ the user is using "Custom" settings by determining the sender*/ #pragma mark Preset Outline View Methods #pragma mark - Required /* These are required by the NSOutlineView Datasource Delegate */ + + +/* used to specify the number of levels to show for each item */ +- (int)outlineView:(NSOutlineView *)fPresetsOutlineView numberOfChildrenOfItem:(id)item +{ + /* currently use no levels to test outline view viability */ + if (item == nil) // for an outline view the root level of the hierarchy is always nil + { + return [UserPresets count]; + } + else + { + /* we need to return the count of the array in ChildrenArray for this folder */ + NSArray *children = nil; + children = [item objectForKey:@"ChildrenArray"]; + if ([children count] > 0) + { + return [children count]; + } + else + { + return 0; + } + } +} + /* We use this to deterimine children of an item */ -- (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(NSInteger)index ofItem:(id)item +- (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(int)index ofItem:(id)item { -if (item == nil) - return [UserPresets objectAtIndex:index]; + + /* we need to return the count of the array in ChildrenArray for this folder */ + NSArray *children = nil; + if (item == nil) + { + children = UserPresets; + } + else + { + if ([item objectForKey:@"ChildrenArray"]) + { + children = [item objectForKey:@"ChildrenArray"]; + } + } + if ((children == nil) || ([children count] <= index)) + { + return nil; + } + else + { + return [children objectAtIndex:index]; + } + // We are only one level deep, so we can't be asked about children - NSAssert (NO, @"Presets View outlineView:child:ofItem: currently can't handle nested items."); - return nil; + //NSAssert (NO, @"Presets View outlineView:child:ofItem: currently can't handle nested items."); + //return nil; } + /* We use this to determine if an item should be expandable */ - (BOOL)outlineView:(NSOutlineView *)fPresetsOutlineView isItemExpandable:(id)item { - - /* For now, we maintain one level, so set to no - * when nested, we set to yes for any preset "folders" - */ - return NO; - -} -/* used to specify the number of levels to show for each item */ -- (int)outlineView:(NSOutlineView *)fPresetsOutlineView numberOfChildrenOfItem:(id)item -{ - /* currently use no levels to test outline view viability */ + + /* we need to return the count of the array in ChildrenArray for this folder */ + NSArray *children= nil; if (item == nil) - return [UserPresets count]; + { + children = UserPresets; + } + else + { + if ([item objectForKey:@"ChildrenArray"]) + { + children = [item objectForKey:@"ChildrenArray"]; + } + } + + /* To deterimine if an item should show a disclosure triangle + * we could do it by the children count as so: + * if ([children count] < 1) + * However, lets leave the triangle show even if there are no + * children to help indicate a folder, just like folder in the + * finder can show a disclosure triangle even when empty + */ + + /* We need to determine if the item is a folder */ + if ([[item objectForKey:@"Folder"] intValue] == 1) + { + return YES; + } else - return 0; + { + return NO; + } + } + +- (BOOL)outlineView:(NSOutlineView *)outlineView shouldExpandItem:(id)item +{ + // Our outline view has no levels, but we can still expand every item. Doing so + // just makes the row taller. See heightOfRowByItem below. +//return ![(HBQueueOutlineView*)outlineView isDragging]; + +return YES; +} + + /* Used to tell the outline view which information is to be displayed per item */ - (id)outlineView:(NSOutlineView *)fPresetsOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { @@ -4754,7 +4831,8 @@ if (item == nil) } else { - return @"something"; + //return @""; + return nil; } } @@ -4764,7 +4842,6 @@ if (item == nil) { if ([[tableColumn identifier] isEqualToString:@"PresetName"]) { - NSDictionary *userPresetDict = item; NSFont *txtFont; NSColor *fontColor; NSColor *shadowColor; @@ -4778,7 +4855,7 @@ if (item == nil) } else { - if ([[userPresetDict objectForKey:@"Type"] intValue] == 0) + if ([[item objectForKey:@"Type"] intValue] == 0) { fontColor = [NSColor blueColor]; } @@ -4786,15 +4863,21 @@ if (item == nil) { fontColor = [NSColor blackColor]; } - shadowColor = nil; + /* check to see if its a folder */ + //if ([[item objectForKey:@"Folder"] intValue] == 1) + //{ + //fontColor = [NSColor greenColor]; + //} + + } /* We use Bold Text for the HB Default */ - if ([[userPresetDict objectForKey:@"Default"] intValue] == 1)// 1 is HB default + if ([[item objectForKey:@"Default"] intValue] == 1)// 1 is HB default { txtFont = [NSFont boldSystemFontOfSize: [NSFont smallSystemFontSize]]; } /* We use Bold Text for the User Specified Default */ - if ([[userPresetDict objectForKey:@"Default"] intValue] == 2)// 2 is User default + if ([[item objectForKey:@"Default"] intValue] == 2)// 2 is User default { txtFont = [NSFont boldSystemFontOfSize: [NSFont smallSystemFontSize]]; } @@ -4851,7 +4934,8 @@ if (item == nil) - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard { // Dragging is only allowed for custom presets. - if ([[[UserPresets objectAtIndex:[fPresetsOutlineView selectedRow]] objectForKey:@"Type"] intValue] == 0) // 0 is built in preset + //[[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Default"] intValue] != 1 + if ([[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Type"] intValue] == 0) // 0 is built in preset { return NO; } @@ -4869,16 +4953,15 @@ if (item == nil) - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index { + // Don't allow dropping ONTO an item since they can't really contain any children. BOOL isOnDropTypeProposal = index == NSOutlineViewDropOnItemIndex; if (isOnDropTypeProposal) return NSDragOperationNone; - - // Don't allow dropping INTO an item since they can't really contain any children as of yet. - - if (item != nil) + // Don't allow dropping INTO an item since they can't really contain any children as of yet. + if (item != nil) { index = [fPresetsOutlineView rowForItem: item] + 1; item = nil; @@ -4889,7 +4972,7 @@ if (item == nil) { return NSDragOperationNone; index = MAX (index, presetCurrentBuiltInCount); - } + } [outlineView setDropItem:item dropChildIndex:index]; return NSDragOperationGeneric; @@ -4899,16 +4982,27 @@ if (item == nil) - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index { - NSMutableIndexSet *moveItems = [NSMutableIndexSet indexSet]; - - id obj; - NSEnumerator *enumerator = [fDraggedNodes objectEnumerator]; - while (obj = [enumerator nextObject]) - { - [moveItems addIndex:[UserPresets indexOfObject:obj]]; + /* first, lets see if we are dropping into a folder */ + if ([[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] && [[[fPresetsOutlineView itemAtRow:index] objectForKey:@"Folder"] intValue] == 1) // if its a folder + { + NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; + childrenArray = [[fPresetsOutlineView itemAtRow:index] objectForKey:@"ChildrenArray"]; + [childrenArray addObject:item]; + [[fPresetsOutlineView itemAtRow:index] setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + [childrenArray autorelease]; + } + else // We are not, so we just move the preset into the existing array + { + NSMutableIndexSet *moveItems = [NSMutableIndexSet indexSet]; + id obj; + NSEnumerator *enumerator = [fDraggedNodes objectEnumerator]; + while (obj = [enumerator nextObject]) + { + [moveItems addIndex:[UserPresets indexOfObject:obj]]; + } + // Successful drop, lets rearrange the view and save it all + [self moveObjectsInPresetsArray:UserPresets fromIndexes:moveItems toIndex: index]; } - // Successful drop, lets rearrange the view and save it all - [self moveObjectsInPresetsArray:UserPresets fromIndexes:moveItems toIndex: index]; [fPresetsOutlineView reloadData]; [self savePreset]; return YES; @@ -4949,12 +5043,12 @@ if (item == nil) - (IBAction)selectPreset:(id)sender { - - if ([fPresetsOutlineView selectedRow] >= 0) + + if ([fPresetsOutlineView selectedRow] >= 0 && [[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] != 1) { chosenPreset = [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]; - /* we set the preset display field in main window here */ [fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]]; + if ([[chosenPreset objectForKey:@"Default"] intValue] == 1) { [fPresetSelectedDisplay setStringValue:[NSString stringWithFormat:@"%@ (Default)", [chosenPreset objectForKey:@"PresetName"]]]; @@ -4963,17 +5057,18 @@ if (item == nil) { [fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]]; } + /* File Format */ [fDstFormatPopUp selectItemWithTitle:[chosenPreset objectForKey:@"FileFormat"]]; [self formatPopUpChanged:nil]; - + /* Chapter Markers*/ [fCreateChapterMarkers setState:[[chosenPreset objectForKey:@"ChapterMarkers"] intValue]]; /* Allow Mpeg4 64 bit formatting +4GB file sizes */ [fDstMp4LargeFileCheck setState:[[chosenPreset objectForKey:@"Mp4LargeFile"] intValue]]; /* Mux mp4 with http optimization */ [fDstMp4HttpOptFileCheck setState:[[chosenPreset objectForKey:@"Mp4HttpOptimize"] intValue]]; - + /* Video encoder */ /* We set the advanced opt string here if applicable*/ [fAdvancedOptions setOptions:[chosenPreset objectForKey:@"x264Option"]]; @@ -5008,22 +5103,22 @@ if (item == nil) { [fVidEncoderPopUp selectItemWithTitle:[chosenPreset objectForKey:@"VideoEncoder"]]; } - + /* Lets run through the following functions to get variables set there */ [self videoEncoderPopUpChanged:nil]; /* Set the state of ipod compatible with Mp4iPodCompatible. Only for x264*/ [fDstMp4iPodFileCheck setState:[[chosenPreset objectForKey:@"Mp4iPodCompatible"] intValue]]; [self calculateBitrate:nil]; - + /* Video quality */ [fVidQualityMatrix selectCellAtRow:[[chosenPreset objectForKey:@"VideoQualityType"] intValue] column:0]; - + [fVidTargetSizeField setStringValue:[chosenPreset objectForKey:@"VideoTargetSize"]]; [fVidBitrateField setStringValue:[chosenPreset objectForKey:@"VideoAvgBitrate"]]; [fVidQualitySlider setFloatValue:[[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]]; - + [self videoMatrixChanged:nil]; - + /* Video framerate */ /* For video preset video framerate, we want to make sure that Same as source does not conflict with the detected framerate in the fVidRatePopUp so we use index 0*/ @@ -5035,16 +5130,16 @@ if (item == nil) { [fVidRatePopUp selectItemWithTitle:[chosenPreset objectForKey:@"VideoFramerate"]]; } - + /* GrayScale */ [fVidGrayscaleCheck setState:[[chosenPreset objectForKey:@"VideoGrayScale"] intValue]]; - + /* 2 Pass Encoding */ [fVidTwoPassCheck setState:[[chosenPreset objectForKey:@"VideoTwoPass"] intValue]]; [self twoPassCheckboxChanged:nil]; /* Turbo 1st pass for 2 Pass Encoding */ [fVidTurboPassCheck setState:[[chosenPreset objectForKey:@"VideoTurboTwoPass"] intValue]]; - + /*Audio*/ if ([chosenPreset objectForKey:@"FileCodecs"]) { @@ -5163,7 +5258,7 @@ if (item == nil) } } /* We detect here if we have the old audio sample rate and if so we apply samplerate and bitrate to the existing four tracks if chosen - * UNLESS the CodecPopUp is AC3 in which case the preset values are ignored in favor of rates set in audioTrackMixdownChanged*/ + * UNLESS the CodecPopUp is AC3 in which case the preset values are ignored in favor of rates set in audioTrackMixdownChanged*/ if ([chosenPreset objectForKey:@"AudioSampleRate"]) { if ([fAudLang1PopUp indexOfSelectedItem] > 0 && [fAudTrack1CodecPopUp titleOfSelectedItem] != @"AC3 Passthru") @@ -5314,10 +5409,10 @@ if (item == nil) [fAudTrack4DrcSlider setFloatValue:[[chosenPreset objectForKey:@"Audio4TrackDRCSlider"] floatValue]]; [self audioDRCSliderChanged: fAudTrack4DrcSlider]; } - - + + } - + /* We now cleanup any extra audio tracks that may be previously set if we need to, we do it here so we don't have to * duplicate any code for legacy presets.*/ /* First we handle the legacy Codecs crazy AVC/H.264 Video / AAC + AC3 Audio atv hybrid */ @@ -5346,12 +5441,12 @@ if (item == nil) [self audioTrackPopUpChanged: fAudLang4PopUp]; } } - + /*Subtitles*/ [fSubPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Subtitles"]]; /* Forced Subtitles */ [fSubForcedCheck setState:[[chosenPreset objectForKey:@"SubtitlesForced"] intValue]]; - + /* Picture Settings */ /* Note: objectForKey:@"UsesPictureSettings" now refers to picture size, this encompasses: * height, width, keep ar, anamorphic and crop settings. @@ -5489,21 +5584,21 @@ if (item == nil) /* Deblock */ if ([[chosenPreset objectForKey:@"PictureDeblock"] intValue] == 1) { - /* since we used to use 1 to turn on deblock, we now use a 5 in our sliding scale */ - [fPictureController setDeblock:5]; + /* since we used to use 1 to turn on deblock, we now use a 5 in our sliding scale */ + [fPictureController setDeblock:5]; } else { [fPictureController setDeblock:0]; - + } - - [self calculatePictureSizing:nil]; + + [self calculatePictureSizing:nil]; } - + } - - + + } /* If the preset has an objectForKey:@"UsesPictureFilters", then we know it is a newer style filters preset * and handle the filters here depending on whether or not the preset specifies applying the filter. @@ -5614,6 +5709,8 @@ if (item == nil) [fPresetNewPicSettingsPopUp selectItemAtIndex: 0]; /* Uncheck the preset use filters checkbox */ [fPresetNewPicFiltersCheck setState:NSOffState]; + // fPresetNewFolderCheck + [fPresetNewFolderCheck setState:NSOffState]; /* Erase info from the input fields*/ [fPresetNewName setStringValue: @""]; [fPresetNewDesc setStringValue: @""]; @@ -5685,130 +5782,141 @@ if (item == nil) NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ [preset setObject:[fPresetNewName stringValue] forKey:@"PresetName"]; + /* Set whether or not this is to be a folder fPresetNewFolderCheck*/ + [preset setObject:[NSNumber numberWithBool:[fPresetNewFolderCheck state]] forKey:@"Folder"]; /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:1] forKey:@"Type"]; /*Set whether or not this is default, at creation set to 0*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - /*Get the whether or not to apply pic Size and Cropping (includes Anamorphic)*/ - [preset setObject:[NSNumber numberWithInt:[fPresetNewPicSettingsPopUp indexOfSelectedItem]] forKey:@"UsesPictureSettings"]; - /* Get whether or not to use the current Picture Filter settings for the preset */ - [preset setObject:[NSNumber numberWithInt:[fPresetNewPicFiltersCheck state]] forKey:@"UsesPictureFilters"]; - - /* Get New Preset Description from the field in the AddPresetPanel*/ - [preset setObject:[fPresetNewDesc stringValue] forKey:@"PresetDescription"]; - /* File Format */ - [preset setObject:[fDstFormatPopUp titleOfSelectedItem] forKey:@"FileFormat"]; - /* Chapter Markers fCreateChapterMarkers*/ - [preset setObject:[NSNumber numberWithInt:[fCreateChapterMarkers state]] forKey:@"ChapterMarkers"]; - /* Allow Mpeg4 64 bit formatting +4GB file sizes */ - [preset setObject:[NSNumber numberWithInt:[fDstMp4LargeFileCheck state]] forKey:@"Mp4LargeFile"]; - /* Mux mp4 with http optimization */ - [preset setObject:[NSNumber numberWithInt:[fDstMp4HttpOptFileCheck state]] forKey:@"Mp4HttpOptimize"]; - /* Add iPod uuid atom */ - [preset setObject:[NSNumber numberWithInt:[fDstMp4iPodFileCheck state]] forKey:@"Mp4iPodCompatible"]; - - /* Codecs */ - /* Video encoder */ - [preset setObject:[fVidEncoderPopUp titleOfSelectedItem] forKey:@"VideoEncoder"]; - /* x264 Option String */ - [preset setObject:[fAdvancedOptions optionsString] forKey:@"x264Option"]; - - [preset setObject:[NSNumber numberWithInt:[fVidQualityMatrix selectedRow]] forKey:@"VideoQualityType"]; - [preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"]; - [preset setObject:[fVidBitrateField stringValue] forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - if ([fVidRatePopUp indexOfSelectedItem] == 0) // Same as source is selected - { - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - } - else // we can record the actual titleOfSelectedItem + if ([fPresetNewFolderCheck state] == YES) { - [preset setObject:[fVidRatePopUp titleOfSelectedItem] forKey:@"VideoFramerate"]; + /* initialize and set an empty array for children here since we are a new folder */ + NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; + [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + [childrenArray autorelease]; } - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:[fVidGrayscaleCheck state]] forKey:@"VideoGrayScale"]; - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"]; - /* Turbo 2 pass Encoding fVidTurboPassCheck*/ - [preset setObject:[NSNumber numberWithInt:[fVidTurboPassCheck state]] forKey:@"VideoTurboTwoPass"]; - /*Picture Settings*/ - hb_job_t * job = fTitle->job; - /* Picture Sizing */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"]; - - /* Set crop settings here */ - [preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[0]] forKey:@"PictureTopCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[2]] forKey:@"PictureLeftCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"]; - - /* Picture Filters */ - [preset setObject:[NSNumber numberWithInt:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"]; - [preset setObject:[NSNumber numberWithInt:[fPictureController detelecine]] forKey:@"PictureDetelecine"]; - //[preset setObject:[NSNumber numberWithInt:[fPictureController vfr]] forKey:@"VFR"]; - [preset setObject:[NSNumber numberWithInt:[fPictureController denoise]] forKey:@"PictureDenoise"]; - [preset setObject:[NSNumber numberWithInt:[fPictureController deblock]] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:[fPictureController decomb]] forKey:@"PictureDecomb"]; - - - /*Audio*/ - if ([fAudLang1PopUp indexOfSelectedItem] > 0) + else // we are not creating a preset folder, so we go ahead with the rest of the preset info { - [preset setObject:[NSNumber numberWithInt:[fAudLang1PopUp indexOfSelectedItem]] forKey:@"Audio1Track"]; - [preset setObject:[fAudLang1PopUp titleOfSelectedItem] forKey:@"Audio1TrackDescription"]; - [preset setObject:[fAudTrack1CodecPopUp titleOfSelectedItem] forKey:@"Audio1Encoder"]; - [preset setObject:[fAudTrack1MixPopUp titleOfSelectedItem] forKey:@"Audio1Mixdown"]; - [preset setObject:[fAudTrack1RatePopUp titleOfSelectedItem] forKey:@"Audio1Samplerate"]; - [preset setObject:[fAudTrack1BitratePopUp titleOfSelectedItem] forKey:@"Audio1Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:[fAudTrack1DrcSlider floatValue]] forKey:@"Audio1TrackDRCSlider"]; - } - if ([fAudLang2PopUp indexOfSelectedItem] > 0) - { - [preset setObject:[NSNumber numberWithInt:[fAudLang2PopUp indexOfSelectedItem]] forKey:@"Audio2Track"]; - [preset setObject:[fAudLang2PopUp titleOfSelectedItem] forKey:@"Audio2TrackDescription"]; - [preset setObject:[fAudTrack2CodecPopUp titleOfSelectedItem] forKey:@"Audio2Encoder"]; - [preset setObject:[fAudTrack2MixPopUp titleOfSelectedItem] forKey:@"Audio2Mixdown"]; - [preset setObject:[fAudTrack2RatePopUp titleOfSelectedItem] forKey:@"Audio2Samplerate"]; - [preset setObject:[fAudTrack2BitratePopUp titleOfSelectedItem] forKey:@"Audio2Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:[fAudTrack2DrcSlider floatValue]] forKey:@"Audio2TrackDRCSlider"]; - } - if ([fAudLang3PopUp indexOfSelectedItem] > 0) - { - [preset setObject:[NSNumber numberWithInt:[fAudLang3PopUp indexOfSelectedItem]] forKey:@"Audio3Track"]; - [preset setObject:[fAudLang3PopUp titleOfSelectedItem] forKey:@"Audio3TrackDescription"]; - [preset setObject:[fAudTrack3CodecPopUp titleOfSelectedItem] forKey:@"Audio3Encoder"]; - [preset setObject:[fAudTrack3MixPopUp titleOfSelectedItem] forKey:@"Audio3Mixdown"]; - [preset setObject:[fAudTrack3RatePopUp titleOfSelectedItem] forKey:@"Audio3Samplerate"]; - [preset setObject:[fAudTrack3BitratePopUp titleOfSelectedItem] forKey:@"Audio3Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:[fAudTrack3DrcSlider floatValue]] forKey:@"Audio3TrackDRCSlider"]; - } - if ([fAudLang4PopUp indexOfSelectedItem] > 0) - { - [preset setObject:[NSNumber numberWithInt:[fAudLang4PopUp indexOfSelectedItem]] forKey:@"Audio4Track"]; - [preset setObject:[fAudLang4PopUp titleOfSelectedItem] forKey:@"Audio4TrackDescription"]; - [preset setObject:[fAudTrack4CodecPopUp titleOfSelectedItem] forKey:@"Audio4Encoder"]; - [preset setObject:[fAudTrack4MixPopUp titleOfSelectedItem] forKey:@"Audio4Mixdown"]; - [preset setObject:[fAudTrack4RatePopUp titleOfSelectedItem] forKey:@"Audio4Samplerate"]; - [preset setObject:[fAudTrack4BitratePopUp titleOfSelectedItem] forKey:@"Audio4Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:[fAudTrack4DrcSlider floatValue]] forKey:@"Audio4TrackDRCSlider"]; + /*Get the whether or not to apply pic Size and Cropping (includes Anamorphic)*/ + [preset setObject:[NSNumber numberWithInt:[fPresetNewPicSettingsPopUp indexOfSelectedItem]] forKey:@"UsesPictureSettings"]; + /* Get whether or not to use the current Picture Filter settings for the preset */ + [preset setObject:[NSNumber numberWithInt:[fPresetNewPicFiltersCheck state]] forKey:@"UsesPictureFilters"]; + + /* Get New Preset Description from the field in the AddPresetPanel*/ + [preset setObject:[fPresetNewDesc stringValue] forKey:@"PresetDescription"]; + /* File Format */ + [preset setObject:[fDstFormatPopUp titleOfSelectedItem] forKey:@"FileFormat"]; + /* Chapter Markers fCreateChapterMarkers*/ + [preset setObject:[NSNumber numberWithInt:[fCreateChapterMarkers state]] forKey:@"ChapterMarkers"]; + /* Allow Mpeg4 64 bit formatting +4GB file sizes */ + [preset setObject:[NSNumber numberWithInt:[fDstMp4LargeFileCheck state]] forKey:@"Mp4LargeFile"]; + /* Mux mp4 with http optimization */ + [preset setObject:[NSNumber numberWithInt:[fDstMp4HttpOptFileCheck state]] forKey:@"Mp4HttpOptimize"]; + /* Add iPod uuid atom */ + [preset setObject:[NSNumber numberWithInt:[fDstMp4iPodFileCheck state]] forKey:@"Mp4iPodCompatible"]; + + /* Codecs */ + /* Video encoder */ + [preset setObject:[fVidEncoderPopUp titleOfSelectedItem] forKey:@"VideoEncoder"]; + /* x264 Option String */ + [preset setObject:[fAdvancedOptions optionsString] forKey:@"x264Option"]; + + [preset setObject:[NSNumber numberWithInt:[fVidQualityMatrix selectedRow]] forKey:@"VideoQualityType"]; + [preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"]; + [preset setObject:[fVidBitrateField stringValue] forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithFloat:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"]; + + /* Video framerate */ + if ([fVidRatePopUp indexOfSelectedItem] == 0) // Same as source is selected + { + [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; + } + else // we can record the actual titleOfSelectedItem + { + [preset setObject:[fVidRatePopUp titleOfSelectedItem] forKey:@"VideoFramerate"]; + } + /* GrayScale */ + [preset setObject:[NSNumber numberWithInt:[fVidGrayscaleCheck state]] forKey:@"VideoGrayScale"]; + /* 2 Pass Encoding */ + [preset setObject:[NSNumber numberWithInt:[fVidTwoPassCheck state]] forKey:@"VideoTwoPass"]; + /* Turbo 2 pass Encoding fVidTurboPassCheck*/ + [preset setObject:[NSNumber numberWithInt:[fVidTurboPassCheck state]] forKey:@"VideoTurboTwoPass"]; + /*Picture Settings*/ + hb_job_t * job = fTitle->job; + /* Picture Sizing */ + /* Use Max Picture settings for whatever the dvd is.*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"]; + [preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"]; + + /* Set crop settings here */ + [preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:job->crop[0]] forKey:@"PictureTopCrop"]; + [preset setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"]; + [preset setObject:[NSNumber numberWithInt:job->crop[2]] forKey:@"PictureLeftCrop"]; + [preset setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"]; + + /* Picture Filters */ + [preset setObject:[NSNumber numberWithInt:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController detelecine]] forKey:@"PictureDetelecine"]; + //[preset setObject:[NSNumber numberWithInt:[fPictureController vfr]] forKey:@"VFR"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController denoise]] forKey:@"PictureDenoise"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController deblock]] forKey:@"PictureDeblock"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController decomb]] forKey:@"PictureDecomb"]; + + + /*Audio*/ + if ([fAudLang1PopUp indexOfSelectedItem] > 0) + { + [preset setObject:[NSNumber numberWithInt:[fAudLang1PopUp indexOfSelectedItem]] forKey:@"Audio1Track"]; + [preset setObject:[fAudLang1PopUp titleOfSelectedItem] forKey:@"Audio1TrackDescription"]; + [preset setObject:[fAudTrack1CodecPopUp titleOfSelectedItem] forKey:@"Audio1Encoder"]; + [preset setObject:[fAudTrack1MixPopUp titleOfSelectedItem] forKey:@"Audio1Mixdown"]; + [preset setObject:[fAudTrack1RatePopUp titleOfSelectedItem] forKey:@"Audio1Samplerate"]; + [preset setObject:[fAudTrack1BitratePopUp titleOfSelectedItem] forKey:@"Audio1Bitrate"]; + [preset setObject:[NSNumber numberWithFloat:[fAudTrack1DrcSlider floatValue]] forKey:@"Audio1TrackDRCSlider"]; + } + if ([fAudLang2PopUp indexOfSelectedItem] > 0) + { + [preset setObject:[NSNumber numberWithInt:[fAudLang2PopUp indexOfSelectedItem]] forKey:@"Audio2Track"]; + [preset setObject:[fAudLang2PopUp titleOfSelectedItem] forKey:@"Audio2TrackDescription"]; + [preset setObject:[fAudTrack2CodecPopUp titleOfSelectedItem] forKey:@"Audio2Encoder"]; + [preset setObject:[fAudTrack2MixPopUp titleOfSelectedItem] forKey:@"Audio2Mixdown"]; + [preset setObject:[fAudTrack2RatePopUp titleOfSelectedItem] forKey:@"Audio2Samplerate"]; + [preset setObject:[fAudTrack2BitratePopUp titleOfSelectedItem] forKey:@"Audio2Bitrate"]; + [preset setObject:[NSNumber numberWithFloat:[fAudTrack2DrcSlider floatValue]] forKey:@"Audio2TrackDRCSlider"]; + } + if ([fAudLang3PopUp indexOfSelectedItem] > 0) + { + [preset setObject:[NSNumber numberWithInt:[fAudLang3PopUp indexOfSelectedItem]] forKey:@"Audio3Track"]; + [preset setObject:[fAudLang3PopUp titleOfSelectedItem] forKey:@"Audio3TrackDescription"]; + [preset setObject:[fAudTrack3CodecPopUp titleOfSelectedItem] forKey:@"Audio3Encoder"]; + [preset setObject:[fAudTrack3MixPopUp titleOfSelectedItem] forKey:@"Audio3Mixdown"]; + [preset setObject:[fAudTrack3RatePopUp titleOfSelectedItem] forKey:@"Audio3Samplerate"]; + [preset setObject:[fAudTrack3BitratePopUp titleOfSelectedItem] forKey:@"Audio3Bitrate"]; + [preset setObject:[NSNumber numberWithFloat:[fAudTrack3DrcSlider floatValue]] forKey:@"Audio3TrackDRCSlider"]; + } + if ([fAudLang4PopUp indexOfSelectedItem] > 0) + { + [preset setObject:[NSNumber numberWithInt:[fAudLang4PopUp indexOfSelectedItem]] forKey:@"Audio4Track"]; + [preset setObject:[fAudLang4PopUp titleOfSelectedItem] forKey:@"Audio4TrackDescription"]; + [preset setObject:[fAudTrack4CodecPopUp titleOfSelectedItem] forKey:@"Audio4Encoder"]; + [preset setObject:[fAudTrack4MixPopUp titleOfSelectedItem] forKey:@"Audio4Mixdown"]; + [preset setObject:[fAudTrack4RatePopUp titleOfSelectedItem] forKey:@"Audio4Samplerate"]; + [preset setObject:[fAudTrack4BitratePopUp titleOfSelectedItem] forKey:@"Audio4Bitrate"]; + [preset setObject:[NSNumber numberWithFloat:[fAudTrack4DrcSlider floatValue]] forKey:@"Audio4TrackDRCSlider"]; + } + + /* Subtitles*/ + [preset setObject:[fSubPopUp titleOfSelectedItem] forKey:@"Subtitles"]; + /* Forced Subtitles */ + [preset setObject:[NSNumber numberWithInt:[fSubForcedCheck state]] forKey:@"SubtitlesForced"]; } - - /* Subtitles*/ - [preset setObject:[fSubPopUp titleOfSelectedItem] forKey:@"Subtitles"]; - /* Forced Subtitles */ - [preset setObject:[NSNumber numberWithInt:[fSubForcedCheck state]] forKey:@"SubtitlesForced"]; - [preset autorelease]; return preset; - + } - (void)savePreset @@ -5821,30 +5929,49 @@ if (item == nil) - (IBAction)deletePreset:(id)sender { - int status; - NSEnumerator *enumerator; - NSNumber *index; - NSMutableArray *tempArray; - id tempObject; + if ( [fPresetsOutlineView numberOfSelectedRows] == 0 ) + { return; + } /* Alert user before deleting preset */ - /* Comment out for now, tie to user pref eventually */ - - //NSBeep(); + int status; status = NSRunAlertPanel(@"Warning!", @"Are you sure that you want to delete the selected preset?", @"OK", @"Cancel", nil); - if ( status == NSAlertDefaultReturn ) { - enumerator = [fPresetsOutlineView selectedRowEnumerator]; + if ( status == NSAlertDefaultReturn ) + { + int presetToModLevel = [fPresetsOutlineView levelForItem: [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]]; + NSDictionary *presetToMod = [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]; + NSDictionary *presetToModParent = [fPresetsOutlineView parentForItem: presetToMod]; + + NSEnumerator *enumerator; + NSMutableArray *presetsArrayToMod; + NSMutableArray *tempArray; + id tempObject; + /* If we are a root level preset, we are modding the UserPresets array */ + if (presetToModLevel == 0) + { + presetsArrayToMod = UserPresets; + } + else // We have a parent preset, so we modify the chidren array object for key + { + presetsArrayToMod = [presetToModParent objectForKey:@"ChildrenArray"]; + } + + enumerator = [presetsArrayToMod objectEnumerator]; tempArray = [NSMutableArray array]; - while ( (index = [enumerator nextObject]) ) { - tempObject = [UserPresets objectAtIndex:[index intValue]]; - [tempArray addObject:tempObject]; + while (tempObject = [enumerator nextObject]) + { + NSDictionary *thisPresetDict = tempObject; + if (thisPresetDict == presetToMod) + { + [tempArray addObject:tempObject]; + } } - [UserPresets removeObjectsInArray:tempArray]; + [presetsArrayToMod removeObjectsInArray:tempArray]; [fPresetsOutlineView reloadData]; [self savePreset]; } @@ -5855,72 +5982,224 @@ if (item == nil) - (IBAction)getDefaultPresets:(id)sender { - int i = 0; + presetHbDefault = nil; + presetUserDefault = nil; + presetUserDefaultParent = nil; + presetUserDefaultParentParent = nil; + NSMutableDictionary *presetHbDefaultParent = nil; + NSMutableDictionary *presetHbDefaultParentParent = nil; + + int i = 0; + BOOL userDefaultFound = NO; presetCurrentBuiltInCount = 0; + /* First we iterate through the root UserPresets array to check for defaults */ NSEnumerator *enumerator = [UserPresets objectEnumerator]; id tempObject; while (tempObject = [enumerator nextObject]) { - NSDictionary *thisPresetDict = tempObject; + NSMutableDictionary *thisPresetDict = tempObject; if ([[thisPresetDict objectForKey:@"Default"] intValue] == 1) // 1 is HB default { - presetHbDefault = i; + presetHbDefault = thisPresetDict; } if ([[thisPresetDict objectForKey:@"Default"] intValue] == 2) // 2 is User specified default { - presetUserDefault = i; - } + presetUserDefault = thisPresetDict; + userDefaultFound = YES; + } if ([[thisPresetDict objectForKey:@"Type"] intValue] == 0) // Type 0 is a built in preset { presetCurrentBuiltInCount++; // <--increment the current number of built in presets } i++; + + /* if we run into a folder, go to level 1 and iterate through the children arrays for the default */ + if ([thisPresetDict objectForKey:@"ChildrenArray"]) + { + NSMutableDictionary *thisPresetDictParent = thisPresetDict; + NSEnumerator *enumerator = [[thisPresetDict objectForKey:@"ChildrenArray"] objectEnumerator]; + id tempObject; + while (tempObject = [enumerator nextObject]) + { + NSMutableDictionary *thisPresetDict = tempObject; + if ([[thisPresetDict objectForKey:@"Default"] intValue] == 1) // 1 is HB default + { + presetHbDefault = thisPresetDict; + presetHbDefaultParent = thisPresetDictParent; + } + if ([[thisPresetDict objectForKey:@"Default"] intValue] == 2) // 2 is User specified default + { + presetUserDefault = thisPresetDict; + presetUserDefaultParent = thisPresetDictParent; + userDefaultFound = YES; + } + + /* if we run into a folder, go to level 2 and iterate through the children arrays for the default */ + if ([thisPresetDict objectForKey:@"ChildrenArray"]) + { + NSMutableDictionary *thisPresetDictParentParent = thisPresetDict; + NSEnumerator *enumerator = [[thisPresetDict objectForKey:@"ChildrenArray"] objectEnumerator]; + id tempObject; + while (tempObject = [enumerator nextObject]) + { + NSMutableDictionary *thisPresetDict = tempObject; + if ([[thisPresetDict objectForKey:@"Default"] intValue] == 1) // 1 is HB default + { + presetHbDefault = thisPresetDict; + presetHbDefaultParent = thisPresetDictParent; + presetHbDefaultParentParent = thisPresetDictParentParent; + } + if ([[thisPresetDict objectForKey:@"Default"] intValue] == 2) // 2 is User specified default + { + presetUserDefault = thisPresetDict; + presetUserDefaultParent = thisPresetDictParent; + presetUserDefaultParentParent = thisPresetDictParentParent; + userDefaultFound = YES; + } + + } + } + } + } + } + /* check to see if a user specified preset was found, if not then assign the parents for + * the presetHbDefault so that we can open the parents for the nested presets + */ + if (userDefaultFound == NO) + { + presetUserDefaultParent = presetHbDefaultParent; + presetUserDefaultParentParent = presetHbDefaultParentParent; + } } - (IBAction)setDefaultPreset:(id)sender { +/* We need to determine if the item is a folder */ + if ([[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] == 1) + { + return; + } + int i = 0; NSEnumerator *enumerator = [UserPresets objectEnumerator]; id tempObject; /* First make sure the old user specified default preset is removed */ - while (tempObject = [enumerator nextObject]) + while (tempObject = [enumerator nextObject]) { - /* make sure we are not removing the default HB preset */ - if ([[[UserPresets objectAtIndex:i] objectForKey:@"Default"] intValue] != 1) // 1 is HB default + NSMutableDictionary *thisPresetDict = tempObject; + if ([[tempObject objectForKey:@"Default"] intValue] != 1) // if not the default HB Preset, set to 0 { - [[UserPresets objectAtIndex:i] setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [[UserPresets objectAtIndex:i] setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; } - i++; - } - /* Second, go ahead and set the appropriate user specfied preset */ - /* we get the chosen preset from the UserPresets array */ - if ([[[UserPresets objectAtIndex:[fPresetsOutlineView selectedRow]] objectForKey:@"Default"] intValue] != 1) // 1 is HB default - { - [[UserPresets objectAtIndex:[fPresetsOutlineView selectedRow]] setObject:[NSNumber numberWithInt:2] forKey:@"Default"]; + + /* if we run into a folder, go to level 1 and iterate through the children arrays for the default */ + if ([thisPresetDict objectForKey:@"ChildrenArray"]) + { + NSEnumerator *enumerator = [[thisPresetDict objectForKey:@"ChildrenArray"] objectEnumerator]; + id tempObject; + int ii = 0; + while (tempObject = [enumerator nextObject]) + { + NSMutableDictionary *thisPresetDict1 = tempObject; + if ([[tempObject objectForKey:@"Default"] intValue] != 1) // if not the default HB Preset, set to 0 + { + [[[thisPresetDict objectForKey:@"ChildrenArray"] objectAtIndex:ii] setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + } + /* if we run into a folder, go to level 2 and iterate through the children arrays for the default */ + if ([thisPresetDict1 objectForKey:@"ChildrenArray"]) + { + NSEnumerator *enumerator = [[thisPresetDict1 objectForKey:@"ChildrenArray"] objectEnumerator]; + id tempObject; + int iii = 0; + while (tempObject = [enumerator nextObject]) + { + if ([[tempObject objectForKey:@"Default"] intValue] != 1) // if not the default HB Preset, set to 0 + { + [[[thisPresetDict1 objectForKey:@"ChildrenArray"] objectAtIndex:iii] setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + } + iii++; + } + } + ii++; + } + + } + i++; } - /*FIX ME: I think we now need to use the items not rows in NSOutlineView */ - presetUserDefault = [fPresetsOutlineView selectedRow]; - - /* We save all of the preset data here */ + + + int presetToModLevel = [fPresetsOutlineView levelForItem: [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]]; + NSDictionary *presetToMod = [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]; + NSDictionary *presetToModParent = [fPresetsOutlineView parentForItem: presetToMod]; + + + NSMutableArray *presetsArrayToMod; + NSMutableArray *tempArray; + + /* If we are a root level preset, we are modding the UserPresets array */ + if (presetToModLevel == 0) + { + presetsArrayToMod = UserPresets; + } + else // We have a parent preset, so we modify the chidren array object for key + { + presetsArrayToMod = [presetToModParent objectForKey:@"ChildrenArray"]; + } + + enumerator = [presetsArrayToMod objectEnumerator]; + tempArray = [NSMutableArray array]; + int iiii = 0; + while (tempObject = [enumerator nextObject]) + { + NSDictionary *thisPresetDict = tempObject; + if (thisPresetDict == presetToMod) + { + if ([[tempObject objectForKey:@"Default"] intValue] != 1) // if not the default HB Preset, set to 2 + { + [[presetsArrayToMod objectAtIndex:iiii] setObject:[NSNumber numberWithInt:2] forKey:@"Default"]; + } + } + iiii++; + } + + + /* We save all of the preset data here */ [self savePreset]; - /* We Reload the New Table data for presets */ + /* We Reload the New Table data for presets */ [fPresetsOutlineView reloadData]; } - (IBAction)selectDefaultPreset:(id)sender { - /* if there is a user specified default, we use it */ + NSMutableDictionary *presetToMod; + /* if there is a user specified default, we use it */ if (presetUserDefault) { - [fPresetsOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:presetUserDefault] byExtendingSelection:NO]; - [self selectPreset:nil]; - } + presetToMod = presetUserDefault; + } else if (presetHbDefault) //else we use the built in default presetHbDefault { - [fPresetsOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:presetHbDefault] byExtendingSelection:NO]; - [self selectPreset:nil]; + presetToMod = presetHbDefault; } + else + { + return; + } + + if (presetUserDefaultParent != nil) + { + [fPresetsOutlineView expandItem:presetUserDefaultParent]; + + } + if (presetUserDefaultParentParent != nil) + { + [fPresetsOutlineView expandItem:presetUserDefaultParentParent]; + + } + + [fPresetsOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[fPresetsOutlineView rowForItem: presetToMod]] byExtendingSelection:NO]; + [self selectPreset:nil]; } @@ -5988,7 +6267,7 @@ if (item == nil) // By default, NSTableView only drags an image of the first column. Change this to // drag an image of the queue's icon and PresetName columns. - NSArray * cols = [NSArray arrayWithObjects: [self tableColumnWithIdentifier:@"icon"], [self tableColumnWithIdentifier:@"PresetName"], nil]; + NSArray * cols = [NSArray arrayWithObjects: [self tableColumnWithIdentifier:@"PresetName"], nil]; return [super dragImageForRowsWithIndexes:dragRows tableColumns:cols event:dragEvent offset:dragImageOffset]; } diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib index d1c74642c..f40841a2c 100644 --- a/macosx/English.lproj/MainMenu.xib +++ b/macosx/English.lproj/MainMenu.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">352.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="2"/> + <integer value="1868"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -40,7 +40,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="168918359"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -3242,7 +3242,6 @@ </object> </object> <string key="NSFrameSize">{760, 550}</string> - <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{213, 129}</string> @@ -4056,39 +4055,9 @@ </object> <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSTableColumn" id="353294161"> - <string key="NSIdentifier">icon</string> - <double key="NSWidth">1.600000e+01</double> - <double key="NSMinWidth">1.600000e+01</double> - <double key="NSMaxWidth">1.000000e+03</double> - <object class="NSTableHeaderCell" key="NSHeaderCell"> - <int key="NSCellFlags">75628032</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents"/> - <reference key="NSSupport" ref="26"/> - <object class="NSColor" key="NSBackgroundColor" id="68749412"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes> - </object> - <reference key="NSTextColor" ref="188451177"/> - </object> - <object class="NSTextFieldCell" key="NSDataCell" id="952769800"> - <int key="NSCellFlags">337772096</int> - <int key="NSCellFlags2">2048</int> - <string key="NSContents">Text Cell</string> - <reference key="NSSupport" ref="995413175"/> - <reference key="NSControlView" ref="807972370"/> - <reference key="NSBackgroundColor" ref="355843302"/> - <reference key="NSTextColor" ref="701609070"/> - </object> - <int key="NSResizingMask">1</int> - <bool key="NSIsResizeable">YES</bool> - <bool key="NSIsEditable">YES</bool> - <reference key="NSTableView" ref="807972370"/> - </object> <object class="NSTableColumn" id="658438499"> <string key="NSIdentifier">PresetName</string> - <double key="NSWidth">2.250000e+02</double> + <double key="NSWidth">2.440000e+02</double> <double key="NSMinWidth">4.000000e+01</double> <double key="NSMaxWidth">1.000000e+03</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> @@ -4096,7 +4065,10 @@ <int key="NSCellFlags2">0</int> <string key="NSContents">Presets</string> <reference key="NSSupport" ref="26"/> - <reference key="NSBackgroundColor" ref="68749412"/> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes> + </object> <reference key="NSTextColor" ref="188451177"/> </object> <object class="NSTextFieldCell" key="NSDataCell" id="384895213"> @@ -4134,6 +4106,7 @@ </object> <string key="NSFrame">{{1, 1}, {247, 506}}</string> <reference key="NSSuperview" ref="33643505"/> + <reference key="NSNextKeyView" ref="807972370"/> <reference key="NSDocView" ref="807972370"/> <reference key="NSBGColor" ref="355843302"/> <int key="NScvFlags">4</int> @@ -4161,6 +4134,7 @@ </object> <string key="NSFrame">{{4, 31}, {260, 508}}</string> <reference key="NSSuperview" ref="621751818"/> + <reference key="NSNextKeyView" ref="421228634"/> <int key="NSsFlags">18</int> <reference key="NSVScroller" ref="475123229"/> <reference key="NSHScroller" ref="573337548"/> @@ -4308,7 +4282,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{338, 232}</string> <object class="NSView" key="NSWindowView" id="69290042"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -4378,7 +4352,7 @@ <object class="NSPopUpButton" id="167356719"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">266</int> - <string key="NSFrame">{{166, 208}, {155, 22}}</string> + <string key="NSFrame">{{166, 183}, {155, 22}}</string> <reference key="NSSuperview" ref="69290042"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="17688962"> @@ -4464,7 +4438,7 @@ <object class="NSTextField" id="340554114"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 242}, {91, 14}}</string> + <string key="NSFrame">{{17, 217}, {91, 14}}</string> <reference key="NSSuperview" ref="69290042"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="70981869"> @@ -4480,7 +4454,7 @@ <object class="NSTextField" id="384547934"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 135}, {114, 14}}</string> + <string key="NSFrame">{{17, 100}, {114, 14}}</string> <reference key="NSSuperview" ref="69290042"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="207651610"> @@ -4496,7 +4470,7 @@ <object class="NSTextField" id="511645357"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">274</int> - <string key="NSFrame">{{20, 51}, {298, 76}}</string> + <string key="NSFrame">{{20, 51}, {298, 41}}</string> <reference key="NSSuperview" ref="69290042"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="855042909"> @@ -4513,7 +4487,7 @@ <object class="NSTextField" id="31472093"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 212}, {147, 14}}</string> + <string key="NSFrame">{{17, 187}, {147, 14}}</string> <reference key="NSSuperview" ref="69290042"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="31665321"> @@ -4529,7 +4503,7 @@ <object class="NSButton" id="1024752086"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{166, 182}, {24, 18}}</string> + <string key="NSFrame">{{166, 157}, {24, 18}}</string> <reference key="NSSuperview" ref="69290042"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="625635488"> @@ -4548,10 +4522,32 @@ <int key="NSPeriodicInterval">25</int> </object> </object> + <object class="NSButton" id="786415813"> + <reference key="NSNextResponder" ref="69290042"/> + <int key="NSvFlags">-2147483380</int> + <string key="NSFrame">{{17, 240}, {303, 18}}</string> + <reference key="NSSuperview" ref="69290042"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="977106207"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">131072</int> + <string key="NSContents">Preset Folder ( if checked disregard below )</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="786415813"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSNormalImage" ref="887198214"/> + <reference key="NSAlternateImage" ref="624832340"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> <object class="NSBox" id="5085381"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{113, 245}, {205, 5}}</string> + <string key="NSFrame">{{113, 220}, {205, 5}}</string> <reference key="NSSuperview" ref="69290042"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -4573,7 +4569,7 @@ <object class="NSBox" id="988499754"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{20, 155}, {298, 5}}</string> + <string key="NSFrame">{{20, 130}, {298, 5}}</string> <reference key="NSSuperview" ref="69290042"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -4595,7 +4591,7 @@ <object class="NSTextField" id="59653352"> <reference key="NSNextResponder" ref="69290042"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 184}, {147, 15}}</string> + <string key="NSFrame">{{17, 159}, {147, 15}}</string> <reference key="NSSuperview" ref="69290042"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="155469085"> @@ -4610,6 +4606,7 @@ </object> </object> <string key="NSFrameSize">{338, 318}</string> + <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{338, 254}</string> @@ -6552,6 +6549,14 @@ </object> <int key="connectionID">5152</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">fPresetNewFolderCheck</string> + <reference key="source" ref="2258723"/> + <reference key="destination" ref="786415813"/> + </object> + <int key="connectionID">5155</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -8176,7 +8181,6 @@ <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="658438499"/> - <reference ref="353294161"/> </object> <reference key="parent" ref="33643505"/> </object> @@ -8195,20 +8199,6 @@ <reference key="parent" ref="658438499"/> </object> <object class="IBObjectRecord"> - <int key="objectID">4184</int> - <reference key="object" ref="353294161"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="952769800"/> - </object> - <reference key="parent" ref="807972370"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">4185</int> - <reference key="object" ref="952769800"/> - <reference key="parent" ref="353294161"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">4317</int> <reference key="object" ref="241719587"/> <object class="NSMutableArray" key="children"> @@ -8247,13 +8237,14 @@ <reference ref="167356719"/> <reference ref="343391844"/> <reference ref="340554114"/> - <reference ref="384547934"/> <reference ref="511645357"/> <reference ref="31472093"/> <reference ref="1024752086"/> <reference ref="5085381"/> <reference ref="988499754"/> <reference ref="59653352"/> + <reference ref="384547934"/> + <reference ref="786415813"/> </object> <reference key="parent" ref="888992113"/> </object> @@ -9975,6 +9966,20 @@ <reference key="object" ref="583192244"/> <reference key="parent" ref="717227898"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">5153</int> + <reference key="object" ref="786415813"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="977106207"/> + </object> + <reference key="parent" ref="69290042"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5154</int> + <reference key="object" ref="977106207"/> + <reference key="parent" ref="786415813"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -10470,10 +10475,6 @@ <string>4182.ImportedFromIB2</string> <string>4183.IBPluginDependency</string> <string>4183.ImportedFromIB2</string> - <string>4184.IBPluginDependency</string> - <string>4184.ImportedFromIB2</string> - <string>4185.IBPluginDependency</string> - <string>4185.ImportedFromIB2</string> <string>4186.IBPluginDependency</string> <string>4186.ImportedFromIB2</string> <string>4317.IBPluginDependency</string> @@ -10643,6 +10644,8 @@ <string>5133.IBPluginDependency</string> <string>5134.IBPluginDependency</string> <string>5135.IBPluginDependency</string> + <string>5153.IBPluginDependency</string> + <string>5153.ImportedFromIB2</string> <string>56.IBPluginDependency</string> <string>56.ImportedFromIB2</string> <string>57.IBPluginDependency</string> @@ -10935,9 +10938,9 @@ <integer value="0" id="8"/> <reference ref="9"/> <string>{{720, 261}, {270, 550}}</string> - <string>{{122, 631}, {338, 318}}</string> + <string>{{275, 198}, {338, 318}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{122, 631}, {338, 318}}</string> + <string>{{275, 198}, {338, 318}}</string> <reference ref="9"/> <string>{{421, 536}, {338, 318}}</string> <reference ref="9"/> @@ -11169,10 +11172,6 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{57, 766}, {300, 233}}</string> <reference ref="9"/> <string>{{57, 766}, {300, 233}}</string> @@ -11353,6 +11352,8 @@ <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> <string>{{75, 683}, {235, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -11384,7 +11385,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">5152</int> + <int key="maxID">5155</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -11582,6 +11583,7 @@ <string>fPictureButton</string> <string>fPresetDrawer</string> <string>fPresetNewDesc</string> + <string>fPresetNewFolderCheck</string> <string>fPresetNewName</string> <string>fPresetNewPicFiltersCheck</string> <string>fPresetNewPicSettingsPopUp</string> @@ -11706,6 +11708,7 @@ <string>NSButton</string> <string>NSDrawer</string> <string>NSTextField</string> + <string>NSButton</string> <string>NSTextField</string> <string>NSButton</string> <string>NSPopUpButton</string> diff --git a/macosx/HBPresets.h b/macosx/HBPresets.h index e3b872cd7..e91041b66 100644 --- a/macosx/HBPresets.h +++ b/macosx/HBPresets.h @@ -13,15 +13,18 @@ - (NSMutableArray *) generateBuiltinPresets: (NSMutableArray *) UserPresets; /* Built-In Preset Dictionaries (one for each built in preset) */ +- (NSDictionary *)createApplePresetFolder; +- (NSDictionary *)createAppleIpodFamilyPresetFolder; +- (NSDictionary *)createBasicPresetFolder; +- (NSDictionary *)createGamingConsolesPresetFolder; +- (NSDictionary *)createHiProfilePresetFolder; + - (NSDictionary *)create360Preset; - (NSDictionary *)createAnimationPreset; - (NSDictionary *)createAppleTVPreset; -- (NSDictionary *)createBedlamPreset; -- (NSDictionary *)createBlindPreset; -- (NSDictionary *)createBrokePreset; +- (NSDictionary *)createAppleUniversalPreset; - (NSDictionary *)createClassicPreset; - (NSDictionary *)createCRFPreset; -- (NSDictionary *)createDeuxSixQuatrePreset; - (NSDictionary *)createFilmPreset; - (NSDictionary *)createiPhonePreset; - (NSDictionary *)createIpodHighPreset; diff --git a/macosx/HBPresets.m b/macosx/HBPresets.m index 893112bd4..a1fac57cc 100644 --- a/macosx/HBPresets.m +++ b/macosx/HBPresets.m @@ -18,218 +18,210 @@ { /* We receive the user presets array of dictionaries from controller.mm */ /* We re-create new built in presets programmatically and add them to our presets array */ - [UserPresets addObject:[self createAnimationPreset]]; - [UserPresets addObject:[self createAppleTVPreset]]; - [UserPresets addObject:[self createBedlamPreset]]; - [UserPresets addObject:[self createBlindPreset]]; - [UserPresets addObject:[self createBrokePreset]]; - [UserPresets addObject:[self createClassicPreset]]; - [UserPresets addObject:[self createCRFPreset]]; - [UserPresets addObject:[self createDeuxSixQuatrePreset]]; - [UserPresets addObject:[self createFilmPreset]]; - [UserPresets addObject:[self createiPhonePreset]]; - [UserPresets addObject:[self createIpodHighPreset]]; - [UserPresets addObject:[self createIpodLowPreset]]; - [UserPresets addObject:[self createNormalPreset]]; - [UserPresets addObject:[self createPSPPreset]]; - [UserPresets addObject:[self createPSThreePreset]]; - [UserPresets addObject:[self createQuickTimePreset]]; - [UserPresets addObject:[self createTelevisionPreset]]; - [UserPresets addObject:[self create360Preset]]; + + /* Note: the built in presets will *not* sort themselves alphabetically, so they will + * appear in the order you create them + */ + /* Built in preset folders at the root of the hierarchy */ + [UserPresets addObject:[self createApplePresetFolder]]; + [UserPresets addObject:[self createBasicPresetFolder]]; + [UserPresets addObject:[self createHiProfilePresetFolder]]; + [UserPresets addObject:[self createGamingConsolesPresetFolder]]; + + /* Independent presets at the root hierarchy level would go here */ + /* return the newly regenerated preset array back to Controller.mm */ return UserPresets; } #pragma mark - -#pragma mark Built In Preset Definitions - -/* These NSDictionary Buit-In Preset definitions contain all of the settings for one built in preset */ -/* Note: For now, you can no longer have reference to any main window fields in your key values */ +#pragma mark Built In Preset Folder Definitions -- (NSDictionary *)create360Preset +- (NSDictionary *)createApplePresetFolder { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; +/*Set whether or not this is a folder, 1 is bool for folder*/ + [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; + /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Xbox 360" forKey:@"PresetName"]; + [preset setObject:@"Apple" forKey:@"PresetName"]; /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; /*Set whether or not this is default, at creation set to 0*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - - /*Get the whether or not to apply pic settings in the AddPresetPanel*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for the Microsoft Xbox 360." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - /* x264 Option String */ - [preset setObject:@"level=40:ref=2:mixed-refs:bframes=3:weightb:subme=7:direct=auto:b-pyramid:me=umh:analyse=all:no-fast-pskip:filter=-2,-1" forKey:@"x264Option"]; + /* Lets initalize the child array of dictionaries for folders, this + is an array of dictionaries much like the root level of presets and + may contain folders and presets alike, etc.*/ + NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; + /* we actually call the methods for the nests here */ + [childrenArray addObject:[self createAppleUniversalPreset]]; + [childrenArray addObject:[self createAppleTVPreset]]; + [childrenArray addObject:[self createAppleIpodFamilyPresetFolder]]; + [childrenArray addObject:[self createQuickTimePreset]]; + [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + + [childrenArray autorelease]; - /* Video quality */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; - [preset setObject:@"700" forKey:@"VideoTargetSize"]; - [preset setObject:@"2000" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; - /* Video framerate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + [preset autorelease]; + return preset; +} - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; +- (NSDictionary *)createAppleIpodFamilyPresetFolder +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; +/*Set whether or not this is a folder, 1 is bool for folder*/ + [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; - /*Picture Settings*/ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PicturePAR"]; - /* Explicitly set the filters for built-in presets */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VFR"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + /* Get the New Preset Name from the field in the AddPresetPanel */ + [preset setObject:@"iPod & iPhone" forKey:@"PresetName"]; - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; + /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ + /*Set whether or not this is default, at creation set to 0*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - /* Track 1 */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio1Track"]; - [preset setObject:@"AAC (faac)" forKey:@"Audio1Encoder"]; - [preset setObject:@"Dolby Pro Logic II" forKey:@"Audio1Mixdown"]; - [preset setObject:@"48" forKey:@"Audio1Samplerate"]; - [preset setObject:@"160" forKey:@"Audio1Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio1TrackDRCSlider"]; + /* Lets initalize the child array of dictionaries for folders, this + is an array of dictionaries much like the root level of presets and + may contain folders and presets alike, etc.*/ + NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; + /* we actually call the methods for the nests here */ + [childrenArray addObject:[self createIpodLowPreset]]; + [childrenArray addObject:[self createiPhonePreset]]; + [childrenArray addObject:[self createIpodHighPreset]]; - /* Subtitles*/ - [preset setObject:@"None" forKey:@"Subtitles"]; + [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + + [childrenArray autorelease]; + + [preset autorelease]; return preset; } -- (NSDictionary *)createAnimationPreset +- (NSDictionary *)createGamingConsolesPresetFolder { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; +/*Set whether or not this is a folder, 1 is bool for folder*/ + [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; + /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Animation" forKey:@"PresetName"]; + [preset setObject:@"Gaming Consoles" forKey:@"PresetName"]; - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ + /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; /*Set whether or not this is default, at creation set to 0*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + + /* Lets initalize the child array of dictionaries for folders, this + is an array of dictionaries much like the root level of presets and + may contain folders and presets alike, etc.*/ + NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; + /* we actually call the methods for the nests here */ + [childrenArray addObject:[self createPSPPreset]]; + [childrenArray addObject:[self createPSThreePreset]]; + [childrenArray addObject:[self create360Preset]]; + [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + + [childrenArray autorelease]; - /*Get the whether or not to apply pic settings in the AddPresetPanel*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for cartoons, anime, and CGI." forKey:@"PresetDescription"]; - /* File Format */ - [preset setObject:@"MKV file" forKey:@"FileFormat"]; + [preset autorelease]; + return preset; +} - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; +- (NSDictionary *)createBasicPresetFolder +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; +/*Set whether or not this is a folder, 1 is bool for folder*/ + [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; - /* x264 Option String */ - [preset setObject:@"ref=5:mixed-refs:bframes=6:subme=7:weightb:direct=auto:b-pyramid:me=umh:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip:filter=2,2" forKey:@"x264Option"]; - /* Video quality */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; - [preset setObject:@"700" forKey:@"VideoTargetSize"]; - [preset setObject:@"1000" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; + /* Get the New Preset Name from the field in the AddPresetPanel */ + [preset setObject:@"Basic" forKey:@"PresetName"]; - /* Video framerate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; + /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + /*Set whether or not this is default, at creation set to 0*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + + /* Lets initalize the child array of dictionaries for folders, this + is an array of dictionaries much like the root level of presets and + may contain folders and presets alike, etc.*/ + NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; + /* we actually call the methods for the nests here */ + [childrenArray addObject:[self createNormalPreset]]; + [childrenArray addObject:[self createClassicPreset]]; + [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + + [childrenArray autorelease]; - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoTurboTwoPass"]; - /*Picture Settings*/ - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PicturePAR"]; - /* Filters. For animation, use slower deinterlacing. */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:3] forKey:@"PictureDeinterlace"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VFR"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset autorelease]; + return preset; +} - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; +- (NSDictionary *)createHiProfilePresetFolder +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; +/*Set whether or not this is a folder, 1 is bool for folder*/ + [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ + + /* Get the New Preset Name from the field in the AddPresetPanel */ + [preset setObject:@"High Profile" forKey:@"PresetName"]; + + /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; + + /*Set whether or not this is default, at creation set to 0*/ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - /* Track 1 */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio1Track"]; - [preset setObject:@"AAC (faac)" forKey:@"Audio1Encoder"]; - [preset setObject:@"Dolby Pro Logic II" forKey:@"Audio1Mixdown"]; - [preset setObject:@"Auto" forKey:@"Audio1Samplerate"]; - [preset setObject:@"160" forKey:@"Audio1Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio1TrackDRCSlider"]; + /* Lets initalize the child array of dictionaries for folders, this + is an array of dictionaries much like the root level of presets and + may contain folders and presets alike, etc.*/ + NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; + /* we actually call the methods for the nests here */ + [childrenArray addObject:[self createAnimationPreset]]; + [childrenArray addObject:[self createCRFPreset]]; + [childrenArray addObject:[self createFilmPreset]]; + [childrenArray addObject:[self createTelevisionPreset]]; + [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; - /* Subtitles*/ - [preset setObject:@"None" forKey:@"Subtitles"]; - + [childrenArray autorelease]; [preset autorelease]; return preset; } -- (NSDictionary *)createAppleTVPreset + +#pragma mark - + +#pragma mark Built In Preset Definitions + +/* These NSDictionary Buit-In Preset definitions contain all of the settings for one built in preset */ +/* Note: For now, you can no longer have reference to any main window fields in your key values */ + +- (NSDictionary *)create360Preset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"AppleTV" forKey:@"PresetName"]; + [preset setObject:@"Xbox 360" forKey:@"PresetName"]; /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; @@ -241,27 +233,24 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for the AppleTV, including Dolby Digital 5.1 AC3 sound. Provides a good balance between quality and file size, and optimizes performance." forKey:@"PresetDescription"]; + [preset setObject:@"HandBrake's settings for the Microsoft Xbox 360." forKey:@"PresetDescription"]; /* File Format */ [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - /* 64-bit MP4 file */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; /* Video encoder */ [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the appleTV output)*/ - [preset setObject:@"bframes=3:ref=1:me=umh:no-fast-pskip=1:trellis=1:cabac=0" forKey:@"x264Option"]; + + /* x264 Option String */ + [preset setObject:@"level=40:ref=2:mixed-refs:bframes=3:weightb:subme=7:direct=auto:b-pyramid:me=umh:analyse=all:no-fast-pskip:filter=-2,-1" forKey:@"x264Option"]; /* Video quality */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:@"2000" forKey:@"VideoAvgBitrate"]; [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ @@ -273,7 +262,7 @@ /* 2 Pass Encoding */ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - /* Basic Picture Settings */ + /*Picture Settings*/ /* Use Max Picture settings for whatever the dvd is.*/ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesMaxPictureSettings"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; @@ -306,18 +295,7 @@ [preset setObject:@"48" forKey:@"Audio1Samplerate"]; [preset setObject:@"160" forKey:@"Audio1Bitrate"]; [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio1TrackDRCSlider"]; - - /* Track 2 */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio2Track"]; - [preset setObject:@"AC3 Passthru" forKey:@"Audio2Encoder"]; - [preset setObject:@"AC3 Passthru" forKey:@"Audio2Mixdown"]; - [preset setObject:@"Auto" forKey:@"Audio2Samplerate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ - [preset setObject:@"160" forKey:@"Audio2Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio2TrackDRCSlider"]; - + /* Subtitles*/ [preset setObject:@"None" forKey:@"Subtitles"]; @@ -325,12 +303,12 @@ return preset; } -- (NSDictionary *)createBedlamPreset +- (NSDictionary *)createAnimationPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Bedlam" forKey:@"PresetName"]; + [preset setObject:@"Animation" forKey:@"PresetName"]; /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; @@ -342,7 +320,7 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings maxed out for slowest encoding and highest quality. Use at your own risk. So slow it's not just insane...it's a trip to the looney bin." forKey:@"PresetDescription"]; + [preset setObject:@"HandBrake's settings for cartoons, anime, and CGI." forKey:@"PresetDescription"]; /* File Format */ [preset setObject:@"MKV file" forKey:@"FileFormat"]; @@ -354,12 +332,12 @@ [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; /* x264 Option String */ - [preset setObject:@"ref=16:mixed-refs:bframes=16:weightb:direct=auto:b-pyramid:me=esa:subme=9:me-range=64:analyse=all:8x8dct:trellis=1:no-fast-pskip:no-dct-decimate:filter=-2,-1" forKey:@"x264Option"]; + [preset setObject:@"ref=5:mixed-refs:bframes=6:weightb:direct=auto:b-pyramid:me=umh:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip:filter=2,2:psy-rd=1,1:subme=9" forKey:@"x264Option"]; /* Video quality */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; - [preset setObject:@"1800" forKey:@"VideoAvgBitrate"]; + [preset setObject:@"1000" forKey:@"VideoAvgBitrate"]; [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ @@ -373,6 +351,7 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoTurboTwoPass"]; /*Picture Settings*/ + /* Basic Picture Settings */ /* Use Max Picture settings for whatever the dvd is.*/ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesMaxPictureSettings"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; @@ -381,13 +360,14 @@ [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"PicturePAR"]; - /* Explicitly set the filters for built-in presets */ + /* Filters. For animation, use slower deinterlacing. */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecomb"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"VFR"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDetelecine"]; /* Set crop settings here */ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ @@ -401,15 +381,12 @@ /* Track 1 */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio1Track"]; - [preset setObject:@"AC3 Passthru" forKey:@"Audio1Encoder"]; - [preset setObject:@"AC3 Passthru" forKey:@"Audio1Mixdown"]; + [preset setObject:@"AAC (faac)" forKey:@"Audio1Encoder"]; + [preset setObject:@"Dolby Pro Logic II" forKey:@"Audio1Mixdown"]; [preset setObject:@"Auto" forKey:@"Audio1Samplerate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ [preset setObject:@"160" forKey:@"Audio1Bitrate"]; [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio1TrackDRCSlider"]; - + /* Subtitles*/ [preset setObject:@"None" forKey:@"Subtitles"]; @@ -417,16 +394,17 @@ return preset; } -- (NSDictionary *)createBlindPreset +- (NSDictionary *)createAppleTVPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Blind" forKey:@"PresetName"]; + [preset setObject:@"AppleTV" forKey:@"PresetName"]; - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ + /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - + /*Set whether or not this is a folder, 1 is bool for folder*/ + [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; /*Set whether or not this is default, at creation set to 0*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; @@ -434,25 +412,28 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for impatient people who don't care about picture quality." forKey:@"PresetDescription"]; + [preset setObject:@"HandBrake's settings for the AppleTV, including Dolby Digital 5.1 AC3 sound. Provides a good balance between quality and file size, and optimizes performance." forKey:@"PresetDescription"]; /* File Format */ [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + /* 64-bit MP4 file */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + /* Chapter Markers*/ [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; /* Video encoder */ - [preset setObject:@"MPEG-4 (FFmpeg)" forKey:@"VideoEncoder"]; + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + /* x264 Option String (We can use this to tweak the appleTV output)*/ + [preset setObject:@"level=30:cabac=0:ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:no-fast-pskip=1:me=umh:subq=9:analyse=all" forKey:@"x264Option"]; /* Video quality */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; - [preset setObject:@"512" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithFloat:0.59] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; @@ -462,16 +443,14 @@ /* 2 Pass Encoding */ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - /*Picture Settings*/ - /* Use a width of 512 to save on space for Blind */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; - [preset setObject:[NSNumber numberWithInt:512] forKey:@"PictureWidth"]; + /* Basic Picture Settings */ + /* Use Max Picture settings for whatever the dvd is.*/ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; /* Explicitly set the filters for built-in presets */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; @@ -483,6 +462,7 @@ /* Set crop settings here */ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; @@ -495,10 +475,21 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio1Track"]; [preset setObject:@"AAC (faac)" forKey:@"Audio1Encoder"]; [preset setObject:@"Dolby Pro Logic II" forKey:@"Audio1Mixdown"]; - [preset setObject:@"Auto" forKey:@"Audio1Samplerate"]; - [preset setObject:@"128" forKey:@"Audio1Bitrate"]; + [preset setObject:@"48" forKey:@"Audio1Samplerate"]; + [preset setObject:@"160" forKey:@"Audio1Bitrate"]; [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio1TrackDRCSlider"]; + /* Track 2 */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio2Track"]; + [preset setObject:@"AC3 Passthru" forKey:@"Audio2Encoder"]; + [preset setObject:@"AC3 Passthru" forKey:@"Audio2Mixdown"]; + [preset setObject:@"Auto" forKey:@"Audio2Samplerate"]; + /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use + * the sources bitrate, however we need to initially set the value to something so + * the macgui doesnt barf, so 160 seems as good as anything */ + [preset setObject:@"160" forKey:@"Audio2Bitrate"]; + [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio2TrackDRCSlider"]; + /* Subtitles*/ [preset setObject:@"None" forKey:@"Subtitles"]; @@ -506,16 +497,17 @@ return preset; } -- (NSDictionary *)createBrokePreset +- (NSDictionary *)createAppleUniversalPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Broke" forKey:@"PresetName"]; + [preset setObject:@"Universal" forKey:@"PresetName"]; - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ + /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - + /*Set whether or not this is a folder, 1 is bool for folder*/ + [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; /*Set whether or not this is default, at creation set to 0*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; @@ -523,25 +515,28 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for people without a lot of money to waste on hard drives. Tries to maximize quality for burning to CDs, so you can party like it's 1999." forKey:@"PresetDescription"]; + [preset setObject:@"HandBrake's universally compatible, full resolution settings for all current Apple devices: iPod, iPhone, AppleTV, and Macs" forKey:@"PresetDescription"]; /* File Format */ [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + /* 64-bit MP4 file */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + /* Chapter Markers*/ [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; /* Video encoder */ [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - /* x264 Option String */ - [preset setObject:@"ref=3:mixed-refs:bframes=16:weightb:b-pyramid:direct=auto:subme=7:me=umh:trellis=1:analyse=all:8x8dct:no-fast-pskip" forKey:@"x264Option"]; + /* x264 Option String (We can use this to tweak the appleTV output)*/ + [preset setObject:@"level=30:cabac=0:ref=3:mixed-refs=1:analyse=all:me=umh:no-fast-pskip=1:subme=8" forKey:@"x264Option"]; /* Video quality */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoQualityType"]; - [preset setObject:@"695" forKey:@"VideoTargetSize"]; - [preset setObject:@"1600" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"700" forKey:@"VideoTargetSize"]; + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithFloat:0.59] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; @@ -550,17 +545,15 @@ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - /*Picture Settings*/ - /* Use a width of 640 for Broke */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; - [preset setObject:[NSNumber numberWithInt:640] forKey:@"PictureWidth"]; + /* Basic Picture Settings */ + /* Use Max Picture settings for whatever the dvd is.*/ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; /* Explicitly set the filters for built-in presets */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; @@ -572,6 +565,7 @@ /* Set crop settings here */ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; @@ -584,10 +578,21 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio1Track"]; [preset setObject:@"AAC (faac)" forKey:@"Audio1Encoder"]; [preset setObject:@"Dolby Pro Logic II" forKey:@"Audio1Mixdown"]; - [preset setObject:@"Auto" forKey:@"Audio1Samplerate"]; - [preset setObject:@"128" forKey:@"Audio1Bitrate"]; + [preset setObject:@"48" forKey:@"Audio1Samplerate"]; + [preset setObject:@"160" forKey:@"Audio1Bitrate"]; [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio1TrackDRCSlider"]; + /* Track 2 */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio2Track"]; + [preset setObject:@"AC3 Passthru" forKey:@"Audio2Encoder"]; + [preset setObject:@"AC3 Passthru" forKey:@"Audio2Mixdown"]; + [preset setObject:@"Auto" forKey:@"Audio2Samplerate"]; + /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use + * the sources bitrate, however we need to initially set the value to something so + * the macgui doesnt barf, so 160 seems as good as anything */ + [preset setObject:@"160" forKey:@"Audio2Bitrate"]; + [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio2TrackDRCSlider"]; + /* Subtitles*/ [preset setObject:@"None" forKey:@"Subtitles"]; @@ -712,13 +717,13 @@ [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; /* x264 Option String */ - [preset setObject:@"ref=3:mixed-refs:bframes=3:b-pyramid:subme=7:weightb:filter=-2,-1:trellis=1:analyse=all:8x8dct:me=umh" forKey:@"x264Option"]; + [preset setObject:@"ref=3:mixed-refs:bframes=3:b-pyramid:weightb:filter=-2,-1:trellis=1:analyse=all:8x8dct:me=umh:subme=9:psy-rd=1,1" forKey:@"x264Option"]; /* Video quality */ [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; [preset setObject:@"2000" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; + [preset setObject:[NSNumber numberWithFloat:0.60] forKey:@"VideoQualitySlider"]; /* Video framerate */ [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; @@ -775,98 +780,6 @@ return preset; } -- (NSDictionary *)createDeuxSixQuatrePreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Deux Six Quatre" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - - /*Set whether or not this is default, at creation set to 0*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - - /*Get the whether or not to apply pic settings in the AddPresetPanel*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for true high profile x264 quality. A good balance of quality and speed, based on community standards found in the wild. This preset will give you a much better sense of x264's capabilities than vanilla main profile." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MKV file" forKey:@"FileFormat"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String */ - [preset setObject:@"ref=5:mixed-refs:bframes=3:weightb:b-pyramid:me=umh:subme=8:trellis=1:analyse=all:8x8dct:no-fast-pskip" forKey:@"x264Option"]; - - /* Video quality */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; - [preset setObject:@"700" forKey:@"VideoTargetSize"]; - [preset setObject:@"1600" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoTurboTwoPass"]; - - /*Picture Settings*/ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PicturePAR"]; - - /* Explicitly set the filters for built-in presets */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VFR"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - - /* Track 1 */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Audio1Track"]; - [preset setObject:@"AC3 Passthru" forKey:@"Audio1Encoder"]; - [preset setObject:@"AC3 Passthru" forKey:@"Audio1Mixdown"]; - [preset setObject:@"Auto" forKey:@"Audio1Samplerate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ - [preset setObject:@"160" forKey:@"Audio1Bitrate"]; - [preset setObject:[NSNumber numberWithFloat:1.0] forKey:@"Audio1TrackDRCSlider"]; - - /* Subtitles*/ - [preset setObject:@"None" forKey:@"Subtitles"]; - - [preset autorelease]; - return preset; -} - - (NSDictionary *)createFilmPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; @@ -896,7 +809,7 @@ [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; /* x264 Option String */ - [preset setObject:@"ref=3:mixed-refs:bframes=6:weightb:direct=auto:b-pyramid:me=umh:subme=8:analyse=all:8x8dct:trellis=1:no-fast-pskip" forKey:@"x264Option"]; + [preset setObject:@"ref=3:mixed-refs:bframes=6:weightb:direct=auto:b-pyramid:me=umh:subme=9:analyse=all:8x8dct:trellis=1:no-fast-pskip:psy-rd=1,1" forKey:@"x264Option"]; /* Video quality */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; @@ -964,7 +877,7 @@ NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPhone / iPod Touch" forKey:@"PresetName"]; + [preset setObject:@"iPhone & iPod Touch" forKey:@"PresetName"]; /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; @@ -1052,7 +965,7 @@ NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPod High-Rez" forKey:@"PresetName"]; + [preset setObject:@"iPod Legacy" forKey:@"PresetName"]; /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; @@ -1064,7 +977,7 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's high resolution settings for the iPod. Good video quality, great for viewing on a TV using your iPod" forKey:@"PresetDescription"]; + [preset setObject:@"HandBrake's high resolution settings for older 5 and 5.5G iPods. Good video quality, great for viewing on a TV using your iPod" forKey:@"PresetDescription"]; /* File Format */ [preset setObject:@"MP4 file" forKey:@"FileFormat"]; @@ -1140,7 +1053,7 @@ NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPod Low-Rez" forKey:@"PresetName"]; + [preset setObject:@"iPod Classic & iPod Nano" forKey:@"PresetName"]; /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; @@ -1464,6 +1377,7 @@ /* Set crop settings here */ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; @@ -1504,7 +1418,7 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's high quality settings for use with QuickTime. It can be slow, so use it when the Normal preset doesn't look good enough." forKey:@"PresetDescription"]; + [preset setObject:@"HandBrake's high profile settings for use with QuickTime. It can be slow, so use it when the Normal preset doesn't look good enough." forKey:@"PresetDescription"]; /* File Format */ [preset setObject:@"MP4 file" forKey:@"FileFormat"]; @@ -1516,12 +1430,12 @@ [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; /* x264 Option String */ - [preset setObject:@"ref=3:mixed-refs:bframes=3:subme=7:weightb:direct=auto:me=umh:analyse=all:trellis=1:no-fast-pskip" forKey:@"x264Option"]; + [preset setObject:@"ref=3:mixed-refs:bframes=3:weightb:direct=auto:me=umh:subme=7:analyse=all:8x8dct:trellis=1:no-fast-pskip=1:psy-rd=1,1" forKey:@"x264Option"]; /* Video quality */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; [preset setObject:@"700" forKey:@"VideoTargetSize"]; - [preset setObject:@"2000" forKey:@"VideoAvgBitrate"]; + [preset setObject:@"1800" forKey:@"VideoAvgBitrate"]; [preset setObject:[NSNumber numberWithFloat:0.6471] forKey:@"VideoQualitySlider"]; /* Video framerate */ @@ -1605,7 +1519,7 @@ [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; /* x264 Option String */ - [preset setObject:@"ref=3:mixed-refs:bframes=6:subme=7:weightb:direct=auto:b-pyramid:me=umh:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip" forKey:@"x264Option"]; + [preset setObject:@"ref=3:mixed-refs:bframes=6:weightb:direct=auto:b-pyramid:me=umh:subme=9:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip=1:psy-rd=1,1" forKey:@"x264Option"]; /* Video quality */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"]; @@ -1629,15 +1543,16 @@ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PicturePAR"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:3] forKey:@"PictureDeinterlace"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDenoise"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecomb"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"VFR"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDetelecine"]; /* Set crop settings here */ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ |