]> granicus.if.org Git - handbrake/commitdiff
Updates to Mac OS X GUI to support 5.1 audio extraction as AAC, based on dynaflash...
authormaurj <handbrake@maurj.com>
Tue, 13 Feb 2007 20:40:03 +0000 (20:40 +0000)
committermaurj <handbrake@maurj.com>
Tue, 13 Feb 2007 20:40:03 +0000 (20:40 +0000)
- this includes a new function in controller.mm - Check6ChannelAACExtraction - to set the visibility of the checkbox (fAudLang1SurroundCheck) based on the current audio settings.  This is called by several of the popup menus whenever they change

- note - this still doesn't take into account the second audio track, which is still broken (and disabled) as before

git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.8.0_beta2_5.1@321 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
test/test.c

index 6caf48a8de221b2b9e378c21bc8362de3f52fae9..9f38e00c265fd821ba0caac3b74ac2a6a752a63d 100644 (file)
     /* Audio box */
     IBOutlet NSTextField         * fAudLang1Field;
     IBOutlet NSPopUpButton       * fAudLang1PopUp;
-    IBOutlet NSButton       * fAudLang1Surround;
+    IBOutlet NSButton               * fAudLang1SurroundCheck;
     IBOutlet NSTextField         * fAudLang2Field;
     IBOutlet NSPopUpButton       * fAudLang2PopUp;
     IBOutlet NSTextField         * fAudRateField;
     IBOutlet NSButton            * fRipButton;
 
     hb_handle_t                  * fHandle;
-       hb_title_t               * fTitle;
+       hb_title_t                   * fTitle;
 }
 
 - (void)     TranslateStrings;
 - (IBAction) FormatPopUpChanged: (id) sender;
 - (IBAction) CodecsPopUpChanged: (id) sender;
 - (IBAction) EncoderPopUpChanged: (id) sender;
+- (IBAction) Check6ChannelAACExtraction: (id) sender;
 - (IBAction) LanguagePopUpChanged: (id) sender;
 
 - (IBAction) BrowseFile: (id) sender;
index 0857b5add04aab88a167156f81bb036d9c59a6bc..5635fd5dcd0cd50791ec898263f39a7ba8789821 100644 (file)
@@ -534,12 +534,21 @@ static int FormatSettings[3][4] =
             }
         }
         [controls[i] setEnabled: b];
-               /* Temporarily disable Lang2 until crash is fixed */
-               [fAudLang2PopUp setEnabled: NO];
-               [fAudLang2Field setEnabled: NO];
-       
+
     }
 
+       /* Temporarily disable Lang2 until crash is fixed */
+       [fAudLang2PopUp setEnabled: NO];
+       [fAudLang2Field setEnabled: NO];
+       
+       if (b) {
+               /* if we're enabling the interface, check if we should / should't offer 6-channel AAC extraction */
+               [self Check6ChannelAACExtraction: NULL];
+       } else {
+               /* if we're disabling the interface, turn it off */
+               [fAudLang1SurroundCheck setEnabled: NO];
+       }
+
     [self VideoMatrixChanged: NULL];
 }
 
@@ -747,6 +756,13 @@ static int FormatSettings[3][4] =
                      indexOfSelectedItem]].rate;
     job->abitrate = hb_audio_bitrates[[fAudBitratePopUp
                         indexOfSelectedItem]].rate;
+       /* have we selected that 5.1 should be extracted as AAC? */
+       if (job->acodec == HB_ACODEC_FAAC && [fAudLang1SurroundCheck isEnabled] && [fAudLang1SurroundCheck state] == NSOnState) {
+               job->surround = 1;
+       } else {
+               job->surround = 0;
+       }
+
 }
 
 - (IBAction) EnableQueue: (id) sender
@@ -1001,6 +1017,11 @@ static int FormatSettings[3][4] =
     [fAudLang2PopUp selectItemAtIndex: 0];
        
        /* END pri */
+
+       /* 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];
+
 }
 
 - (IBAction) ChapterPopUpChanged: (id) sender
@@ -1084,6 +1105,11 @@ static int FormatSettings[3][4] =
         [fDstFile2Field setStringValue: [NSString stringWithFormat:
             @"%@.%s", string, ext]];
     }
+
+       /* changing the codecs on offer may mean that we are/aren't now offering AAC, so */
+       /* check if this change means we should / should't offer 6-channel AAC extraction */
+       [self Check6ChannelAACExtraction: sender];
+
 }
 
 - (IBAction) CodecsPopUpChanged: (id) sender
@@ -1122,7 +1148,11 @@ static int FormatSettings[3][4] =
         [fAudBitratePopUp setEnabled: YES];
     }
 
+       /* check if this change means we should / should't offer 6-channel AAC extraction */
+       [self Check6ChannelAACExtraction: sender];
+
     [self CalculateBitrate: sender];
+
 }
 
 - (IBAction) EncoderPopUpChanged: (id) sender
