diff options
author | sr55 <[email protected]> | 2011-06-12 16:54:23 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-06-12 16:54:23 +0000 |
commit | 399ab292d7feddf5e83be866caafbaef634eca87 (patch) | |
tree | 519a29f631a5d07c25e4b01ef195005d166ddad6 /win/CS/HandBrake.Interop/HandBrakeInterop/SourceData | |
parent | 191aad2ed1e77d8292f72ab7caf8996d117edd63 (diff) |
WinGui: Bring in the HandBrake Interop library written by RandomEngy.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4045 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/SourceData')
8 files changed, 394 insertions, 0 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs new file mode 100644 index 000000000..ee5f8133d --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs @@ -0,0 +1,17 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HandBrake.SourceData
+{
+ // Only contains 2 real codecs at the moment as those are what we care about. More will be added later.
+ public enum AudioCodec
+ {
+ Ac3,
+
+ Dts,
+
+ Other
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs new file mode 100644 index 000000000..a7b7926c1 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs @@ -0,0 +1,90 @@ +/* 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>
+ /// Gets or sets the audio codec of this Track.
+ /// </summary>
+ public AudioCodec Codec { 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>
+ /// Gets or sets the channel layout of this Audio Track.
+ /// </summary>
+ public int ChannelLayout { get; set; }
+
+ /// <summary>
+ /// The frequency (in Hz) of this Audio Track
+ /// </summary>
+ public int SampleRate { get; set; }
+
+ /// <summary>
+ /// The bitrate (in bits/sec) 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/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Chapter.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Chapter.cs new file mode 100644 index 000000000..74d3703e0 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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/CS/HandBrake.Interop/HandBrakeInterop/SourceData/InputType.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/InputType.cs new file mode 100644 index 000000000..b96b4f174 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/InputType.cs @@ -0,0 +1,20 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+
+namespace HandBrake.SourceData
+{
+ public enum InputType
+ {
+ [Display(Name = "File")]
+ Stream,
+
+ [Display(Name = "DVD")]
+ Dvd,
+
+ [Display(Name = "Blu-ray")]
+ Bluray
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Subtitle.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Subtitle.cs new file mode 100644 index 000000000..5f100db30 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Subtitle.cs @@ -0,0 +1,54 @@ +/* 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; }
+
+ public SubtitleSource SubtitleSource { get; set; }
+
+ /// <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.SubtitleSource);
+ }
+
+ public string Display
+ {
+ get
+ {
+ return this.ToString();
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/SubtitleSource.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/SubtitleSource.cs new file mode 100644 index 000000000..b884b8a32 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/SubtitleSource.cs @@ -0,0 +1,18 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HandBrake.SourceData
+{
+ public enum SubtitleSource
+ {
+ VobSub,
+ SRT,
+ CC608,
+ CC708,
+ UTF8,
+ TX3G,
+ SSA
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/SubtitleType.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/SubtitleType.cs new file mode 100644 index 000000000..2c4471e99 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs new file mode 100644 index 000000000..c8b296825 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs @@ -0,0 +1,144 @@ +/* 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>
+ /// Gets or sets the input type of this title.
+ /// </summary>
+ public InputType InputType { get; set; }
+
+ /// <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; }
+
+ /// <summary>
+ /// Gets or sets the number of angles on the title.
+ /// </summary>
+ 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>
+ /// Gets or sets the name of the video codec for this title.
+ /// </summary>
+ public string VideoCodecName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video frame rate for this title.
+ /// </summary>
+ public double Framerate { get; set; }
+
+ /// <summary>
+ /// The total number of frames in this title.
+ /// </summary>
+ public int Frames
+ {
+ get
+ {
+ return (int)Math.Ceiling(((double)this.Duration.TotalSeconds) * this.Framerate);
+ }
+ }
+
+ /// <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 |