diff options
author | ritsuka <[email protected]> | 2015-05-14 19:37:49 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-05-14 19:37:49 +0000 |
commit | 2659b80cc0d4e078db19436f4f144b50525f2983 (patch) | |
tree | 54a8813f4a53c25e1630e6aa654c348e603f9ee8 /macosx/HBVideo.m | |
parent | 970688a142998ddf68cf1950436bb92e0385139c (diff) |
MacGui: use libhb built-in presets and validation functions. Update the format and save the presets in UserPresets.json, the old presets are automatically imported if the new presets file is not found. The mac gui now requires 10.7 or later.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7181 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBVideo.m')
-rw-r--r-- | macosx/HBVideo.m | 79 |
1 files changed, 24 insertions, 55 deletions
diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index 48cd9f4a3..490bb29be 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -509,9 +509,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; if (self.encoder == HB_VCODEC_X264 || self.encoder == HB_VCODEC_X265) { - if (self.encoder == HB_VCODEC_X264 && - (!preset[@"x264UseAdvancedOptions"] || - [preset[@"x264UseAdvancedOptions"] intValue])) + if (self.encoder == HB_VCODEC_X264 && [preset[@"x264UseAdvancedOptions"] boolValue]) { // preset does not use the x264 preset system, reset the widgets. self.preset = @"medium"; @@ -520,18 +518,8 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; self.level = @"auto"; self.fastDecode = NO; - // x264UseAdvancedOptions is not set (legacy preset) - // or set to 1 (enabled), so we use the old advanced panel. - if (preset[@"x264Option"]) - { - // we set the advanced options string here if applicable. - self.videoOptionExtra = preset[@"x264Option"]; - self.advancedOptions = YES; - } - else - { - self.videoOptionExtra = nil; - } + self.videoOptionExtra = preset[@"VideoOptionExtra"]; + self.advancedOptions = YES; } else { @@ -540,24 +528,11 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; // disable the advanced panel self.advancedOptions = NO; - if (preset[@"x264Preset"]) - { - // Read the old x264 preset keys - self.preset = preset[@"x264Preset"]; - self.tune = preset[@"x264Tune"]; - self.videoOptionExtra = preset[@"x264OptionExtra"]; - self.profile = preset[@"h264Profile"]; - self.level = preset[@"h264Level"]; - } - else - { - // Read the new preset keys (0.10) - self.preset = preset[@"VideoPreset"]; - self.tune = preset[@"VideoTune"]; - self.videoOptionExtra = preset[@"VideoOptionExtra"]; - self.profile = preset[@"VideoProfile"]; - self.level = preset[@"VideoLevel"]; - } + self.preset = preset[@"VideoPreset"]; + self.tune = preset[@"VideoTune"]; + self.videoOptionExtra = preset[@"VideoOptionExtra"]; + self.profile = preset[@"VideoProfile"]; + self.level = preset[@"VideoLevel"]; if ([self.tune rangeOfString:@"fastdecode"].location != NSNotFound) { @@ -573,15 +548,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; } else { - if (preset[@"lavcOption"]) - { - // Load the old format - self.videoOptionExtra = preset[@"lavcOption"]; - } - else - { - self.videoOptionExtra = preset[@"VideoOptionExtra"]; - } + self.videoOptionExtra = preset[@"VideoOptionExtra"]; } int qualityType = [preset[@"VideoQualityType"] intValue] - 1; @@ -600,7 +567,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; self.quality = [preset[@"VideoQualitySlider"] floatValue]; // Video framerate - if ([preset[@"VideoFramerate"] isEqualToString:@"Same as source"]) + if ([preset[@"VideoFramerate"] isEqualToString:@"auto"]) { // Now set the Video Frame Rate Mode to either vfr or cfr according to the preset. if (!preset[@"VideoFramerateMode"] || @@ -645,24 +612,26 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; - (void)writeToPreset:(NSMutableDictionary *)preset { - preset[@"VideoEncoder"] = @(hb_video_encoder_get_name(self.encoder)); + preset[@"VideoEncoder"] = @(hb_video_encoder_get_short_name(self.encoder)); - // x264 Options, this will either be advanced panel or the video tabs x264 presets panel with modded option string - if (self.advancedOptions) - { - // use the old advanced panel. - preset[@"x264UseAdvancedOptions"] = @1; - preset[@"x264Option"] = self.videoOptionExtra; - } - else if (self.encoder == HB_VCODEC_X264 || self.encoder == HB_VCODEC_X265) + if (self.encoder == HB_VCODEC_X264 || self.encoder == HB_VCODEC_X265) { - // use the new preset system. - preset[@"x264UseAdvancedOptions"] = @0; preset[@"VideoPreset"] = self.preset; preset[@"VideoTune"] = [self completeTune]; preset[@"VideoOptionExtra"] = self.videoOptionExtra; preset[@"VideoProfile"] = self.profile; preset[@"VideoLevel"] = self.level; + + // x264 Options, this will either be advanced panel or the video tabs x264 presets panel with modded option string + if (self.advancedOptions) + { + // use the old advanced panel. + preset[@"x264UseAdvancedOptions"] = @YES; + } + else + { + preset[@"x264UseAdvancedOptions"] = @NO; + } } else { @@ -684,7 +653,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; } if (self.frameRate == 0) // Same as source is selected { - preset[@"VideoFramerate"] = @"Same as source"; + preset[@"VideoFramerate"] = @"auto"; if (self.frameRateMode == 0) { |