]> granicus.if.org Git - handbrake/commitdiff
WinGui: Enable the Auto Passthru behaviours though the JSON api copymask
authorsr55 <sr55.hb@outlook.com>
Wed, 1 Apr 2015 19:52:49 +0000 (19:52 +0000)
committersr55 <sr55.hb@outlook.com>
Wed, 1 Apr 2015 19:52:49 +0000 (19:52 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7032 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs

index 6e4b3038a36543f91a9b40df679a9c374afeb0bc..355a023d88cb5d3de83658fc047921c53aa05e2c 100644 (file)
@@ -29,16 +29,22 @@ namespace HandBrake.ApplicationServices.Interop.HbLib
         public const uint HB_ACODEC_FFFLAC24 = 0x00200000;\r
         public const uint HB_ACODEC_FDK_AAC = 0x00400000;\r
         public const uint HB_ACODEC_FDK_HAAC = 0x00800000;\r
+        public const uint HB_ACODEC_FFEAC3 = 0x01000000;\r
+        public const uint HB_ACODEC_FFTRUEHD = 0x02000000;\r
         public const uint HB_ACODEC_FF_MASK = 0x00FF2800;\r
         public const uint HB_ACODEC_PASS_FLAG = 0x40000000;\r
-        public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA);\r
+        public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_AC3 | HB_ACODEC_DCA | HB_ACODEC_DCA_HD | HB_ACODEC_FFAAC | HB_ACODEC_FFEAC3 | HB_ACODEC_FFFLAC | HB_ACODEC_MP3 | HB_ACODEC_FFTRUEHD);\r
         public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG);\r
         public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_MP3 | HB_ACODEC_PASS_FLAG);\r
         public const uint HB_ACODEC_AAC_PASS = (HB_ACODEC_FFAAC | HB_ACODEC_PASS_FLAG);\r
         public const uint HB_ACODEC_AC3_PASS = (HB_ACODEC_AC3 | HB_ACODEC_PASS_FLAG);\r
         public const uint HB_ACODEC_DCA_PASS = (HB_ACODEC_DCA | HB_ACODEC_PASS_FLAG);\r
         public const uint HB_ACODEC_DCA_HD_PASS = (HB_ACODEC_DCA_HD | HB_ACODEC_PASS_FLAG);\r
+        public const uint HB_ACODEC_EAC3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFEAC3);\r
+        public const uint HB_ACODEC_FLAC_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFFLAC);\r
         public const uint HB_ACODEC_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG);\r
+        public const uint HB_ACODEC_TRUEHD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD);\r
+\r
 \r
         // Encode state\r
         public const int HB_STATE_IDLE = 1;\r
index 2f99e37a9c426cfa8a5b85282ca5b6afe1081104..670424127d6b1b0b3693388ed0ed8826c87c95f4 100644 (file)
@@ -23,6 +23,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
+    using HandBrake.ApplicationServices.Utilities;\r
 \r
     using AudioTrack = HandBrake.ApplicationServices.Services.Encode.Model.Models.AudioTrack;\r
     using Subtitle = HandBrake.ApplicationServices.Interop.Json.Encode.Subtitle;\r
@@ -296,15 +297,19 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
         {\r
             Audio audio = new Audio();\r
 \r
-            // TODO Handled on the front-end ? Maybe we can offload logic.\r
-            //if (!string.IsNullOrEmpty(job.AudioEncoderFallback))\r
-            //{\r
-            //    HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(job.AudioEncoderFallback);\r
-            //    Validate.NotNull(audioEncoder, "Unrecognized fallback audio encoder: " + job.AudioEncoderFallback);\r
-            //    audio.FallbackEncoder = audioEncoder.Id;\r
-            //}\r
-\r
-            audio.CopyMask = (int)NativeConstants.HB_ACODEC_ANY;\r
+            int copyMask = 0;\r
+            if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMask = (int)NativeConstants.HB_ACODEC_AAC_PASS;\r
+            if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_AC3_PASS;\r
+            if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMask |= (int)NativeConstants.HB_ACODEC_DCA_HD_PASS;\r
+            if (job.AllowedPassthruOptions.AudioAllowDTSPass) copyMask |= (int)NativeConstants.HB_ACODEC_DCA_PASS;\r
+            if (job.AllowedPassthruOptions.AudioAllowEAC3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_EAC3_PASS;\r
+            if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMask |= (int)NativeConstants.HB_ACODEC_FLAC_PASS;\r
+            if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_MP3_PASS;\r
+            if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMask |= (int)NativeConstants.HB_ACODEC_TRUEHD_PASS;\r
+\r
+            audio.CopyMask = copyMask; \r
+            HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback));\r
+            audio.FallbackEncoder = audioEncoder.Id;\r
 \r
             audio.AudioList = new List<AudioList>();\r
             foreach (AudioTrack item in job.AudioTracks)\r