summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaurj <[email protected]>2007-04-16 10:41:44 +0000
committermaurj <[email protected]>2007-04-16 10:41:44 +0000
commita715de4c2ff593e121fbfa394409eff4e493415b (patch)
tree3dc203f9b3b5d30fee95f886b3f82eede3a9d11e
parent51782d0468e1dc61fbea765ea4e05a08916e1f40 (diff)
Fixed a bug in the Mac GUI (Controller.mm), introduced in rev 511, whereby selecting "none" on an audio popup when "none" was already selected on the other audio popup would cause an infinite loop, leading to a crash.
Changed the audio popup logic in PrepareJob to use the second audio track settings as the first audio track when the first audio track is set to "none" but the second audio track has a source track selected. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@512 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.mm39
1 files changed, 23 insertions, 16 deletions
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index d69d62055..dcb13ee24 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -847,10 +847,27 @@ static int FormatSettings[3][4] =
/* Subtitle settings */
job->subtitle = [fSubPopUp indexOfSelectedItem] - 1;
- /* Audio tracks */
- job->audios[0] = [fAudLang1PopUp indexOfSelectedItem] - 1;
- job->audios[1] = [fAudLang2PopUp indexOfSelectedItem] - 1;
- job->audios[2] = -1;
+ /* Audio tracks and mixdowns */
+ /* check for the condition where track 2 has an audio selected, but track 1 does not */
+ /* we will use track 2 as track 1 in this scenario */
+ if ([fAudLang1PopUp indexOfSelectedItem] > 0)
+ {
+ job->audios[0] = [fAudLang1PopUp indexOfSelectedItem] - 1;
+ job->audios[1] = [fAudLang2PopUp indexOfSelectedItem] - 1; /* will be -1 if "none" is selected */
+ job->audios[2] = -1;
+ job->audio_mixdowns[0] = [[fAudTrack1MixPopUp selectedItem] tag];
+ job->audio_mixdowns[1] = [[fAudTrack2MixPopUp selectedItem] tag];
+ }
+ else if ([fAudLang2PopUp indexOfSelectedItem] > 0)
+ {
+ job->audios[0] = [fAudLang2PopUp indexOfSelectedItem] - 1;
+ job->audio_mixdowns[0] = [[fAudTrack2MixPopUp selectedItem] tag];
+ job->audios[1] = -1;
+ }
+ else
+ {
+ job->audios[0] = -1;
+ }
/* Audio settings */
job->arate = hb_audio_rates[[fAudRatePopUp
@@ -858,17 +875,6 @@ static int FormatSettings[3][4] =
job->abitrate = hb_audio_bitrates[[fAudBitratePopUp
indexOfSelectedItem]].rate;
- /* Audio mixdown(s) */
- if (job->audios[0] > -1)
- {
- job->audio_mixdowns[0] = [[fAudTrack1MixPopUp selectedItem] tag];
- }
-
- if (job->audios[1] > -1)
- {
- job->audio_mixdowns[1] = [[fAudTrack2MixPopUp selectedItem] tag];
- }
-
}
- (IBAction) EnableQueue: (id) sender
@@ -1413,7 +1419,8 @@ static int FormatSettings[3][4] =
NSPopUpButton * thisAudioPopUp = (thisAudio == 1 ? fAudLang2PopUp : fAudLang1PopUp);
NSPopUpButton * otherAudioPopUp = (thisAudio == 1 ? fAudLang1PopUp : fAudLang2PopUp);
/* if the same track is selected in the other audio popup, then select "none" in that popup */
- if ([thisAudioPopUp indexOfSelectedItem] == [otherAudioPopUp indexOfSelectedItem]) {
+ /* unless, of course, both are selected as "none!" */
+ if ([thisAudioPopUp indexOfSelectedItem] != 0 && [thisAudioPopUp indexOfSelectedItem] == [otherAudioPopUp indexOfSelectedItem]) {
[otherAudioPopUp selectItemAtIndex: 0];
[self AudioTrackPopUpChanged: otherAudioPopUp];
}