Skip to content

Commit

Permalink
MacGui: Adds a new sheet for audio defaults (presets), uses the same …
Browse files Browse the repository at this point in the history
…preset keys as the LinGui.

The built-in presets still use the languages from the Audio preferences.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6264 b64f7644-9d1e-0410-96f1-a4d463321fa5
  • Loading branch information
galad87 committed Aug 4, 2014
1 parent 49a49b9 commit 3fdfc2d
Show file tree
Hide file tree
Showing 14 changed files with 1,723 additions and 531 deletions.
120 changes: 26 additions & 94 deletions macosx/Controller.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#import "DockTextField.h"
#import "HBUtilities.h"

#import "HBAudioSettings.h"

unsigned int maximumNumberOfAllowedAudioTracks = 1024;
NSString *HBContainerChangedNotification = @"HBContainerChangedNotification";
NSString *keyContainerTag = @"keyContainerTag";
Expand Down Expand Up @@ -207,7 +209,6 @@ - (void) applicationDidFinishLaunching: (NSNotification *) notification

// setup the audio controller
fAudioController = [[HBAudioController alloc] init];
[fAudioController setHBController: self];
[fAudioView addSubview: [fAudioController view]];

// make sure we automatically resize the controller's view to the current window size
Expand All @@ -232,6 +233,8 @@ - (void) applicationDidFinishLaunching: (NSNotification *) notification
[[fVideoController view] setFrame: [fVideoView bounds]];
[[fVideoController view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )];

[fWindow recalculateKeyViewLoop];

[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(autoSetM4vExtension:) name: HBMixdownChangedNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateMp4Checkboxes:) name: HBVideoEncoderChangedNotification object: nil];

Expand Down Expand Up @@ -2599,15 +2602,15 @@ - (NSDictionary *)createQueueFileItem
[queueFileJob setObject:[NSNumber numberWithInteger:[fPictureController grayscale]] forKey:@"VideoGrayScale"];

/* Auto Passthru */
[queueFileJob setObject:@(fAudioController.allowAACPassCheck) forKey: @"AudioAllowAACPass"];
[queueFileJob setObject:@(fAudioController.allowAC3PassCheck) forKey: @"AudioAllowAC3Pass"];
[queueFileJob setObject:@(fAudioController.allowDTSHDPassCheck) forKey: @"AudioAllowDTSHDPass"];
[queueFileJob setObject:@(fAudioController.allowDTSPassCheck) forKey: @"AudioAllowDTSPass"];
[queueFileJob setObject:@(fAudioController.allowMP3PassCheck) forKey: @"AudioAllowMP3Pass"];
[queueFileJob setObject:@(fAudioController.settings.allowAACPassthru) forKey: @"AudioAllowAACPass"];
[queueFileJob setObject:@(fAudioController.settings.allowAC3Passthru) forKey: @"AudioAllowAC3Pass"];
[queueFileJob setObject:@(fAudioController.settings.allowDTSHDPassthru) forKey: @"AudioAllowDTSHDPass"];
[queueFileJob setObject:@(fAudioController.settings.allowDTSPassthru) forKey: @"AudioAllowDTSPass"];
[queueFileJob setObject:@(fAudioController.settings.allowMP3Passthru) forKey: @"AudioAllowMP3Pass"];
// just in case we need it for display purposes
[queueFileJob setObject:fAudioController.audioEncoderFallback forKey: @"AudioEncoderFallback"];
[queueFileJob setObject:@(hb_audio_encoder_get_name((int)fAudioController.settings.encoderFallback)) forKey: @"AudioEncoderFallback"];
// actual fallback encoder
[queueFileJob setObject:@(fAudioController.audioEncoderFallbackTag) forKey: @"JobAudioEncoderFallback"];
[queueFileJob setObject:@(fAudioController.settings.encoderFallback) forKey: @"JobAudioEncoderFallback"];

/* Audio */
[fAudioController prepareAudioForQueueFileJob: queueFileJob];
Expand Down Expand Up @@ -2900,12 +2903,12 @@ - (IBAction)applyQueueSettingsToMainWindow:(id)sender
[fVideoController applyVideoSettingsFromQueue:queueToApply];

/* Auto Passthru */
fAudioController.allowAACPassCheck = [[queueToApply objectForKey:@"AudioAllowAACPass"] boolValue];
fAudioController.allowAC3PassCheck = [[queueToApply objectForKey:@"AudioAllowAC3Pass"] boolValue];
fAudioController.allowDTSHDPassCheck = [[queueToApply objectForKey:@"AudioAllowDTSHDPass"] boolValue];
fAudioController.allowDTSPassCheck = [[queueToApply objectForKey:@"AudioAllowDTSPass"] boolValue];
fAudioController.allowMP3PassCheck = [[queueToApply objectForKey:@"AudioAllowMP3Pass"] boolValue];
fAudioController.audioEncoderFallback = [queueToApply objectForKey:@"AudioEncoderFallback"];
fAudioController.settings.allowAACPassthru = [[queueToApply objectForKey:@"AudioAllowAACPass"] boolValue];
fAudioController.settings.allowAC3Passthru = [[queueToApply objectForKey:@"AudioAllowAC3Pass"] boolValue];
fAudioController.settings.allowDTSHDPassthru = [[queueToApply objectForKey:@"AudioAllowDTSHDPass"] boolValue];
fAudioController.settings.allowDTSPassthru = [[queueToApply objectForKey:@"AudioAllowDTSPass"] boolValue];
fAudioController.settings.allowMP3Passthru = [[queueToApply objectForKey:@"AudioAllowMP3Pass"] boolValue];
fAudioController.settings.encoderFallback = [queueToApply objectForKey:@"AudioEncoderFallback"];

