summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2007-04-12 18:38:40 +0000
committerdynaflash <[email protected]>2007-04-12 18:38:40 +0000
commit5c07a00af3dc434e341ca706270cba271d524980 (patch)
tree2fec88cf6bfdc4c42b7b03c4b3db639d4a1f9d13 /macosx
parent9bb7db3d4b027879a27f80b8b726a84660d349a8 (diff)
MacGui: Presets now utilize Audio Mixdowns Thanks maurj!
- Added second audio track support in presets - Mixdowns regress gracefully depending on current dvd source - Source Track 2 sets to "None" if one is specified that doesn't exist in current dvd. Note: in initial testing, second track using 6 channel kills encode performance and yields a track with no sound. Needs to be tested and verified. Main track works flawlessly in initial testing. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@499 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.h1
-rw-r--r--macosx/Controller.mm102
-rw-r--r--macosx/English.lproj/MainMenu.nib/info.nib2
-rw-r--r--macosx/English.lproj/MainMenu.nib/keyedobjects.nibbin101975 -> 101978 bytes
4 files changed, 86 insertions, 19 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index 8537718de..dd366dd98 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -170,6 +170,7 @@
- (IBAction) EncoderPopUpChanged: (id) sender;
- (IBAction) SetEnabledStateOfAudioMixdownControls: (id) sender;
- (IBAction) AudioTrackPopUpChanged: (id) sender;
+- (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse;
- (IBAction) BrowseFile: (id) sender;
- (void) BrowseFileDone: (NSSavePanel *) sheet
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 0cbc20f3d..20c7b87a3 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -1170,8 +1170,8 @@ static int FormatSettings[3][4] =
/* changing the title may have changed the audio channels on offer, */
/* so call AudioTrackPopUpChanged for both audio tracks to update the mixdown popups */
- [self AudioTrackPopUpChanged: fAudLang1PopUp];
- [self AudioTrackPopUpChanged: fAudLang2PopUp];
+ [self AudioTrackPopUpChanged: fAudLang1PopUp mixdownToUse: 0];
+ [self AudioTrackPopUpChanged: fAudLang2PopUp mixdownToUse: 0];
}
@@ -1269,8 +1269,8 @@ static int FormatSettings[3][4] =
/* changing the format may mean that we can / can't offer mono or 6ch, */
/* so call AudioTrackPopUpChanged for both audio tracks to update the mixdown popups */
- [self AudioTrackPopUpChanged: fAudLang1PopUp];
- [self AudioTrackPopUpChanged: fAudLang2PopUp];
+ [self AudioTrackPopUpChanged: fAudLang1PopUp mixdownToUse: 0];
+ [self AudioTrackPopUpChanged: fAudLang2PopUp mixdownToUse: 0];
/* We call method method to change UI to reflect whether a preset is used or not*/
[self CustomSettingUsed: sender];
@@ -1315,8 +1315,8 @@ static int FormatSettings[3][4] =
/* changing the codecs on offer may mean that we can / can't offer mono or 6ch, */
/* so call AudioTrackPopUpChanged for both audio tracks to update the mixdown popups */
- [self AudioTrackPopUpChanged: fAudLang1PopUp];
- [self AudioTrackPopUpChanged: fAudLang2PopUp];
+ [self AudioTrackPopUpChanged: fAudLang1PopUp mixdownToUse: 0];
+ [self AudioTrackPopUpChanged: fAudLang2PopUp mixdownToUse: 0];
[self CalculateBitrate: sender];
/* We call method method to change UI to reflect whether a preset is used or not*/
@@ -1371,6 +1371,11 @@ static int FormatSettings[3][4] =
- (IBAction) AudioTrackPopUpChanged: (id) sender
{
+ [self AudioTrackPopUpChanged: sender mixdownToUse: 0];
+}
+
+- (IBAction) AudioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse
+{
/* make sure we have a selected title before continuing */
if (fTitle == NULL) return;
@@ -1517,16 +1522,26 @@ static int FormatSettings[3][4] =
/* for now, this is hard-coded to a "best" mixdown of HB_AMIXDOWN_DOLBYPLII */
/* ultimately this should be a prefs option */
- int prefsMixdown = HB_AMIXDOWN_DOLBYPLII;
+ int useMixdown;
- /* if prefsMixdown > maxMixdownUsed, then use maxMixdownUsed */
- if (prefsMixdown > maxMixdownUsed) prefsMixdown = maxMixdownUsed;
+ /* if we passed in a mixdown to use - in order to load a preset - then try and use it */
+ if (mixdownToUse > 0)
+ {
+ useMixdown = mixdownToUse;
+ }
+ else
+ {
+ useMixdown = HB_AMIXDOWN_DOLBYPLII;
+ }
+
+ /* if useMixdown > maxMixdownUsed, then use maxMixdownUsed */
+ if (useMixdown > maxMixdownUsed) useMixdown = maxMixdownUsed;
- /* if prefsMixdown < minMixdownUsed, then use minMixdownUsed */
- if (prefsMixdown < minMixdownUsed) prefsMixdown = minMixdownUsed;
+ /* if useMixdown < minMixdownUsed, then use minMixdownUsed */
+ if (useMixdown < minMixdownUsed) useMixdown = minMixdownUsed;
/* select the (possibly-amended) preferred mixdown */
- [mixdownPopUp selectItemWithTag: prefsMixdown];
+ [mixdownPopUp selectItemWithTag: useMixdown];
}
@@ -1832,8 +1847,24 @@ the user is using "Custom" settings by determining the sender*/
/*Audio*/
/* Audio Language One*/
[preset setObject:[fAudLang1PopUp titleOfSelectedItem] forKey:@"AudioLang1"];
- /* Audio Language One Surround Sound Checkbox*/
-// [preset setObject:[NSNumber numberWithInt:[fAudLang1SurroundCheck state]] forKey:@"AudioLang1Surround"];
+ /* Audio Track one mixdown */
+ if ([fAudLang1PopUp indexOfSelectedItem] > 0) {
+ [preset setObject:[NSString stringWithCString:hb_mixdown_get_short_name_from_mixdown([[fAudTrack1MixPopUp selectedItem] tag])] forKey:@"AudioLang1Mixdown"];
+ }
+ else
+ {
+ [preset setObject:[NSString stringWithCString:""] forKey:@"AudioLang1Mixdown"];
+ }
+ /* Audio Language Two*/
+ [preset setObject:[fAudLang2PopUp titleOfSelectedItem] forKey:@"AudioLang2"];
+ /* Audio Track Two mixdown */
+ if ([fAudLang2PopUp indexOfSelectedItem] > 0) {
+ [preset setObject:[NSString stringWithCString:hb_mixdown_get_short_name_from_mixdown([[fAudTrack2MixPopUp selectedItem] tag])] forKey:@"AudioLang2Mixdown"];
+ }
+ else
+ {
+ [preset setObject:[NSString stringWithCString:""] forKey:@"AudioLang2Mixdown"];
+ }
/* Audio Sample Rate*/
[preset setObject:[fAudRatePopUp titleOfSelectedItem] forKey:@"AudioSampleRate"];
/* Audio Bitrate Rate*/
@@ -2120,7 +2151,6 @@ the user is using "Custom" settings by determining the sender*/
[fDisplayX264Options setStringValue: [NSString stringWithFormat:[chosenPreset valueForKey:@"x264Option"]]];
/* Lets run through the following functions to get variables set there */
[self EncoderPopUpChanged: NULL];
- [self AudioTrackPopUpChanged: NULL];
[self CalculateBitrate: NULL];
/* Video quality */
@@ -2145,9 +2175,45 @@ the user is using "Custom" settings by determining the sender*/
/*Audio*/
/* Audio Language One*/
[fAudLang1PopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioLang1"]]];
- /* Audio Language One Surround Sound Checkbox*/
-// [fAudLang1SurroundCheck setState:[[chosenPreset objectForKey:@"AudioLang1Surround"] intValue]];
- [self AudioTrackPopUpChanged: NULL];
+ /* We check to make sure something is selected for track 1 */
+ if ([fAudLang1PopUp indexOfSelectedItem] == -1)
+ {
+ /* If not we choose the first source in the track 1 dropdown */
+ [fAudLang1PopUp selectItemAtIndex: 0];
+ }
+
+ /* if the preset contains a mixdown value for track 1, then try and load it */
+ /* if the preset contains the empty string for this value, then we'll get
+ a mixdown of 0 from hb_mixdown_get_mixdown_from_short_name,
+ which will be correctly ignored by AudioTrackPopUpChanged */
+ /* if the mixdown is unavailable, AudioTrackPopUpChanged will choose the next best mixdown */
+ char cBuffer1[32];
+ NSString * short_name1 = [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioLang1Mixdown"]];
+ [short_name1 getCString:cBuffer1];
+ int mixdown1 = hb_mixdown_get_mixdown_from_short_name(cBuffer1);
+ [self AudioTrackPopUpChanged: fAudLang1PopUp mixdownToUse: mixdown1];
+
+ /* Audio Language Two*/
+ [fAudLang2PopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioLang2"]]];
+ /* We check to make sure something is selected for track 2 */
+ if ([fAudLang2PopUp indexOfSelectedItem] == -1)
+ {
+ /* If not we choose "None" in the track 2 dropdown */
+ [fAudLang2PopUp selectItemWithTitle: [NSString stringWithFormat:@"None"]];
+ //[self SetEnabledStateOfAudioMixdownControls: sender];
+ }
+ /* if the preset contains a mixdown value for track 2, then try and load it */
+ /* if the preset contains the empty string for this value, then we'll get
+ a mixdown of 0 from hb_mixdown_get_mixdown_from_short_name,
+ which will be correctly ignored by AudioTrackPopUpChanged */
+ /* if the mixdown is unavailable, AudioTrackPopUpChanged will choose the next best mixdown */
+ char cBuffer2[32];
+ NSString * short_name2 = [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioLang2Mixdown"]];
+ [short_name2 getCString:cBuffer2];
+ int mixdown2 = hb_mixdown_get_mixdown_from_short_name(cBuffer2);
+ [self AudioTrackPopUpChanged: fAudLang2PopUp mixdownToUse: mixdown2];
+
+
/* Audio Sample Rate*/
[fAudRatePopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioSampleRate"]]];
/* Audio Bitrate Rate*/
diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib
index 65baf2026..1f041f6db 100644
--- a/macosx/English.lproj/MainMenu.nib/info.nib
+++ b/macosx/English.lproj/MainMenu.nib/info.nib
@@ -19,8 +19,8 @@
</array>
<key>IBOpenObjects</key>
<array>
- <integer>21</integer>
<integer>29</integer>
+ <integer>21</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 0eb8c26cb..21448ee2c 100644
--- a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
+++ b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
Binary files differ