summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <dynaflashtech@gmail.com>2007-04-04 19:06:56 +0000
committerdynaflash <dynaflashtech@gmail.com>2007-04-04 19:06:56 +0000
commit2d1ae8ed793752954420a9697428416ad94e45f4 (patch)
treef0284205be484b28a4e1291440df8ad0e58b2aa2 /macosx
parent12491db87e85c9d6a004752985efd10f0dee84bd (diff)
MacGui: x264 options in presets - initial implementation
- x264 options string can be entered in NSTextview in the create new preset window NOTE: - When using x264, the gui first looks for a preset with a x264 option string available and then looks for the string in the preferences if it cant find it in the preset. So, if there is a string available in the preset, it ignores the string (if there is one available) in the prefs. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@475 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.h21
-rw-r--r--macosx/Controller.mm61
-rw-r--r--macosx/English.lproj/MainMenu.nib/classes.nib3
-rw-r--r--macosx/English.lproj/MainMenu.nib/info.nib8
-rw-r--r--macosx/English.lproj/MainMenu.nib/keyedobjects.nibbin97772 -> 99773 bytes
5 files changed, 71 insertions, 22 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index 4fd0f272e..4d997df7c 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -127,19 +127,22 @@
IBOutlet NSDrawer * fPresetDrawer;
IBOutlet NSTextField * fPresetNewName;
+ IBOutlet NSTextView * fPresetNewX264Opt;
+ IBOutlet NSTextField * fPresetNewX264OptLabel;
IBOutlet NSButton * fPresetNewPicSettingsApply;
IBOutlet NSTextField * fPresetSelectedDisplay;
+ IBOutlet NSTextField * fDisplayX264Options;
- NSString * AppSupportDirectory;
- NSString * UserPresetsFile;
- NSString * x264ProfilesFile;
- NSMutableArray * UserPresets;
- NSMutableArray * x264Profiles;
- NSMutableArray *UserPresetssortedArray;
- NSMutableDictionary * chosenPreset;
-
+ NSString * AppSupportDirectory;
+ NSString * UserPresetsFile;
+ NSString * x264ProfilesFile;
+ NSMutableArray * UserPresets;
+ NSMutableArray * x264Profiles;
+ NSMutableArray * UserPresetssortedArray;
+ NSMutableDictionary * chosenPreset;
+ int curUserPresetChosenNum;
- IBOutlet NSPanel * fAddPresetPanel;
+ IBOutlet NSPanel * fAddPresetPanel;
IBOutlet NSTableView * tableView;
IBOutlet NSButton * fPresetsAdd;
IBOutlet NSButton * fPresetsDelete;
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index a8b25bab6..f3e6133c1 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -585,7 +585,7 @@ static int FormatSettings[3][4] =
fPicLabelAr,fPicLabelDeinter,fPicLabelSrcX,fPicLabelOutputX,
fPicLabelPAROutp,fPicLabelPAROutputX,fPicSettingPARWidth,fPicSettingPARHeight,
fPicSettingPARDsply,fPicLabelAnamorphic,tableView,fPresetsAdd,fPresetsDelete,
- fCreateChapterMarkers};
+ fCreateChapterMarkers,fPresetNewX264OptLabel};
for( unsigned i = 0;
i < sizeof( controls ) / sizeof( NSControl * ); i++ )
@@ -784,8 +784,21 @@ static int FormatSettings[3][4] =
job->crf = 1;
}
- /* Sends x264 options to the core library*/
- job->x264opts = [[[NSUserDefaults standardUserDefaults] stringForKey:@"DefAdvancedx264Flags"] UTF8String];
+ /* Below Sends x264 options to the core library if x264 is selected*/
+ /* First we look to see if a user preset has been selected that contains a x264 optional string CurUserPresetChosenNum = nil */
+ if (curUserPresetChosenNum != nil)
+ {
+ /* Lets use this to see if the proper string is being passed in the gui. We can comment out if need be.
+ for public use we have the field hidden in the nib */
+ [fDisplayX264Options setStringValue: [NSString stringWithFormat:@"%@",[chosenPreset valueForKey:@"x264Option"]]];
+ job->x264opts = [[chosenPreset valueForKey:@"x264Option"] cString];
+ }
+ else
+ {
+ /* if not, then we check to see if there is a x264 opt in the preferences and use that if we want */
+ job->x264opts = [[[NSUserDefaults standardUserDefaults] stringForKey:@"DefAdvancedx264Flags"] UTF8String];
+ }
+
job->h264_13 = [fVidEncoderPopUp indexOfSelectedItem];
@@ -1433,7 +1446,7 @@ static int FormatSettings[3][4] =
- (IBAction) CalculatePictureSizing: (id) sender
{
- hb_job_t * job = fTitle->job;
+ //hb_job_t * job = fTitle->job;
[fPicSettingWidth setStringValue: [NSString stringWithFormat:
@"%d", fTitle->job->width]];
@@ -1496,7 +1509,7 @@ static int FormatSettings[3][4] =
[fPicSettingPARDsply setStringValue: @"Off"];
}
-
+ [self CustomSettingUsed: sender];
}
- (IBAction) CalculateBitrate: (id) sender
@@ -1530,21 +1543,38 @@ the user is using "Custom" settings by determining the sender*/
[tableView deselectRow:[tableView selectedRow]];
/* Change UI to show "Custom" settings are being used */
[fPresetSelectedDisplay setStringValue: @"Custom"];
+ /* Empty the field to display custom x264 preset options*/
+ [fDisplayX264Options setStringValue: @""];
+ curUserPresetChosenNum = nil;
+
}
}
- (IBAction) ShowAddPresetPanel: (id) sender
{
- /* Show the panel */
- /* Temporarily disable until window hang bug is fixed */
+ /* If we have MP4, AVC H.264 and x264 Main then we enable the x264 Options field for the
+ Add Preset window we are about to open. We do this before we actually open the panel,
+ as doing it after causes it to stick from the last selection for some reason. */
+ if ([fDstFormatPopUp indexOfSelectedItem] == 0 && [fDstCodecsPopUp indexOfSelectedItem] == 1 && [fVidEncoderPopUp indexOfSelectedItem] == 0)
+ {
+ [fPresetNewX264Opt setEditable: YES];
+ [fPresetNewX264OptLabel setEnabled: YES];
+ }
+ else
+ {
+ [fPresetNewX264Opt setEditable: NO];
+ [fPresetNewX264OptLabel setEnabled: NO];
+ }
- [NSApp beginSheet: fAddPresetPanel modalForWindow: fWindow
+ /* Show the panel */
+ [NSApp beginSheet: fAddPresetPanel modalForWindow: fWindow
modalDelegate: NULL didEndSelector: NULL contextInfo: NULL];
[NSApp runModalForWindow: fAddPresetPanel];
[NSApp endSheet: fAddPresetPanel];
[fAddPresetPanel orderOut: self];
+
}
- (IBAction) CloseAddPresetPanel: (id) sender
{
@@ -1581,6 +1611,7 @@ the user is using "Custom" settings by determining the sender*/
/* We stop the modal window for the new preset */
[fPresetNewName setStringValue: @""];
+ //[fPresetNewX264Opt setStringValue: @""];
[NSApp stopModal];
/* We Reload the New Table data for presets */
[tableView reloadData];
@@ -1615,6 +1646,9 @@ the user is using "Custom" settings by determining the sender*/
[preset setObject:[fDstCodecsPopUp titleOfSelectedItem] forKey:@"FileCodecs"];
/* Video encoder */
[preset setObject:[fVidEncoderPopUp titleOfSelectedItem] forKey:@"VideoEncoder"];
+ /* x264 Option String */
+ [preset setObject:[fPresetNewX264Opt string] forKey:@"x264Option"];
+ //[fDisplayX264Options setStringValue: [NSString stringWithFormat: @"Using Option: %@",CurUserPresetx264Opt]];
/* Video quality */
[preset setObject:[NSNumber numberWithInt:[fVidQualityMatrix selectedRow]] forKey:@"VideoQualityType"];
[preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
@@ -1682,6 +1716,8 @@ the user is using "Custom" settings by determining the sender*/
[preset setObject:@"AVC/H.264 Video / AAC Audio" forKey:@"FileCodecs"];
/* Video encoder */
[preset setObject:@"x264 (h.264 iPod)" forKey:@"VideoEncoder"];
+ /* x264 Option String */
+ [preset setObject:@"" forKey:@"x264Option"];
/* Video quality */
[preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"];
[preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
@@ -1749,6 +1785,8 @@ the user is using "Custom" settings by determining the sender*/
[preset setObject:@"AVC/H.264 Video / AAC Audio" forKey:@"FileCodecs"];
/* Video encoder */
[preset setObject:@"x264 (h.264 Main)" forKey:@"VideoEncoder"];
+ /* x264 Option String (We can use this to tweak the appleTV output)*/
+ [preset setObject:@"" forKey:@"x264Option"];
/* Video quality */
[preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"];
[preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
@@ -1842,8 +1880,9 @@ the user is using "Custom" settings by determining the sender*/
/* we get the chosen preset from the UserPresets array */
chosenPreset = [UserPresets objectAtIndex:[sender selectedRow]];
+ curUserPresetChosenNum = [sender selectedRow];
/* we set the preset display field in main window here */
- [fPresetSelectedDisplay setStringValue: [NSString stringWithFormat: @"%@", [chosenPreset valueForKey:@"PresetName"]]];
+ [fPresetSelectedDisplay setStringValue: [NSString stringWithFormat: @"%@",[chosenPreset valueForKey:@"PresetName"]]];
/* File Format */
[fDstFormatPopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"FileFormat"]]];
[self FormatPopUpChanged: NULL];
@@ -1854,6 +1893,10 @@ the user is using "Custom" settings by determining the sender*/
[self CodecsPopUpChanged: NULL];
/* Video encoder */
[fVidEncoderPopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoEncoder"]]];
+
+ /* We can show the preset options here in the gui if we want to
+ Field is currently hidden from user, unhide it if we need to test */
+ [fDisplayX264Options setStringValue: [NSString stringWithFormat:[chosenPreset valueForKey:@"x264Option"]]];
/* Lets run through the following functions to get variables set there */
[self EncoderPopUpChanged: NULL];
[self Check6ChannelAACExtraction: NULL];
diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib
index 28e806f96..99d4450ad 100644
--- a/macosx/English.lproj/MainMenu.nib/classes.nib
+++ b/macosx/English.lproj/MainMenu.nib/classes.nib
@@ -47,6 +47,7 @@
fAudRateField = NSTextField;
fAudRatePopUp = NSPopUpButton;
fCreateChapterMarkers = NSButton;
+ fDisplayX264Options = NSTextField;
fDstBrowseButton = NSButton;
fDstCodecsField = NSTextField;
fDstCodecsPopUp = NSPopUpButton;
@@ -83,6 +84,8 @@
fPresetDrawer = NSDrawer;
fPresetNewName = NSTextField;
fPresetNewPicSettingsApply = NSButton;
+ fPresetNewX264Opt = NSTextView;
+ fPresetNewX264OptLabel = NSTextField;
fPresetSaveButton = NSButton;
fPresetSelectedDisplay = NSTextField;
fPresetsAdd = NSButton;
diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib
index 035e42b5d..67a0fec86 100644
--- a/macosx/English.lproj/MainMenu.nib/info.nib
+++ b/macosx/English.lproj/MainMenu.nib/info.nib
@@ -3,11 +3,11 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
- <string>-2 228 630 601 0 0 1440 878 </string>
+ <string>160 277 630 601 0 0 1440 878 </string>
<key>IBEditorPositions</key>
<dict>
<key>1843</key>
- <string>1791 35 220 592 1440 0 1280 1024 </string>
+ <string>610 276 220 592 0 0 1440 878 </string>
<key>29</key>
<string>102 834 300 44 0 0 1440 878 </string>
</dict>
@@ -19,9 +19,9 @@
</array>
<key>IBOpenObjects</key>
<array>
- <integer>29</integer>
- <integer>1843</integer>
<integer>21</integer>
+ <integer>29</integer>
+ <integer>1867</integer>
</array>
<key>IBSystem Version</key>
<string>8P2137</string>
diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
index f1c390d96..581ea6c23 100644
--- a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
+++ b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
Binary files differ