diff options
author | Rodeo <[email protected]> | 2015-05-29 22:20:35 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2015-05-29 22:20:35 +0000 |
commit | 93fb333304b2493a50623b04caac95b53eca3240 (patch) | |
tree | 6770a27513b3c5f1d8a5231cfad9692d3fcd7329 /macosx | |
parent | 1538772d963815afb194a80fe73e751d75badb99 (diff) |
MacGui: don't hardcode which encoders support the preset system.
Just ask libhb instead.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7243 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBJob+HBJobConversion.m | 14 | ||||
-rw-r--r-- | macosx/HBJob+UIAdditions.m | 2 | ||||
-rw-r--r-- | macosx/HBVideo+UIAdditions.m | 11 | ||||
-rw-r--r-- | macosx/HBVideo.m | 8 | ||||
-rw-r--r-- | macosx/HBVideoController.m | 2 |
5 files changed, 25 insertions, 12 deletions
diff --git a/macosx/HBJob+HBJobConversion.m b/macosx/HBJob+HBJobConversion.m index 4f0288921..8a0836b2e 100644 --- a/macosx/HBJob+HBJobConversion.m +++ b/macosx/HBJob+HBJobConversion.m @@ -104,15 +104,15 @@ job->ipod_atom = self.mp4iPodCompatible; } - job->twopass = self.video.twoPass; - if (job->vcodec == HB_VCODEC_X264 || job->vcodec == HB_VCODEC_X265) + if (self.video.twoPass && (self.video.encoder == HB_VCODEC_X264 || + self.video.encoder == HB_VCODEC_X265)) { - // set fastfirstpass if 2-pass and Turbo are enabled - if (self.video.twoPass) - { - job->fastfirstpass = self.video.turboTwoPass; - } + job->fastfirstpass = self.video.turboTwoPass; + } + job->twopass = self.video.twoPass; + if (hb_video_encoder_get_presets(self.video.encoder) != NULL) + { // advanced x264/x265 options NSString *tmpString; // translate zero-length strings to NULL for libhb diff --git a/macosx/HBJob+UIAdditions.m b/macosx/HBJob+UIAdditions.m index 71696e877..2d126dd5b 100644 --- a/macosx/HBJob+UIAdditions.m +++ b/macosx/HBJob+UIAdditions.m @@ -302,7 +302,7 @@ static NSDictionary *shortHeightAttr; [finalString appendString:@"\n" withAttributes:detailAttr]; - if (self.video.encoder == HB_VCODEC_X264 || self.video.encoder == HB_VCODEC_X265) + if (hb_video_encoder_get_presets(self.video.encoder) != NULL) { // we are using x264/x265 NSString *encoderPresetInfo = @""; diff --git a/macosx/HBVideo+UIAdditions.m b/macosx/HBVideo+UIAdditions.m index 7de227676..cd07bde11 100644 --- a/macosx/HBVideo+UIAdditions.m +++ b/macosx/HBVideo+UIAdditions.m @@ -69,7 +69,16 @@ - (BOOL)fastDecodeSupported { - return (self.encoder == HB_VCODEC_X264 || self.encoder == HB_VCODEC_X265); + const char * const *tunes = hb_video_encoder_get_tunes(self.encoder); + + for (int i = 0; tunes != NULL && tunes[i] != NULL; i++) + { + if (!strcasecmp(tunes[i], "fastdecode")) + { + return YES; + } + } + return NO; } - (BOOL)turboTwoPassSupported diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index b1a002bba..f264a16b5 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -331,6 +331,10 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; { [temp addObject:@(profiles[i])]; } + if (!temp.count) + { + [temp addObject:@"auto"]; + } return [temp copy]; } @@ -506,7 +510,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; // map legacy encoder names via libhb. self.encoder = hb_video_encoder_get_from_name([preset[@"VideoEncoder"] UTF8String]); - if (self.encoder == HB_VCODEC_X264 || self.encoder == HB_VCODEC_X265) + if (hb_video_encoder_get_presets(self.encoder) != NULL) { if (self.encoder == HB_VCODEC_X264 && [preset[@"x264UseAdvancedOptions"] boolValue]) { @@ -613,7 +617,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; { preset[@"VideoEncoder"] = @(hb_video_encoder_get_short_name(self.encoder)); - if (self.encoder == HB_VCODEC_X264 || self.encoder == HB_VCODEC_X265) + if (hb_video_encoder_get_presets(self.encoder) != NULL) { preset[@"VideoPreset"] = self.preset; preset[@"VideoTune"] = [self completeTune]; diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index 0ffc87b5d..54a0e2d13 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -209,7 +209,7 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; { self.advancedController.hidden = YES; - if (self.video.encoder == HB_VCODEC_X264 || self.video.encoder == HB_VCODEC_X265) + if (hb_video_encoder_get_presets(self.video.encoder) != NULL) { [self toggleAdvancedOptionsCheckBoxForEncoder:self.video.encoder]; |