summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-01-22 20:45:08 +0000
committersr55 <[email protected]>2012-01-22 20:45:08 +0000
commitdab8b3b4cfbe05f84bb89fb76252c68c41d3a06f (patch)
tree4153040ed252f0f5a13a9a8a50c9fd8c7289f2ac /win/CS/HandBrake.ApplicationServices
parent35018826f82041b6ed7bd6b445f07bd64cb178fd (diff)
WinGui: (WPF) Further work on the Audio and Subtitle tabs along with the API & Utilities.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4418 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs12
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs250
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs105
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/CharCodesUtilities.cs59
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs7
6 files changed, 325 insertions, 109 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs
index 8147f527f..0308069f9 100644
--- a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs
+++ b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs
@@ -10,6 +10,7 @@ namespace HandBrake.ApplicationServices.Functions
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
+ using System.Linq;
using System.Reflection;
/// <summary>
@@ -72,6 +73,17 @@ namespace HandBrake.ApplicationServices.Functions
}
/// <summary>
+ /// Return a list of all the enum values.
+ /// </summary>
+ /// <returns>
+ /// An Enum Oject List
+ /// </returns>
+ public static IEnumerable<T> GetEnumList()
+ {
+ return Enum.GetValues(typeof(T)).Cast<T>().ToList();
+ }
+
+ /// <summary>
/// Get a list of string names for each enum value.
/// </summary>
/// <param name="enumType">
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 2cb6ab738..ff6f8cd4b 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -150,6 +150,7 @@
<Compile Include="Services\UserSettingService.cs" />
<Compile Include="ASUserSettingConstants.cs" />
<Compile Include="Utilities\AppcastReader.cs" />
+ <Compile Include="Utilities\CharCodesUtilities.cs" />
<Compile Include="Utilities\GeneralUtilities.cs" />
<Compile Include="Utilities\LanguageUtilities.cs" />
<Compile Include="Utilities\PlistUtility.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
index 9a92eab80..3ef786629 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
@@ -1,7 +1,11 @@
-/* AudioTrack.cs $
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioTrack.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>
+// An Audio Track for the Audio Panel
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
namespace HandBrake.ApplicationServices.Model.Encoding
{
@@ -17,27 +21,56 @@ namespace HandBrake.ApplicationServices.Model.Encoding
/// </summary>
public class AudioTrack : ModelBase
{
- #region Private Variables
+ #region Constants and Fields
+
/// <summary>
- /// The gain value
+ /// The bitrate.
/// </summary>
- private int gain;
+ private int bitrate;
/// <summary>
- /// The DRC Value
+ /// The DRC Value
/// </summary>
private double drc;
/// <summary>
- /// The Scanned Audio Track
+ /// The encoder.
+ /// </summary>
+ private AudioEncoder encoder;
+
+ /// <summary>
+ /// The gain value
+ /// </summary>
+ private int gain;
+
+ /// <summary>
+ /// The mix down.
+ /// </summary>
+ private Mixdown mixDown;
+
+ /// <summary>
+ /// The sample rate.
+ /// </summary>
+ private double sampleRate;
+
+ /// <summary>
+ /// The Scanned Audio Track
/// </summary>
[NonSerialized]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
private Audio scannedTrack;
+
+ /// <summary>
+ /// The track name.
+ /// </summary>
+ private string trackName;
+
#endregion
+ #region Constructors and Destructors
+
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref = "AudioTrack" /> class.
/// </summary>
public AudioTrack()
{
@@ -50,166 +83,231 @@ namespace HandBrake.ApplicationServices.Model.Encoding
this.ScannedTrack = new Audio();
}
+ #endregion
+
+ #region Public Properties
+
/// <summary>
- /// Gets the Audio Track Name
+ /// Gets AudioEncoderDisplayValue.
/// </summary>
- public int? Track
+ public string AudioEncoderDisplayValue
{
get
{
- if (this.ScannedTrack != null)
+ return EnumHelper<AudioEncoder>.GetDisplay(this.Encoder);
+ }
+ }
+
+ /// <summary>
+ /// Gets AudioMixdownDisplayValue.
+ /// </summary>
+ public string AudioMixdownDisplayValue
+ {
+ get
+ {
+ return EnumHelper<Mixdown>.GetDisplay(this.MixDown);
+ }
+ }
+
+ /// <summary>
+ /// Gets the The UI display value for bit rate
+ /// </summary>
+ public string BitRateDisplayValue
+ {
+ get
+ {
+ if (this.Encoder == AudioEncoder.Ac3Passthrough || this.Encoder == AudioEncoder.DtsPassthrough
+ || this.Encoder == AudioEncoder.DtsHDPassthrough)
{
- return this.ScannedTrack.TrackNumber;
+ return "Auto";
}
- return null;
+ return this.Bitrate.ToString();
}
}
/// <summary>
- /// Gets or sets the Scanned Audio Tracks
+ /// Gets or sets Audio Bitrate
/// </summary>
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Audio ScannedTrack
+ public int Bitrate
{
get
{
- return this.scannedTrack;
+ return this.bitrate;
}
set
{
- this.scannedTrack = value;
- this.OnPropertyChanged("ScannedTrack");
- this.OnPropertyChanged("TrackDisplay");
+ this.bitrate = value;
+ this.OnPropertyChanged("Bitrate");
}
}
/// <summary>
- /// Gets the Display Value for this model.
+ /// Gets or sets Dynamic Range Compression
/// </summary>
- public string TrackDisplay
+ public double DRC
{
get
{
- return this.ScannedTrack == null ? string.Empty : this.ScannedTrack.ToString();
+ return this.drc;
+ }
+
+ set
+ {
+ if (!object.Equals(value, this.drc))
+ {
+ this.drc = value;
+ this.OnPropertyChanged("DRC");
+ }
}
}
/// <summary>
- /// Gets the The UI display value for sample rate
+ /// Gets or sets Audio Encoder
/// </summary>
- public string SampleRateDisplayValue
+ public AudioEncoder Encoder
{
get
{
- return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();
+ return this.encoder;
+ }
+
+ set
+ {
+ this.encoder = value;
+ this.OnPropertyChanged("Encoder");
}
}
/// <summary>
- /// Gets the The UI display value for bit rate
+ /// Gets or sets the Gain for the audio track
/// </summary>
- public string BitRateDisplayValue
+ public int Gain
{
get
{
- if (this.Encoder == AudioEncoder.Ac3Passthrough || this.Encoder == AudioEncoder.DtsPassthrough ||
- this.Encoder == AudioEncoder.DtsHDPassthrough)
+ return this.gain;
+ }
+
+ set
+ {
+ if (!object.Equals(value, this.gain))
{
- return "Auto";
+ this.gain = value;
+ this.OnPropertyChanged("Gain");
}
-
- return this.Bitrate.ToString();
}
}
/// <summary>
- /// Gets AudioEncoderDisplayValue.
+ /// Gets or sets Audio Mixdown
/// </summary>
- public string AudioEncoderDisplayValue
+ public Mixdown MixDown
{
get
{
- return EnumHelper<AudioEncoder>.GetDisplay(this.Encoder);
+ return this.mixDown;
+ }
+
+ set
+ {
+ this.mixDown = value;
+ this.OnPropertyChanged("MixDown");
}
}
/// <summary>
- /// Gets AudioMixdownDisplayValue.
+ /// Gets or sets Audio SampleRate
/// </summary>
- public string AudioMixdownDisplayValue
+ public double SampleRate
{
get
{
- return EnumHelper<Mixdown>.GetDisplay(this.MixDown);
+ return this.sampleRate;
}
- }
+ set
+ {
+ this.sampleRate = value;
+ this.OnPropertyChanged("SampleRate");
+ }
+ }
/// <summary>
- /// Gets or sets Audio Mixdown
+ /// Gets the The UI display value for sample rate
/// </summary>
- public Mixdown MixDown { get; set; }
+ public string SampleRateDisplayValue
+ {
+ get
+ {
+ return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();
+ }
+ }
/// <summary>
- /// Gets or sets Audio Encoder
+ /// Gets or sets the Scanned Audio Tracks
/// </summary>
- public AudioEncoder Encoder { get; set; }
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Audio ScannedTrack
+ {
+ get
+ {
+ return this.scannedTrack;
+ }
- /// <summary>
- /// Gets or sets Audio Bitrate
- /// </summary>
- public int Bitrate { get; set; }
+ set
+ {
+ this.scannedTrack = value;
+ this.OnPropertyChanged("ScannedTrack");
+ this.OnPropertyChanged("TrackDisplay");
+ }
+ }
/// <summary>
- /// Gets or sets Audio SampleRate
+ /// Gets the Audio Track Name
/// </summary>
- public double SampleRate { get; set; }
+ public int? Track
+ {
+ get
+ {
+ if (this.ScannedTrack != null)
+ {
+ return this.ScannedTrack.TrackNumber;
+ }
- /// <summary>
- /// Gets or sets TrackName.
- /// </summary>
- public string TrackName { get; set; }
+ return null;
+ }
+ }
/// <summary>
- /// Gets or sets Dynamic Range Compression
+ /// Gets the Display Value for this model.
/// </summary>
- public double DRC
+ public string TrackDisplay
{
get
{
- return this.drc;
- }
-
- set
- {
- if (!object.Equals(value, this.drc))
- {
- this.drc = value;
- this.OnPropertyChanged("DRC");
- }
+ return this.ScannedTrack == null ? string.Empty : this.ScannedTrack.ToString();
}
}
/// <summary>
- /// Gets or sets the Gain for the audio track
+ /// Gets or sets TrackName.
/// </summary>
- public int Gain
+ public string TrackName
{
get
{
- return this.gain;
+ return this.trackName;
}
set
{
- if (!object.Equals(value, this.gain))
- {
- this.gain = value;
- this.OnPropertyChanged("Gain");
- }
+ this.trackName = value;
+ this.OnPropertyChanged("TrackName");
}
}
+
+ #endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
index f69abed7d..fa7dfd10e 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
@@ -1,82 +1,123 @@
-/* SubtitleTrack.cs $
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleTrack.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>
+// Subtitle Information
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
namespace HandBrake.ApplicationServices.Model.Encoding
{
+ using System;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices.Parsing;
+
/// <summary>
/// Subtitle Information
/// </summary>
- public class SubtitleTrack
+ public class SubtitleTrack : ModelBase
{
- /// <summary>
- /// Gets or sets Track.
- /// </summary>
- public string Track { get; set; }
+ #region Constants and Fields
/// <summary>
- /// Gets or sets a value indicating whether Forced.
+ /// The source track.
/// </summary>
- public bool Forced { get; set; }
+ private Subtitle sourceTrack;
+
+ #endregion
+
+ #region Public Properties
/// <summary>
- /// Gets or sets a value indicating whether Burned.
+ /// Gets or sets a value indicating whether Burned.
/// </summary>
public bool Burned { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether Default.
+ /// Gets or sets a value indicating whether Default.
/// </summary>
public bool Default { get; set; }
- #region SRT Specific Options
+ /// <summary>
+ /// Gets or sets a value indicating whether Forced.
+ /// </summary>
+ public bool Forced { get; set; }
/// <summary>
- /// Gets or sets the SRT Language
+ /// Gets a value indicating whether this is an SRT subtitle.
/// </summary>
- public string SrtLang { get; set; }
+ public bool IsSrtSubtitle
+ {
+ get
+ {
+ return this.SrtFileName != "-";
+ }
+ }
/// <summary>
- /// Gets or sets the SRT Character Code
+ /// Gets or sets Track.
/// </summary>
- public string SrtCharCode { get; set; }
+ [Obsolete("Use SourceTrack Instead")]
+ public string Track { get; set; }
+
/// <summary>
- /// Gets or sets the SRT Offset
+ /// Gets or sets SourceTrack.
/// </summary>
- public int SrtOffset { get; set; }
+ public Subtitle SourceTrack
+ {
+ get
+ {
+ return this.sourceTrack;
+ }
+
+ set
+ {
+ this.sourceTrack = value;
+ this.OnPropertyChanged("SourceTrack");
+ if (this.sourceTrack != null)
+ {
+ this.Track = this.sourceTrack.ToString();
+ }
+ }
+ }
/// <summary>
- /// Gets or sets the Path to the SRT file
+ /// Gets or sets the SRT Character Code
/// </summary>
- public string SrtPath { get; set; }
+ public string SrtCharCode { get; set; }
/// <summary>
- /// Gets or sets the SRT Filename
+ /// Gets or sets the SRT Filename
/// </summary>
public string SrtFileName { get; set; }
/// <summary>
- /// Gets a value indicating whether this is an SRT subtitle.
+ /// Gets or sets the SRT Language
/// </summary>
- public bool IsSrtSubtitle
- {
- get { return this.SrtFileName != "-"; }
- }
+ public string SrtLang { get; set; }
- #endregion
+ /// <summary>
+ /// Gets or sets the SRT Offset
+ /// </summary>
+ public int SrtOffset { get; set; }
/// <summary>
- /// Gets or sets the type of the subtitle
+ /// Gets or sets the Path to the SRT file
+ /// </summary>
+ public string SrtPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type of the subtitle
/// </summary>
public SubtitleType SubtitleType { get; set; }
/// <summary>
- /// Gets A ListViewItem Containing information about this subitlte
+ /// Gets A ListViewItem Containing information about this subitlte
/// </summary>
+ [Obsolete("Used only for the old forms gui. Will be removed.")]
public ListViewItem ListView
{
get
@@ -91,5 +132,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
return listTrack;
}
}
+
+ #endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/CharCodesUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/CharCodesUtilities.cs
new file mode 100644
index 000000000..9c9801015
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/CharCodesUtilities.cs
@@ -0,0 +1,59 @@
+/* AppcastReader.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Utilities
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Char Codes
+ /// </summary>
+ public class CharCodesUtilities
+ {
+ /// <summary>
+ /// Get a command subset of character codes.
+ /// </summary>
+ /// <returns>
+ /// A String List of Character codes.
+ /// </returns>
+ public static List<string> GetCharacterCodes()
+ {
+ return new List<string>
+ {
+ "ANSI_X3.4-1968",
+ "ANSI_X3.4-1986",
+ "ANSI_X3.4",
+ "ANSI_X3.110-1983",
+ "ANSI_X3.110",
+ "ASCII",
+ "ECMA-114",
+ "ECMA-118",
+ "ECMA-128",
+ "ECMA-CYRILLIC",
+ "IEC_P27-1",
+ "ISO-8859-1",
+ "ISO-8859-2",
+ "ISO-8859-3",
+ "ISO-8859-4",
+ "ISO-8859-5",
+ "ISO-8859-6",
+ "ISO-8859-7",
+ "ISO-8859-8",
+ "ISO-8859-9",
+ "ISO-8859-9E",
+ "ISO-8859-10",
+ "ISO-8859-11",
+ "ISO-8859-13",
+ "ISO-8859-14",
+ "ISO-8859-15",
+ "ISO-8859-16",
+ "UTF-7",
+ "UTF-8",
+ "UTF-16",
+ "UTF-32"
+ };
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
index d879afd27..ff56be2dc 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
@@ -3,10 +3,13 @@
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
-using System.Collections.Generic;
-
namespace HandBrake.ApplicationServices.Utilities
{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Language Utilities
+ /// </summary>
public class LanguageUtilities
{
/// <summary>