summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviourModes.cs28
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviours.cs103
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Preset.cs14
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviourModes.cs28
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviours.cs154
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs39
8 files changed, 370 insertions, 2 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 6110c187d..6ba1e302d 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -97,7 +97,11 @@
<Compile Include="Isolation\BackgroundServiceConnector.cs" />
<Compile Include="Isolation\IsolatedEncodeService.cs" />
<Compile Include="LibHb\AudioVideoHelpers.cs" />
+ <Compile Include="Model\Audio\AudioBehaviourModes.cs" />
+ <Compile Include="Model\Audio\AudioBehaviours.cs" />
<Compile Include="Model\HBConfiguration.cs" />
+ <Compile Include="Model\Subtitle\SubtitleBehaviourModes.cs" />
+ <Compile Include="Model\Subtitle\SubtitleBehaviours.cs" />
<Compile Include="Model\VideoScaler.cs" />
<Compile Include="Services\Interfaces\IEncodeServiceWrapper.cs" />
<Compile Include="Services\Interfaces\IHbServiceCallback.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviourModes.cs b/win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviourModes.cs
new file mode 100644
index 000000000..0172b8b1b
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviourModes.cs
@@ -0,0 +1,28 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioBehaviourModes.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The audio behaviours.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Model.Audio
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The audio behaviours.
+ /// </summary>
+ public enum AudioBehaviourModes
+ {
+ [Display(Name = "None")]
+ None = 0,
+
+ [Display(Name = "First Matching Selected Language")]
+ FirstMatch,
+
+ [Display(Name = "All Matching Selected Languages")]
+ AllMatching,
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviours.cs b/win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviours.cs
new file mode 100644
index 000000000..119c8d26d
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Model/Audio/AudioBehaviours.cs
@@ -0,0 +1,103 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioBehaviours.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Audio Behaviours
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Model.Audio
+{
+ using System.ComponentModel;
+
+ using Caliburn.Micro;
+
+ /// <summary>
+ /// Audio Behaviours
+ /// </summary>
+ public class AudioBehaviours : PropertyChangedBase
+ {
+ /// <summary>
+ /// The selected behaviour.
+ /// </summary>
+ private AudioBehaviourModes selectedBehaviour;
+
+ /// <summary>
+ /// The selected langauges.
+ /// </summary>
+ private BindingList<string> selectedLangauges;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AudioBehaviours"/> class.
+ /// </summary>
+ public AudioBehaviours()
+ {
+ this.SelectedBehaviour = AudioBehaviourModes.None;
+ this.SelectedLangauges = new BindingList<string>();
+ }
+
+ /// <summary>
+ /// Gets or sets the selected behaviour.
+ /// </summary>
+ public AudioBehaviourModes SelectedBehaviour
+ {
+ get
+ {
+ return this.selectedBehaviour;
+ }
+
+ set
+ {
+ if (value == this.selectedBehaviour)
+ {
+ return;
+ }
+ this.selectedBehaviour = value;
+ this.NotifyOfPropertyChange(() => this.SelectedBehaviour);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected langauges.
+ /// </summary>
+ public BindingList<string> SelectedLangauges
+ {
+ get
+ {
+ return this.selectedLangauges;
+ }
+ set
+ {
+ if (Equals(value, this.selectedLangauges))
+ {
+ return;
+ }
+ this.selectedLangauges = value;
+ this.NotifyOfPropertyChange(() => this.SelectedLangauges);
+ }
+ }
+
+ /// <summary>
+ /// Clone this object
+ /// </summary>
+ /// <returns>
+ /// The <see cref="object"/>.
+ /// </returns>
+ public AudioBehaviours Clone()
+ {
+ AudioBehaviours cloned = new AudioBehaviours
+ {
+ SelectedBehaviour = this.selectedBehaviour,
+ SelectedLangauges = new BindingList<string>()
+ };
+
+ foreach (var item in this.SelectedLangauges)
+ {
+ cloned.SelectedLangauges.Add(item);
+ }
+
+ return cloned;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs
index 7003ca2c7..57faf2968 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs
@@ -11,6 +11,9 @@ namespace HandBrake.ApplicationServices.Model
{
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Model.Audio;
+ using HandBrake.ApplicationServices.Model.Subtitle;
+
/// <summary>
/// A Preset for encoding with.
/// </summary>
@@ -25,6 +28,7 @@ namespace HandBrake.ApplicationServices.Model
#endregion
+
#region Properties
/// <summary>
@@ -89,6 +93,16 @@ namespace HandBrake.ApplicationServices.Model
/// </summary>
public string Version { get; set; }
+ /// <summary>
+ /// Gets or sets the audio track behaviours.
+ /// </summary>
+ public AudioBehaviours AudioTrackBehaviours { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle track behaviours.
+ /// </summary>
+ public SubtitleBehaviours SubtitleTrackBehaviours { get; set; }
+
#endregion
#region Public Methods
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviourModes.cs b/win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviourModes.cs
new file mode 100644
index 000000000..4094c402e
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviourModes.cs
@@ -0,0 +1,28 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleBehaviourModes.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The subtitle behaviours modes.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Model.Subtitle
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The subtitle behaviours modes.
+ /// </summary>
+ public enum SubtitleBehaviourModes
+ {
+ [Display(Name = "None")]
+ None = 0,
+
+ [Display(Name = "First Matching Selected Language")]
+ FirstMatch,
+
+ [Display(Name = "All Matching Selected Languages")]
+ AllMatching,
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviours.cs b/win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviours.cs
new file mode 100644
index 000000000..28f5176d1
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Model/Subtitle/SubtitleBehaviours.cs
@@ -0,0 +1,154 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleBehaviours.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// A class to track the behaviours of audio track selection
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Model.Subtitle
+{
+ using System.ComponentModel;
+
+ using Caliburn.Micro;
+
+ /// <summary>
+ /// A class to track the behaviours of audio track selection
+ /// </summary>
+ public class SubtitleBehaviours : PropertyChangedBase
+ {
+ /// <summary>
+ /// The selected behaviour.
+ /// </summary>
+ private SubtitleBehaviourModes selectedBehaviour;
+
+ /// <summary>
+ /// The selected langauges.
+ /// </summary>
+ private BindingList<string> selectedLangauges;
+
+ /// <summary>
+ /// The add foreign audio scan track.
+ /// </summary>
+ private bool addForeignAudioScanTrack;
+
+ /// <summary>
+ /// The add closed captions.
+ /// </summary>
+ private bool addClosedCaptions;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SubtitleBehaviours"/> class.
+ /// </summary>
+ public SubtitleBehaviours()
+ {
+ this.SelectedBehaviour = SubtitleBehaviourModes.None;
+ this.SelectedLangauges = new BindingList<string>();
+ }
+
+ /// <summary>
+ /// Gets or sets the selected behaviour.
+ /// </summary>
+ public SubtitleBehaviourModes SelectedBehaviour
+ {
+ get
+ {
+ return this.selectedBehaviour;
+ }
+ set
+ {
+ if (value == this.selectedBehaviour)
+ {
+ return;
+ }
+ this.selectedBehaviour = value;
+ this.NotifyOfPropertyChange(() => this.SelectedBehaviour);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected langages.
+ /// </summary>
+ public BindingList<string> SelectedLangauges
+ {
+ get
+ {
+ return this.selectedLangauges;
+ }
+ set
+ {
+ if (Equals(value, this.selectedLangauges))
+ {
+ return;
+ }
+ this.selectedLangauges = value;
+ this.NotifyOfPropertyChange(() => this.SelectedLangauges);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether add foreign audio scan track.
+ /// </summary>
+ public bool AddForeignAudioScanTrack
+ {
+ get
+ {
+ return this.addForeignAudioScanTrack;
+ }
+ set
+ {
+ if (value.Equals(this.addForeignAudioScanTrack))
+ {
+ return;
+ }
+ this.addForeignAudioScanTrack = value;
+ this.NotifyOfPropertyChange(() => this.AddForeignAudioScanTrack);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether add closed captions.
+ /// </summary>
+ public bool AddClosedCaptions
+ {
+ get
+ {
+ return this.addClosedCaptions;
+ }
+ set
+ {
+ if (value.Equals(this.addClosedCaptions))
+ {
+ return;
+ }
+ this.addClosedCaptions = value;
+ this.NotifyOfPropertyChange(() => this.AddClosedCaptions);
+ }
+ }
+
+ /// <summary>
+ /// Clone this object
+ /// </summary>
+ /// <returns>
+ /// The <see cref="object"/>.
+ /// </returns>
+ public SubtitleBehaviours Clone()
+ {
+ SubtitleBehaviours cloned = new SubtitleBehaviours
+ {
+ SelectedBehaviour = this.selectedBehaviour,
+ SelectedLangauges = new BindingList<string>(),
+ AddClosedCaptions = this.addClosedCaptions,
+ AddForeignAudioScanTrack = this.addForeignAudioScanTrack,
+ };
+
+ foreach (var item in this.SelectedLangauges)
+ {
+ cloned.SelectedLangauges.Add(item);
+ }
+
+ return cloned;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs
index 1c6b785bb..9651c6e71 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs
@@ -129,7 +129,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
case Mixdown.Auto:
case Mixdown.None:
- return "auto";
+ return "none";
case Mixdown.Mono:
return "mono";
case Mixdown.LeftOnly:
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
index bbfe8f62c..94a1fb201 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
@@ -11,6 +11,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
using System.Collections.Generic;
using System.Collections.Specialized;
+ using System.Linq;
/// <summary>
/// Language Utilities
@@ -248,6 +249,42 @@ namespace HandBrake.ApplicationServices.Utilities
}
return iso6392Codes;
- }
+ }
+
+ /// <summary>
+ /// The get language codes.
+ /// </summary>
+ /// <param name="userLanguages">
+ /// The user languages.
+ /// </param>
+ /// <returns>
+ /// The <see cref="List"/>.
+ /// </returns>
+ public static List<string> GetLanguageCodes(IList<string> userLanguages)
+ {
+ // Translate to Iso Codes
+ List<string> iso6392Codes = new List<string>();
+ foreach (var item in userLanguages)
+ {
+ string isoCode;
+ if (LanguageUtilities.MapLanguages().TryGetValue(item, out isoCode))
+ {
+ iso6392Codes.Add(isoCode);
+ }
+ }
+
+ return iso6392Codes;
+ }
+
+ /// <summary>
+ /// The get iso codes.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="List"/>.
+ /// </returns>
+ public static List<string> GetIsoCodes()
+ {
+ return MapLanguages().Values.ToList();
+ }
}
}