/* Audio */
/* Now lets add our new tracks to the audio list here */
Expand Down Expand Up @@ -3200,28 +3203,28 @@ - (void) prepareJobForPreview

/* Auto Passthru */
job->acodec_copy_mask = 0;
if (fAudioController.allowAACPassCheck)
if (fAudioController.settings.allowAACPassthru)
{
job->acodec_copy_mask |= HB_ACODEC_FFAAC;
}
if (fAudioController.allowAC3PassCheck)
if (fAudioController.settings.allowAC3Passthru)
{
job->acodec_copy_mask |= HB_ACODEC_AC3;
}
if (fAudioController.allowDTSHDPassCheck)
if (fAudioController.settings.allowDTSHDPassthru)
{
job->acodec_copy_mask |= HB_ACODEC_DCA_HD;
}
if (fAudioController.allowDTSPassCheck)
if (fAudioController.settings.allowDTSPassthru)
{
job->acodec_copy_mask |= HB_ACODEC_DCA;
}
if (fAudioController.allowMP3PassCheck)
if (fAudioController.settings.allowMP3Passthru)
{
job->acodec_copy_mask |= HB_ACODEC_MP3;
}
job->acodec_fallback = (int)fAudioController.audioEncoderFallbackTag;
job->acodec_fallback = fAudioController.settings.encoderFallback;

/* Audio tracks and mixdowns */
[fAudioController prepareAudioForJobPreview: job];

Expand Down Expand Up @@ -5264,66 +5267,8 @@ - (IBAction)selectPreset:(id)sender
/* Set the state of ipod compatible with Mp4iPodCompatible. Only for x264*/
[fDstMp4iPodFileCheck setState:[[chosenPreset objectForKey:@"Mp4iPodCompatible"] intValue]];

/* Video quality */


/* Auto Passthru: if the preset has Auto Passthru fields, use them.
* Otherwise assume every passthru is allowed and the fallback is AC3 */

id tempObject;
if ((tempObject = [chosenPreset objectForKey:@"AudioAllowAACPass"]) != nil)
{
fAudioController.allowAACPassCheck = [tempObject boolValue];
}
else
{
fAudioController.allowAACPassCheck = YES;
}
if ((tempObject = [chosenPreset objectForKey:@"AudioAllowAC3Pass"]) != nil)
{
fAudioController.allowAC3PassCheck = [tempObject boolValue];
}
else
{
fAudioController.allowAC3PassCheck = YES;
}
if ((tempObject = [chosenPreset objectForKey:@"AudioAllowDTSHDPass"]) != nil)
{
fAudioController.allowDTSHDPassCheck = [tempObject boolValue];
}
else
{
fAudioController.allowDTSHDPassCheck = YES;
}
if ((tempObject = [chosenPreset objectForKey:@"AudioAllowDTSPass"]) != nil)
{
fAudioController.allowDTSPassCheck= [tempObject boolValue];
}
else
{
fAudioController.allowDTSPassCheck = YES;
}
if ((tempObject = [chosenPreset objectForKey:@"AudioAllowMP3Pass"]) != nil)
{
fAudioController.allowMP3PassCheck = [tempObject boolValue];
}
else
{
fAudioController.allowAACPassCheck = YES;
}
if ((tempObject = [chosenPreset objectForKey:@"AudioEncoderFallback"]) != nil)
{
// map legacy encoder names via libhb
strValue = hb_audio_encoder_sanitize_name([tempObject UTF8String]);
fAudioController.audioEncoderFallback = [NSString stringWithFormat:@"%s", strValue];
}
else
{
fAudioController.audioEncoderFallbackTag = HB_ACODEC_AC3;
}

/* Audio */
[fAudioController addTracksFromPreset: chosenPreset];
[fAudioController applySettingsFromPreset: chosenPreset];

/*Subtitles*/
[fSubtitlesViewController applySettingsFromPreset:chosenPreset];
Expand Down Expand Up @@ -5798,21 +5743,8 @@ - (NSDictionary *)createPreset
[preset setObject:[fPictureController decombCustomString] forKey:@"PictureDecombCustom"];
[preset setObject:[NSNumber numberWithInteger:[fPictureController grayscale]] forKey:@"VideoGrayScale"];

/* Auto Pasthru */
[preset setObject:@(fAudioController.allowAACPassCheck) forKey: @"AudioAllowAACPass"];
[preset setObject:@(fAudioController.allowAC3PassCheck) forKey: @"AudioAllowAC3Pass"];
[preset setObject:@(fAudioController.allowDTSHDPassCheck) forKey: @"AudioAllowDTSHDPass"];
[preset setObject:@(fAudioController.allowDTSPassCheck) forKey: @"AudioAllowDTSPass"];
[preset setObject:@(fAudioController.allowMP3PassCheck) forKey: @"AudioAllowMP3Pass"];
[preset setObject:fAudioController.audioEncoderFallback forKey: @"AudioEncoderFallback"];

/* Audio */
NSMutableArray *audioListArray = [[NSMutableArray alloc] init];
[fAudioController prepareAudioForPreset: audioListArray];


[preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"];
[audioListArray release];
[fAudioController.settings prepareAudioForPreset:preset];

/* Subtitles */
[fSubtitlesViewController prepareSubtitlesForPreset:preset];
Expand Down
Loading

0 comments on commit 3fdfc2d

Please sign in to comment.