diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 75 | ||||
-rw-r--r-- | macosx/Controller.m | 1203 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.xib | 235 | ||||
-rw-r--r-- | macosx/English.lproj/Presets.xib | 154 | ||||
-rw-r--r-- | macosx/HBPreset.h | 39 | ||||
-rw-r--r-- | macosx/HBPreset.m | 141 | ||||
-rw-r--r-- | macosx/HBPresets.h | 33 | ||||
-rw-r--r-- | macosx/HBPresets.m | 1420 | ||||
-rw-r--r-- | macosx/HBPresetsManager.h | 74 | ||||
-rw-r--r-- | macosx/HBPresetsManager.m | 1742 | ||||
-rw-r--r-- | macosx/HBPresetsViewController.h | 34 | ||||
-rw-r--r-- | macosx/HBPresetsViewController.m | 396 | ||||
-rw-r--r-- | macosx/HBViewValidation.h | 15 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 38 |
14 files changed, 2890 insertions, 2709 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 89f62d82d..037671f14 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -21,7 +21,6 @@ #import "HBChapterTitlesController.h" #import "HBPreferencesController.h" -#import "HBPresets.h" extern NSString *HBContainerChangedNotification; extern NSString *keyContainerTag; @@ -29,17 +28,10 @@ extern NSString *HBTitleChangedNotification; extern NSString *keyTitleTag; @class HBOutputPanelController; +@class HBPresetsViewController; +@class HBPresetsManager; @class DockTextField; -/* We subclass NSView so that our drags show both the icon as well as PresetName columns */ -@interface HBPresetsOutlineView : NSOutlineView -{ - -BOOL fIsDragging; - -} -@end - @interface HBController : NSObject <GrowlApplicationBridgeDelegate, HBPictureControllerDelegate, NSToolbarDelegate, NSDrawerDelegate> { NSImage * fApplicationIcon; @@ -155,7 +147,9 @@ BOOL fIsDragging; NSInteger currentQueueEncodeIndex; // Used to track the currently encoding queueu item /* User Preset variables here */ - HBPresets * fPresetsBuiltin; + HBPresetsManager * presetManager; + HBPresetsViewController * fPresetsView; + IBOutlet NSDrawer * fPresetDrawer; IBOutlet NSTextField * fPresetNewName; IBOutlet NSTextField * fPresetNewDesc; @@ -163,28 +157,11 @@ BOOL fIsDragging; IBOutlet NSTextField * fPresetNewPicWidth; IBOutlet NSTextField * fPresetNewPicHeight; IBOutlet NSBox * fPresetNewPicWidthHeightBox; - + IBOutlet NSButton * fPresetNewPicFiltersCheck; - IBOutlet NSButton * fPresetNewFolderCheck; IBOutlet NSTextField * fPresetSelectedDisplay; - - NSString * UserPresetsFile; - NSMutableArray * UserPresets; - NSMutableArray * UserPresetssortedArray; - NSMutableDictionary * chosenPreset; - - 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; - - /* NSOutline View for the presets */ - NSArray *fDraggedNodes; - IBOutlet HBPresetsOutlineView * fPresetsOutlineView; - IBOutlet NSButton * fPresetsAdd; - IBOutlet NSButton * fPresetsDelete; hb_handle_t * fHandle; @@ -316,57 +293,23 @@ BOOL fIsDragging; - (IBAction) openUserGuide: (id) sender; // Preset Methods Here - -/* These are required by the NSOutlineView Datasource Delegate */ -/* We use this to deterimine children of an item */ -- (id)outlineView:(NSOutlineView *)fPresetsOutlineView child:(NSInteger)index ofItem:(id)item; -/* We use this to determine if an item should be expandable */ -- (BOOL)outlineView:(NSOutlineView *)fPresetsOutlineView isItemExpandable:(id)item; -/* used to specify the number of levels to show for each item */ -- (NSInteger)outlineView:(NSOutlineView *)fPresetsOutlineView numberOfChildrenOfItem:(id)item; -/* Used to tell the outline view which information is to be displayed per item */ -- (id)outlineView:(NSOutlineView *)fPresetsOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item; -/* Use to customize the font and display characteristics of the title cell */ -- (void)outlineView:(NSOutlineView *)fPresetsOutlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item; -/* We use this to edit the name field in the outline view */ -- (void)outlineView:(NSOutlineView *)fPresetsOutlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item; -/* We use this to provide tooltips for the items in the presets outline view */ -- (NSString *)outlineView:(NSOutlineView *)fPresetsOutlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc item:(id)item mouseLocation:(NSPoint)mouseLocation; -- (void) checkBuiltInsForUpdates; -/* We use this to actually select the preset and act accordingly */ -- (IBAction)selectPreset:(id)sender; - -@property (nonatomic, readonly) BOOL hasValidPresetSelected; -- (id)selectedPreset; +- (void)applyPreset; /* Export / Import Presets */ - (IBAction) browseExportPresetFile: (id) sender; -- (void) browseExportPresetFileDone: (NSSavePanel *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo; - - (IBAction) browseImportPresetFile: (id) sender; -- (void) browseImportPresetDone: (NSSavePanel *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo; /* Manage User presets */ -- (void) loadPresets; - (IBAction) customSettingUsed: (id) sender; - (IBAction) showAddPresetPanel: (id) sender; - (IBAction) addPresetPicDropdownChanged: (id) sender; - (IBAction) closeAddPresetPanel: (id) sender; - (NSDictionary *)createPreset; -- (IBAction)setDefaultPreset:(id)sender; - (IBAction)selectDefaultPreset:(id)sender; -- (void) savePreset; -- (void)sortPresets; - (IBAction)addFactoryPresets:(id)sender; - (IBAction)deleteFactoryPresets:(id)sender; - (IBAction)addUserPreset:(id)sender; -- (void)addPreset; -- (IBAction)insertPreset:(id)sender; -- (IBAction)deletePreset:(id)sender; -- (IBAction)getDefaultPresets:(id)sender; -(void)sendToMetaX:(NSString *) filePath; // Growl methods @@ -378,8 +321,6 @@ BOOL fIsDragging; - (void) prepareJobForPreview; - (void) remindUserOfSleepOrShutdown; -- (void)moveObjectsInPresetsArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex; - - (int) hbInstances; // Drag & Drop methods diff --git a/macosx/Controller.m b/macosx/Controller.m index de0713aca..77e8e9e35 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -9,11 +9,13 @@ #import "HBOutputPanelController.h" #import "HBPreferencesController.h" #import "HBDVDDetector.h" -#import "HBPresets.h" +#import "HBPresetsManager.h" #import "HBPreviewController.h" #import "DockTextField.h" #import "HBUtilities.h" +#import "HBPresetsViewController.h" + #import "HBAudioSettings.h" NSString *HBContainerChangedNotification = @"HBContainerChangedNotification"; @@ -23,8 +25,6 @@ NSString *keyTitleTag = @"keyTitleTag"; NSString *dragDropFiles = @"dragDropFiles"; -#define DragDropSimplePboardType @"MyCustomOutlineViewPboardType" - NSString *dockTilePercentFormat = @"%2.1f%%"; // DockTile update freqency in total percent increment #define dockTileUpdateFrequency 0.1f @@ -40,6 +40,8 @@ static NSString * ShowPreviewIdentifier = @"Show Preview Win static NSString * ShowActivityIdentifier = @"Debug Output Item Identifier"; static NSString * ChooseSourceIdentifier = @"Choose Source Item Identifier"; +@interface HBController () <HBPresetsViewControllerDelegate> +@end /******************************* * HBController implementation * @@ -75,11 +77,11 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It outputPanel = [[HBOutputPanelController alloc] init]; fPictureController = [[HBPictureController alloc] init]; fQueueController = [[HBQueueController alloc] init]; - /* we init the HBPresets class which currently is only used - * for updating built in presets, may move more functionality - * there in the future - */ - fPresetsBuiltin = [[HBPresets alloc] init]; + + /* we init the HBPresetsManager class */ + NSURL *presetsURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"UserPresets.plist"]]; + presetManager = [[HBPresetsManager alloc] initWithURL:presetsURL]; + fPreferencesController = [[HBPreferencesController alloc] init]; /* Lets report the HandBrake version number here to the activity log and text log file */ NSString *versionStringFull = [[NSString stringWithFormat: @"Handbrake Version: %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]] stringByAppendingString: [NSString stringWithFormat: @" (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]]; @@ -103,6 +105,14 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It [iv addSubview:timeField]; [self updateDockIcon:-1.0 withETA:@""]; + + /* Init libhb with check for updates libhb style set to "0" so its ignored and lets sparkle take care of it */ + int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; + fHandle = hb_init(loggingLevel, 0); + /* Optional dvd nav UseDvdNav*/ + hb_dvd_set_dvdnav([[[NSUserDefaults standardUserDefaults] objectForKey:@"UseDvdNav"] boolValue]); + /* Init a separate instance of libhb for user scanning and setting up jobs */ + fQueueEncodeLibhb = hb_init(loggingLevel, 0); return self; } @@ -171,14 +181,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It - (void) applicationDidFinishLaunching: (NSNotification *) notification { - /* Init libhb with check for updates libhb style set to "0" so its ignored and lets sparkle take care of it */ - int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; - fHandle = hb_init(loggingLevel, 0); - /* Optional dvd nav UseDvdNav*/ - hb_dvd_set_dvdnav([[[NSUserDefaults standardUserDefaults] objectForKey:@"UseDvdNav"] boolValue]); - /* Init a separate instance of libhb for user scanning and setting up jobs */ - fQueueEncodeLibhb = hb_init(loggingLevel, 0); - // Set the Growl Delegate [GrowlApplicationBridge setGrowlDelegate: self]; /* Init others controllers */ @@ -188,55 +190,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It [fQueueController setHandle: fQueueEncodeLibhb]; [fQueueController setHBController: self]; - // Set up the chapters title view - fChapterTitlesController = [[HBChapterTitlesController alloc] init]; - [fChaptersTitlesView addSubview: [fChapterTitlesController view]]; - - // make sure we automatically resize the controller's view to the current window size - [[fChapterTitlesController view] setFrame: [fChaptersTitlesView bounds]]; - [[fChapterTitlesController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; - - // setup the subtitles view - fSubtitlesViewController = [[HBSubtitlesController alloc] init]; - [fSubtitlesView addSubview: [fSubtitlesViewController view]]; - - // make sure we automatically resize the controller's view to the current window size - [[fSubtitlesViewController view] setFrame: [fSubtitlesView bounds]]; - [[fSubtitlesViewController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; - - // setup the audio controller - fAudioController = [[HBAudioController alloc] init]; - [fAudioView addSubview: [fAudioController view]]; - - // make sure we automatically resize the controller's view to the current window size - [[fAudioController view] setFrame: [fAudioView bounds]]; - [[fAudioController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; - - // setup the advanced view controller - fAdvancedOptions = [[HBAdvancedController alloc] init]; - [fAdvancedView addSubview: [fAdvancedOptions view]]; - - // make sure we automatically resize the controller's view to the current window size - [[fAudioController view] setFrame: [fAudioView bounds]]; - [[fAudioController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; - - // setup the video view controller - fVideoController = [[HBVideoController alloc] init]; - fVideoController.fAdvancedOptions = fAdvancedOptions; - fVideoController.fHBController = self; - [fVideoView addSubview: [fVideoController view]]; - - // make sure we automatically resize the controller's view to the current window size - [[fVideoController view] setFrame: [fVideoView bounds]]; - [[fVideoController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; - - [fWindow recalculateKeyViewLoop]; - [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(autoSetM4vExtension:) name: HBMixdownChangedNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateMp4Checkboxes:) name: HBVideoEncoderChangedNotification object: nil]; - - [fPresetsOutlineView setAutosaveName:@"Presets View"]; - [fPresetsOutlineView setAutosaveExpandedItems:YES]; dockIconProgress = 0; @@ -587,7 +542,9 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It // When the application is closed and we still have some files in the dragDropFiles array // it's highly probable that the user throw a lot of files and just want to reset this [[NSUserDefaults standardUserDefaults] removeObjectForKey:dragDropFiles]; - + + [presetManager savePresets]; + [self closeQueueFSEvent]; [currentQueueEncodeNameString release]; [browsedSourceDisplayName release]; @@ -608,19 +565,12 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It { [fWindow center]; [fWindow setExcludedFromWindowsMenu:NO]; - - /* lets setup our presets drawer for drag and drop here */ - [fPresetsOutlineView registerForDraggedTypes: [NSArray arrayWithObject:DragDropSimplePboardType] ]; - [fPresetsOutlineView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES]; - [fPresetsOutlineView setVerticalMotionCanBeginDrag: YES]; /* Initialize currentScanCount so HB can use it to evaluate successive scans */ currentScanCount = 0; - - - /* Init UserPresets .plist */ - [self loadPresets]; + + [self checkBuiltInsForUpdates]; fRipIndicatorShown = NO; // initially out of view in the nib @@ -696,13 +646,62 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It [self setupToolbar]; - /* lets get our default prefs here */ - [self getDefaultPresets:nil]; /* lets initialize the current successful scancount here to 0 */ currentSuccessfulScanCount = 0; - + /* Register HBController's Window as a receiver for files/folders drag & drop operations */ [fWindow registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]]; + + // Set up the preset drawer + fPresetsView = [[HBPresetsViewController alloc] initWithPresetManager:presetManager]; + [fPresetDrawer setContentView:[fPresetsView view]]; + fPresetsView.delegate = self; + + [[fPresetDrawer contentView] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; + + // Set up the chapters title view + fChapterTitlesController = [[HBChapterTitlesController alloc] init]; + [fChaptersTitlesView addSubview: [fChapterTitlesController view]]; + + // make sure we automatically resize the controller's view to the current window size + [[fChapterTitlesController view] setFrame: [fChaptersTitlesView bounds]]; + [[fChapterTitlesController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; + + // setup the subtitles view + fSubtitlesViewController = [[HBSubtitlesController alloc] init]; + [fSubtitlesView addSubview: [fSubtitlesViewController view]]; + + // make sure we automatically resize the controller's view to the current window size + [[fSubtitlesViewController view] setFrame: [fSubtitlesView bounds]]; + [[fSubtitlesViewController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; + + // setup the audio controller + fAudioController = [[HBAudioController alloc] init]; + [fAudioView addSubview: [fAudioController view]]; + + // make sure we automatically resize the controller's view to the current window size + [[fAudioController view] setFrame: [fAudioView bounds]]; + [[fAudioController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; + + // setup the advanced view controller + fAdvancedOptions = [[HBAdvancedController alloc] init]; + [fAdvancedView addSubview: [fAdvancedOptions view]]; + + // make sure we automatically resize the controller's view to the current window size + [[fAudioController view] setFrame: [fAudioView bounds]]; + [[fAudioController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; + + // setup the video view controller + fVideoController = [[HBVideoController alloc] init]; + fVideoController.fAdvancedOptions = fAdvancedOptions; + fVideoController.fHBController = self; + [fVideoView addSubview: [fVideoController view]]; + + // make sure we automatically resize the controller's view to the current window size + [[fVideoController view] setFrame: [fVideoView bounds]]; + [[fVideoController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )]; + + [fWindow recalculateKeyViewLoop]; } - (void) enableUI: (BOOL) b @@ -713,8 +712,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It fSrcChapterStartPopUp, fSrcChapterToField, fSrcChapterEndPopUp, fSrcDuration1Field, fSrcDuration2Field, fDstFormatField, fDstFormatPopUp, fDstFile1Field, fDstFile2Field, - fDstBrowseButton, fPresetsAdd, fPresetsDelete, fSrcAngleLabel, - fSrcAnglePopUp, fDstMp4LargeFileCheck, fPresetsOutlineView, + fDstBrowseButton, fSrcAngleLabel, + fSrcAnglePopUp, fDstMp4LargeFileCheck, fDstMp4HttpOptFileCheck, fDstMp4iPodFileCheck, fEncodeStartStopPopUp, fSrcTimeStartEncodingField, fSrcTimeEndEncodingField, fSrcFrameStartEncodingField, @@ -743,11 +742,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* we also call calculatePictureSizing here to sense check if we already have vfr selected ??? */ [self pictureSettingsDidChange]; } - else - { - [fPresetsOutlineView setEnabled: NO]; - } + [fPresetsView setEnabled:b]; [fVideoController enableUI:b]; [fChapterTitlesController enableUI:b]; [fSubtitlesViewController enableUI:b]; @@ -1491,7 +1487,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It return [fWindow attachedSheet] == nil; } if (action == @selector(selectDefaultPreset:)) - return [fPresetsOutlineView selectedRow] >= 0 && [fWindow attachedSheet] == nil; + return [fWindow attachedSheet] == nil; if (action == @selector(Pause:)) { if (s.state == HB_STATE_WORKING) @@ -1527,10 +1523,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It return NO; } } - if( action == @selector(setDefaultPreset:) ) - { - return [fPresetsOutlineView selectedRow] != -1; - } return YES; } @@ -2521,8 +2513,8 @@ fWorkingCount = 0; /* Lets get the preset info if there is any */ [queueFileJob setObject:[fPresetSelectedDisplay stringValue] forKey:@"PresetName"]; - [queueFileJob setObject:[NSNumber numberWithInteger:[fPresetsOutlineView selectedRow]] forKey:@"PresetIndexNum"]; - + [queueFileJob setObject:[NSNumber numberWithInteger:fPresetsView.indexOfSelectedItem] forKey:@"PresetIndexNum"]; + [queueFileJob setObject:[fDstFormatPopUp titleOfSelectedItem] forKey:@"FileFormat"]; /* Chapter Markers*/ /* If we are encoding by chapters and we have only one chapter or a title without chapters, set chapter markers to off. @@ -3041,24 +3033,15 @@ fWorkingCount = 0; /* we call SetTitle: in fPictureController so we get an instant update in the Picture Settings window */ [fPictureController setTitle:fTitle]; [self pictureSettingsDidChange]; - - /* somehow we need to figure out a way to tie the queue item to a preset if it used one */ - //[queueFileJob setObject:[fPresetSelectedDisplay stringValue] forKey:@"PresetName"]; - //[queueFileJob setObject:[NSNumber numberWithInt:[fPresetsOutlineView selectedRow]] forKey:@"PresetIndexNum"]; + if ([queueToApply objectForKey:@"PresetIndexNum"]) // This item used a preset so insert that info { - /* Deselect the currently selected Preset if there is one*/ - //[fPresetsOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[[queueToApply objectForKey:@"PresetIndexNum"] intValue]] byExtendingSelection:NO]; - //[self selectPreset:nil]; - - //[fPresetsOutlineView selectRow:[[queueToApply objectForKey:@"PresetIndexNum"] intValue]]; - /* Change UI to show "Custom" settings are being used */ - //[fPresetSelectedDisplay setStringValue: [[queueToApply objectForKey:@"PresetName"] stringValue]]; + /* somehow we need to figure out a way to tie the queue item to a preset if it used one */ } else { /* Deselect the currently selected Preset if there is one*/ - [fPresetsOutlineView deselectRow:[fPresetsOutlineView selectedRow]]; + [fPresetsView deselect]; /* Change UI to show "Custom" settings are being used */ [fPresetSelectedDisplay setStringValue: @"Custom"]; } @@ -4422,7 +4405,7 @@ fWorkingCount = 0; } /* lets call tableViewSelected to make sure that any preset we have selected is enforced after a title change */ - [self selectPreset:nil]; + [self applyPreset]; } - (IBAction) encodeStartStopPopUpChanged: (id) sender; @@ -4636,7 +4619,7 @@ the user is using "Custom" settings by determining the sender*/ if ([sender stringValue]) { /* Deselect the currently selected Preset if there is one*/ - [fPresetsOutlineView deselectRow:[fPresetsOutlineView selectedRow]]; + [fPresetsView deselect]; /* Change UI to show "Custom" settings are being used */ [fPresetSelectedDisplay setStringValue: @"Custom"]; } @@ -4911,337 +4894,17 @@ the user is using "Custom" settings by determining the sender*/ [fPictureController showPreviewWindow:sender]; } -#pragma mark - -#pragma mark Preset Outline View Methods -#pragma mark - Required -/* These are required by the NSOutlineView Datasource Delegate */ - +#pragma mark - Preset Methods -/* used to specify the number of levels to show for each item */ -- (NSInteger)outlineView:(NSOutlineView *)fPresetsOutlineView numberOfChildrenOfItem:(id)item +- (void)applyPreset { - /* 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 -{ - - /* 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] <= (NSUInteger) 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; -} - -/* We use this to determine if an item should be expandable */ -- (BOOL)outlineView:(NSOutlineView *)fPresetsOutlineView isItemExpandable:(id)item -{ - /* 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 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 -{ - /* We have two columns right now, icon and PresetName */ - - if ([[tableColumn identifier] isEqualToString:@"PresetName"]) - { - return [item objectForKey:@"PresetName"]; - } - else - { - //return @""; - return nil; - } -} - -- (id)outlineView:(NSOutlineView *)outlineView itemForPersistentObject:(id)object -{ - return [NSKeyedUnarchiver unarchiveObjectWithData:object]; -} -- (id)outlineView:(NSOutlineView *)outlineView persistentObjectForItem:(id)item -{ - return [NSKeyedArchiver archivedDataWithRootObject:item]; -} - -#pragma mark - Added Functionality (optional) -/* Use to customize the font and display characteristics of the title cell */ -- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item -{ - if ([[tableColumn identifier] isEqualToString:@"PresetName"]) - { - NSFont *txtFont; - NSColor *fontColor; - txtFont = [NSFont systemFontOfSize: [NSFont smallSystemFontSize]]; - /*check to see if its a selected row */ - if ([fPresetsOutlineView selectedRow] == [fPresetsOutlineView rowForItem:item]) - { - fontColor = [NSColor blackColor]; - } - else - { - if ([[item objectForKey:@"Type"] intValue] == 0) - { - fontColor = [NSColor blueColor]; - } - else // User created preset, use a black font - { - fontColor = [NSColor blackColor]; - } - /* check to see if its a folder */ - //if ([[item objectForKey:@"Folder"] intValue] == 1) - //{ - //fontColor = [NSColor greenColor]; - //} - - - } - /* We use bold text for the default preset */ - if (presetUserDefault == nil && // no User default found - [[item objectForKey:@"Default"] intValue] == 1)// 1 is HB default - { - txtFont = [NSFont boldSystemFontOfSize: [NSFont smallSystemFontSize]]; - } - if ([[item objectForKey:@"Default"] intValue] == 2)// 2 is User default - { - txtFont = [NSFont boldSystemFontOfSize: [NSFont smallSystemFontSize]]; - } - - - [cell setTextColor:fontColor]; - [cell setFont:txtFont]; - - } -} - -/* We use this to edit the name field in the outline view */ -- (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item -{ - if ([[tableColumn identifier] isEqualToString:@"PresetName"]) - { - id theRecord; - - theRecord = item; - [theRecord setObject:object forKey:@"PresetName"]; - - [self sortPresets]; - - [fPresetsOutlineView reloadData]; - /* We save all of the preset data here */ - [self savePreset]; - } -} -/* We use this to provide tooltips for the items in the presets outline view */ -- (NSString *)outlineView:(NSOutlineView *)fPresetsOutlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc item:(id)item mouseLocation:(NSPoint)mouseLocation -{ - //if ([[tc identifier] isEqualToString:@"PresetName"]) - //{ - /* initialize the tooltip contents variable */ - NSString *loc_tip; - /* if there is a description for the preset, we show it in the tooltip */ - if ([item objectForKey:@"PresetDescription"]) - { - loc_tip = [item objectForKey:@"PresetDescription"]; - return (loc_tip); - } - else - { - loc_tip = @"No description available"; - } - return (loc_tip); - //} -} - -- (void) outlineViewSelectionDidChange: (NSNotification *) ignored - -{ - [self willChangeValueForKey: @"hasValidPresetSelected"]; - [self didChangeValueForKey: @"hasValidPresetSelected"]; - return; -} - -#pragma mark - -#pragma mark Preset Outline View Methods (dragging related) - - -- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard -{ - // Dragging is only allowed for custom presets. - //[[[self selectedPreset] objectForKey:@"Default"] intValue] != 1 - if ([[[self selectedPreset] objectForKey:@"Type"] intValue] == 0) // 0 is built in preset - { - return NO; - } - // Don't retain since this is just holding temporaral drag information, and it is - //only used during a drag! We could put this in the pboard actually. - fDraggedNodes = items; - // Provide data for our custom type, and simple NSStrings. - [pboard declareTypes:[NSArray arrayWithObjects: DragDropSimplePboardType, nil] owner:self]; - - // the actual data doesn't matter since DragDropSimplePboardType drags aren't recognized by anyone but us!. - [pboard setData:[NSData data] forType:DragDropSimplePboardType]; - - return YES; -} - -- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)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) - { - index = [fPresetsOutlineView rowForItem: item] + 1; - item = nil; - } - - // Don't allow dropping into the Built In Presets. - if (index < presetCurrentBuiltInCount) - { - return NSDragOperationNone; - index = MAX (index, presetCurrentBuiltInCount); - } - - [outlineView setDropItem:item dropChildIndex:index]; - return NSDragOperationGeneric; -} - - - -- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index -{ - /* 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 = [[fPresetsOutlineView itemAtRow:index] objectForKey:@"ChildrenArray"]; - [childrenArray addObject:item]; - [[fPresetsOutlineView itemAtRow:index] setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; - } - 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]; - } - [fPresetsOutlineView reloadData]; - [self savePreset]; - return YES; -} - -- (void)moveObjectsInPresetsArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex -{ - NSUInteger index = [indexSet lastIndex]; - NSUInteger aboveInsertIndexCount = 0; - - NSUInteger removeIndex; - - if (index >= insertIndex) - { - removeIndex = index + aboveInsertIndexCount; - aboveInsertIndexCount++; - } - else - { - removeIndex = index; - insertIndex--; - } - - id object = [[array objectAtIndex:removeIndex] retain]; - [array removeObjectAtIndex:removeIndex]; - [array insertObject:object atIndex:insertIndex]; - [object release]; -} - - - -#pragma mark - Functional Preset NSOutlineView Methods - -- (IBAction)selectPreset:(id)sender -{ - if (YES == [self hasValidPresetSelected]) + if (fPresetsView.selectedPreset != nil) { hb_job_t * job = fTitle->job; // for mapping names via libhb const char *strValue; - chosenPreset = [self selectedPreset]; + NSDictionary *chosenPreset = [fPresetsView.selectedPreset content]; [fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]]; if ([[chosenPreset objectForKey:@"Default"] intValue] == 1) @@ -5494,82 +5157,33 @@ return YES; [self pictureSettingsDidChange]; } +#pragma mark - Presets View Controller Delegate -- (BOOL)hasValidPresetSelected +- (void)selectionDidChange { - return ([fPresetsOutlineView selectedRow] >= 0 && [[[self selectedPreset] objectForKey:@"Folder"] intValue] != 1); + [self applyPreset]; } - -- (id)selectedPreset -{ - return [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]; -} - - #pragma mark - #pragma mark Manage Presets -- (void) loadPresets { - /* We declare the default NSFileManager into fileManager */ - NSFileManager * fileManager = [NSFileManager defaultManager]; - /* We define the location of the user presets file */ - UserPresetsFile = [[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"UserPresets.plist"] retain]; - /* We check for the presets.plist */ - if ([fileManager fileExistsAtPath:UserPresetsFile] == 0) - { - [fileManager createFileAtPath:UserPresetsFile contents:nil attributes:nil]; - } - - UserPresets = [[NSMutableArray alloc] initWithContentsOfFile:UserPresetsFile]; - if (nil == UserPresets) - { - UserPresets = [[NSMutableArray alloc] init]; - [self addFactoryPresets:nil]; - } - [fPresetsOutlineView reloadData]; - - [self checkBuiltInsForUpdates]; -} - -- (void) checkBuiltInsForUpdates { - - BOOL updateBuiltInPresets = NO; - int i = 0; - NSEnumerator *enumerator = [UserPresets objectEnumerator]; - id tempObject; - while (tempObject = [enumerator nextObject]) - { - /* iterate through the built in presets to see if any have an old build number */ - NSMutableDictionary *thisPresetDict = tempObject; - /*Key Type == 0 is built in, and key PresetBuildNumber is the build number it was created with */ - if ([[thisPresetDict objectForKey:@"Type"] intValue] == 0) - { - if (![thisPresetDict objectForKey:@"PresetBuildNumber"] || [[thisPresetDict objectForKey:@"PresetBuildNumber"] intValue] < [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]) - { - updateBuiltInPresets = YES; - } - } - i++; - } +- (void) checkBuiltInsForUpdates +{ /* if we have built in presets to update, then do so AlertBuiltInPresetUpdate*/ - if ( updateBuiltInPresets == YES) + if ([presetManager checkBuiltInsForUpdates]) { if( [[NSUserDefaults standardUserDefaults] boolForKey:@"AlertBuiltInPresetUpdate"] == YES) { /* Show an alert window that built in presets will be updated */ /*On Screen Notification*/ - NSBeep(); NSRunAlertPanel(@"HandBrake has determined your built in presets are out of date…",@"HandBrake will now update your built-in presets.", @"OK", nil, nil); [NSApp requestUserAttention:NSCriticalRequest]; } /* when alert is dismissed, go ahead and update the built in presets */ - [self addFactoryPresets:nil]; + [presetManager generateBuiltInPresets]; } - } - - (IBAction) addPresetPicDropdownChanged: (id) sender { if ([[fPresetNewPicSettingsPopUp selectedItem] tag] == 1) @@ -5584,9 +5198,6 @@ return YES; - (IBAction) showAddPresetPanel: (id) sender { - /* Deselect the currently selected Preset if there is one*/ - [fPresetsOutlineView deselectRow:[fPresetsOutlineView selectedRow]]; - /* * Populate the preset picture settings popup. * @@ -5612,8 +5223,6 @@ return YES; [fPresetNewPicSettingsPopUp selectItemWithTag: (1 + (fTitle->job->anamorphic.mode == HB_ANAMORPHIC_STRICT))]; /* Save the current filters in the preset by default */ [fPresetNewPicFiltersCheck setState:NSOnState]; - // fPresetNewFolderCheck - [fPresetNewFolderCheck setState:NSOffState]; /* Erase info from the input fields*/ [fPresetNewName setStringValue: @""]; [fPresetNewDesc setStringValue: @""]; @@ -5636,55 +5245,17 @@ return YES; - (IBAction)addUserPreset:(id)sender { if (![[fPresetNewName stringValue] length]) + { NSRunAlertPanel(@"Warning!", @"You need to insert a name for the preset.", @"OK", nil , nil); + } else { /* Here we create a custom user preset */ - [UserPresets addObject:[self createPreset]]; - [self addPreset]; + [presetManager addPreset:[self createPreset]]; [self closeAddPresetPanel:nil]; } } -- (void)addPreset -{ - - - /* We Reload the New Table data for presets */ - [fPresetsOutlineView reloadData]; - /* We save all of the preset data here */ - [self savePreset]; -} - -- (void)sortPresets -{ - - - /* We Sort the Presets By Factory or Custom */ - NSSortDescriptor * presetTypeDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"Type" - ascending:YES] autorelease]; - /* We Sort the Presets Alphabetically by name We do not use this now as we have drag and drop*/ - /* - NSSortDescriptor * presetNameDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"PresetName" - ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease]; - //NSArray *sortDescriptors=[NSArray arrayWithObjects:presetTypeDescriptor,presetNameDescriptor,nil]; - - */ - /* Since we can drag and drop our custom presets, lets just sort by type and not name */ - NSArray *sortDescriptors=[NSArray arrayWithObjects:presetTypeDescriptor,nil]; - NSArray *sortedArray=[UserPresets sortedArrayUsingDescriptors:sortDescriptors]; - [UserPresets setArray:sortedArray]; - - -} - -- (IBAction)insertPreset:(id)sender -{ - NSInteger index = [fPresetsOutlineView selectedRow]; - [UserPresets insertObject:[self createPreset] atIndex:index]; - [fPresetsOutlineView reloadData]; - [self savePreset]; -} - (NSDictionary *)createPreset { @@ -5695,199 +5266,125 @@ return YES; /* 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"]; + [preset setObject:[NSNumber numberWithBool:NO] 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"]; - if ([fPresetNewFolderCheck state] == YES) - { - /* 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]; - } - else // we are not creating a preset folder, so we go ahead with the rest of the preset info - { - /*Get the whether or not to apply pic Size and Cropping (includes Anamorphic)*/ - [preset setObject:[NSNumber numberWithInteger:[[fPresetNewPicSettingsPopUp selectedItem] tag]] forKey:@"UsesPictureSettings"]; - /* Get whether or not to use the current Picture Filter settings for the preset */ - [preset setObject:[NSNumber numberWithInteger:[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:@(fChapterTitlesController.createChapterMarkers) forKey:@"ChapterMarkers"]; - /* Allow Mpeg4 64 bit formatting +4GB file sizes */ - [preset setObject:[NSNumber numberWithInteger:[fDstMp4LargeFileCheck state]] forKey:@"Mp4LargeFile"]; - /* Mux mp4 with http optimization */ - [preset setObject:[NSNumber numberWithInteger:[fDstMp4HttpOptFileCheck state]] forKey:@"Mp4HttpOptimize"]; - /* Add iPod uuid atom */ - [preset setObject:[NSNumber numberWithInteger:[fDstMp4iPodFileCheck state]] forKey:@"Mp4iPodCompatible"]; - - /* Codecs */ - /* Video encoder */ - [fVideoController prepareVideoForPreset:preset]; + /*Get the whether or not to apply pic Size and Cropping (includes Anamorphic)*/ + [preset setObject:[NSNumber numberWithInteger:[[fPresetNewPicSettingsPopUp selectedItem] tag]] forKey:@"UsesPictureSettings"]; + /* Get whether or not to use the current Picture Filter settings for the preset */ + [preset setObject:[NSNumber numberWithInteger:[fPresetNewPicFiltersCheck state]] forKey:@"UsesPictureFilters"]; - /*Picture Settings*/ - hb_job_t * job = fTitle->job; - - /* Picture Sizing */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:[fPresetNewPicWidth intValue]] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:[fPresetNewPicHeight intValue]] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.keep_display_aspect] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PictureModulus"]; - - /* 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 numberWithInteger:[fPictureController useDecomb]] forKey:@"PictureDecombDeinterlace"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"]; - [preset setObject:[fPictureController deinterlaceCustomString] forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController detelecine]] forKey:@"PictureDetelecine"]; - [preset setObject:[fPictureController detelecineCustomString] forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController denoise]] forKey:@"PictureDenoise"]; - [preset setObject:[fPictureController denoiseCustomString] forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController deblock]] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController decomb]] forKey:@"PictureDecomb"]; - [preset setObject:[fPictureController decombCustomString] forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController grayscale]] forKey:@"VideoGrayScale"]; + /* 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:@(fChapterTitlesController.createChapterMarkers) forKey:@"ChapterMarkers"]; + /* Allow Mpeg4 64 bit formatting +4GB file sizes */ + [preset setObject:[NSNumber numberWithInteger:[fDstMp4LargeFileCheck state]] forKey:@"Mp4LargeFile"]; + /* Mux mp4 with http optimization */ + [preset setObject:[NSNumber numberWithInteger:[fDstMp4HttpOptFileCheck state]] forKey:@"Mp4HttpOptimize"]; + /* Add iPod uuid atom */ + [preset setObject:[NSNumber numberWithInteger:[fDstMp4iPodFileCheck state]] forKey:@"Mp4iPodCompatible"]; + + /* Codecs */ + /* Video encoder */ + [fVideoController prepareVideoForPreset:preset]; - /* Audio */ - [fAudioController.settings prepareAudioForPreset:preset]; + /*Picture Settings*/ + hb_job_t * job = fTitle->job; + + /* Picture Sizing */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:[fPresetNewPicWidth intValue]] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:[fPresetNewPicHeight intValue]] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.keep_display_aspect] forKey:@"PictureKeepRatio"]; + [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PictureModulus"]; - /* Subtitles */ - [fSubtitlesViewController prepareSubtitlesForPreset:preset]; - } - [preset autorelease]; - return preset; + /* 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 numberWithInteger:[fPictureController useDecomb]] forKey:@"PictureDecombDeinterlace"]; + [preset setObject:[NSNumber numberWithInteger:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"]; + [preset setObject:[fPictureController deinterlaceCustomString] forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInteger:[fPictureController detelecine]] forKey:@"PictureDetelecine"]; + [preset setObject:[fPictureController detelecineCustomString] forKey:@"PictureDetelecineCustom"]; + [preset setObject:[NSNumber numberWithInteger:[fPictureController denoise]] forKey:@"PictureDenoise"]; + [preset setObject:[fPictureController denoiseCustomString] forKey:@"PictureDenoiseCustom"]; + [preset setObject:[NSNumber numberWithInteger:[fPictureController deblock]] forKey:@"PictureDeblock"]; + [preset setObject:[NSNumber numberWithInteger:[fPictureController decomb]] forKey:@"PictureDecomb"]; + [preset setObject:[fPictureController decombCustomString] forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInteger:[fPictureController grayscale]] forKey:@"VideoGrayScale"]; -- (void)savePreset -{ - [UserPresets writeToFile:UserPresetsFile atomically:YES]; - /* We get the default preset in case it changed */ - [self getDefaultPresets:nil]; + /* Audio */ + [fAudioController.settings prepareAudioForPreset:preset]; -} + /* Subtitles */ + [fSubtitlesViewController prepareSubtitlesForPreset:preset]; -- (IBAction)deletePreset:(id)sender -{ - + [preset autorelease]; + return preset; - if ( [fPresetsOutlineView numberOfSelectedRows] == 0 ) - { - return; - } - /* Alert user before deleting preset */ - NSInteger status; - status = NSRunAlertPanel(@"Warning!", @"Are you sure that you want to delete the selected preset?", @"OK", @"Cancel", nil); - - if ( status == NSAlertDefaultReturn ) - { - NSInteger presetToModLevel = [fPresetsOutlineView levelForItem: [self selectedPreset]]; - NSDictionary *presetToMod = [self selectedPreset]; - 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 (tempObject = [enumerator nextObject]) - { - NSDictionary *thisPresetDict = tempObject; - if (thisPresetDict == presetToMod) - { - [tempArray addObject:tempObject]; - } - } - - [presetsArrayToMod removeObjectsInArray:tempArray]; - [fPresetsOutlineView reloadData]; - [self savePreset]; - } } - #pragma mark - #pragma mark Import Export Preset(s) - (IBAction) browseExportPresetFile: (id) sender { /* Open a panel to let the user choose where and how to save the export file */ - NSSavePanel * panel = [NSSavePanel savePanel]; + NSSavePanel *panel = [NSSavePanel savePanel]; /* We get the current file name and path from the destination field here */ NSString *defaultExportDirectory = [NSString stringWithFormat: @"%@/Desktop/", NSHomeDirectory()]; [panel setDirectoryURL:[NSURL fileURLWithPath:defaultExportDirectory]]; [panel setNameFieldStringValue:@"HB_Export.plist"]; [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { - [self browseExportPresetFileDone:panel returnCode: (int)result contextInfo:sender]; - }]; -} - -- (void) browseExportPresetFileDone: (NSSavePanel *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo -{ - if( returnCode == NSOKButton ) - { - NSURL *exportPresetsFile = [sheet URL]; - NSURL *presetExportDirectory = [exportPresetsFile URLByDeletingLastPathComponent]; - [[NSUserDefaults standardUserDefaults] setURL:presetExportDirectory forKey:@"LastPresetExportDirectoryURL"]; - - /* We check for the presets.plist */ - if ([[NSFileManager defaultManager] fileExistsAtPath:[exportPresetsFile path]] == 0) + if( result == NSOKButton ) { - [[NSFileManager defaultManager] createFileAtPath:[exportPresetsFile path] contents:nil attributes:nil]; - } + NSURL *exportPresetsFile = [panel URL]; + NSURL *presetExportDirectory = [exportPresetsFile URLByDeletingLastPathComponent]; + [[NSUserDefaults standardUserDefaults] setURL:presetExportDirectory forKey:@"LastPresetExportDirectoryURL"]; - NSMutableArray *presetsToExport = [[[NSMutableArray alloc] initWithContentsOfURL:exportPresetsFile] autorelease]; - if (presetsToExport == nil) - { - presetsToExport = [[NSMutableArray alloc] init]; - /* now get and add selected presets to export */ + /* We check for the presets.plist */ + if ([[NSFileManager defaultManager] fileExistsAtPath:[exportPresetsFile path]] == 0) + { + [[NSFileManager defaultManager] createFileAtPath:[exportPresetsFile path] contents:nil attributes:nil]; + } + NSMutableArray *presetsToExport = [[[NSMutableArray alloc] initWithContentsOfURL:exportPresetsFile] autorelease]; + if (presetsToExport == nil) + { + presetsToExport = [[NSMutableArray alloc] init]; + /* now get and add selected presets to export */ + } + if (fPresetsView.selectedPreset != nil) + { + [presetsToExport addObject:[fPresetsView.selectedPreset content]]; + [presetsToExport writeToURL:exportPresetsFile atomically:YES]; + } } - if ([self hasValidPresetSelected]) - { - [presetsToExport addObject:[self selectedPreset]]; - [presetsToExport writeToURL:exportPresetsFile atomically:YES]; - } - } + }]; } - -- (IBAction) browseImportPresetFile: (id) sender +- (IBAction)browseImportPresetFile:(id)sender { + NSOpenPanel *panel; - NSOpenPanel * panel; - panel = [NSOpenPanel openPanel]; - [panel setAllowsMultipleSelection: NO]; - [panel setCanChooseFiles: YES]; - [panel setCanChooseDirectories: NO ]; + [panel setAllowsMultipleSelection:NO]; + [panel setCanChooseFiles:YES]; + [panel setCanChooseDirectories:NO]; + [panel setAllowedFileTypes:@[@"plist", @"xml"]]; + NSURL *sourceDirectory; if ([[NSUserDefaults standardUserDefaults] URLForKey:@"LastPresetImportDirectoryURL"]) { @@ -5901,366 +5398,52 @@ return YES; * to evaluate whether we want to specify a title, we pass the sender in the contextInfo variable */ /* set this for allowed file types, not sure if we should allow xml or not */ - NSArray *fileTypes = [NSArray arrayWithObjects:@"plist", @"xml", nil]; [panel setDirectoryURL:sourceDirectory]; - [panel setAllowedFileTypes:fileTypes]; - [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { - [self browseImportPresetDone:panel returnCode:(int)result contextInfo:sender]; - }]; -} - -- (void) browseImportPresetDone: (NSSavePanel *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo -{ - if( returnCode == NSOKButton ) + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { - NSURL *importPresetsFile = [sheet URL]; + NSURL *importPresetsFile = [panel URL]; NSURL *importPresetsDirectory = nil;//[importPresetsFile URLByDeletingLastPathComponent]; [[NSUserDefaults standardUserDefaults] setURL:importPresetsDirectory forKey:@"LastPresetImportDirectoryURL"]; /* NOTE: here we need to do some sanity checking to verify we do not hose up our presets file */ NSMutableArray * presetsToImport = [[NSMutableArray alloc] initWithContentsOfURL:importPresetsFile]; /* iterate though the new array of presets to import and add them to our presets array */ - int i = 0; - NSEnumerator *enumerator = [presetsToImport objectEnumerator]; - id tempObject; - while (tempObject = [enumerator nextObject]) + for (id tempObject in presetsToImport) { /* make any changes to the incoming preset we see fit */ /* make sure the incoming preset is not tagged as default */ [tempObject setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; /* prepend "(imported) to the name of the incoming preset for clarification since it can be changed */ - NSString * prependedName = [@"(import) " stringByAppendingString:[tempObject objectForKey:@"PresetName"]] ; + NSString *prependedName = [@"(import) " stringByAppendingString:[tempObject objectForKey:@"PresetName"]] ; [tempObject setObject:prependedName forKey:@"PresetName"]; /* actually add the new preset to our presets array */ - [UserPresets addObject:tempObject]; - i++; + [presetManager addPreset:tempObject]; } [presetsToImport autorelease]; - [self sortPresets]; - [self addPreset]; - - } + }]; } #pragma mark - #pragma mark Manage Default Preset -- (IBAction)getDefaultPresets:(id)sender -{ - 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]) - { - NSMutableDictionary *thisPresetDict = tempObject; - if ([[thisPresetDict objectForKey:@"Default"] intValue] == 1) // 1 is HB default - { - presetHbDefault = thisPresetDict; - } - if ([[thisPresetDict objectForKey:@"Default"] intValue] == 2) // 2 is User specified default - { - 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 ([[[self selectedPreset] 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]) - { - 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"]; - } - - /* 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++; - } - - - NSInteger presetToModLevel = [fPresetsOutlineView levelForItem: [self selectedPreset]]; - NSDictionary *presetToMod = [self selectedPreset]; - NSDictionary *presetToModParent = [fPresetsOutlineView parentForItem: presetToMod]; - - - NSMutableArray *presetsArrayToMod; - - /* 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]; - 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 */ - [fPresetsOutlineView reloadData]; -} - - (IBAction)selectDefaultPreset:(id)sender { - NSMutableDictionary *presetToMod; - /* if there is a user specified default, we use it */ - if (presetUserDefault) - { - presetToMod = presetUserDefault; - } - else if (presetHbDefault) //else we use the built in default presetHbDefault - { - 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]; + [fPresetsView selectDefaultPreset]; } - #pragma mark - #pragma mark Manage Built In Presets - - (IBAction)deleteFactoryPresets:(id)sender { - //int status; - NSEnumerator *enumerator = [UserPresets objectEnumerator]; - id tempObject; - - //NSNumber *index; - NSMutableArray *tempArray; - - - tempArray = [NSMutableArray array]; - /* we look here to see if the preset is we move on to the next one */ - while ( tempObject = [enumerator nextObject] ) - { - /* if the preset is "Factory" then we put it in the array of - presets to delete */ - if ([[tempObject objectForKey:@"Type"] intValue] == 0) - { - [tempArray addObject:tempObject]; - } - } - - [UserPresets removeObjectsInArray:tempArray]; - [fPresetsOutlineView reloadData]; - [self savePreset]; - + [presetManager deleteBuiltInPresets]; } /* We use this method to recreate new, updated factory presets */ - (IBAction)addFactoryPresets:(id)sender { - - /* First, we delete any existing built in presets */ - [self deleteFactoryPresets: sender]; - /* Then we generate new built in presets programmatically with fPresetsBuiltin - * which is all setup in HBPresets.h and HBPresets.m*/ - [fPresetsBuiltin generateBuiltinPresets:UserPresets]; - /* update build number for built in presets */ - /* iterate though the new array of presets to import and add them to our presets array */ - int i = 0; - NSEnumerator *enumerator = [UserPresets objectEnumerator]; - id tempObject; - while (tempObject = [enumerator nextObject]) - { - /* Record the apps current build number in the PresetBuildNumber key */ - if ([[tempObject objectForKey:@"Type"] intValue] == 0) // Type 0 is a built in preset - { - /* Preset build number */ - [[UserPresets objectAtIndex:i] setObject:[NSNumber numberWithInt:[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]] forKey:@"PresetBuildNumber"]; - } - i++; - } - /* report the built in preset updating to the activity log */ - [HBUtilities writeToActivityLog: "built in presets updated to build number: %d", [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]]; - - [self sortPresets]; - [self addPreset]; - + [presetManager generateBuiltInPresets]; } @end - -/******************************* - * Subclass of the HBPresetsOutlineView * - *******************************/ - -@implementation HBPresetsOutlineView -- (NSImage *)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows tableColumns:(NSArray *)tableColumns event:(NSEvent*)dragEvent offset:(NSPointPointer)dragImageOffset -{ - fIsDragging = YES; - - // 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:@"PresetName"], nil]; - return [super dragImageForRowsWithIndexes:dragRows tableColumns:cols event:dragEvent offset:dragImageOffset]; -} - - - -- (void) mouseDown:(NSEvent *)theEvent -{ - [super mouseDown:theEvent]; - fIsDragging = NO; -} - - - -- (BOOL) isDragging; -{ - return fIsDragging; -} -@end diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib index 459e1327f..2c7697695 100644 --- a/macosx/English.lproj/MainMenu.xib +++ b/macosx/English.lproj/MainMenu.xib @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="14A299l" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" defaultVersion="1090" identifier="macosx"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> @@ -88,7 +88,7 @@ <textField verticalHuggingPriority="750" id="1538"> <rect key="frame" x="20" y="530" width="45" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Source:" id="4905"> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Source:" id="4905"> <font key="font" metaFont="smallSystemBold"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> @@ -104,11 +104,11 @@ </textFieldCell> </textField> <popUpButton verticalHuggingPriority="750" id="1541"> - <rect key="frame" x="55" y="501" width="323" height="15"/> + <rect key="frame" x="53" y="496" width="332" height="22"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1543" id="4908"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1543" id="4908"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> + <font key="font" metaFont="smallSystem"/> <menu key="menu" title="OtherViews" id="1542"> <items> <menuItem state="on" id="1543"/> @@ -120,11 +120,11 @@ </connections> </popUpButton> <popUpButton verticalHuggingPriority="750" id="5513"> - <rect key="frame" x="483" y="500" width="77" height="15"/> + <rect key="frame" x="512" y="496" width="84" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="clipping" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="5514"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="5514"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> + <font key="font" metaFont="smallSystem"/> <menu key="menu" title="OtherViews" id="5515"/> </popUpButtonCell> <connections> @@ -132,7 +132,7 @@ </connections> </popUpButton> <textField verticalHuggingPriority="750" id="5180"> - <rect key="frame" x="385" y="498" width="46" height="17"/> + <rect key="frame" x="410" y="501" width="46" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Angle:" id="5185"> <font key="font" metaFont="smallSystem"/> @@ -141,11 +141,11 @@ </textFieldCell> </textField> <popUpButton verticalHuggingPriority="750" id="5181"> - <rect key="frame" x="433" y="500" width="41" height="15"/> + <rect key="frame" x="456" y="496" width="44" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="5184" id="5182"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="5184" id="5182"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> + <font key="font" metaFont="smallSystem"/> <menu key="menu" title="OtherViews" id="5183"> <items> <menuItem state="on" id="5184"/> @@ -163,7 +163,7 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="1553"> - <rect key="frame" x="751" y="501" width="57" height="14"/> + <rect key="frame" x="784" y="501" width="65" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Duration:" id="4914"> <font key="font" metaFont="smallSystem"/> @@ -172,9 +172,9 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="1554"> - <rect key="frame" x="808" y="501" width="79" height="14"/> + <rect key="frame" x="849" y="501" width="99" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" id="4915"> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="00:00:00" id="4915"> <font key="font" metaFont="smallSystem"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" red="0.76630436999999996" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/> @@ -224,7 +224,7 @@ <font key="titleFont" metaFont="system"/> </box> <textField verticalHuggingPriority="750" id="1539"> - <rect key="frame" x="70" y="530" width="309" height="14.00000018353732"/> + <rect key="frame" x="70" y="530" width="341" height="14.00000018353732"/> <autoresizingMask key="autoresizingMask" flexibleMinY="YES" heightSizable="YES"/> <textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingMiddle" selectable="YES" sendsActionOnEndEditing="YES" alignment="left" id="4906"> <font key="font" metaFont="smallSystem"/> @@ -241,11 +241,11 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> - <textField verticalHuggingPriority="750" id="5491"> - <rect key="frame" x="571" y="485" width="54" height="16"/> + <textField hidden="YES" verticalHuggingPriority="750" id="5491"> + <rect key="frame" x="601" y="482" width="54" height="19"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5492"> - <font key="font" metaFont="miniSystem"/> + <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5492"> + <font key="font" metaFont="smallSystem"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -253,11 +253,11 @@ <action selector="startEndSecValueChanged:" target="240" id="5528"/> </connections> </textField> - <textField verticalHuggingPriority="750" id="5521"> - <rect key="frame" x="628" y="485" width="54" height="16"/> + <textField hidden="YES" verticalHuggingPriority="750" id="5521"> + <rect key="frame" x="658" y="482" width="54" height="19"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5522"> - <font key="font" metaFont="miniSystem"/> + <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5522"> + <font key="font" metaFont="smallSystem"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -265,11 +265,11 @@ <action selector="startEndFrameValueChanged:" target="240" id="5530"/> </connections> </textField> - <textField verticalHuggingPriority="750" id="5493"> - <rect key="frame" x="686" y="485" width="54" height="16"/> + <textField hidden="YES" verticalHuggingPriority="750" id="5493"> + <rect key="frame" x="716" y="482" width="54" height="19"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5494"> - <font key="font" metaFont="miniSystem"/> + <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5494"> + <font key="font" metaFont="smallSystem"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -277,11 +277,11 @@ <action selector="startEndSecValueChanged:" target="240" id="5529"/> </connections> </textField> - <textField verticalHuggingPriority="750" id="5523"> - <rect key="frame" x="748" y="485" width="54" height="16"/> + <textField hidden="YES" verticalHuggingPriority="750" id="5523"> + <rect key="frame" x="778" y="482" width="54" height="19"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5524"> - <font key="font" metaFont="miniSystem"/> + <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5524"> + <font key="font" metaFont="smallSystem"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -333,18 +333,18 @@ </textFieldCell> </textField> <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="3205"> - <rect key="frame" x="386" y="533" width="560" height="5"/> + <rect key="frame" x="417" y="533" width="529" height="5"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <font key="titleFont" metaFont="system"/> </box> <progressIndicator hidden="YES" verticalHuggingPriority="750" maxValue="100" bezeled="NO" controlSize="small" style="bar" id="3203"> - <rect key="frame" x="385" y="532.00000018353728" width="562" height="12"/> + <rect key="frame" x="417" y="532.00000018353728" width="530" height="12"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> </progressIndicator> <button toolTip="This rearranges the header of the MP4 file to optimize it for streaming across the web." id="4579"> - <rect key="frame" x="396" y="391" width="102" height="18"/> + <rect key="frame" x="269" y="391" width="102" height="18"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <buttonCell key="cell" type="check" title="Web optimized" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="4927"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> @@ -355,7 +355,7 @@ </connections> </button> <button id="2364"> - <rect key="frame" x="283" y="391" width="96" height="18"/> + <rect key="frame" x="513" y="391" width="96" height="18"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <string key="toolTip">Caution: This option will likely break device compatiblity with all but the AppleTV Take 2. Checking this box enables a 64 bit mp4 file which can be over 4 GB.</string> <buttonCell key="cell" type="check" title="Large file size" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="4926"> @@ -367,7 +367,7 @@ </connections> </button> <button toolTip="This option adds an atom to the MP4 file which allows older iPods (5th Generation classic style) to play the file." id="4967"> - <rect key="frame" x="515" y="391" width="108" height="18"/> + <rect key="frame" x="388" y="391" width="108" height="18"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <buttonCell key="cell" type="check" title="iPod 5G support" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="4968"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> @@ -378,7 +378,7 @@ </connections> </button> <textField verticalHuggingPriority="750" id="5505"> - <rect key="frame" x="627" y="500" width="56" height="15"/> + <rect key="frame" x="657" y="500" width="56" height="15"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="through" id="5506"> <font key="font" metaFont="smallSystem"/> @@ -387,11 +387,11 @@ </textFieldCell> </textField> <popUpButton verticalHuggingPriority="750" id="1545"> - <rect key="frame" x="570" y="500" width="57" height="15"/> + <rect key="frame" x="598" y="496" width="60" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1547" id="4910"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1547" id="4910"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> + <font key="font" metaFont="smallSystem"/> <menu key="menu" title="OtherViews" id="1546"> <items> <menuItem state="on" id="1547"/> @@ -403,11 +403,11 @@ </connections> </popUpButton> <popUpButton verticalHuggingPriority="750" id="1548"> - <rect key="frame" x="685" y="500" width="57" height="15"/> + <rect key="frame" x="713" y="496" width="60" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1550" id="4911"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1550" id="4911"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="miniSystem"/> + <font key="font" metaFont="smallSystem"/> <menu key="menu" title="OtherViews" id="1549"> <items> <menuItem state="on" id="1550"/> @@ -649,24 +649,19 @@ <menuItem title="Presets" id="1948"> <menu key="submenu" title="Presets" id="1949"> <items> - <menuItem title="Update Built-in Presets" id="1950"> + <menuItem title="New Preset…" keyEquivalent="n" id="1955"> <connections> - <action selector="addFactoryPresets:" target="240" id="1952"/> + <action selector="showAddPresetPanel:" target="240" id="1956"/> </connections> </menuItem> - <menuItem title="Delete Built-in Presets" id="1951"> + <menuItem title="Select Default Preset" id="2421"> <connections> - <action selector="deleteFactoryPresets:" target="240" id="1953"/> + <action selector="selectDefaultPreset:" target="240" id="2422"/> </connections> </menuItem> <menuItem isSeparatorItem="YES" id="1954"> <modifierMask key="keyEquivalentModifierMask" command="YES"/> </menuItem> - <menuItem title="New Preset…" keyEquivalent="n" id="1955"> - <connections> - <action selector="showAddPresetPanel:" target="240" id="1956"/> - </connections> - </menuItem> <menuItem title="Export…" id="5188"> <modifierMask key="keyEquivalentModifierMask"/> <connections> @@ -679,9 +674,17 @@ <action selector="browseImportPresetFile:" target="240" id="5193"/> </connections> </menuItem> - <menuItem title="Select Default Preset" id="2421"> + <menuItem isSeparatorItem="YES" id="5qo-64-GYU"> + <modifierMask key="keyEquivalentModifierMask" command="YES"/> + </menuItem> + <menuItem title="Update Built-in Presets" id="1950"> <connections> - <action selector="selectDefaultPreset:" target="240" id="2422"/> + <action selector="addFactoryPresets:" target="240" id="1952"/> + </connections> + </menuItem> + <menuItem title="Delete Built-in Presets" id="1951"> + <connections> + <action selector="deleteFactoryPresets:" target="240" id="1953"/> </connections> </menuItem> </items> @@ -806,116 +809,17 @@ DQ <size key="minContentSize" width="100" height="50"/> <size key="maxContentSize" width="280" height="550"/> <connections> - <outlet property="contentView" destination="1843" id="1844"/> <outlet property="parentWindow" destination="21" id="1842"/> </connections> </drawer> - <customView id="1843" userLabel="PresetsView"> - <rect key="frame" x="0.0" y="0.0" width="270" height="550"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <popUpButton verticalHuggingPriority="750" id="5130"> - <rect key="frame" x="59" y="1" width="33" height="23"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <popUpButtonCell key="cell" type="smallSquare" bezelStyle="smallSquare" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" pullsDown="YES" id="5131"> - <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="menu"/> - <menu key="menu" title="Presets Action Menu" id="5132"> - <items> - <menuItem state="on" image="NSActionTemplate" hidden="YES" id="5133"/> - <menuItem title="Make Default" id="5134"> - <connections> - <action selector="setDefaultPreset:" target="240" id="5138"/> - </connections> - </menuItem> - <menuItem title="Update Built-in Presets" id="5135"> - <connections> - <action selector="addFactoryPresets:" target="240" id="5139"/> - </connections> - </menuItem> - </items> - </menu> - </popUpButtonCell> - </popUpButton> - <button verticalHuggingPriority="750" id="4322"> - <rect key="frame" x="4" y="1" width="24" height="23"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" inset="3" id="4933"> - <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="systemBold"/> - </buttonCell> - <connections> - <action selector="showAddPresetPanel:" target="240" id="4325"/> - </connections> - </button> - <button verticalHuggingPriority="750" id="4317"> - <rect key="frame" x="27" y="1" width="24" height="23"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="only" alignment="left" borderStyle="border" inset="3" id="4932"> - <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="systemBold"/> - </buttonCell> - <connections> - <action selector="deletePreset:" target="240" id="4321"/> - </connections> - </button> - <scrollView horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="4179"> - <rect key="frame" x="4" y="31" width="260" height="508"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <clipView key="contentView" id="R2Z-Tc-0TS"> - <rect key="frame" x="1" y="1" width="244" height="506"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <subviews> - <outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="14" indentationPerLevel="12" autoresizesOutlineColumn="YES" outlineTableColumn="4183" id="4182" customClass="HBPresetsOutlineView"> - <rect key="frame" x="0.0" y="0.0" width="244" height="506"/> - <autoresizingMask key="autoresizingMask"/> - <size key="intercellSpacing" width="3" height="2"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/> - <tableColumns> - <tableColumn identifier="PresetName" width="241" minWidth="40" maxWidth="1000" id="4183"> - <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Presets"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/> - </tableHeaderCell> - <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="4186"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - <sortDescriptor key="sortDescriptorPrototype" selector="compare:" sortKey="PresetName"/> - <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/> - </tableColumn> - </tableColumns> - <connections> - <action selector="selectPreset:" target="240" id="4312"/> - <outlet property="dataSource" destination="240" id="4188"/> - <outlet property="delegate" destination="240" id="4189"/> - </connections> - </outlineView> - </subviews> - <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> - </clipView> - <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="4961"> - <rect key="frame" x="-100" y="-100" width="183" height="15"/> - <autoresizingMask key="autoresizingMask"/> - </scroller> - <scroller key="verticalScroller" verticalHuggingPriority="750" controlSize="small" horizontal="NO" id="4960"> - <rect key="frame" x="245" y="1" width="14" height="506"/> - <autoresizingMask key="autoresizingMask"/> - </scroller> - </scrollView> - </subviews> - </customView> <window title="Create A New Preset" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1867" userLabel="AddPresetPanel" customClass="NSPanel"> <windowStyleMask key="styleMask" titled="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> - <rect key="contentRect" x="421" y="536" width="338" height="308"/> + <rect key="contentRect" x="421" y="536" width="338" height="281"/> <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/> <value key="minSize" type="size" width="338" height="232"/> <view key="contentView" id="1868"> - <rect key="frame" x="0.0" y="0.0" width="338" height="308"/> + <rect key="frame" x="0.0" y="0.0" width="338" height="281"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button verticalHuggingPriority="750" id="1870"> @@ -947,7 +851,7 @@ Gw </connections> </button> <textField verticalHuggingPriority="750" id="1872"> - <rect key="frame" x="20" y="256" width="298" height="19"/> + <rect key="frame" x="20" y="229" width="298" height="19"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="4936"> <font key="font" metaFont="smallSystem"/> @@ -974,7 +878,7 @@ Gw </connections> </popUpButton> <textField verticalHuggingPriority="750" id="2670"> - <rect key="frame" x="17" y="279" width="303" height="14"/> + <rect key="frame" x="17" y="252" width="303" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Preset Name:" id="4938"> <font key="font" metaFont="smallSystem"/> @@ -1026,14 +930,6 @@ Gw <font key="font" metaFont="smallSystem"/> </buttonCell> </button> - <button hidden="YES" id="5153"> - <rect key="frame" x="17" y="230" width="303" height="18"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <buttonCell key="cell" type="check" title="Preset Folder ( if checked disregard below )" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="5154"> - <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> - <font key="font" metaFont="smallSystem"/> - </buttonCell> - </button> <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="2839"> <rect key="frame" x="113" y="210" width="205" height="5"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> @@ -1218,7 +1114,6 @@ DQ <outlet property="fOpenSourceTitleMMenu" destination="2698" id="2700"/> <outlet property="fPresetDrawer" destination="1841" id="1889"/> <outlet property="fPresetNewDesc" destination="2673" id="2674"/> - <outlet property="fPresetNewFolderCheck" destination="5153" id="5155"/> <outlet property="fPresetNewName" destination="1872" id="1875"/> <outlet property="fPresetNewPicFiltersCheck" destination="2837" id="2841"/> <outlet property="fPresetNewPicHeight" destination="5551" id="5669"/> @@ -1226,9 +1121,6 @@ DQ <outlet property="fPresetNewPicWidth" destination="5549" id="5668"/> <outlet property="fPresetNewPicWidthHeightBox" destination="5670" id="5671"/> <outlet property="fPresetSelectedDisplay" destination="1882" id="1883"/> - <outlet property="fPresetsAdd" destination="4322" id="4324"/> - <outlet property="fPresetsDelete" destination="4317" id="4319"/> - <outlet property="fPresetsOutlineView" destination="4182" id="4187"/> <outlet property="fQueueStatus" destination="2006" id="2007"/> <outlet property="fRipIndicator" destination="1373" id="1374"/> <outlet property="fScanHorizontalLine" destination="3205" id="6004"/> @@ -1264,8 +1156,5 @@ DQ </objects> <resources> <image name="HandBrake.icns" width="128" height="128"/> - <image name="NSActionTemplate" width="14" height="14"/> - <image name="NSAddTemplate" width="11" height="11"/> - <image name="NSRemoveTemplate" width="11" height="11"/> </resources> </document> diff --git a/macosx/English.lproj/Presets.xib b/macosx/English.lproj/Presets.xib new file mode 100644 index 000000000..f1c070576 --- /dev/null +++ b/macosx/English.lproj/Presets.xib @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> + </dependencies> + <objects> + <customObject id="-2" userLabel="File's Owner" customClass="HBPresetsViewController"> + <connections> + <outlet property="outlineView" destination="00W-tb-wgY" id="T3u-ix-uIb"/> + <outlet property="treeController" destination="ohT-Pp-wBT" id="YGP-sN-dS3"/> + <outlet property="view" destination="Hz6-mo-xeY" id="xR8-5v-xDQ"/> + </connections> + </customObject> + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> + <customObject id="-3" userLabel="Application"/> + <customView id="Hz6-mo-xeY"> + <rect key="frame" x="0.0" y="0.0" width="230" height="325"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="uad-bt-uKD"> + <rect key="frame" x="4" y="33" width="224" height="285"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <clipView key="contentView" id="Rcx-jI-nnq"> + <rect key="frame" x="1" y="1" width="222" height="283"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="14" indentationPerLevel="16" outlineTableColumn="jhC-ge-H1w" id="00W-tb-wgY"> + <rect key="frame" x="0.0" y="0.0" width="222" height="283"/> + <autoresizingMask key="autoresizingMask"/> + <size key="intercellSpacing" width="3" height="2"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/> + <tableColumns> + <tableColumn identifier="name" width="219" minWidth="16" maxWidth="1000" id="jhC-ge-H1w"> + <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/> + </tableHeaderCell> + <textFieldCell key="dataCell" controlSize="small" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="4tC-UE-40G"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> + <connections> + <binding destination="ohT-Pp-wBT" name="editable" keyPath="arrangedObjects.isBuiltIn" id="JA3-ww-RjO"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSNegateBoolean</string> + </dictionary> + </binding> + <binding destination="ohT-Pp-wBT" name="fontBold" keyPath="arrangedObjects.isDefault" id="Bki-AQ-Pa7"/> + <binding destination="ohT-Pp-wBT" name="value" keyPath="arrangedObjects.name" id="hDR-Al-iwT"> + <dictionary key="options"> + <string key="NSNullPlaceholder">Unamed Preset</string> + <bool key="NSValidatesImmediately" value="YES"/> + </dictionary> + </binding> + </connections> + </tableColumn> + </tableColumns> + <connections> + <action selector="clicked:" target="-2" id="8jb-bC-QI3"/> + <binding destination="ohT-Pp-wBT" name="content" keyPath="arrangedObjects" id="y8f-ht-Zs3"/> + <binding destination="ohT-Pp-wBT" name="selectionIndexPaths" keyPath="selectionIndexPaths" previousBinding="y8f-ht-Zs3" id="ntG-Tk-AkS"/> + <outlet property="dataSource" destination="-2" id="XrD-y9-BCi"/> + <outlet property="delegate" destination="-2" id="VEB-gf-oNP"/> + </connections> + </outlineView> + </subviews> + <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> + </clipView> + <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="RAh-Ad-miy"> + <rect key="frame" x="1" y="1" width="0.0" height="16"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="xU9-j2-UAo"> + <rect key="frame" x="-15" y="17" width="16" height="0.0"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + </scrollView> + <popUpButton verticalHuggingPriority="750" id="Ybq-Zt-sta"> + <rect key="frame" x="59" y="3" width="35" height="23"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <popUpButtonCell key="cell" type="smallSquare" bezelStyle="smallSquare" imagePosition="only" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" pullsDown="YES" id="2JY-O9-FR6"> + <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="menu"/> + <menu key="menu" title="Presets Action Menu" id="LQk-kD-5sj"> + <items> + <menuItem state="on" image="NSActionTemplate" hidden="YES" id="KPx-Ep-mb4"/> + <menuItem title="New Folder" id="Io0-Vm-Qez"> + <connections> + <action selector="insertFolder:" target="-2" id="ufd-hE-TG1"/> + </connections> + </menuItem> + <menuItem title="Make Default" id="D2t-YG-Frn"> + <connections> + <action selector="setDefault:" target="-2" id="tLd-jt-H1g"/> + </connections> + </menuItem> + <menuItem isSeparatorItem="YES" id="QaO-y0-sMc"/> + <menuItem title="Update Built-in Presets" id="cm5-Kl-dB3"> + <connections> + <action selector="updateBuiltInPresets:" target="-2" id="rND-6g-LMP"/> + </connections> + </menuItem> + </items> + </menu> + </popUpButtonCell> + </popUpButton> + <button verticalHuggingPriority="750" id="kfi-wq-mgV"> + <rect key="frame" x="4" y="3" width="24" height="23"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" inset="3" id="OJ3-1k-3DY"> + <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="systemBold"/> + </buttonCell> + <connections> + <action selector="addNewPreset:" target="-2" id="TYV-vH-8hk"/> + <binding destination="-2" name="enabled" keyPath="self.enabled" id="lmV-Y3-JoF"/> + </connections> + </button> + <button verticalHuggingPriority="750" id="b3V-8w-euU"> + <rect key="frame" x="27" y="3" width="24" height="23"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="only" alignment="left" borderStyle="border" inset="3" id="Kb1-6u-550"> + <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="systemBold"/> + </buttonCell> + <connections> + <action selector="deletePreset:" target="-2" id="b6N-h7-25y"/> + <binding destination="ohT-Pp-wBT" name="enabled" keyPath="canRemove" id="WNd-yX-UEH"/> + </connections> + </button> + </subviews> + </customView> + <treeController objectClassName="HBPreset" childrenKeyPath="children" leafKeyPath="isLeaf" id="ohT-Pp-wBT"> + <declaredKeys> + <string>name</string> + <string>children</string> + <string>isBuiltIn</string> + <string>isDefault</string> + </declaredKeys> + <connections> + <binding destination="-2" name="contentArray" keyPath="presets.contents" id="9w3-Oi-cf0"/> + </connections> + </treeController> + </objects> + <resources> + <image name="NSActionTemplate" width="14" height="14"/> + <image name="NSAddTemplate" width="8" height="8"/> + <image name="NSRemoveTemplate" width="8" height="8"/> + </resources> +</document> diff --git a/macosx/HBPreset.h b/macosx/HBPreset.h new file mode 100644 index 000000000..1c2fe22d3 --- /dev/null +++ b/macosx/HBPreset.h @@ -0,0 +1,39 @@ +// +// HBBaseNode.h +// PresetsView +// +// Created by Damiano Galassi on 14/07/14. +// Copyright (c) 2014 Damiano Galassi. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +/** + * HBPreset + * Stores a preset dictionary + * and implements the requited methods to work with a NSTreeController. + */ +@interface HBPreset : NSObject <NSCopying> + +- (instancetype)initWithName:(NSString *)title content:(NSDictionary *)content builtIn:(BOOL)builtIn; +- (instancetype)initWithFolderName:(NSString *)title builtIn:(BOOL)builtIn; + +@property (nonatomic, copy) NSString *name; +@property (nonatomic, readwrite, retain) NSString *presetDescription; +@property (nonatomic, retain) NSDictionary *content; + +@property (nonatomic, readwrite) BOOL isDefault; +@property (nonatomic, readonly) BOOL isBuiltIn; + +// NSTreeController required properties +@property (nonatomic, retain) NSMutableArray *children; +@property (nonatomic) BOOL isLeaf; + +/** + * Executes a given block using each object in the tree, starting with the root object and continuing through the tree to the last object. + * + * @param block The block to apply to elements in the tree. + */ +- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSIndexPath *idx, BOOL *stop))block; + +@end diff --git a/macosx/HBPreset.m b/macosx/HBPreset.m new file mode 100644 index 000000000..05cd45552 --- /dev/null +++ b/macosx/HBPreset.m @@ -0,0 +1,141 @@ +// +// HBBaseNode.m +// PresetsView +// +// Created by Damiano Galassi on 14/07/14. +// Copyright (c) 2014 Damiano Galassi. All rights reserved. +// + +#import "HBPreset.h" + +@implementation HBPreset + +- (instancetype)initWithName:(NSString *)title content:(NSDictionary *)content builtIn:(BOOL)builtIn; +{ + self = [self init]; + if (self) + { + _name = [title copy]; + _isBuiltIn = builtIn; + _content = [content retain]; + _presetDescription = [content[@"PresetDescription"] copy]; + } + return self; +} + +- (instancetype)initWithFolderName:(NSString *)title builtIn:(BOOL)builtIn; +{ + self = [self init]; + if (self) + { + _name = [title copy]; + _isBuiltIn = builtIn; + _isLeaf = NO; + } + return self; +} + +- (instancetype)init +{ + self = [super init]; + if (self) + { + _children = [[NSMutableArray alloc] init]; + _name = @"New Preset"; + _isLeaf = YES; + _presetDescription = @""; + } + return self; +} + +- (void)dealloc +{ + [_name release]; + [_content release]; + [_presetDescription release]; + [_children release]; + + [super dealloc]; +} + +- (id)copyWithZone:(NSZone *)zone +{ + HBPreset *node = [[HBPreset alloc] init]; + node->_name = [self.name copy]; + node->_content = [self.content copy]; + node->_presetDescription = [self.presetDescription copy]; + for (HBPreset *children in self.children) + { + [node->_children addObject:[[children copy] autorelease]]; + } + + return node; +} + +- (NSUInteger)hash +{ + return self.name.hash + self.isBuiltIn + self.isLeaf; +} + +#pragma mark - KVC + +- (BOOL)validateName:(id *)ioValue error:(NSError * __autoreleasing *)outError +{ + // Return an error is the name is empty + if (![*ioValue length]) + { + if (outError) + { + *outError = [[NSError alloc] initWithDomain:@"HBErrorDomain" + code:0 + userInfo:@{NSLocalizedDescriptionKey:@"The preset title cannot be empty.", + NSLocalizedRecoverySuggestionErrorKey:@"Please enter a title."}]; + } + return NO; + } + + return YES; +} + +#pragma mark - Enumeration + +- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSIndexPath *idx, BOOL *stop))block +{ + BOOL stop = NO; + NSMutableArray *queue = [[NSMutableArray alloc] init]; + NSMutableArray *indexesQueue = [[NSMutableArray alloc] init]; + + [queue addObject:self]; + [indexesQueue addObject:[[[NSIndexPath alloc] init] autorelease]]; + + HBPreset *node = nil; + while ((node = [queue lastObject]) != nil) + { + // Get the index path of the current object + NSIndexPath *indexPath = [indexesQueue lastObject]; + + // Call the block + block(node, indexPath, &stop); + + if (stop) + { + break; + } + + [indexesQueue removeLastObject]; + + for (int i = 0; i < node.children.count; i++) + { + [indexesQueue addObject:[indexPath indexPathByAddingIndex:i]]; + } + + [queue removeLastObject]; + [queue addObjectsFromArray:node.children]; + + } + + [queue release]; + [indexesQueue release]; +} + +@end diff --git a/macosx/HBPresets.h b/macosx/HBPresets.h deleted file mode 100644 index 139b200ed..000000000 --- a/macosx/HBPresets.h +++ /dev/null @@ -1,33 +0,0 @@ -/* HBPresets.h $ - - This file is part of the HandBrake source code. - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License. */ - -#import <Cocoa/Cocoa.h> - -@interface HBPresets : NSObject {} - -/* Called by -addFactoryPresets in Controller.m */ -- (NSMutableArray *)generateBuiltinPresets:(NSMutableArray *)UserPresets; - -/* Dictionaries for preset folders ("Devices, "Regular") */ -- (NSDictionary *)createDevicesPresetFolder; -- (NSDictionary *)createRegularPresetFolder; - -/* Dictionaries for individual presets ("Devices" folder) */ -- (NSDictionary *)createUniversalPreset; -- (NSDictionary *)createiPodPreset; -- (NSDictionary *)createiPhoneiPodtouchPreset; -- (NSDictionary *)createiPadPreset; -- (NSDictionary *)createAppleTVPreset; -- (NSDictionary *)createAppleTV2Preset; -- (NSDictionary *)createAppleTV3Preset; -- (NSDictionary *)createAndroidPreset; -- (NSDictionary *)createAndroidTabletPreset; - -/* Dictionaries for individual presets ("Regular" folder) */ -- (NSDictionary *)createNormalPreset; -- (NSDictionary *)createHighProfilePreset; - -@end diff --git a/macosx/HBPresets.m b/macosx/HBPresets.m deleted file mode 100644 index 4afac4113..000000000 --- a/macosx/HBPresets.m +++ /dev/null @@ -1,1420 +0,0 @@ -/* HBPresets.m $ - - This file is part of the HandBrake source code. - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License. */ - -#import "HBPresets.h" - -@implementation HBPresets - -- (id)init -{ - self = [super init]; - return self; -} - -/* Called by -addFactoryPresets in Controller.m */ -- (NSMutableArray *)generateBuiltinPresets:(NSMutableArray *)UserPresets -{ - /* - * We receive the user presets array of dictionaries from Controller.m - * - * Re-create new built-in presets programmatically and add them to the array - * - * 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 createDevicesPresetFolder]]; - [UserPresets addObject:[self createRegularPresetFolder]]; - - /* Independent presets at the root hierarchy level would go here */ - - /* Return the newly-regenerated preset array back to Controller.m */ - return UserPresets; -} - -#pragma mark - -#pragma mark Preset Folder Definitions - -- (NSDictionary *)createDevicesPresetFolder -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"Devices" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:YES] forKey:@"Folder"]; - - /* Initialize a child array, and add the individual presets to it */ - NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; - [childrenArray addObject:[self createUniversalPreset]]; - [childrenArray addObject:[self createiPodPreset]]; - [childrenArray addObject:[self createiPhoneiPodtouchPreset]]; - [childrenArray addObject:[self createiPadPreset]]; - [childrenArray addObject:[self createAppleTVPreset]]; - [childrenArray addObject:[self createAppleTV2Preset]]; - [childrenArray addObject:[self createAppleTV3Preset]]; - [childrenArray addObject:[self createAndroidPreset]]; - [childrenArray addObject:[self createAndroidTabletPreset]]; - [childrenArray addObject:[self createW8PhonePreset]]; - - /* Add the individual presets to the folder */ - [preset setObject:[NSMutableArray arrayWithArray:childrenArray] - forKey:@"ChildrenArray"]; - - /* Clean up and return the folder */ - [childrenArray autorelease]; - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createRegularPresetFolder -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"Regular" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:YES] forKey:@"Folder"]; - - /* Initialize a child array, and add the individual presets to it */ - NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; - [childrenArray addObject:[self createNormalPreset]]; - [childrenArray addObject:[self createHighProfilePreset]]; - - /* Add the individual presets to the folder */ - [preset setObject:[NSMutableArray arrayWithArray:childrenArray] - forKey:@"ChildrenArray"]; - - /* Clean up and return the folder */ - [childrenArray autorelease]; - [preset autorelease]; - return preset; -} - -#pragma mark - -#pragma mark Individual Preset Definitions -/* These NSDictionary definitions contain settings for one built-in preset */ - -- (NSDictionary *)createUniversalPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"Universal" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for compatibility with all Apple devices (including the iPod 6G and later). Includes Dolby Digital audio for surround sound." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"fast" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"baseline" forKey:@"h264Profile"]; - [preset setObject:@"3.0" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:576] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createiPodPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"iPod" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for playback on the iPod with Video (all generations)." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"baseline" forKey:@"h264Profile"]; - [preset setObject:@"1.3" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:320] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:240] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; //none - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createiPhoneiPodtouchPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"iPhone & iPod touch" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for handheld iOS devices (iPhone 4, iPod touch 3G and later)." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:640] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createiPadPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"iPad" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for playback on the iPad (all generations)." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createAppleTVPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"AppleTV" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for the original AppleTV. Includes Dolby Digital audio for surround sound. Also compatible with iOS devices released since 2009." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500" - forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createAppleTV2Preset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"AppleTV 2" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for the second-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createAppleTV3Preset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"AppleTV 3" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for the third-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV. May stutter on the second-generation AppleTV." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"4.0" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1920] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:1080] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:3] forKey:@"PictureDecomb"]; //fast - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createAndroidPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"Android" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's settings for midrange devices running Android 2.3 or later." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"3.0" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:576] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createAndroidTabletPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"Android Tablet" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's preset for tablets running Android 2.3 or later." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createW8PhonePreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"Windows Phone 8" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's preset for Windows Phone 8 devices" - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; //None - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createNormalPreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"Normal" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Default"]; //default - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's normal, default settings." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"veryfast" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"4.0" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -- (NSDictionary *)createHighProfilePreset -{ - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Preset properties (name, type: factory/user, default, folder, tooltip) */ - [preset setObject:@"High Profile" forKey:@"PresetName"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - [preset setObject:@"HandBrake's general-purpose preset for High Profile H.264 video." - forKey:@"PresetDescription"]; - - /* Container format and related settings */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter markers */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder and advanced options */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - [preset setObject:@"" forKey:@"lavcOption"]; - [preset setObject:@"" forKey:@"x264Option"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"4.1" forKey:@"h264Level"]; - - /* Video rate control */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video frame rate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - - /* Picture size */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - - /* Picture filters */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureDecomb"]; //default - [preset setObject:@"" forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; - [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; - [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* Picture crop */ - [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"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Auto Passthru */ - [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - - /* Audio track list - no need to add "None" at the end */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ - NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (avcodec)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack1Array autorelease]; - [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - /* Add the audio track(s) to the preset's audio list */ - [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [audioListArray release]; - - /* Subtitles (note: currently ignored) */ - [preset setObject:@"None" forKey:@"Subtitles"]; - - /* Clean up and return the preset */ - [preset autorelease]; - return preset; -} - -@end diff --git a/macosx/HBPresetsManager.h b/macosx/HBPresetsManager.h new file mode 100644 index 000000000..d7dc1efbf --- /dev/null +++ b/macosx/HBPresetsManager.h @@ -0,0 +1,74 @@ +/* HBPresets.h $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import <Cocoa/Cocoa.h> + +@class HBPreset; + +/** + * HBPresetManager + * Manages the load/save of presets to an in memory tree. + */ +@interface HBPresetsManager : NSObject + +/** + * The root array of presets. + */ +@property (nonatomic, readonly, retain) NSMutableArray *contents; + +/** + * defaultPreset and its index path in the tree + */ +@property (nonatomic, readwrite, retain) HBPreset *defaultPreset; + +/** + * Returs a HBPresetManager with the presets loaded at the passed URL. + * + * @param url the URL of the presets file to load. + * + * @return the initialized presets manager. + */ +- (instancetype)initWithURL:(NSURL *)url; + +/** + * Checks the version number of the builtin presets. + * + * @return YES if the builtin presets are out of date. + */ +- (BOOL)checkBuiltInsForUpdates; + +/** + * Saves the presets to disk. + */ +- (BOOL)savePresets; + +/** + * Adds a given preset to the manager. + * + * @param preset the preset dict. + */ +- (void)addPreset:(NSDictionary *)preset; + +/** + * Deletes the presets at the specified index path. + * + * @param idx the NSIndexPath of the preset to delete. + */ +- (void)deletePresetAtIndexPath:(NSIndexPath *)idx; + +/** + * Returns the index path of the specified object. + * + * @param preset the preset. + * + * @return The index path whose corresponding value is equal to the preset. Returns nil if not found. + */ +- (NSIndexPath *)indexPathOfPreset:(HBPreset *)preset; + +- (void)generateBuiltInPresets; +- (void)deleteBuiltInPresets; + +@end diff --git a/macosx/HBPresetsManager.m b/macosx/HBPresetsManager.m new file mode 100644 index 000000000..88a74cdf2 --- /dev/null +++ b/macosx/HBPresetsManager.m @@ -0,0 +1,1742 @@ +/* HBPresets.m $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import "HBPresetsManager.h" +#import "HBPreset.h" + +#import "HBUtilities.h" + +@interface HBPresetsManager () + +@property (nonatomic, readonly, copy) NSURL *fileURL; + +@property (nonatomic, readonly, retain) HBPreset *root; + +/* Dictionaries for individual presets ("Devices" folder) */ +- (NSDictionary *)createUniversalPreset; +- (NSDictionary *)createiPodPreset; +- (NSDictionary *)createiPhoneiPodtouchPreset; +- (NSDictionary *)createiPadPreset; +- (NSDictionary *)createAppleTVPreset; +- (NSDictionary *)createAppleTV2Preset; +- (NSDictionary *)createAppleTV3Preset; +- (NSDictionary *)createAndroidPreset; +- (NSDictionary *)createAndroidTabletPreset; +- (NSDictionary *)createW8PhonePreset; + +/* Dictionaries for individual presets ("Regular" folder) */ +- (NSDictionary *)createNormalPreset; +- (NSDictionary *)createHighProfilePreset; + +@end + +@implementation HBPresetsManager + +- (instancetype)init +{ + self = [super init]; + if (self) + { + // Init the root of the tree, it won't never be shown in the UI + _root = [[HBPreset alloc] initWithFolderName:@"Root" builtIn:YES]; + } + return self; +} + +- (instancetype)initWithURL:(NSURL *)url +{ + self = [self init]; + if (self) + { + _fileURL = [url copy]; + [self loadPresetsFromURL:url]; + } + return self; +} + +- (void)dealloc +{ + [_fileURL release]; + [_defaultPreset release]; + + [_root release]; + + [super dealloc]; +} + +- (NSMutableArray *)contents +{ + return self.root.children; +} + +- (NSIndexPath *)indexPathOfPreset:(HBPreset *)preset +{ + __block NSIndexPath *retValue = nil; + + // Visit the whole tree to find the index path. + [self.root enumerateObjectsUsingBlock:^(id obj, NSIndexPath *idx, BOOL *stop) + { + if ([obj isEqualTo:preset]) + { + retValue = [idx retain]; + *stop = YES; + } + }]; + + return [retValue autorelease]; +} + +#pragma mark - Load/Save + +- (BOOL)loadPresetsFromURL:(NSURL *)url +{ + NSArray *presetsArray = [[NSArray alloc] initWithContentsOfURL:url]; + + for (NSDictionary *child in presetsArray) + { + [self.root.children addObject:[self loadFromDict:child]]; + } + + [presetsArray release]; + + // If the preset list is empty, + // readd the built in presets. + if (self.root.children.count == 0) + { + [self generateBuiltInPresets]; + } + + if (self.defaultPreset == nil) + { + [self selectNewDefault]; + } + + return YES; +} + +- (BOOL)savePresetsToURL:(NSURL *)url +{ + NSMutableArray *presetsArray = [[[NSMutableArray alloc] init] autorelease]; + + for (HBPreset *node in self.contents) + { + [presetsArray addObject:[self convertToDict:node]]; + } + + return [presetsArray writeToURL:url atomically:YES]; + + return YES; +} + +- (BOOL)savePresets +{ + return [self savePresetsToURL:self.fileURL]; +} + +#pragma mark - NSDictionary conversions + +/** + * Converts the NSDictionary to a HBPreset object, + */ +- (HBPreset *)loadFromDict:(NSDictionary *)dict +{ + HBPreset *node = nil; + if ([dict[@"Folder"] boolValue]) + { + node = [[[HBPreset alloc] initWithFolderName:dict[@"PresetName"] + builtIn:![dict[@"Type"] boolValue]] autorelease]; + + for (NSDictionary *child in dict[@"ChildrenArray"]) + { + [node.children addObject:[self loadFromDict:child]]; + } + } + else + { + node = [[[HBPreset alloc] initWithName:dict[@"PresetName"] + content:dict + builtIn:![dict[@"Type"] boolValue]] autorelease]; + node.isDefault = [dict[@"Default"] boolValue]; + + if ([dict[@"Default"] boolValue]) + { + self.defaultPreset = node; + } + } + + return node; +} + +/** + * Converts the HBPreset and its childrens to a NSDictionary. + */ +- (NSDictionary *)convertToDict:(HBPreset *)node +{ + NSMutableDictionary *output = [[NSMutableDictionary alloc] init]; + [output addEntriesFromDictionary:node.content]; + + output[@"PresetName"] = node.name; + output[@"Folder"] = @(!node.isLeaf); + output[@"Type"] = @(!node.isBuiltIn); + output[@"Default"] = @(node.isDefault); + + if (!node.isLeaf) + { + NSMutableArray *childArray = [[NSMutableArray alloc] init]; + for (HBPreset *child in node.children) + { + [childArray addObject:[self convertToDict:child]]; + } + + output[@"ChildrenArray"] = childArray; + [childArray release]; + } + + return [output autorelease]; +} + +#pragma mark - Presets Management + +- (BOOL)checkBuiltInsForUpdates +{ + __block BOOL retValue = NO; + + [self.root enumerateObjectsUsingBlock:^(id obj, NSIndexPath *idx, BOOL *stop) { + NSDictionary *dict = [obj content]; + + if ([obj isBuiltIn] && [obj isLeaf]) + { + if (!dict[@"PresetBuildNumber"] || + [dict[@"PresetBuildNumber"] intValue] < [[[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"] intValue]) + { + retValue = YES; + *stop = YES; + } + } + }]; + + return retValue; +} + +- (void)addPreset:(NSDictionary *)preset +{ + HBPreset *presetNode = [[HBPreset alloc] initWithName:preset[@"PresetName"] + content:preset + builtIn:NO]; + [self insertObject:presetNode inContentsAtIndex:[self countOfContents]]; + [presetNode release]; + + [self savePresets]; +} + +- (void)deletePresetAtIndexPath:(NSIndexPath *)idx +{ + [self willChangeValueForKey:@"contents"]; + + NSMutableArray *parentArray = self.contents; + + // Find the preset parent array + // and delete it. + NSUInteger currIdx = 0; + NSUInteger i = 0; + for (i = 0; i < idx.length - 1; i++) + { + currIdx = [idx indexAtPosition:i]; + + if (parentArray.count > currIdx) + { + parentArray = [(HBPreset *)[parentArray objectAtIndex:currIdx] children]; + } + } + + currIdx = [idx indexAtPosition:i]; + + if (parentArray.count > currIdx) + { + if ([[parentArray objectAtIndex:currIdx] isDefault]) + { + [parentArray removeObjectAtIndex:currIdx]; + // Try to select a new default preset + [self selectNewDefault]; + } + else + { + [parentArray removeObjectAtIndex:currIdx]; + } + } + + [self didChangeValueForKey:@"contents"]; +} + +/** + * Private method to select a new default + * when the default preset is deleted. + */ +- (void)selectNewDefault +{ + __block HBPreset *normalPreset = nil; + __block HBPreset *firstUserPreset = nil; + + // Search for a possibile new default preset + // Try to use "Normal" or the first user preset. + [self.root enumerateObjectsUsingBlock:^(id obj, NSIndexPath *idx, BOOL *stop) { + if ([obj isBuiltIn] && [obj isLeaf]) + { + if ([[obj name] isEqualToString:@"Normal"]) + { + normalPreset = obj; + } + } + else if ([obj isLeaf]) + { + firstUserPreset = obj; + *stop = YES; + } + }]; + + if (normalPreset) + { + self.defaultPreset = normalPreset; + normalPreset.isDefault = YES; + } + else if (firstUserPreset) + { + self.defaultPreset = firstUserPreset; + firstUserPreset.isDefault = YES; + } +} + +- (void)setDefaultPreset:(HBPreset *)defaultPreset +{ + if (defaultPreset && defaultPreset.isLeaf) + { + if (_defaultPreset) + { + _defaultPreset.isDefault = NO; + [_defaultPreset autorelease]; + } + defaultPreset.isDefault = YES; + _defaultPreset = [defaultPreset retain]; + } +} + +#pragma mark - +#pragma mark KVC + +- (NSUInteger)countOfContents +{ + return [self.contents count]; +} + +- (HBPreset *)objectInContentsAtIndex:(NSUInteger)index +{ + return [self.contents objectAtIndex:index]; +} + +- (void)insertObject:(HBPreset *)presetObject inContentsAtIndex:(NSUInteger)index; +{ + [self.contents insertObject:presetObject atIndex:index]; +} + +- (void)removeObjectFromContentsAtIndex:(NSUInteger)index +{ + [self.contents removeObjectAtIndex: index]; +} + +#pragma mark - Built In Generation + +- (void)loadPresetsForType:(NSString *)type fromSel:(SEL[])selArray length:(int)len +{ + HBPreset *folderNode = [[HBPreset alloc] initWithFolderName:type builtIn:YES]; + + for (int i = 0; i < len; i++) + { + NSMutableDictionary *presetDict = [self performSelector:selArray[i]]; + presetDict[@"PresetBuildNumber"] = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + HBPreset *presetNode = [[HBPreset alloc] initWithName:presetDict[@"PresetName"] + content:presetDict + builtIn:YES]; + [folderNode.children addObject:presetNode]; + [presetNode release]; + } + + [self.contents insertObject:folderNode atIndex:0]; + [folderNode release]; +} + +/** + * Built-in preset folders at the root of the hierarchy + * + * Re-create new built-in presets programmatically and add them to the array + * + * Note: the built-in presets will *not* sort themselves alphabetically, + * so they will appear in the order you create them. + */ +- (void)generateBuiltInPresets +{ + SEL devicesPresets[] = { @selector(createUniversalPreset), + @selector(createiPodPreset), + @selector(createiPhoneiPodtouchPreset), + @selector(createiPadPreset), + @selector(createAppleTVPreset), + @selector(createAppleTV2Preset), + @selector(createAppleTV3Preset), + @selector(createAndroidPreset), + @selector(createAndroidTabletPreset), + @selector(createW8PhonePreset) + }; + + SEL regularPresets[] = { @selector(createNormalPreset), + @selector(createHighProfilePreset)}; + + [self willChangeValueForKey:@"contents"]; + NSMutableIndexSet *indexes = [[NSMutableIndexSet alloc] init]; + [self.contents enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + if ([obj isBuiltIn]) + { + [indexes addIndex:idx]; + } + }]; + [self.contents removeObjectsAtIndexes:indexes]; + [indexes release]; + + [self loadPresetsForType:@"Regular" fromSel:regularPresets length:2]; + [self loadPresetsForType:@"Devices" fromSel:devicesPresets length:10]; + + if (self.defaultPreset == nil) + { + [self selectNewDefault]; + } + + [self didChangeValueForKey:@"contents"]; + + [HBUtilities writeToActivityLog: "built in presets updated to build number: %d", [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]]; +} + +- (void)deleteBuiltInPresets +{ + [self willChangeValueForKey:@"contents"]; + NSMutableArray *nodeToRemove = [[NSMutableArray alloc] init]; + for (HBPreset *node in self.contents) + { + if (node.isBuiltIn) + { + [nodeToRemove addObject:node]; + } + } + [self.contents removeObjectsInArray:nodeToRemove]; + [nodeToRemove release]; + [self didChangeValueForKey:@"contents"]; +} + +#pragma mark - +#pragma mark Individual Preset Definitions +/* These NSDictionary definitions contain settings for one built-in preset */ + +- (NSMutableDictionary *)createUniversalPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"Universal"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for compatibility with all Apple devices (including the iPod 6G and later). Includes Dolby Digital audio for surround sound."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @0; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"fast"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"baseline"; + preset[@"h264Level"] = @"3.0"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @20.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @720; + preset[@"PictureHeight"] = @576; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + audioTrack2Array[@"AudioTrack"] = @1; + audioTrack2Array[@"AudioEncoder"] = @"AC3 Passthru"; + audioTrack2Array[@"AudioMixdown"] = @"None"; + audioTrack2Array[@"AudioSamplerate"] = @"Auto"; + audioTrack2Array[@"AudioBitrate"] = @"160"; + audioTrack2Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack2Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createiPodPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"iPod"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for playback on the iPod with Video (all generations)."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @0; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @1; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"baseline"; + preset[@"h264Level"] = @"1.3"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @22.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @320; + preset[@"PictureHeight"] = @240; + preset[@"PicturePAR"] = @0; //none + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @1; + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createiPhoneiPodtouchPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"iPhone & iPod touch"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for handheld iOS devices (iPhone 4, iPod touch 3G and later)."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @1; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"high"; + preset[@"h264Level"] = @"3.1"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @22.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @960; + preset[@"PictureHeight"] = @640; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createiPadPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"iPad"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for playback on the iPad (all generations)."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @1; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"high"; + preset[@"h264Level"] = @"3.1"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @20.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @1280; + preset[@"PictureHeight"] = @720; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createAppleTVPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"AppleTV"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for the original AppleTV. Includes Dolby Digital audio for surround sound. Also compatible with iOS devices released since 2009."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @1; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @"qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500"; + preset[@"h264Profile"] = @"high"; + preset[@"h264Level"] = @"3.1"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @20.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @960; + preset[@"PictureHeight"] = @720; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + audioTrack2Array[@"AudioTrack"] = @1; + audioTrack2Array[@"AudioEncoder"] = @"AC3 Passthru"; + audioTrack2Array[@"AudioMixdown"] = @"None"; + audioTrack2Array[@"AudioSamplerate"] = @"Auto"; + audioTrack2Array[@"AudioBitrate"] = @"160"; + audioTrack2Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack2Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createAppleTV2Preset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"AppleTV 2"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for the second-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @1; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"high"; + preset[@"h264Level"] = @"3.1"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @20.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @1280; + preset[@"PictureHeight"] = @720; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + audioTrack2Array[@"AudioTrack"] = @1; + audioTrack2Array[@"AudioEncoder"] = @"AC3 Passthru"; + audioTrack2Array[@"AudioMixdown"] = @"None"; + audioTrack2Array[@"AudioSamplerate"] = @"Auto"; + audioTrack2Array[@"AudioBitrate"] = @"160"; + audioTrack2Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack2Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createAppleTV3Preset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"AppleTV 3"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for the third-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV. May stutter on the second-generation AppleTV."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @1; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"high"; + preset[@"h264Level"] = @"4.0"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @20.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @1920; + preset[@"PictureHeight"] = @1080; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @3; //fast + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + audioTrack2Array[@"AudioTrack"] = @1; + audioTrack2Array[@"AudioEncoder"] = @"AC3 Passthru"; + audioTrack2Array[@"AudioMixdown"] = @"None"; + audioTrack2Array[@"AudioSamplerate"] = @"Auto"; + audioTrack2Array[@"AudioBitrate"] = @"160"; + audioTrack2Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack2Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createAndroidPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"Android"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's settings for midrange devices running Android 2.3 or later."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @0; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @0; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"main"; + preset[@"h264Level"] = @"3.0"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @22.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @720; + preset[@"PictureHeight"] = @576; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"128"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createAndroidTabletPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"Android Tablet"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's preset for tablets running Android 2.3 or later."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @0; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @0; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"main"; + preset[@"h264Level"] = @"3.1"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @22.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @1280; + preset[@"PictureHeight"] = @720; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"128"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createW8PhonePreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"Windows Phone 8"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's preset for Windows Phone 8 devices"; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @0; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @0; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"main"; + preset[@"h264Level"] = @"3.1"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @22.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"30"; + preset[@"VideoFramerateMode"] = @"pfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @1280; + preset[@"PictureHeight"] = @720; + preset[@"PicturePAR"] = @0; //None + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @1; + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"128"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createNormalPreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"Normal"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @1; //default + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's normal, default settings."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @0; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"veryfast"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"main"; + preset[@"h264Level"] = @"4.0"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @20.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"Same as source"; + preset[@"VideoFramerateMode"] = @"vfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @0; + preset[@"PictureHeight"] = @0; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @0; //off + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +- (NSMutableDictionary *)createHighProfilePreset +{ + NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + preset[@"PresetName"] = @"High Profile"; + preset[@"Type"] = @0; //factory + preset[@"Default"] = @0; + preset[@"Folder"] = @NO; + preset[@"PresetDescription"] = @"HandBrake's general-purpose preset for High Profile H.264 video."; + + /* Container format and related settings */ + preset[@"FileFormat"] = @"MP4 file"; + preset[@"Mp4LargeFile"] = @1; + preset[@"Mp4HttpOptimize"] = @0; + preset[@"Mp4iPodCompatible"] = @0; + + /* Chapter markers */ + preset[@"ChapterMarkers"] = @1; + + /* Video encoder and advanced options */ + preset[@"VideoEncoder"] = @"H.264 (x264)"; + preset[@"lavcOption"] = @""; + preset[@"x264Option"] = @""; + preset[@"x264UseAdvancedOptions"] = @0; + preset[@"x264Preset"] = @"medium"; + preset[@"x264Tune"] = @""; + preset[@"x264OptionExtra"] = @""; + preset[@"h264Profile"] = @"high"; + preset[@"h264Level"] = @"4.1"; + + /* Video rate control */ + preset[@"VideoAvgBitrate"] = @"2500"; + preset[@"VideoTwoPass"] = @0; + preset[@"VideoTurboTwoPass"] = @0; + preset[@"VideoQualityType"] = @2; //cq + preset[@"VideoQualitySlider"] = @20.0f; + + /* Video frame rate */ + preset[@"VideoFramerate"] = @"Same as source"; + preset[@"VideoFramerateMode"] = @"vfr"; + + /* Picture size */ + preset[@"UsesPictureSettings"] = @1; + preset[@"PictureWidth"] = @0; + preset[@"PictureHeight"] = @0; + preset[@"PicturePAR"] = @2; //loose + preset[@"PictureModulus"] = @2; + preset[@"PictureKeepRatio"] = @0; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ + preset[@"UsesPictureFilters"] = @1; + preset[@"PictureDecomb"] = @2; //default + preset[@"PictureDecombCustom"] = @""; + preset[@"PictureDecombDeinterlace"] = @1; //decomb + preset[@"PictureDeinterlace"] = @0; + preset[@"PictureDeinterlaceCustom"] = @""; + preset[@"PictureDetelecine"] = @0; + preset[@"PictureDetelecineCustom"] = @""; + preset[@"PictureDenoise"] = @0; + preset[@"PictureDenoiseCustom"] = @""; + preset[@"PictureDeblock"] = @0; + preset[@"VideoGrayScale"] = @0; + + /* Picture crop */ + preset[@"PictureAutoCrop"] = @1; + preset[@"PictureTopCrop"] = @0; + preset[@"PictureBottomCrop"] = @0; + preset[@"PictureLeftCrop"] = @0; + preset[@"PictureRightCrop"] = @0; + + /* Auto Passthru */ + preset[@"AudioEncoderFallback"] = @"AC3 (ffmpeg)"; + preset[@"AudioAllowAACPass"] = @1; + preset[@"AudioAllowAC3Pass"] = @1; + preset[@"AudioAllowDTSHDPass"] = @1; + preset[@"AudioAllowDTSPass"] = @1; + preset[@"AudioAllowMP3Pass"] = @1; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ + NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; + audioTrack1Array[@"AudioTrack"] = @1; + audioTrack1Array[@"AudioEncoder"] = @"AAC (avcodec)"; + audioTrack1Array[@"AudioMixdown"] = @"Dolby Pro Logic II"; + audioTrack1Array[@"AudioSamplerate"] = @"Auto"; + audioTrack1Array[@"AudioBitrate"] = @"160"; + audioTrack1Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack1Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack1Array autorelease]; + [audioListArray addObject:audioTrack1Array]; + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + audioTrack2Array[@"AudioTrack"] = @1; + audioTrack2Array[@"AudioEncoder"] = @"AC3 Passthru"; + audioTrack2Array[@"AudioMixdown"] = @"None"; + audioTrack2Array[@"AudioSamplerate"] = @"Auto"; + audioTrack2Array[@"AudioBitrate"] = @"160"; + audioTrack2Array[@"AudioTrackGainSlider"] = @0.0f; + audioTrack2Array[@"AudioTrackDRCSlider"] = @0.0f; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + preset[@"AudioList"] = [NSMutableArray arrayWithArray:audioListArray]; + [audioListArray release]; + + /* Subtitles (note: currently ignored) */ + preset[@"Subtitles"] = @"None"; + + /* Clean up and return the preset */ + [preset autorelease]; + return preset; +} + +@end diff --git a/macosx/HBPresetsViewController.h b/macosx/HBPresetsViewController.h new file mode 100644 index 000000000..b0e78034c --- /dev/null +++ b/macosx/HBPresetsViewController.h @@ -0,0 +1,34 @@ +// +// HBPresetsViewController.h +// PresetsView +// +// Created by Damiano Galassi on 14/07/14. +// Copyright (c) 2014 Damiano Galassi. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import "HBViewValidation.h" + +@class HBPresetsManager; +@class HBPreset; + +@protocol HBPresetsViewControllerDelegate <NSObject> + +- (void)selectionDidChange; +- (void)showAddPresetPanel:(id)sender; + +@end + +@interface HBPresetsViewController : NSViewController <HBViewValidation> + +- (instancetype)initWithPresetManager:(HBPresetsManager *)presetManager; + +@property (nonatomic, readwrite, assign) id<HBPresetsViewControllerDelegate> delegate; + +- (void)deselect; +- (void)selectDefaultPreset; + +@property (nonatomic, readonly) HBPreset *selectedPreset; +@property (nonatomic, readonly) NSUInteger indexOfSelectedItem; + +@end diff --git a/macosx/HBPresetsViewController.m b/macosx/HBPresetsViewController.m new file mode 100644 index 000000000..768dd1aa7 --- /dev/null +++ b/macosx/HBPresetsViewController.m @@ -0,0 +1,396 @@ +// +// HBPresetsViewController.m +// PresetsView +// +// Created by Damiano Galassi on 14/07/14. +// Copyright (c) 2014 Damiano Galassi. All rights reserved. +// + +#import "HBPresetsViewController.h" +#import "HBPresetsManager.h" +#import "HBPreset.h" + +// drag and drop pasteboard type +#define kHandBrakePresetPBoardType @"handBrakePresetPBoardType" + +@interface HBPresetsViewController () <NSOutlineViewDelegate> + +@property (nonatomic, retain) HBPresetsManager *presets; +@property (nonatomic, assign) IBOutlet NSTreeController *treeController; + +/** + * Helper var for drag & drop + */ +@property (nonatomic, retain) NSArray *dragNodesArray; + +/** + * The status (expanded or not) of the folders. + */ +@property (nonatomic, retain) NSMutableArray *expandedNodes; + +@property (assign) IBOutlet NSOutlineView *outlineView; + +@property (nonatomic) BOOL enabled; + +@end + +@implementation HBPresetsViewController + +- (instancetype)initWithPresetManager:(HBPresetsManager *)presetManager +{ + self = [super initWithNibName:@"Presets" bundle:nil]; + if (self) + { + _presets = [presetManager retain]; + _expandedNodes = [[NSArray arrayWithArray:[[NSUserDefaults standardUserDefaults] + objectForKey:@"HBPreviewViewExpandedStatus"]] mutableCopy]; + } + return self; +} + +- (void)dealloc +{ + self.presets = nil; + self.dragNodesArray = nil; + self.expandedNodes = nil; + + [super dealloc]; +} + +- (void)loadView +{ + [super loadView]; + + // drag and drop support + [self.outlineView registerForDraggedTypes:@[kHandBrakePresetPBoardType]]; + + // Re-expand the items + [self expandNodes:[self.treeController.arrangedObjects childNodes]]; + + [self deselect]; +} + +- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem +{ + SEL action = anItem.action; + + if (action == @selector(setDefault:)) + { + if (![[[self.treeController selectedObjects] firstObject] isLeaf]) + { + return NO; + } + } + + return YES; +} + +#pragma mark - HBViewValidation methods + +- (void)setEnabled:(BOOL)enabled +{ + _enabled = enabled; +} + +#pragma mark - UI Methods + +- (IBAction)clicked:(id)sender +{ + if (self.delegate && [[self.treeController.selectedObjects firstObject] isLeaf] && self.enabled) + { + [self.delegate selectionDidChange]; + } +} + +- (IBAction)addNewPreset:(id)sender +{ + if (self.delegate) + { + [self.delegate showAddPresetPanel:sender]; + } +} + +- (IBAction)deletePreset:(id)sender +{ + if ([self.treeController canRemove]) + { + /* Alert user before deleting preset */ + NSAlert *alert = [NSAlert alertWithMessageText:@"Warning!" + defaultButton:@"OK" + alternateButton:@"Cancel" + otherButton:nil + informativeTextWithFormat:@"Are you sure that you want to delete the selected preset?"]; + [alert setAlertStyle:NSCriticalAlertStyle]; + + NSInteger status = [alert runModal]; + + if (status == NSAlertDefaultReturn) + { + [self.presets deletePresetAtIndexPath:[self.treeController selectionIndexPath]]; + } + } +} + +- (IBAction)insertFolder:(id)sender +{ + NSIndexPath *selectionIndexPath = [self.treeController selectionIndexPath]; + if (!selectionIndexPath) + { + selectionIndexPath = [NSIndexPath indexPathWithIndex:self.presets.contents.count]; + } + + HBPreset *selectedNode = [[self.treeController selectedObjects] firstObject]; + if (!selectedNode.isBuiltIn) + { + HBPreset *node = [[HBPreset alloc] initWithFolderName:@"New Folder" builtIn:NO]; + [self.treeController insertObject:node atArrangedObjectIndexPath:selectionIndexPath]; + [node autorelease]; + } +} + +- (IBAction)setDefault:(id)sender +{ + HBPreset *selectedNode = [[self.treeController selectedObjects] firstObject]; + if ([[selectedNode valueForKey:@"isLeaf"] boolValue]) + { + self.presets.defaultPreset = selectedNode; + } +} + +- (void)deselect +{ + [self.treeController setSelectionIndexPath:nil]; +} + +- (void)selectDefaultPreset +{ + NSIndexPath *idx = [self.presets indexPathOfPreset:self.presets.defaultPreset]; + + if (idx) + { + [self.treeController setSelectionIndexPath:idx]; + [self clicked:self]; + } +} + +- (HBPreset *)selectedPreset +{ + HBPreset *selectedNode = [[self.treeController selectedObjects] firstObject]; + if ([[selectedNode valueForKey:@"isLeaf"] boolValue]) + { + return selectedNode; + } + else + { + return self.presets.defaultPreset; + } +} + +- (IBAction)updateBuiltInPresets:(id)sender +{ + [self.presets generateBuiltInPresets]; + + // Re-expand the items + [self expandNodes:[self.treeController.arrangedObjects childNodes]]; +} + +#pragma mark - Added Functionality (optional) + +/* We use this to provide tooltips for the items in the presets outline view */ +- (NSString *)outlineView:(NSOutlineView *)fPresetsOutlineView + toolTipForCell:(NSCell *)cell + rect:(NSRectPointer)rect + tableColumn:(NSTableColumn *)tc + item:(id)item + mouseLocation:(NSPoint)mouseLocation +{ + return [[item representedObject] presetDescription]; +} + +/* Use to customize the font and display characteristics of the title cell */ +- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item +{ + NSColor *fontColor; + + if ([self.outlineView selectedRow] == [self.outlineView rowForItem:item]) + { + fontColor = [NSColor blackColor]; + } + else + { + if ([[item representedObject] isBuiltIn]) + { + fontColor = [NSColor blueColor]; + } + else // User created preset, use a black font + { + fontColor = [NSColor blackColor]; + } + } + + [cell setTextColor:fontColor]; +} + +#pragma mark - Expanded node persitence methods + +- (void)expandNodes:(NSArray *)childNodes +{ + for (id node in childNodes) + { + [self expandNodes:[node childNodes]]; + if ([self.expandedNodes containsObject:@([[node representedObject] hash])]) + [self.outlineView expandItem:node expandChildren:YES]; + } +} + +- (void)outlineViewItemDidExpand:(NSNotification *)notification +{ + HBPreset *node = [[[notification userInfo] valueForKey:@"NSObject"] representedObject]; + if (![self.expandedNodes containsObject:@(node.hash)]) + { + [self.expandedNodes addObject:@(node.hash)]; + [[NSUserDefaults standardUserDefaults] setObject:self.expandedNodes forKey:@"HBPreviewViewExpandedStatus"]; + } +} + +- (void)outlineViewItemDidCollapse:(NSNotification *)notification +{ + HBPreset *node = [[[notification userInfo] valueForKey:@"NSObject"] representedObject]; + [self.expandedNodes removeObject:@(node.hash)]; + [[NSUserDefaults standardUserDefaults] setObject:self.expandedNodes forKey:@"HBPreviewViewExpandedStatus"]; +} + +#pragma mark - Drag & Drops + +/** + * draggingSourceOperationMaskForLocal <NSDraggingSource override> + */ +- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal +{ + return NSDragOperationMove; +} + +/** + * outlineView:writeItems:toPasteboard + */ +- (BOOL)outlineView:(NSOutlineView *)ov writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard +{ + // Return no if we are trying to drag a built-in preset + for (id item in items) { + if ([[item representedObject] isBuiltIn]) + return NO; + } + + [pboard declareTypes:@[kHandBrakePresetPBoardType] owner:self]; + + // keep track of this nodes for drag feedback in "validateDrop" + self.dragNodesArray = items; + + return YES; +} + +/** + * outlineView:validateDrop:proposedItem:proposedChildrenIndex: + * + * This method is used by NSOutlineView to determine a valid drop target. + */ + - (NSDragOperation)outlineView:(NSOutlineView *)ov + validateDrop:(id <NSDraggingInfo>)info + proposedItem:(id)item + proposedChildIndex:(NSInteger)index +{ + NSDragOperation result = NSDragOperationNone; + + if (!item) + { + // no item to drop on + result = NSDragOperationGeneric; + } + else + { + if (index == -1 || [[item representedObject] isBuiltIn] || [self.dragNodesArray containsObject:item]) + { + // don't allow dropping on a child + result = NSDragOperationNone; + } + else + { + // drop location is a container + result = NSDragOperationMove; + } + } + + return result; +} + +/** + * handleInternalDrops:pboard:withIndexPath: + * + * The user is doing an intra-app drag within the outline view. + */ +- (void)handleInternalDrops:(NSPasteboard *)pboard withIndexPath:(NSIndexPath *)indexPath +{ + // user is doing an intra app drag within the outline view: + NSArray *newNodes = self.dragNodesArray; + + // move the items to their new place (we do this backwards, otherwise they will end up in reverse order) + NSInteger idx; + for (idx = ([newNodes count] - 1); idx >= 0; idx--) + { + [self.treeController moveNode:newNodes[idx] toIndexPath:indexPath]; + } + + // keep the moved nodes selected + NSMutableArray *indexPathList = [NSMutableArray array]; + for (NSUInteger i = 0; i < [newNodes count]; i++) + { + [indexPathList addObject:[newNodes[i] indexPath]]; + } + [self.treeController setSelectionIndexPaths: indexPathList]; +} + +/** + * outlineView:acceptDrop:item:childIndex + * + * This method is called when the mouse is released over an outline view that previously decided to allow a drop + * via the validateDrop method. The data source should incorporate the data from the dragging pasteboard at this time. + * 'index' is the location to insert the data as a child of 'item', and are the values previously set in the validateDrop: method. + * + */ +- (BOOL)outlineView:(NSOutlineView *)ov acceptDrop:(id <NSDraggingInfo>)info item:(id)targetItem childIndex:(NSInteger)index +{ + // note that "targetItem" is a NSTreeNode proxy + // + BOOL result = NO; + + // find the index path to insert our dropped object(s) + NSIndexPath *indexPath; + if (targetItem) + { + // drop down inside the tree node: + // feth the index path to insert our dropped node + indexPath = [[targetItem indexPath] indexPathByAddingIndex:index]; + } + else + { + // drop at the top root level + if (index == -1) // drop area might be ambibuous (not at a particular location) + indexPath = [NSIndexPath indexPathWithIndex:self.presets.contents.count]; // drop at the end of the top level + else + indexPath = [NSIndexPath indexPathWithIndex:index]; // drop at a particular place at the top level + } + + NSPasteboard *pboard = [info draggingPasteboard]; // get the pasteboard + + // check the dragging type - + if ([pboard availableTypeFromArray:@[kHandBrakePresetPBoardType]]) + { + // user is doing an intra-app drag within the outline view + [self handleInternalDrops:pboard withIndexPath:indexPath]; + result = YES; + } + + return result; +} + +@end diff --git a/macosx/HBViewValidation.h b/macosx/HBViewValidation.h new file mode 100644 index 000000000..610d7bb25 --- /dev/null +++ b/macosx/HBViewValidation.h @@ -0,0 +1,15 @@ +// +// HBViewValidation.h +// HandBrake +// +// Created by Damiano Galassi on 07/08/14. +// +// + +#import <Foundation/Foundation.h> + +@protocol HBViewValidation <NSObject> + +- (void)setEnabled:(BOOL)enabled; + +@end diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index 9bae27c06..01ffb42e3 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -30,7 +30,7 @@ 273F20B314ADBE670021BE6D /* HBOutputPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F209C14ADBE670021BE6D /* HBOutputPanelController.m */; }; 273F20B414ADBE670021BE6D /* HBOutputRedirect.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F209E14ADBE670021BE6D /* HBOutputRedirect.m */; }; 273F20B514ADBE670021BE6D /* HBPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20A014ADBE670021BE6D /* HBPreferencesController.m */; }; - 273F20B614ADBE670021BE6D /* HBPresets.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20A214ADBE670021BE6D /* HBPresets.m */; }; + 273F20B614ADBE670021BE6D /* HBPresetsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20A214ADBE670021BE6D /* HBPresetsManager.m */; }; 273F20B714ADBE670021BE6D /* HBPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20A414ADBE670021BE6D /* HBPreviewController.m */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; 273F20B814ADBE670021BE6D /* HBQueueController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 273F20A614ADBE670021BE6D /* HBQueueController.mm */; }; 273F20BA14ADBE670021BE6D /* PictureController.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20AA14ADBE670021BE6D /* PictureController.m */; }; @@ -127,6 +127,9 @@ A9935213196F38A70069C6B7 /* ChaptersTitles.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9935211196F38A70069C6B7 /* ChaptersTitles.xib */; }; A9AA447A1970664A00D7DEFC /* HBUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AA44791970664A00D7DEFC /* HBUtilities.m */; }; A9C0DB85197E7B0000DF55B3 /* SubtitlesDefaults.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C0DB83197E7B0000DF55B3 /* SubtitlesDefaults.xib */; }; + A9CF25F11990D62C0023F727 /* Presets.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9CF25EF1990D62C0023F727 /* Presets.xib */; }; + A9CF25F41990D64E0023F727 /* HBPreset.m in Sources */ = {isa = PBXBuildFile; fileRef = A9CF25F31990D64E0023F727 /* HBPreset.m */; }; + A9CF25F71990D6820023F727 /* HBPresetsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9CF25F61990D6820023F727 /* HBPresetsViewController.m */; }; A9D1E41718262364002F6424 /* HBPreviewGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1E41618262364002F6424 /* HBPreviewGenerator.m */; }; A9DC6C52196F04F6002AE6B4 /* HBSubtitlesController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9DC6C50196F04F6002AE6B4 /* HBSubtitlesController.m */; }; A9DC6C56196F0517002AE6B4 /* Subtitles.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9DC6C54196F0517002AE6B4 /* Subtitles.xib */; }; @@ -246,8 +249,8 @@ 273F209E14ADBE670021BE6D /* HBOutputRedirect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBOutputRedirect.m; sourceTree = "<group>"; }; 273F209F14ADBE670021BE6D /* HBPreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPreferencesController.h; sourceTree = "<group>"; }; 273F20A014ADBE670021BE6D /* HBPreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPreferencesController.m; sourceTree = "<group>"; }; - 273F20A114ADBE670021BE6D /* HBPresets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPresets.h; sourceTree = "<group>"; }; - 273F20A214ADBE670021BE6D /* HBPresets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPresets.m; sourceTree = "<group>"; }; + 273F20A114ADBE670021BE6D /* HBPresetsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPresetsManager.h; sourceTree = "<group>"; }; + 273F20A214ADBE670021BE6D /* HBPresetsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPresetsManager.m; sourceTree = "<group>"; }; 273F20A314ADBE670021BE6D /* HBPreviewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPreviewController.h; sourceTree = "<group>"; }; 273F20A414ADBE670021BE6D /* HBPreviewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPreviewController.m; sourceTree = "<group>"; }; 273F20A614ADBE670021BE6D /* HBQueueController.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = HBQueueController.mm; sourceTree = "<group>"; }; @@ -324,6 +327,7 @@ A90A0CAE1988D57200DA65CE /* HBAudioTrackPreset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAudioTrackPreset.m; sourceTree = "<group>"; }; A91726E5197291BC00D1AFEF /* HBChapterTitlesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBChapterTitlesController.h; sourceTree = "<group>"; }; A91726E6197291BC00D1AFEF /* HBChapterTitlesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBChapterTitlesController.m; sourceTree = "<group>"; }; + A919C7AC199369180049E6A3 /* HBViewValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBViewValidation.h; sourceTree = "<group>"; }; A932E26B1988334B0047D13E /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = AudioDefaults.xib; sourceTree = "<group>"; }; A932E26D198833920047D13E /* HBAudioDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAudioDefaultsController.h; sourceTree = "<group>"; }; A932E26E198833920047D13E /* HBAudioDefaultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAudioDefaultsController.m; sourceTree = "<group>"; }; @@ -342,6 +346,11 @@ A9AA447D1970729300D7DEFC /* HBPreviewGenerator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBPreviewGenerator.h; sourceTree = "<group>"; }; A9B34D74197696FE00871B7D /* DiskArbitration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiskArbitration.framework; path = System/Library/Frameworks/DiskArbitration.framework; sourceTree = SDKROOT; }; A9C0DB84197E7B0000DF55B3 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = SubtitlesDefaults.xib; sourceTree = "<group>"; }; + A9CF25F01990D62C0023F727 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Presets.xib; sourceTree = "<group>"; }; + A9CF25F21990D64E0023F727 /* HBPreset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPreset.h; sourceTree = "<group>"; }; + A9CF25F31990D64E0023F727 /* HBPreset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPreset.m; sourceTree = "<group>"; }; + A9CF25F51990D6820023F727 /* HBPresetsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPresetsViewController.h; sourceTree = "<group>"; }; + A9CF25F61990D6820023F727 /* HBPresetsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPresetsViewController.m; sourceTree = "<group>"; }; A9D1E41618262364002F6424 /* HBPreviewGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPreviewGenerator.m; sourceTree = "<group>"; }; A9DC6C4F196F04F6002AE6B4 /* HBSubtitlesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBSubtitlesController.h; sourceTree = SOURCE_ROOT; }; A9DC6C50196F04F6002AE6B4 /* HBSubtitlesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBSubtitlesController.m; sourceTree = SOURCE_ROOT; }; @@ -664,6 +673,7 @@ children = ( 273F217C14ADDDA10021BE6D /* InfoPlist.strings */, 273F217E14ADDDA10021BE6D /* MainMenu.xib */, + A9CF25EF1990D62C0023F727 /* Presets.xib */, A93E0ED51972958C00FD67FB /* Video.xib */, A9F2EB6D196F12C800066546 /* Audio.xib */, A932E26A1988334B0047D13E /* AudioDefaults.xib */, @@ -745,8 +755,10 @@ A98C29C51977C00000AF5DED /* Model */ = { isa = PBXGroup; children = ( - 273F20A114ADBE670021BE6D /* HBPresets.h */, - 273F20A214ADBE670021BE6D /* HBPresets.m */, + 273F20A114ADBE670021BE6D /* HBPresetsManager.h */, + 273F20A214ADBE670021BE6D /* HBPresetsManager.m */, + A9CF25F21990D64E0023F727 /* HBPreset.h */, + A9CF25F31990D64E0023F727 /* HBPreset.m */, A932E271198834130047D13E /* HBAudioSettings.h */, A932E272198834130047D13E /* HBAudioSettings.m */, A9F4728B1976BAA70009EC65 /* HBSubtitlesSettings.h */, @@ -782,6 +794,8 @@ A9B34D701976841800871B7D /* Main Window View Controllers */ = { isa = PBXGroup; children = ( + A9CF25F51990D6820023F727 /* HBPresetsViewController.h */, + A9CF25F61990D6820023F727 /* HBPresetsViewController.m */, A93E0ED01972957000FD67FB /* HBVideoController.h */, A93E0ED11972957000FD67FB /* HBVideoController.m */, A9AA447B1970724D00D7DEFC /* HBAdvancedController.h */, @@ -796,6 +810,7 @@ A9F472851976B7AA0009EC65 /* Subtitles Defaults */, A91726E5197291BC00D1AFEF /* HBChapterTitlesController.h */, A91726E6197291BC00D1AFEF /* HBChapterTitlesController.m */, + A919C7AC199369180049E6A3 /* HBViewValidation.h */, ); name = "Main Window View Controllers"; sourceTree = "<group>"; @@ -926,6 +941,7 @@ 273F215B14ADCBF80021BE6D /* JobPassFirstSmall.png in Resources */, 273F215D14ADCBF80021BE6D /* JobPassSecondSmall.png in Resources */, 273F215F14ADCBF80021BE6D /* JobPassSubtitleSmall.png in Resources */, + A9CF25F11990D62C0023F727 /* Presets.xib in Resources */, 273F216014ADCBF80021BE6D /* JobPassUnknownSmall.png in Resources */, 273F216114ADCBF80021BE6D /* JobSmall.png in Resources */, 273F216714ADCBF80021BE6D /* Reveal.png in Resources */, @@ -1010,14 +1026,16 @@ 273F20B514ADBE670021BE6D /* HBPreferencesController.m in Sources */, A9DC6C52196F04F6002AE6B4 /* HBSubtitlesController.m in Sources */, A9F472891976B7F30009EC65 /* HBSubtitlesDefaultsController.m in Sources */, + A9CF25F41990D64E0023F727 /* HBPreset.m in Sources */, A9F4728D1976BAA70009EC65 /* HBSubtitlesSettings.m in Sources */, A93E0ED31972957000FD67FB /* HBVideoController.m in Sources */, - 273F20B614ADBE670021BE6D /* HBPresets.m in Sources */, + 273F20B614ADBE670021BE6D /* HBPresetsManager.m in Sources */, 273F20B714ADBE670021BE6D /* HBPreviewController.m in Sources */, A9D1E41718262364002F6424 /* HBPreviewGenerator.m in Sources */, A90A0CAF1988D57200DA65CE /* HBAudioTrackPreset.m in Sources */, 273F20B814ADBE670021BE6D /* HBQueueController.mm in Sources */, 273F20BA14ADBE670021BE6D /* PictureController.m in Sources */, + A9CF25F71990D6820023F727 /* HBPresetsViewController.m in Sources */, 273F20BE14ADC09F0021BE6D /* main.mm in Sources */, A91726E7197291BC00D1AFEF /* HBChapterTitlesController.m in Sources */, A932E26F198833920047D13E /* HBAudioDefaultsController.m in Sources */, @@ -1137,6 +1155,14 @@ name = SubtitlesDefaults.xib; sourceTree = "<group>"; }; + A9CF25EF1990D62C0023F727 /* Presets.xib */ = { + isa = PBXVariantGroup; + children = ( + A9CF25F01990D62C0023F727 /* English */, + ); + name = Presets.xib; + sourceTree = "<group>"; + }; A9DC6C54196F0517002AE6B4 /* Subtitles.xib */ = { isa = PBXVariantGroup; children = ( |