]> granicus.if.org Git - handbrake/commitdiff
MacGui: Create Chapter Markers implemented in gui.
authordynaflash <dynaflashtech@gmail.com>
Fri, 23 Mar 2007 19:33:38 +0000 (19:33 +0000)
committerdynaflash <dynaflashtech@gmail.com>
Fri, 23 Mar 2007 19:33:38 +0000 (19:33 +0000)
- 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

macosx/Controller.h
macosx/Controller.mm
macosx/English.lproj/MainMenu.nib/classes.nib
macosx/English.lproj/MainMenu.nib/info.nib
macosx/English.lproj/MainMenu.nib/keyedobjects.nib

index 8d920d1041fbcaca19f28048affef0e4c817b81a..c4abf29bd1a5efd887bac046362c009493cd52f1 100644 (file)
@@ -52,6 +52,7 @@
     IBOutlet NSTextField         * fDstFile1Field;
     IBOutlet NSTextField         * fDstFile2Field;
     IBOutlet NSButton            * fDstBrowseButton;
+       IBOutlet NSButton            * fCreateChapterMarkers;
 
     /* Video box */
     IBOutlet NSTextField         * fVidRateField;
 
 - (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;
index cdd14e05a2d36c09d14d4b6291ed8ddbb67e4ed1..0de001cdbaca6e3eb3070a216b7a0d53def50538 100644 (file)
@@ -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;
index 86004dbdcd156bb011e1dc577d65eac706d4a2f4..60d576b6b2576ba1c6057a4c9c6ed5bd4422b592 100644 (file)
@@ -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; 
index 02501e0fd7026a53b396828c4ba08e728bd03a83..3d6e506bfd2169893f52a79890abc6e562b3b0c1 100644 (file)
@@ -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>
        </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>
index 0d8b1659e9e80c9025aa4767feea361c66ebdd92..0f0ede5be10e54047241a6d7d10339be9601a7b7 100644 (file)
Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