summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-04-01 19:52:49 +0000
committersr55 <[email protected]>2015-04-01 19:52:49 +0000
commitc1fefaee7a3c8d4a35d1224ba19d7a7915e2e075 (patch)
treec64cf3e972ef383e7ecbaee79acdbdbe66babd71
parent67f6b82d9c52e005e5df02c31807a4899b3e2629 (diff)
WinGui: Enable the Auto Passthru behaviours though the JSON api copymask
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7032 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs23
2 files changed, 21 insertions, 10 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs
index 6e4b3038a..355a023d8 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs
@@ -29,16 +29,22 @@ namespace HandBrake.ApplicationServices.Interop.HbLib
public const uint HB_ACODEC_FFFLAC24 = 0x00200000;
public const uint HB_ACODEC_FDK_AAC = 0x00400000;
public const uint HB_ACODEC_FDK_HAAC = 0x00800000;
+ public const uint HB_ACODEC_FFEAC3 = 0x01000000;
+ public const uint HB_ACODEC_FFTRUEHD = 0x02000000;
public const uint HB_ACODEC_FF_MASK = 0x00FF2800;
public const uint HB_ACODEC_PASS_FLAG = 0x40000000;
- public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA);
+ 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);
public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG);
public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_MP3 | HB_ACODEC_PASS_FLAG);
public const uint HB_ACODEC_AAC_PASS = (HB_ACODEC_FFAAC | HB_ACODEC_PASS_FLAG);
public const uint HB_ACODEC_AC3_PASS = (HB_ACODEC_AC3 | HB_ACODEC_PASS_FLAG);
public const uint HB_ACODEC_DCA_PASS = (HB_ACODEC_DCA | HB_ACODEC_PASS_FLAG);
public const uint HB_ACODEC_DCA_HD_PASS = (HB_ACODEC_DCA_HD | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_EAC3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFEAC3);
+ public const uint HB_ACODEC_FLAC_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFFLAC);
public const uint HB_ACODEC_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_TRUEHD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD);
+
// Encode state
public const int HB_STATE_IDLE = 1;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs
index 2f99e37a9..670424127 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs
@@ -23,6 +23,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
+ using HandBrake.ApplicationServices.Utilities;
using AudioTrack = HandBrake.ApplicationServices.Services.Encode.Model.Models.AudioTrack;
using Subtitle = HandBrake.ApplicationServices.Interop.Json.Encode.Subtitle;
@@ -296,15 +297,19 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
{
Audio audio = new Audio();
- // TODO Handled on the front-end ? Maybe we can offload logic.
- //if (!string.IsNullOrEmpty(job.AudioEncoderFallback))
- //{
- // HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(job.AudioEncoderFallback);
- // Validate.NotNull(audioEncoder, "Unrecognized fallback audio encoder: " + job.AudioEncoderFallback);
- // audio.FallbackEncoder = audioEncoder.Id;
- //}
-
- audio.CopyMask = (int)NativeConstants.HB_ACODEC_ANY;
+ int copyMask = 0;
+ if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMask = (int)NativeConstants.HB_ACODEC_AAC_PASS;
+ if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_AC3_PASS;
+ if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMask |= (int)NativeConstants.HB_ACODEC_DCA_HD_PASS;
+ if (job.AllowedPassthruOptions.AudioAllowDTSPass) copyMask |= (int)NativeConstants.HB_ACODEC_DCA_PASS;
+ if (job.AllowedPassthruOptions.AudioAllowEAC3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_EAC3_PASS;
+ if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMask |= (int)NativeConstants.HB_ACODEC_FLAC_PASS;
+ if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_MP3_PASS;
+ if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMask |= (int)NativeConstants.HB_ACODEC_TRUEHD_PASS;
+
+ audio.CopyMask = copyMask;
+ HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback));
+ audio.FallbackEncoder = audioEncoder.Id;
audio.AudioList = new List<AudioList>();
foreach (AudioTrack item in job.AudioTracks)