summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordynaflash <[email protected]>2007-03-23 19:33:38 +0000
committerdynaflash <[email protected]>2007-03-23 19:33:38 +0000
commitea3368225df25963dda8f5ea7ef170ce92f3c997 (patch)
tree474768695eb010f5b2c898fd686b4bdd8313ba70
parentd247bba2cb6161ada13d4930116f5a090eae9f51 (diff)
MacGui: Create Chapter Markers implemented in gui.
- Checkbox is only available when format is MP4 - Does not force an .m4v file extension at this time - Add built in presets initial implementation - built in presets still needs to be finalized and refined - Caused a bug in creating custom presets (see NOTE below) NOTE: this rev has the add preset button non-functional as some user preset changes have been made but not finished and the add preset window currently hangs. As rev 440 states, you still need to use ./configure then ./jam to build contribs. jam will report a failed build, but then just use "make internal" and it will build successfully. We still need priaux or someone to compile maurj's changes to contribs. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@441 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.h13
-rw-r--r--macosx/Controller.mm192
-rw-r--r--macosx/English.lproj/MainMenu.nib/classes.nib9
-rw-r--r--macosx/English.lproj/MainMenu.nib/info.nib7
-rw-r--r--macosx/English.lproj/MainMenu.nib/keyedobjects.nibbin95535 -> 96446 bytes
5 files changed, 201 insertions, 20 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index 8d920d104..c4abf29bd 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -52,6 +52,7 @@
IBOutlet NSTextField * fDstFile1Field;
IBOutlet NSTextField * fDstFile2Field;
IBOutlet NSButton * fDstBrowseButton;
+ IBOutlet NSButton * fCreateChapterMarkers;
/* Video box */
IBOutlet NSTextField * fVidRateField;
@@ -197,12 +198,16 @@
- (IBAction) ShowAddPresetPanel: (id) sender;
- (IBAction) CloseAddPresetPanel: (id) sender;
-- (NSDictionary *)CreatePreset;
+- (NSDictionary *)CreatePreset;
+- (NSDictionary *)CreateIpodPreset;
+- (NSDictionary *)CreateAppleTVPreset;
- (void) savePreset;
-- (IBAction)addPreset:(id)sender;
-- (IBAction)insertPreset:(id)sender;
-- (IBAction)deletePreset:(id)sender;
+- (IBAction)AddFactoryPresets:(id)sender;
+- (IBAction)AddUserPreset:(id)sender;
+- (IBAction)AddPreset:(id)sender;
+- (IBAction)InsertPreset:(id)sender;
+- (IBAction)DeletePreset:(id)sender;
- (IBAction)tableViewSelected:(id)sender;
// NSTableDataSource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index cdd14e05a..0de001cdb 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -137,6 +137,7 @@ static int FormatSettings[3][4] =
if (nil == UserPresets)
{
UserPresets = [[NSMutableArray alloc] init];
+ [self AddFactoryPresets:NULL];
}
/* Show/Dont Show Presets drawer upon launch based
on user preference DefaultPresetsDrawerShow*/
@@ -577,7 +578,8 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
fPicSettingDeinterlaceDsply,fPicLabelSettings,fPicLabelSrc,fPicLabelOutp,
fPicLabelAr,fPicLabelDeinter,fPicLabelSrcX,fPicLabelOutputX,
fPicLabelPAROutp,fPicLabelPAROutputX,fPicSettingPARWidth,fPicSettingPARHeight,
- fPicSettingPARDsply,fPicLabelAnamorphic,tableView,fPresetsAdd,fPresetsDelete};
+ fPicSettingPARDsply,fPicLabelAnamorphic,tableView,fPresetsAdd,fPresetsDelete,
+ fCreateChapterMarkers};
for( unsigned i = 0;
i < sizeof( controls ) / sizeof( NSControl * ); i++ )
@@ -738,7 +740,12 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
job->mux = FormatSettings[format][codecs] & HB_MUX_MASK;
job->vcodec = FormatSettings[format][codecs] & HB_VCODEC_MASK;
job->acodec = FormatSettings[format][codecs] & HB_ACODEC_MASK;
-
+ /* We set the chapter marker extraction here based on the format being
+ mpeg4 and the checkbox being checked */
+ if ([fDstFormatPopUp indexOfSelectedItem] == 0 && [fCreateChapterMarkers state] == NSOnState)
+ {
+ job->chapter_markers = 1;
+ }
if( ( job->vcodec & HB_VCODEC_FFMPEG ) &&
[fVidEncoderPopUp indexOfSelectedItem] > 0 )
{
@@ -1120,6 +1127,8 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
/* changing the title may have changed the audio channels on offer, so */
/* check if this change means we should / should't offer 6-channel AAC extraction */
[self Check6ChannelAACExtraction: sender];
+
+
}
@@ -1170,7 +1179,9 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
_( @"MPEG-4 Video / AAC Audio" )];
[fDstCodecsPopUp addItemWithTitle:
_( @"AVC/H.264 Video / AAC Audio" )];
- break;
+ /* We enable the create chapters checkbox here since we are .mp4 */
+ [fCreateChapterMarkers setEnabled: YES];
+ break;
case 1:
ext = "avi";
[fDstCodecsPopUp addItemWithTitle:
@@ -1181,6 +1192,10 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
_( @"AVC/H.264 Video / MP3 Audio" )];
[fDstCodecsPopUp addItemWithTitle:
_( @"AVC/H.264 Video / AC-3 Audio" )];
+ /* We disable the create chapters checkbox here since we are NOT .mp4
+ and make sure it is unchecked*/
+ [fCreateChapterMarkers setEnabled: NO];
+ [fCreateChapterMarkers setState: NSOffState];
break;
case 2:
ext = "ogm";
@@ -1188,7 +1203,11 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
_( @"MPEG-4 Video / Vorbis Audio" )];
[fDstCodecsPopUp addItemWithTitle:
_( @"MPEG-4 Video / MP3 Audio" )];
- break;
+ /* We disable the create chapters checkbox here since we are NOT .mp4
+ and make sure it is unchecked*/
+ [fCreateChapterMarkers setEnabled: NO];
+ [fCreateChapterMarkers setState: NSOffState];
+ break;
}
[self CodecsPopUpChanged: NULL];
@@ -1455,24 +1474,44 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
- (IBAction) ShowAddPresetPanel: (id) sender
{
/* Show the panel */
+ /* Temporarily disable until window hang bug is fixed */
+ /*
[NSApp beginSheet: fAddPresetPanel modalForWindow: fWindow
modalDelegate: NULL didEndSelector: NULL contextInfo: NULL];
[NSApp runModalForWindow: fAddPresetPanel];
[NSApp endSheet: fAddPresetPanel];
- [fAddPresetPanel orderOut: self];
+ [fAddPresetPanel orderOut: self]
+ */
}
- (IBAction) CloseAddPresetPanel: (id) sender
{
[NSApp stopModal];
}
-- (IBAction)addPreset:(id)sender
+- (IBAction)AddFactoryPresets:(id)sender
+{
+ /* Here we create each shipped preset */
+ [UserPresets addObject:[self CreateIpodPreset]];
+ [UserPresets addObject:[self CreateAppleTVPreset]];
+ [self AddPreset: sender];
+}
+- (IBAction)AddUserPreset:(id)sender
+{
+ /* Here we create a custom user preset */
+ [UserPresets addObject:[self CreatePreset]];
+ [self AddPreset: sender];
+}
+- (IBAction)AddPreset:(id)sender
{
- [UserPresets addObject:[self CreatePreset]];
+
+
+ /* We Sort the Presets By Factory or Custom */
+ NSSortDescriptor * presetTypeDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"Type"
+ ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease];
/* We Sort the Presets Alphabetically by name */
- NSSortDescriptor * lastNameDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"PresetName"
+ NSSortDescriptor * presetNameDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"PresetName"
ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease];
- NSArray *sortDescriptors=[NSArray arrayWithObject:lastNameDescriptor];
+ NSArray *sortDescriptors=[NSArray arrayWithObjects:presetTypeDescriptor,presetNameDescriptor,nil];
NSArray *sortedArray=[UserPresets sortedArrayUsingDescriptors:sortDescriptors];
[UserPresets setArray:sortedArray];
@@ -1485,7 +1524,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
[self savePreset];
}
-- (IBAction)insertPreset:(id)sender
+- (IBAction)InsertPreset:(id)sender
{
int index = [tableView selectedRow];
[UserPresets insertObject:[self CreatePreset] atIndex:index];
@@ -1498,6 +1537,10 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
NSMutableDictionary *preset = [[NSMutableDictionary alloc] init];
/* Get the New Preset Name from the field in the AddPresetPanel */
[preset setObject:[fPresetNewName stringValue] forKey:@"PresetName"];
+ /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/
+ [preset setObject:[NSNumber numberWithInt:1] forKey:@"Type"];
+ /*Set whether or not this is default, at creation set to 0*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"];
/*Get the whether or not to apply pic settings in the AddPresetPanel*/
[preset setObject:[NSNumber numberWithInt:[fPresetNewPicSettingsApply state]] forKey:@"UsesPictureSettings"];
/* File Format */
@@ -1552,7 +1595,134 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow
}
-- (IBAction)deletePreset:(id)sender
+- (NSDictionary *)CreateIpodPreset
+{
+ NSMutableDictionary *preset = [[NSMutableDictionary alloc] init];
+ /* Get the New Preset Name from the field in the AddPresetPanel */
+ [preset setObject:@"HB-iPod" forKey:@"PresetName"];
+ /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"];
+ /*Set whether or not this is default, at creation set to 0*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"];
+ /*Get the whether or not to apply pic settings in the AddPresetPanel*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesPictureSettings"];
+ /* File Format */
+ [preset setObject:@"MP4 file" forKey:@"FileFormat"];
+ /* Codecs */
+ [preset setObject:@"AVC/H.264 Video / AAC Audio" forKey:@"FileCodecs"];
+ /* Video encoder */
+ [preset setObject:@"x264 (h.264 iPod)" forKey:@"VideoEncoder"];
+ /* Video quality */
+ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"];
+ [preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
+ [preset setObject:@"1400" forKey:@"VideoAvgBitrate"];
+ [preset setObject:[NSNumber numberWithFloat:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"];
+
+ /* Video framerate */
+ [preset setObject:@"Same as source" forKey:@"VideoFramerate"];
+ /* GrayScale */
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"];
+ /* 2 Pass Encoding */
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"];
+
+ /*Picture Settings*/
+ //hb_job_t * job = fTitle->job;
+ /* Basic Picture Settings */
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->deinterlace] forKey:@"PictureDeinterlace"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+ /* Set crop settings here */
+ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */
+ //[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"];
+
+ /*Audio*/
+ /* Audio Language One*/
+ [preset setObject:[fAudLang1PopUp titleOfSelectedItem] forKey:@"AudioLang1"];
+ /* Audio Language One Surround Sound Checkbox*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"AudioLang1Surround"];
+ /* Audio Sample Rate*/
+ [preset setObject:@"44.1" forKey:@"AudioSampleRate"];
+ /* Audio Bitrate Rate*/
+ [preset setObject:@"128" forKey:@"AudioBitRate"];
+ /* Subtitles*/
+ [preset setObject:@"None" forKey:@"Subtitles"];
+
+
+ [preset autorelease];
+ return preset;
+
+}
+
+- (NSDictionary *)CreateAppleTVPreset
+{
+ NSMutableDictionary *preset = [[NSMutableDictionary alloc] init];
+ /* Get the New Preset Name from the field in the AddPresetPanel */
+ [preset setObject:@"HB-AppleTV" forKey:@"PresetName"];
+ /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"];
+ /*Set whether or not this is default, at creation set to 0*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"];
+ /*Get the whether or not to apply pic settings in the AddPresetPanel*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesPictureSettings"];
+ /* File Format */
+ [preset setObject:@"MP4 file" forKey:@"FileFormat"];
+ /* Codecs */
+ [preset setObject:@"AVC/H.264 Video / AAC Audio" forKey:@"FileCodecs"];
+ /* Video encoder */
+ [preset setObject:@"x264 (h.264 Main)" forKey:@"VideoEncoder"];
+ /* Video quality */
+ [preset setObject:[NSNumber numberWithInt:1] forKey:@"VideoQualityType"];
+ [preset setObject:[fVidTargetSizeField stringValue] forKey:@"VideoTargetSize"];
+ [preset setObject:@"3000" forKey:@"VideoAvgBitrate"];
+ [preset setObject:[NSNumber numberWithFloat:[fVidQualitySlider floatValue]] forKey:@"VideoQualitySlider"];
+
+ /* Video framerate */
+ [preset setObject:@"Same as source" forKey:@"VideoFramerate"];
+ /* GrayScale */
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"];
+ /* 2 Pass Encoding */
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"];
+
+ /*Picture Settings*/
+ //hb_job_t * job = fTitle->job;
+ /* Basic Picture Settings */
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->deinterlace] forKey:@"PictureDeinterlace"];
+ //[preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+ /* Set crop settings here */
+ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */
+ //[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"];
+
+ /*Audio*/
+ /* Audio Language One*/
+ [preset setObject:[fAudLang1PopUp titleOfSelectedItem] forKey:@"AudioLang1"];
+ /* Audio Language One Surround Sound Checkbox*/
+ [preset setObject:[NSNumber numberWithInt:0] forKey:@"AudioLang1Surround"];
+ /* Audio Sample Rate*/
+ [preset setObject:@"44.1" forKey:@"AudioSampleRate"];
+ /* Audio Bitrate Rate*/
+ [preset setObject:@"320" forKey:@"AudioBitRate"];
+ /* Subtitles*/
+ [preset setObject:@"None" forKey:@"Subtitles"];
+
+
+ [preset autorelease];
+ return preset;
+
+}
+
+
+- (IBAction)DeletePreset:(id)sender
{
int status;
NSEnumerator *enumerator;
diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib
index 86004dbdc..60d576b6b 100644
--- a/macosx/English.lproj/MainMenu.nib/classes.nib
+++ b/macosx/English.lproj/MainMenu.nib/classes.nib
@@ -2,13 +2,17 @@
IBClasses = (
{
ACTIONS = {
+ AddFactoryPresets = id;
+ AddPreset = id;
AddToQueue = id;
+ AddUserPreset = id;
BrowseFile = id;
CalculateBitrate = id;
Cancel = id;
ChapterPopUpChanged = id;
CloseAddPresetPanel = id;
CodecsPopUpChanged = id;
+ DeletePreset = id;
EnableQueue = id;
EncoderPopUpChanged = id;
FormatPopUpChanged = id;
@@ -25,8 +29,7 @@
ShowScanPanel = id;
TitlePopUpChanged = id;
VideoMatrixChanged = id;
- addPreset = id;
- deletePreset = id;
+ myAction = id;
tableViewSelected = id;
};
CLASS = HBController;
@@ -43,6 +46,7 @@
fAudLang2PopUp = NSPopUpButton;
fAudRateField = NSTextField;
fAudRatePopUp = NSPopUpButton;
+ fCreateChapterMarkers = NSButton;
fDstBrowseButton = NSButton;
fDstCodecsField = NSTextField;
fDstCodecsPopUp = NSPopUpButton;
@@ -79,6 +83,7 @@
fPresetDrawer = NSDrawer;
fPresetNewName = NSTextField;
fPresetNewPicSettingsApply = NSButton;
+ fPresetSaveButton = NSButton;
fPresetSelectedDisplay = NSTextField;
fPresetsAdd = NSButton;
fPresetsDelete = NSButton;
diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib
index 02501e0fd..3d6e506bf 100644
--- a/macosx/English.lproj/MainMenu.nib/info.nib
+++ b/macosx/English.lproj/MainMenu.nib/info.nib
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
- <string>25 277 630 601 0 0 1440 878 </string>
+ <string>31 44 630 601 0 0 1440 878 </string>
<key>IBEditorPositions</key>
<dict>
<key>1843</key>
@@ -19,9 +19,10 @@
</array>
<key>IBOpenObjects</key>
<array>
- <integer>29</integer>
- <integer>1438</integer>
+ <integer>1867</integer>
<integer>1843</integer>
+ <integer>21</integer>
+ <integer>29</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 0d8b1659e..0f0ede5be 100644
--- a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
+++ b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
Binary files differ