@@ -1147,28 +1177,78 @@ static int FormatSettings[3][4] =
                 }
        }
     
-[self CalculatePictureSizing: sender];    
+       [self CalculatePictureSizing: sender];    
   
 }
 
-
-- (IBAction) LanguagePopUpChanged: (id) sender
+- (IBAction) Check6ChannelAACExtraction: (id) sender
 {
-     /* Original Call from langpopups which then called prepare job*/
-        /*Note: fAudLang2PopUp is still connected to original action */
-     /* [self CalculateBitrate: sender]; */
-     /* Set Audio tracks based on language selected (taken from prepare job)*/
+
+       /* make sure we have a selected title before continuing */
+       if (fTitle == NULL) return;
+
+       /* get the current title's job into a convenience variable */
        hb_job_t * job = fTitle->job;
+       
+    /* get the current audio tracks */
+       /* this is done in PrepareJob too, but we want them here to check against below */
     job->audios[0] = [fAudLang1PopUp indexOfSelectedItem] - 1;
     job->audios[1] = [fAudLang2PopUp indexOfSelectedItem] - 1;
-    job->audios[2] = -1;       
+    job->audios[2] = -1;
 
-    /* We set the checkbox "fAudLang1Surround" here using: */
-    /* [fAudLang1Surround        setState: 0] Depending on variables */        
-       
+       /* now, let's check if any selected audio track has 5.1 sound */
+       hb_audio_t * audio;
+       bool foundfiveoneaudio = false;
+
+       /* find out what the currently-selected audio codec is */
+    int format = [fDstFormatPopUp indexOfSelectedItem];
+    int codecs = [fDstCodecsPopUp indexOfSelectedItem];
+       int acodec = FormatSettings[format][codecs] & HB_ACODEC_MASK;
+
+       /* we only offer the option to extract 5.1 to 6-channel if the selected audio codec is AAC */
+       if (acodec == HB_ACODEC_FAAC) {
+
+               bool doneaudios = false;
+               int thisaudio = 0;
+               
+               while (!doneaudios) {
+
+                       if (job->audios[thisaudio] == -1) {
+                               doneaudios = true;
+                       } else {
+                               audio = (hb_audio_t *) hb_list_item( fTitle->list_audio, job->audios[thisaudio] );
+                               if (audio != NULL) {
+                                       if (audio->channels == 5 && audio->lfechannels == 1) {
+                                               foundfiveoneaudio = true;
+                                               doneaudios = true; /* as it doesn't matter if we find any more! */
+                                       }
+                               }
+                       }
+
+                       thisaudio++;
+               }
+       }
+
+    /* If we are extracting to AAC, and any of our soundtracks were 5.1, then enable the checkbox  */
+       if (foundfiveoneaudio) {
+               [fAudLang1SurroundCheck setEnabled: YES];
+       } else {
+               [fAudLang1SurroundCheck setEnabled: NO];
+       }
+
+}
+
+
+- (IBAction) LanguagePopUpChanged: (id) sender
+{
        
+       /* selecting a different language may mean we have a different number of channels, so */
+       /* check if this change means we should / should't offer 6-channel AAC extraction */
+       [self Check6ChannelAACExtraction: sender];
        
-  
+       /* see if the new language setting will change the bitrate we need */
+    [self CalculateBitrate:     sender];       
+
 }
 
 
index dece618133ab345de1638f9bb75b60241d060a2b..8f1c7c5a617fa5e349ae28c126903316d370e3d1 100644 (file)
@@ -31,7 +31,7 @@
                 fAudBitratePopUp = NSPopUpButton; 
                 fAudLang1Field = NSTextField; 
                 fAudLang1PopUp = NSPopUpButton; 
-                fAudLang1Surround = NSButton; 
+                fAudLang1SurroundCheck = NSButton; 
                 fAudLang2Field = NSTextField; 
                 fAudLang2PopUp = NSPopUpButton; 
                 fAudRateField = NSTextField; 
index 0693ea14890eb8e8f24cfdc4c53294d3f333e803..a3dda6038a5f65e15a6b392d3ff18ab926aa6fac 100644 (file)
@@ -20,7 +20,7 @@
                <integer>21</integer>
        </array>
        <key>IBSystem Version</key>
-       <string>8L127</string>
+       <string>8L2127</string>
        <key>IBUserGuides</key>
        <dict>
                <key>21</key>
index 3461e07ddac20f0f3284c59bf02fd184118d5c9b..c742d03f0f11a2c8c4f989c8705791d7e2568c07 100644 (file)
Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ
index 57fd7598248c714184c241b9340597e911fe1805..5b9b2b3c0da8e82d8d770c112e4a9dd87e7b28d5 100644 (file)
@@ -635,7 +635,7 @@ static int ParseOptions( int argc, char ** argv )
                 update = 1;
                 break;
             case 'v':
-                debug = HB_DEBUG_ALL;
+                debug = HB_DEBUG_NONE;
                 break;
             case 'C':
                 cpu = atoi( optarg );