summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2016-04-09 15:24:50 +0100
committersr55 <[email protected]>2016-04-09 15:24:50 +0100
commitd3866786b03887914eb66f06dc1a529036e86244 (patch)
tree884d7e41c3af9debcafb0bda76d78f9222fd1eca /win/CS/HandBrakeWPF
parent478431fc9ca190a8a43df354bd0a872903bb6c02 (diff)
WinGui: Sanitise all Mixdown selections. Passthru the Codec into the Scanned Track object.
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs34
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/LibScan.cs3
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs14
3 files changed, 34 insertions, 17 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
index b875df16c..3156d5a83 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs
@@ -148,9 +148,12 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
set
{
- this.mixDown = value;
- this.NotifyOfPropertyChange(() => this.MixDown);
- this.SetupLimits();
+ if (!object.Equals(this.mixDown, value))
+ {
+ this.mixDown = value;
+ this.NotifyOfPropertyChange(() => this.MixDown);
+ this.SetupLimits();
+ }
}
}
@@ -166,6 +169,11 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
set
{
+ if (object.Equals(this.encoder, value))
+ {
+ return;
+ }
+
this.encoder = value;
this.NotifyOfPropertyChange(() => this.Encoder);
this.NotifyOfPropertyChange(() => this.IsPassthru);
@@ -627,14 +635,24 @@ namespace HandBrakeWPF.Services.Encode.Model.Models
/// </summary>
private void GetDefaultMixdownIfNull()
{
- if ((this.mixDown == null || this.mixDown == "none" ) && this.ScannedTrack != null)
+ if (this.ScannedTrack == null)
{
- HBAudioEncoder aencoder =
- HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.encoder));
+ return;
+ }
+
+ HBAudioEncoder aencoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.encoder));
+ HBMixdown currentMixdown = HandBrakeEncoderHelpers.GetMixdown(this.mixDown);
+ HBMixdown sanitisedMixdown = HandBrakeEncoderHelpers.SanitizeMixdown(currentMixdown, aencoder, (uint)this.ScannedTrack.ChannelLayout);
+ HBMixdown defaultMixdown = HandBrakeEncoderHelpers.GetDefaultMixdown(aencoder, (uint)this.ScannedTrack.ChannelLayout);
- HBMixdown mixdown = HandBrakeEncoderHelpers.GetDefaultMixdown(aencoder, (uint)this.ScannedTrack.ChannelLayout);
- this.MixDown = mixdown.ShortName;
+ if (this.mixDown == null || this.mixDown == "none")
+ {
+ this.MixDown = defaultMixdown.ShortName;
+ }
+ else
+ {
+ this.MixDown = sanitisedMixdown.ShortName;
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
index 23d38af4e..bd1f4cf12 100644
--- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
+++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
@@ -384,8 +384,7 @@ namespace HandBrakeWPF.Services.Scan
int currentAudioTrack = 1;
foreach (SourceAudioTrack track in title.AudioList)
{
-
- converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate, track.ChannelLayout));
+ converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, track.Codec, track.SampleRate, track.BitRate, track.ChannelLayout));
currentAudioTrack++;
}
diff --git a/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs b/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs
index ca2841bee..c0da86ecc 100644
--- a/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs
+++ b/win/CS/HandBrakeWPF/Services/Scan/Model/Audio.cs
@@ -39,8 +39,8 @@ namespace HandBrakeWPF.Services.Scan.Model
/// <param name="description">
/// The description.
/// </param>
- /// <param name="format">
- /// The format.
+ /// <param name="codec">
+ /// The codec.
/// </param>
/// <param name="sampleRate">
/// The sample rate.
@@ -51,14 +51,14 @@ namespace HandBrakeWPF.Services.Scan.Model
/// <param name="channelLayout">
/// The channel Layout.
/// </param>
- public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate, int channelLayout)
+ public Audio(int trackNumber, string language, string languageCode, string description, int codec, int sampleRate, int bitrate, int channelLayout)
{
this.ChannelLayout = channelLayout;
this.TrackNumber = trackNumber;
this.Language = language;
this.LanguageCode = languageCode;
this.Description = description;
- this.Format = format;
+ this.Codec = codec;
this.SampleRate = sampleRate;
this.Bitrate = bitrate;
}
@@ -86,7 +86,7 @@ namespace HandBrakeWPF.Services.Scan.Model
/// <summary>
/// Gets or sets The primary format of this Audio Track
/// </summary>
- public string Format { get; set; }
+ public int Codec { get; set; }
/// <summary>
/// Gets or sets The frequency (in MHz) of this Audio Track
@@ -138,7 +138,7 @@ namespace HandBrakeWPF.Services.Scan.Model
return true;
}
- return other.TrackNumber == this.TrackNumber && object.Equals(other.Language, this.Language) && object.Equals(other.LanguageCode, this.LanguageCode) && object.Equals(other.Format, this.Format);
+ return other.TrackNumber == this.TrackNumber && object.Equals(other.Language, this.Language) && object.Equals(other.LanguageCode, this.LanguageCode) && object.Equals(other.Codec, this.Codec);
}
/// <summary>
@@ -182,7 +182,7 @@ namespace HandBrakeWPF.Services.Scan.Model
int result = this.TrackNumber;
result = (result * 397) ^ (this.Language != null ? this.Language.GetHashCode() : 0);
result = (result * 397) ^ (this.LanguageCode != null ? this.LanguageCode.GetHashCode() : 0);
- result = (result * 397) ^ (this.Format != null ? this.Format.GetHashCode() : 0);
+ result = (result * 397) ^ (this.Codec != null ? this.Codec.GetHashCode() : 0);
return result;
}
}