summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services/Encode/Model
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Encode/Model')
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs22
2 files changed, 18 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs
index 2dd42c190..2d659bd39 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioEncoder.cs
@@ -9,8 +9,6 @@
namespace HandBrakeWPF.Services.Encode.Model.Models
{
- using System.ComponentModel.DataAnnotations;
-
using HandBrake.ApplicationServices.Attributes;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
index bf5ea27d4..6dede959d 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
@@ -14,6 +14,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
using System.ComponentModel;
using System.Globalization;
using System.Linq;
+ using System.Security;
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Model;
@@ -102,14 +103,27 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
/// <param name="track">
/// The Behavior track
/// </param>
- public AudioTrack(AudioBehaviourTrack track)
- {
+ /// <param name="sourceTrack">
+ /// The source track we are dealing with.
+ /// </param>
+ /// <param name="fallback">
+ /// An encoder to fall back to.
+ /// </param>
+ public AudioTrack(AudioBehaviourTrack track, Audio sourceTrack, AudioEncoder fallback)
+ {
+ AudioEncoder chosenEncoder = track.Encoder;
+ HBAudioEncoder encoderInfo = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(track.Encoder));
+ if (track.IsPassthru && (sourceTrack.Codec & encoderInfo.Id) == 0)
+ {
+ chosenEncoder = fallback;
+ }
+
+ this.scannedTrack = sourceTrack;
this.drc = track.DRC;
- this.encoder = track.Encoder;
+ this.encoder = chosenEncoder;
this.gain = track.Gain;
this.mixDown = track.MixDown != null ? track.MixDown.ShortName : "dpl2";
this.sampleRate = track.SampleRate;
- this.scannedTrack = new Audio();
this.encoderRateType = track.EncoderRateType;
this.quality = track.Quality;
this.bitrate = track.Bitrate;