summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libhb/common.c26
-rw-r--r--libhb/common.h2
-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
6 files changed, 114 insertions, 19 deletions
diff --git a/libhb/common.c b/libhb/common.c
index e7bc6dbb8..d1c4cb34a 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -45,6 +45,32 @@ hb_mixdown_t hb_audio_mixdowns[] =
int hb_audio_mixdowns_count = sizeof( hb_audio_mixdowns ) /
sizeof( hb_mixdown_t );
+int hb_mixdown_get_mixdown_from_short_name( const char * short_name )
+{
+ int i;
+ for (i = 0; i < hb_audio_mixdowns_count; i++)
+ {
+ if (strcmp(hb_audio_mixdowns[i].short_name, short_name) == 0)
+ {
+ return hb_audio_mixdowns[i].amixdown;
+ }
+ }
+ return 0;
+}
+
+const char * hb_mixdown_get_short_name_from_mixdown( int amixdown )
+{
+ int i;
+ for (i = 0; i < hb_audio_mixdowns_count; i++)
+ {
+ if (hb_audio_mixdowns[i].amixdown == amixdown)
+ {
+ return hb_audio_mixdowns[i].short_name;
+ }
+ }
+ return "";
+}
+
/**********************************************************************
* hb_reduce
**********************************************************************
diff --git a/libhb/common.h b/libhb/common.h
index 3ed8f7791..20de051f4 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -92,6 +92,8 @@ extern int hb_audio_bitrates_count;
extern int hb_audio_bitrates_default;
extern hb_mixdown_t hb_audio_mixdowns[];
extern int hb_audio_mixdowns_count;
+int hb_mixdown_get_mixdown_from_short_name( const char * short_name );
+const char * hb_mixdown_get_short_name_from_mixdown( int amixdown );
/******************************************************************************
* hb_job_t: settings to be filled by the UI
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