diff options
Diffstat (limited to 'win/C#/interop/SourceData')
-rw-r--r-- | win/C#/interop/SourceData/AudioTrack.cs | 80 | ||||
-rw-r--r-- | win/C#/interop/SourceData/Chapter.cs | 38 | ||||
-rw-r--r-- | win/C#/interop/SourceData/Subtitle.cs | 70 | ||||
-rw-r--r-- | win/C#/interop/SourceData/SubtitleType.cs | 13 | ||||
-rw-r--r-- | win/C#/interop/SourceData/Title.cs | 115 |
5 files changed, 316 insertions, 0 deletions
diff --git a/win/C#/interop/SourceData/AudioTrack.cs b/win/C#/interop/SourceData/AudioTrack.cs new file mode 100644 index 000000000..735ddd965 --- /dev/null +++ b/win/C#/interop/SourceData/AudioTrack.cs @@ -0,0 +1,80 @@ +/* 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. */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace HandBrake.SourceData
+{
+ /// <summary>
+ /// An object represending an AudioTrack associated with a Title, in a DVD
+ /// </summary>
+ public class AudioTrack
+ {
+ /// <summary>
+ /// The track number of this Audio Track
+ /// </summary>
+ public int TrackNumber { get; set; }
+
+ /// <summary>
+ /// The language (if detected) of this Audio Track
+ /// </summary>
+ public string Language { get; set; }
+
+ public string LanguageCode { get; set; }
+
+ public string Description { get; set; }
+
+ /// <summary>
+ /// The frequency (in MHz) of this Audio Track
+ /// </summary>
+ public int SampleRate { get; set; }
+
+ /// <summary>
+ /// The bitrate (in kbps) of this Audio Track
+ /// </summary>
+ public int Bitrate { get; set; }
+
+ public string Display
+ {
+ get
+ {
+ return this.GetDisplayString(true);
+ }
+ }
+
+ public string NoTrackDisplay
+ {
+ get
+ {
+ return this.GetDisplayString(false);
+ }
+ }
+
+ /// <summary>
+ /// Override of the ToString method to make this object easier to use in the UI
+ /// </summary>
+ /// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>
+ public override string ToString()
+ {
+ return this.GetDisplayString(true);
+ }
+
+ private string GetDisplayString(bool includeTrackNumber)
+ {
+ if (includeTrackNumber)
+ {
+ return this.TrackNumber + " " + this.Description;
+ }
+ else
+ {
+ return this.Description;
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/win/C#/interop/SourceData/Chapter.cs b/win/C#/interop/SourceData/Chapter.cs new file mode 100644 index 000000000..8e41282c4 --- /dev/null +++ b/win/C#/interop/SourceData/Chapter.cs @@ -0,0 +1,38 @@ +/* Chapter.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. */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace HandBrake.SourceData
+{
+ /// <summary>
+ /// An object representing a Chapter aosciated with a Title, in a DVD
+ /// </summary>
+ public class Chapter
+ {
+ /// <summary>
+ /// The number of this Chapter, in regards to its parent Title
+ /// </summary>
+ public int ChapterNumber { get; set; }
+
+ /// <summary>
+ /// The length in time this Chapter spans
+ /// </summary>
+ public TimeSpan Duration { get; set; }
+
+ /// <summary>
+ /// Override of the ToString method to make this object easier to use in the UI
+ /// </summary>
+ /// <returns>A string formatted as: {chapter #}</returns>
+ public override string ToString()
+ {
+ return this.ChapterNumber.ToString();
+ }
+ }
+}
\ No newline at end of file diff --git a/win/C#/interop/SourceData/Subtitle.cs b/win/C#/interop/SourceData/Subtitle.cs new file mode 100644 index 000000000..bf5d4e548 --- /dev/null +++ b/win/C#/interop/SourceData/Subtitle.cs @@ -0,0 +1,70 @@ +/* Subtitle.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. */
+
+using System.Collections.Generic;
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace HandBrake.SourceData
+{
+ /// <summary>
+ /// An object that represents a subtitle associated with a Title, in a DVD
+ /// </summary>
+ public class Subtitle
+ {
+ /// <summary>
+ /// The track number of this Subtitle
+ /// </summary>
+ public int TrackNumber { get; set; }
+
+ /// <summary>
+ /// The language (if detected) of this Subtitle
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Langauage Code
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ public SubtitleType SubtitleType { get; set; }
+
+ /// <summary>
+ /// Subtitle Type
+ /// </summary>
+ public string TypeString
+ {
+ get
+ {
+ if (this.SubtitleType == SubtitleType.Picture)
+ {
+ return "Bitmap";
+ }
+ else
+ {
+ return "Text";
+ }
+ }
+ }
+
+ /// <summary>
+ /// Override of the ToString method to make this object easier to use in the UI
+ /// </summary>
+ /// <returns>A string formatted as: {track #} {language}</returns>
+ public override string ToString()
+ {
+ return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.TypeString);
+ }
+
+ public string Display
+ {
+ get
+ {
+ return this.ToString();
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/win/C#/interop/SourceData/SubtitleType.cs b/win/C#/interop/SourceData/SubtitleType.cs new file mode 100644 index 000000000..68904fed4 --- /dev/null +++ b/win/C#/interop/SourceData/SubtitleType.cs @@ -0,0 +1,13 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HandBrake.SourceData
+{
+ public enum SubtitleType
+ {
+ Picture,
+ Text
+ }
+}
diff --git a/win/C#/interop/SourceData/Title.cs b/win/C#/interop/SourceData/Title.cs new file mode 100644 index 000000000..8d69494ef --- /dev/null +++ b/win/C#/interop/SourceData/Title.cs @@ -0,0 +1,115 @@ +/* Title.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. */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text.RegularExpressions;
+using HandBrake.Interop;
+
+namespace HandBrake.SourceData
+{
+ /// <summary>
+ /// An object that represents a single Title of a DVD
+ /// </summary>
+ public class Title
+ {
+ private static readonly CultureInfo Culture = new CultureInfo("en-US", false);
+ private readonly List<AudioTrack> audioTracks;
+ private readonly List<Chapter> chapters;
+ private readonly List<Subtitle> subtitles;
+
+ /// <summary>
+ /// The constructor for this object
+ /// </summary>
+ public Title()
+ {
+ this.audioTracks = new List<AudioTrack>();
+ this.chapters = new List<Chapter>();
+ this.subtitles = new List<Subtitle>();
+ }
+
+ /// <summary>
+ /// Collection of chapters in this Title
+ /// </summary>
+ public List<Chapter> Chapters
+ {
+ get { return this.chapters; }
+ }
+
+ /// <summary>
+ /// Collection of audio tracks associated with this Title
+ /// </summary>
+ public List<AudioTrack> AudioTracks
+ {
+ get { return this.audioTracks; }
+ }
+
+ /// <summary>
+ /// Collection of subtitles associated with this Title
+ /// </summary>
+ public List<Subtitle> Subtitles
+ {
+ get { return this.subtitles; }
+ }
+
+ /// <summary>
+ /// The track number of this Title (1-based).
+ /// </summary>
+ public int TitleNumber { get; set; }
+
+ /// <summary>
+ /// The length in time of this Title
+ /// </summary>
+ public TimeSpan Duration { get; set; }
+
+ /// <summary>
+ /// The resolution (width/height) of this Title
+ /// </summary>
+ public Size Resolution { get; set; }
+
+ /// <summary>
+ /// The aspect ratio of this Title
+ /// </summary>
+ public double AspectRatio { get; set; }
+
+ public int AngleCount { get; set; }
+
+ /// <summary>
+ /// Par Value
+ /// </summary>
+ public Size ParVal { get; set; }
+
+ /// <summary>
+ /// The automatically detected crop region for this Title.
+ /// This is an int array with 4 items in it as so:
+ /// 0:
+ /// 1:
+ /// 2:
+ /// 3:
+ /// </summary>
+ public Cropping AutoCropDimensions { get; set; }
+
+ /// <summary>
+ /// Override of the ToString method to provide an easy way to use this object in the UI
+ /// </summary>
+ /// <returns>A string representing this track in the format: {title #} (00:00:00)</returns>
+ public override string ToString()
+ {
+ return string.Format("{0} ({1:00}:{2:00}:{3:00})", this.TitleNumber, this.Duration.Hours,
+ this.Duration.Minutes, this.Duration.Seconds);
+ }
+
+ public string Display
+ {
+ get
+ {
+ return this.ToString();
+ }
+ }
+ }
+}
\ No newline at end of file |