]> granicus.if.org Git - handbrake/commitdiff
MacGui: don't hardcode which encoders support the preset system.
authorRodeo <tdskywalker@gmail.com>
Fri, 29 May 2015 22:20:35 +0000 (22:20 +0000)
committerRodeo <tdskywalker@gmail.com>
Fri, 29 May 2015 22:20:35 +0000 (22:20 +0000)
Just ask libhb instead.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7243 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/HBJob+HBJobConversion.m
macosx/HBJob+UIAdditions.m
macosx/HBVideo+UIAdditions.m
macosx/HBVideo.m
macosx/HBVideoController.m

index 4f0288921173169e043bd73f53741df01ba6c34b..8a0836b2e73245813c110cd29b05eef2dd99d0bd 100644 (file)
         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
index 71696e8779e519b68f7621ee604815e4cb5a0f97..2d126dd5bcf8dbeb5110d3af792043402fd30068 100644 (file)
@@ -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 = @"";
index 7de2276769e63fe9f212ed4a5184f4cc4957ef54..cd07bde1169e0aa6afeb68c831aa6b5480154700 100644 (file)
 
 - (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
index b1a002bba65373670fe880c9e1736e6859cbf435..f264a16b561cbd2e3eb2f3c641cda6ca45837eae 100644 (file)
@@ -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];
index 0ffc87b5d39870dc8b1cdbb48bc5c82fa1896bc1..54a0e2d13186a5ec7e5422177793461160be3abe 100644 (file)
@@ -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];