summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2020-12-11 19:31:47 +0000
committersr55 <[email protected]>2020-12-11 19:31:47 +0000
commitf2ffaeecda5976fb8e508607c485963f877e5460 (patch)
tree76edfbb167ad9773703f3bf0bb7bcb2e5b8a4ee0 /win/CS
parent752d2abd67e8331fd6135961765f71a79b981d0e (diff)
WinGui: Work by Nomis101 to add support for MP2 passthru to the windows UI. Thanks. #3222
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs7
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs4
-rw-r--r--win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs14
-rw-r--r--win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs13
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs4
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs43
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs3
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs15
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs15
-rw-r--r--win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml1
12 files changed, 84 insertions, 39 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs
index dd2c64dd7..fda32b6f7 100644
--- a/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs
@@ -660,10 +660,15 @@ namespace HandBrake.Interop.Interop
return HBFunctions.hb_audio_compression_get_default((uint)encoder.Id);
}
- public static uint BuildCopyMask(bool audioAllowMP3Pass, bool audioAllowAACPass, bool audioAllowAC3Pass, bool audioAllowDTSPass, bool audioAllowDTSHDPass, bool audioAllowEac3Pass, bool audioAllowFlacPass, bool audioAllowTruehdPass)
+ public static uint BuildCopyMask(bool audioAllowMP2Pass, bool audioAllowMP3Pass, bool audioAllowAACPass, bool audioAllowAC3Pass, bool audioAllowDTSPass, bool audioAllowDTSHDPass, bool audioAllowEac3Pass, bool audioAllowFlacPass, bool audioAllowTruehdPass)
{
uint mask = 0;
+ if (audioAllowMP2Pass)
+ {
+ mask |= NativeConstants.HB_ACODEC_MP2_PASS;
+ }
+
if (audioAllowMP3Pass)
{
mask |= NativeConstants.HB_ACODEC_MP3_PASS;
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs
index d7a50b7b1..a92434ea5 100644
--- a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs
@@ -22,7 +22,8 @@ namespace HandBrake.Interop.Interop.HbLib
public const uint HB_ACODEC_FFEAC3 = 0x01000000;
public const uint HB_ACODEC_FFTRUEHD = 0x02000000;
public const uint HB_ACODEC_PASS_FLAG = 0x40000000;
- 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_MP2 = 0x06000000;
+ 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_MP2 | HB_ACODEC_MP3 | HB_ACODEC_FFTRUEHD);
public const uint HB_ACODEC_MASK = 0x07FFFF01;
public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_PASS_MASK);
@@ -35,6 +36,7 @@ namespace HandBrake.Interop.Interop.HbLib
public const uint HB_ACODEC_FLAC_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFFLAC);
public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_MP3);
public const uint HB_ACODEC_TRUEHD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD);
+ public const uint HB_ACODEC_MP2_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_MP2);
// VideoEncoders
public const uint HB_VCODEC_QSV_H264 = 0x0000100;
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs
index 1e397532a..bb1959379 100644
--- a/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs
@@ -18,19 +18,13 @@ namespace HandBrakeWPF.Converters.Audio
using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.Model.Encoding;
- using HandBrake.Interop.Utilities;
-
- using HandBrakeWPF.Model.Audio;
using HandBrakeWPF.Services.Scan.Model;
using HandBrakeWPF.Utilities;
- using AudioEncoder = HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder;
- using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
- using OutputFormat = HandBrakeWPF.Services.Encode.Model.Models.OutputFormat;
+ using AudioEncoder = Services.Encode.Model.Models.AudioEncoder;
+ using EncodeTask = Services.Encode.Model.EncodeTask;
+ using OutputFormat = Services.Encode.Model.Models.OutputFormat;
- /// <summary>
- /// Audio Encoder Converter
- /// </summary>
public class AudioEncoderConverter : IMultiValueConverter
{
/// <summary>
@@ -91,6 +85,7 @@ namespace HandBrakeWPF.Converters.Audio
encoders.Remove(AudioEncoder.AacPassthru);
encoders.Remove(AudioEncoder.Ac3Passthrough);
encoders.Remove(AudioEncoder.Mp3Passthru);
+ encoders.Remove(AudioEncoder.Mp2Passthru);
encoders.Remove(AudioEncoder.Passthrough);
encoders.Remove(AudioEncoder.TrueHDPassthrough);
encoders.Remove(AudioEncoder.FlacPassthru);
@@ -111,6 +106,7 @@ namespace HandBrakeWPF.Converters.Audio
RemoveIfNotSupported(AudioEncoder.Mp3Passthru, sourceTrack, encoders);
RemoveIfNotSupported(AudioEncoder.TrueHDPassthrough, sourceTrack, encoders);
RemoveIfNotSupported(AudioEncoder.FlacPassthru, sourceTrack, encoders);
+ RemoveIfNotSupported(AudioEncoder.Mp2Passthru, sourceTrack, encoders);
}
return EnumHelper<AudioEncoder>.GetEnumDisplayValuesSubset(encoders);
diff --git a/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs b/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs
index 5342d2454..a6f8c9860 100644
--- a/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs
+++ b/win/CS/HandBrakeWPF/Model/Audio/AudioBehaviourTrack.cs
@@ -341,7 +341,7 @@ namespace HandBrakeWPF.Model.Audio
|| this.Encoder == AudioEncoder.DtsHDPassthrough || this.Encoder == AudioEncoder.AacPassthru
|| this.Encoder == AudioEncoder.Mp3Passthru || this.Encoder == AudioEncoder.Passthrough ||
this.Encoder == AudioEncoder.EAc3Passthrough || this.Encoder == AudioEncoder.TrueHDPassthrough
- || this.Encoder == AudioEncoder.FlacPassthru)
+ || this.Encoder == AudioEncoder.FlacPassthru || this.Encoder == AudioEncoder.Mp2Passthru)
{
return true;
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs
index 50a480287..e6e3a79c0 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs
@@ -283,6 +283,8 @@ namespace HandBrakeWPF.Services.Encode.Factories
if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMaskList.Add(EnumHelper<AudioEncoder>.GetShortName(AudioEncoder.FlacPassthru));
if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMaskList.Add(EnumHelper<AudioEncoder>.GetShortName(AudioEncoder.Mp3Passthru));
if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMaskList.Add(EnumHelper<AudioEncoder>.GetShortName(AudioEncoder.TrueHDPassthrough));
+ if (job.AllowedPassthruOptions.AudioAllowMP2Pass) copyMaskList.Add(EnumHelper<AudioEncoder>.GetShortName(AudioEncoder.Mp2Passthru));
+
audio.CopyMask = copyMaskList.ToArray();
HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback));
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs
index 47ec12828..1979b10f2 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs
@@ -31,6 +31,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
this.AudioAllowEAC3Pass = true;
this.AudioAllowTrueHDPass = true;
this.AudioAllowFlacPass = true;
+ this.AudioAllowMP2Pass = true;
this.AudioEncoderFallback = AudioEncoder.Ac3;
}
@@ -50,6 +51,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
this.AudioAllowEAC3Pass = initialValue;
this.AudioAllowTrueHDPass = initialValue;
this.AudioAllowFlacPass = initialValue;
+ this.AudioAllowMP2Pass = initialValue;
this.AudioEncoderFallback = AudioEncoder.Ac3;
}
@@ -71,6 +73,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
this.AudioAllowTrueHDPass = initialValue.AudioAllowTrueHDPass;
this.AudioAllowFlacPass = initialValue.AudioAllowFlacPass;
this.AudioEncoderFallback = initialValue.AudioEncoderFallback;
+ this.AudioAllowMP2Pass = initialValue.AudioAllowMP2Pass;
}
#endregion
@@ -118,6 +121,11 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
public bool AudioAllowEAC3Pass { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether AudioAllowMP2Pass.
+ /// </summary>
+ public bool AudioAllowMP2Pass { get; set; }
+
+ /// <summary>
/// Gets or sets AudioEncoderFallback.
/// </summary>
public AudioEncoder AudioEncoderFallback { get; set; }
@@ -162,6 +170,10 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
audioEncoders.Add(AudioEncoder.EAc3Passthrough);
}
+ if (this.AudioAllowMP2Pass)
+ {
+ audioEncoders.Add(AudioEncoder.Mp2Passthru);
+ }
return audioEncoders;
}
@@ -180,6 +192,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
this.AudioAllowEAC3Pass = false;
this.AudioAllowTrueHDPass = false;
this.AudioAllowFlacPass = false;
+ this.AudioAllowMP2Pass = false;
}
#endregion
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs
index 364bae7de..7f8358f20 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs
@@ -72,6 +72,10 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
[ShortName("copy:aac")]
AacPassthru,
+ [DisplayName("MP2 Passthru")]
+ [ShortName("copy:mp2")]
+ Mp2Passthru,
+
[DisplayName("MP3 Passthru")]
[ShortName("copy:mp3")]
Mp3Passthru,
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
index 1d8917d73..494c06096 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
@@ -32,7 +32,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
private int bitrate;
private double drc;
- private HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder encoder;
+ private AudioEncoder encoder;
private int gain;
private string mixDown;
private double sampleRate;
@@ -63,7 +63,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
}
// Setup Backing Properties
- this.EncoderRateType = HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType.Bitrate;
+ this.EncoderRateType = AudioEncoderRateType.Bitrate;
this.SetupLimits();
}
@@ -114,6 +114,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
int format = HandBrakeEncoderHelpers.GetContainer(EnumHelper<OutputFormat>.GetShortName(container)).Id;
int copyMask = checked((int)HandBrakeEncoderHelpers.BuildCopyMask(
+ fallback.AudioAllowMP2Pass,
fallback.AudioAllowMP3Pass,
fallback.AudioAllowAACPass,
fallback.AudioAllowAC3Pass,
@@ -242,7 +243,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
this.NotifyOfPropertyChange(() => this.AudioEncoderRateTypes);
if (!this.AudioEncoderRateTypes.Contains(this.EncoderRateType))
{
- this.EncoderRateType = HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType.Bitrate; // Default to bitrate.
+ this.EncoderRateType = AudioEncoderRateType.Bitrate; // Default to bitrate.
}
}
}
@@ -279,7 +280,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
if (!this.Quality.HasValue)
{
- HBAudioEncoder hbAudioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder>.GetShortName(this.Encoder));
+ HBAudioEncoder hbAudioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.Encoder));
this.Quality = HandBrakeEncoderHelpers.GetDefaultQuality(hbAudioEncoder);
}
}
@@ -331,7 +332,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- return EnumHelper<HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder>.GetDisplay(this.Encoder);
+ return EnumHelper<AudioEncoder>.GetDisplay(this.Encoder);
}
}
@@ -340,8 +341,8 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- if (this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.Ac3Passthrough || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.DtsPassthrough
- || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.DtsHDPassthrough)
+ if (this.Encoder == AudioEncoder.Ac3Passthrough || this.Encoder == AudioEncoder.DtsPassthrough
+ || this.Encoder == AudioEncoder.DtsHDPassthrough)
{
return "Auto";
}
@@ -424,11 +425,11 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- if (this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.Ac3Passthrough || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.DtsPassthrough
- || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.DtsHDPassthrough || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.AacPassthru
- || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.Mp3Passthru || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.Passthrough ||
- this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.EAc3Passthrough || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.TrueHDPassthrough
- || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.FlacPassthru)
+ if (this.Encoder == AudioEncoder.Ac3Passthrough || this.Encoder == AudioEncoder.DtsPassthrough
+ || this.Encoder == AudioEncoder.DtsHDPassthrough || this.Encoder == AudioEncoder.AacPassthru
+ || this.Encoder == AudioEncoder.Mp3Passthru || this.Encoder == AudioEncoder.Passthrough ||
+ this.Encoder == AudioEncoder.EAc3Passthrough || this.Encoder == AudioEncoder.TrueHDPassthrough
+ || this.Encoder == AudioEncoder.FlacPassthru || this.Encoder == AudioEncoder.Mp2Passthru)
{
return true;
}
@@ -459,11 +460,11 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- IList<HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType> types = EnumHelper<HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType>.GetEnumList().ToList();
- HBAudioEncoder hbaenc = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder>.GetShortName(this.Encoder));
+ IList<AudioEncoderRateType> types = EnumHelper<AudioEncoderRateType>.GetEnumList().ToList();
+ HBAudioEncoder hbaenc = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.Encoder));
if (hbaenc == null || !hbaenc.SupportsQuality)
{
- types.Remove(HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType.Quality);
+ types.Remove(AudioEncoderRateType.Quality);
}
return types;
@@ -475,12 +476,12 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- if (this.IsPassthru || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac24)
+ if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
{
return false;
}
- return Equals(this.EncoderRateType, HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType.Bitrate);
+ return Equals(this.EncoderRateType, AudioEncoderRateType.Bitrate);
}
}
@@ -489,12 +490,12 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- if (this.IsPassthru || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac24)
+ if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
{
return false;
}
- return Equals(this.EncoderRateType, HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType.Quality);
+ return Equals(this.EncoderRateType, AudioEncoderRateType.Quality);
}
}
@@ -503,7 +504,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- if (this.IsPassthru || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac24)
+ if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)
{
return false;
}
@@ -517,7 +518,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
{
get
{
- return this.IsPassthru || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac || this.Encoder == HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder.ffflac24;
+ return this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24;
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
index 3348beaeb..4559f61f5 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
@@ -367,6 +367,9 @@ namespace HandBrakeWPF.Services.Presets.Factories
case AudioEncoder.FlacPassthru:
preset.Task.AllowedPassthruOptions.AudioAllowFlacPass = true;
break;
+ case AudioEncoder.Mp2Passthru:
+ preset.Task.AllowedPassthruOptions.AudioAllowMP2Pass = true;
+ break;
case AudioEncoder.Mp3Passthru:
preset.Task.AllowedPassthruOptions.AudioAllowMP3Pass = true;
break;
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs
index fb107b64b..b60767f7f 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs
@@ -142,6 +142,20 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public BindingList<string> SelectedLangaugesToMove { get; private set; }
+ public bool AudioAllowMP2Pass
+ {
+ get
+ {
+ return this.Task.AllowedPassthruOptions.AudioAllowMP2Pass;
+ }
+
+ set
+ {
+ this.task.AllowedPassthruOptions.AudioAllowMP2Pass = value;
+ this.NotifyOfPropertyChange(() => this.AudioAllowMP2Pass);
+ }
+ }
+
/// <summary>
/// Gets or sets a value indicating whether audio allow m p 3 pass.
/// </summary>
@@ -496,6 +510,7 @@ namespace HandBrakeWPF.ViewModels
this.task.AllowedPassthruOptions = new AllowedPassthru(preset.Task.AllowedPassthruOptions);
+ this.NotifyOfPropertyChange(() => this.AudioAllowMP2Pass);
this.NotifyOfPropertyChange(() => this.AudioAllowMP3Pass);
this.NotifyOfPropertyChange(() => this.AudioAllowAACPass);
this.NotifyOfPropertyChange(() => this.AudioAllowAC3Pass);
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
index 37d9e8ee9..ced323b13 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
@@ -12,7 +12,6 @@ namespace HandBrakeWPF.ViewModels
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.ComponentModel;
using System.Linq;
using Caliburn.Micro;
@@ -29,12 +28,11 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.Services.Scan.Model;
using HandBrakeWPF.Utilities;
using HandBrakeWPF.ViewModels.Interfaces;
- using HandBrakeWPF.Views;
- using AudioEncoder = HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder;
- using AudioTrack = HandBrakeWPF.Services.Encode.Model.Models.AudioTrack;
- using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
- using OutputFormat = HandBrakeWPF.Services.Encode.Model.Models.OutputFormat;
+ using AudioEncoder = Services.Encode.Model.Models.AudioEncoder;
+ using AudioTrack = Services.Encode.Model.Models.AudioTrack;
+ using EncodeTask = Services.Encode.Model.EncodeTask;
+ using OutputFormat = Services.Encode.Model.Models.OutputFormat;
/// <summary>
/// The Audio View Model
@@ -296,6 +294,11 @@ namespace HandBrakeWPF.ViewModels
}
}
+ if (preset.Task.AllowedPassthruOptions.AudioAllowMP2Pass != this.Task.AllowedPassthruOptions.AudioAllowMP2Pass)
+ {
+ return false;
+ }
+
if (preset.Task.AllowedPassthruOptions.AudioAllowMP3Pass != this.Task.AllowedPassthruOptions.AudioAllowMP3Pass)
{
return false;
diff --git a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml
index 146049549..f977057ab 100644
--- a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml
@@ -139,6 +139,7 @@
</Grid.ColumnDefinitions>
<StackPanel Margin="10,10,0,0" Orientation="Vertical" Grid.Column="0">
+ <CheckBox Margin="0,0,5,0" Content="MP2" VerticalAlignment="Center" IsChecked="{Binding AudioAllowMP2Pass}" />
<CheckBox Margin="0,0,5,0" Content="MP3" VerticalAlignment="Center" IsChecked="{Binding AudioAllowMP3Pass}" />
<CheckBox Margin="0,0,5,0" Content="AAC" VerticalAlignment="Center" IsChecked="{Binding AudioAllowAACPass}" />
<CheckBox Margin="0,0,5,0" Content="AC3" VerticalAlignment="Center" IsChecked="{Binding AudioAllowAC3Pass}" />