]> granicus.if.org Git - handbrake/commitdiff
MacGui: don't hardcode encoder names.
authorRodeo <tdskywalker@gmail.com>
Sat, 16 May 2015 19:42:30 +0000 (19:42 +0000)
committerRodeo <tdskywalker@gmail.com>
Sat, 16 May 2015 19:42:30 +0000 (19:42 +0000)
However unlikely, the names for the passthru
encoders could change, and this new code won't
need to be updated should that happen.

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

macosx/HBAudioDefaults.m

index 727910aa975456d59c9613edcdce6ba5e7044851..47f085b953de4151e56819288357e0779921b87f 100644 (file)
     // Passthru settings
     for (NSString *copyMask in preset[@"AudioCopyMask"])
     {
-        if ([copyMask isEqualToString:@"copy:aac"])
+        int allowedPassthru = hb_video_encoder_get_from_name(copyMask.UTF8String);
+        if (allowedPassthru & HB_ACODEC_PASS_FLAG)
         {
-            self.allowAACPassthru = YES;
-        }
-        else if ([copyMask isEqualToString:@"copy:ac3"])
-        {
-            self.allowAC3Passthru = YES;
-        }
-        else if ([copyMask isEqualToString:@"copy:eac3"])
-        {
-            self.allowEAC3Passthru = YES;
-        }
-        else if ([copyMask isEqualToString:@"copy:dtshd"])
-        {
-            self.allowDTSHDPassthru = YES;
-        }
-        else if ([copyMask isEqualToString:@"copy:dts"])
-        {
-            self.allowDTSPassthru = YES;
-        }
-        else if ([copyMask isEqualToString:@"copy:mp3"])
-        {
-            self.allowMP3Passthru = YES;
-        }
-        else if ([copyMask isEqualToString:@"copy:truehd"])
-        {
-            self.allowTrueHDPassthru = YES;
-        }
-        else if ([copyMask isEqualToString:@"copy:flac"])
-        {
-            self.allowFLACPassthru = YES;
+            switch (allowedPassthru)
+            {
+                case HB_ACODEC_AAC_PASS:
+                    self.allowAACPassthru = YES;
+                    break;
+                case HB_ACODEC_AC3_PASS:
+                    self.allowAC3Passthru = YES;
+                    break;
+                case HB_ACODEC_DCA_PASS:
+                    self.allowDTSPassthru = YES;
+                    break;
+                case HB_ACODEC_DCA_HD_PASS:
+                    self.allowDTSHDPassthru = YES;
+                    break;
+                case HB_ACODEC_EAC3_PASS:
+                    self.allowEAC3Passthru = YES;
+                    break;
+                case HB_ACODEC_FLAC_PASS:
+                    self.allowFLACPassthru = YES;
+                    break;
+                case HB_ACODEC_MP3_PASS:
+                    self.allowMP3Passthru = YES;
+                    break;
+                case HB_ACODEC_TRUEHD_PASS:
+                    self.allowTrueHDPassthru = YES;
+                    break;
+                default:
+                    break;
+            }
         }
     }
 
     NSMutableArray *copyMask = [NSMutableArray array];
     if (self.allowAACPassthru)
     {
-        [copyMask addObject:@"copy:aac"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_AAC_PASS))];
     }
     if (self.allowAC3Passthru)
     {
-        [copyMask addObject:@"copy:ac3"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_AC3_PASS))];
     }
     if (self.allowEAC3Passthru)
     {
-        [copyMask addObject:@"copy:eac3"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_EAC3_PASS))];
     }
     if (self.allowDTSHDPassthru)
     {
-        [copyMask addObject:@"copy:dtshd"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_DCA_HD_PASS))];
     }
     if (self.allowDTSPassthru)
     {
-        [copyMask addObject:@"copy:dts"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_DCA_PASS))];
     }
     if (self.allowMP3Passthru)
     {
-        [copyMask addObject:@"copy:mp3"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_MP3_PASS))];
     }
     if (self.allowTrueHDPassthru)
     {
-        [copyMask addObject:@"copy:truehd"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_TRUEHD_PASS))];
     }
     if (self.allowFLACPassthru)
     {
-        [copyMask addObject:@"copy:flac"];
+        [copyMask addObject:@(hb_audio_encoder_get_short_name(HB_ACODEC_FLAC_PASS))];
     }
     preset[@"AudioCopyMask"] = [copyMask copy];