From: dynaflash Date: Fri, 26 Jan 2007 07:21:36 +0000 (+0000) Subject: MediaFork mac gui changes: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9f8e9765d9cc12407843644621ffc26a3c84f20;p=handbrake MediaFork mac gui changes: - Added pref for ipod/itunes friendly mp4 filename extension (.m4v) at launch. Default is still .mp4 - Added Pref for using CRF method instead of the default CQP method for x264 Constant Quality encodes. git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/MediaFork_0.8.0@194 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 281c3372b..370aa2219 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -298,6 +298,45 @@ static int FormatSettings[3][4] = [fDstFile2Field setStringValue: [NSString stringWithFormat: @"%@/Desktop/%@.mp4", NSHomeDirectory(),[NSString stringWithUTF8String: title->name]]]; + + int format = [fDstFormatPopUp indexOfSelectedItem]; + char * ext = NULL; + switch( format ) + { + case 0: + /* if Format is mpeg4 Change extension to proper for mpeg4 output */ + + /*Get Default MP4 File Extension for mpeg4 (.mp4 or .m4v) from prefs*/ + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0) + { + ext = "m4v"; + } + else + { + ext = "mp4"; + } + break; + case 1: + ext = "avi"; + case 2: + break; + ext = "ogm"; + break; + } + NSString * string = [fDstFile2Field stringValue]; + /* Add/replace File Output name to the correct extension*/ + if( [string characterAtIndex: [string length] - 4] == '.' ) + { + [fDstFile2Field setStringValue: [NSString stringWithFormat: + @"%@.%s", [string substringToIndex: [string length] - 4], + ext]]; + } + else + { + [fDstFile2Field setStringValue: [NSString stringWithFormat: + @"%@.%s", string, ext]]; + } + [fSrcTitlePopUp addItemWithTitle: [NSString stringWithFormat: @"%d - %02dh%02dm%02ds", @@ -604,8 +643,13 @@ static int FormatSettings[3][4] = job->mux = HB_MUX_IPOD; } - /* Set this flag to switch from Constant Quantizer(default) to Constant Rate Factor */ - // job->crf = 1; + /* Set this flag to switch from Constant Quantizer(default) to Constant Rate Factor Thanks jbrjake + Currently only used with Constant Quality setting*/ + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultCrf"] > 0 && [fVidQualityMatrix selectedRow] == 2) + { + /* Can only be used with svn rev >= 89 */ + job->crf = 1; + } job->h264_13 = [fVidEncoderPopUp indexOfSelectedItem]; } @@ -896,7 +940,15 @@ static int FormatSettings[3][4] = switch( format ) { case 0: - ext = "mp4"; + /*Get Default MP4 File Extension*/ + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0) + { + ext = "m4v"; + } + else + { + ext = "mp4"; + } [fDstCodecsPopUp addItemWithTitle: _( @"MPEG-4 Video / AAC Audio" )]; [fDstCodecsPopUp addItemWithTitle: diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 8c19d8c28..860572995 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -135,7 +135,13 @@ ACTIONS = {CheckChanged = id; ClosePanel = id; OpenPanel = id; }; CLASS = PrefsController; LANGUAGE = ObjC; - OUTLETS = {fPanel = NSPanel; fUpdateCheck = NSButton; fdefaultlanguage = NSComboBox; }; + OUTLETS = { + fDefCrf = NSButton; + fFileExtItunes = NSButton; + fPanel = NSPanel; + fUpdateCheck = NSButton; + fdefaultlanguage = NSComboBox; + }; SUPERCLASS = NSObject; }, { diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index 4c967486e..f8f5b983d 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -17,8 +17,7 @@ IBOpenObjects - 1162 - 21 + 1438 IBSystem Version 8L127 diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index 25b3abfd9..07ea8fbb8 100644 Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/macosx/PrefsController.h b/macosx/PrefsController.h index 46ff48b3b..8d3b95065 100644 --- a/macosx/PrefsController.h +++ b/macosx/PrefsController.h @@ -7,6 +7,8 @@ IBOutlet NSPanel * fPanel; IBOutlet NSButton * fUpdateCheck; IBOutlet NSComboBox * fdefaultlanguage; + IBOutlet NSButton * fFileExtItunes; + IBOutlet NSButton * fDefCrf; } - (IBAction) OpenPanel: (id) sender; diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index a4622ae51..3f0472179 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -8,17 +8,30 @@ NSDictionary * appDefaults; /* Unless the user specified otherwise, default is to check - for update */ + for update */ defaults = [NSUserDefaults standardUserDefaults]; appDefaults = [NSDictionary dictionaryWithObject:@"YES" forKey:@"CheckForUpdates"]; appDefaults = [NSDictionary dictionaryWithObject:@"English" forKey:@"DefaultLanguage"]; + appDefaults = [NSDictionary dictionaryWithObject:@"NO" + forKey:@"DefaultMpegName"]; + appDefaults = [NSDictionary dictionaryWithObject:@"NO" + forKey:@"DefaultCrf"]; [defaults registerDefaults: appDefaults]; - /* Check or uncheck according to the preferences */ + /* fUpdateCheck Check or uncheck according to the preferences */ [fUpdateCheck setState: [defaults boolForKey:@"CheckForUpdates"] ? NSOnState : NSOffState]; + /* fFileExtItunes Check or uncheck according to the preferences */ + [fFileExtItunes setState: [defaults boolForKey:@"DefaultMpegName"] ? + NSOnState : NSOffState]; + + /* fDefCrf Check or uncheck according to the preferences */ + [fDefCrf setState: [defaults boolForKey:@"DefaultCrf"] ? + NSOnState : NSOffState]; + + // Fill the languages combobox [fdefaultlanguage removeAllItems]; [fdefaultlanguage addItemWithObjectValue: @"Afar"]; @@ -207,7 +220,8 @@ { NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults]; - if( [fUpdateCheck state] == NSOnState ) + /* Check Update Itunes Set */ + if( [fUpdateCheck state] == NSOnState ) { [defaults setObject:@"YES" forKey:@"CheckForUpdates"]; } @@ -215,7 +229,29 @@ { [defaults setObject:@"NO" forKey:@"CheckForUpdates"]; } + /* File Extension Itunes Set */ + + if( [fFileExtItunes state] == NSOnState ) + { + [defaults setObject:@"YES" forKey:@"DefaultMpegName"]; + } + else + { + [defaults setObject:@"NO" forKey:@"DefaultMpegName"]; + } + + /* Use CRF for constant mode */ + + if( [fDefCrf state] == NSOnState ) + { + [defaults setObject:@"YES" forKey:@"DefaultCrf"]; + } + else + { + [defaults setObject:@"NO" forKey:@"DefaultCrf"]; + } + /* Preferred Language Combobox Set */ [defaults setObject:[fdefaultlanguage objectValueOfSelectedItem] forKey:@"DefaultLanguage"]; }