diff options
author | sr55 <[email protected]> | 2016-04-12 19:04:11 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2016-04-12 19:04:11 +0100 |
commit | 8be786a08e1368e7420a13b6f8ca99e560f287ff (patch) | |
tree | f9e95f0fd3d314a6138951f970134aa4c229fd42 /win | |
parent | 697553a2f127e8c76d4dbf94fef91d81480869a4 (diff) |
WinGui: Handle null mixdowns properly. Fixes #152
Diffstat (limited to 'win')
3 files changed, 9 insertions, 6 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs index 9de57c2be..e4312e451 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -459,7 +459,11 @@ namespace HandBrake.ApplicationServices.Interop public static HBMixdown SanitizeMixdown(HBMixdown mixdown, HBAudioEncoder encoder, ulong layout)
{
int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id);
- return Mixdowns.Single(m => m.Id == sanitizedMixdown);
+ if (sanitizedMixdown != -1)
+ {
+ return Mixdowns.Single(m => m.Id == sanitizedMixdown);
+ }
+ return Mixdowns.FirstOrDefault(); // "none"
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs index ea90a50f3..0f9aa02fd 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs @@ -340,7 +340,6 @@ namespace HandBrakeWPF.Services.Encode.Factories Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder); HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(item.MixDown); - Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + item.MixDown); HBRate sampleRate = HandBrakeEncoderHelpers.AudioSampleRates.FirstOrDefault(s => s.Name == item.SampleRate.ToString(CultureInfo.InvariantCulture)); @@ -350,7 +349,7 @@ namespace HandBrakeWPF.Services.Encode.Factories DRC = item.DRC, Encoder = encoder.Id, Gain = item.Gain, - Mixdown = mixdown.Id, + Mixdown = mixdown != null ? mixdown.Id : -1, NormalizeMixLevel = false, Samplerate = sampleRate != null ? sampleRate.Rate : 0, Name = item.TrackName, diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs index 3156d5a83..43138481a 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs @@ -160,7 +160,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models /// <summary> /// Gets or sets Audio Encoder /// </summary> - public HandBrakeWPF.Services.Encode.Model.Models.AudioEncoder Encoder + public AudioEncoder Encoder { get { @@ -214,7 +214,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models /// <summary> /// Gets or sets the encoder rate type. /// </summary> - public HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType EncoderRateType + public AudioEncoderRateType EncoderRateType { get { @@ -435,7 +435,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models /// Gets the audio encoder rate types. /// </summary> [JsonIgnore] - public IEnumerable<HandBrakeWPF.Services.Encode.Model.Models.AudioEncoderRateType> AudioEncoderRateTypes + public IEnumerable<AudioEncoderRateType> AudioEncoderRateTypes { get { |