public class AudioTrack\r
{\r
/// <summary>\r
- /// The Track bitrate\r
- /// </summary>\r
- private int bitrate;\r
-\r
- /// <summary>\r
- /// The track format\r
- /// </summary>\r
- private string format;\r
-\r
- /// <summary>\r
- /// The Frequency\r
- /// </summary>\r
- private int frequency;\r
-\r
- /// <summary>\r
- /// Track Language\r
- /// </summary>\r
- private string language;\r
-\r
- /// <summary>\r
- /// Sub Format\r
- /// </summary>\r
- private string subFormat;\r
-\r
- /// <summary>\r
- /// Track Number\r
- /// </summary>\r
- private int trackNumber;\r
-\r
- /// <summary>\r
- /// The ISO639_2 code\r
- /// </summary>\r
- private string iso639_2;\r
-\r
- /// <summary>\r
/// Gets The track number of this Audio Track\r
/// </summary>\r
- public int TrackNumber\r
- {\r
- get { return trackNumber; }\r
- }\r
+ public int TrackNumber { get; private set; }\r
\r
/// <summary>\r
/// Gets The language (if detected) of this Audio Track\r
/// </summary>\r
- public string Language\r
- {\r
- get { return language; }\r
- }\r
+ public string Language { get; private set; }\r
\r
/// <summary>\r
/// Gets The primary format of this Audio Track\r
/// </summary>\r
- public string Format\r
- {\r
- get { return format; }\r
- }\r
+ public string Format { get; private set; }\r
\r
/// <summary>\r
/// Gets Additional format info for this Audio Track\r
/// </summary>\r
- public string SubFormat\r
- {\r
- get { return subFormat; }\r
- }\r
+ public string SubFormat { get; private set; }\r
\r
/// <summary>\r
/// Gets The frequency (in MHz) of this Audio Track\r
/// </summary>\r
- public int Frequency\r
- {\r
- get { return frequency; }\r
- }\r
+ public int Frequency { get; private set; }\r
\r
/// <summary>\r
/// Gets The bitrate (in kbps) of this Audio Track\r
/// </summary>\r
- public int Bitrate\r
- {\r
- get { return bitrate; }\r
- }\r
+ public int Bitrate { get; private set; }\r
\r
/// <summary>\r
/// Gets ISO639_2.\r
/// </summary>\r
- public string ISO639_2\r
- {\r
- get { return iso639_2; }\r
- }\r
+ public string ISO639_2 { get; private set; }\r
\r
/// <summary>\r
/// Parse the CLI input to an Audio Track object\r
{\r
var thisTrack = new AudioTrack\r
{\r
- trackNumber = int.Parse(track.Groups[1].Value.Trim()), \r
- language = track.Groups[2].Value, \r
- format = m.Groups[3].Value, \r
- subFormat = subformat, \r
- frequency = int.Parse(samplerateVal), \r
- bitrate = int.Parse(bitrateVal), \r
- iso639_2 =\r
+ TrackNumber = int.Parse(track.Groups[1].Value.Trim()), \r
+ Language = track.Groups[2].Value, \r
+ Format = m.Groups[3].Value, \r
+ SubFormat = subformat, \r
+ Frequency = int.Parse(samplerateVal), \r
+ Bitrate = int.Parse(bitrateVal), \r
+ ISO639_2 =\r
iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)\r
};\r
return thisTrack;\r
/// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>\r
public override string ToString()\r
{\r
- if (subFormat == null)\r
- return string.Format("{0} {1} ({2})", trackNumber, language, format);\r
+ if (SubFormat == null)\r
+ return string.Format("{0} {1} ({2})", TrackNumber, Language, Format);\r
\r
- return string.Format("{0} {1} ({2}) ({3})", trackNumber, language, format, subFormat);\r
+ return string.Format("{0} {1} ({2}) ({3})", TrackNumber, Language, Format, SubFormat);\r
}\r
}\r
}
\ No newline at end of file
public class Chapter\r
{\r
/// <summary>\r
- /// Chapter Number\r
- /// </summary>\r
- private int chapterNumber;\r
-\r
- /// <summary>\r
- /// The Duration of the chapter\r
- /// </summary>\r
- private TimeSpan duration;\r
-\r
- /// <summary>\r
/// Gets The number of this Chapter, in regards to it's parent Title\r
/// </summary>\r
- public int ChapterNumber\r
- {\r
- get { return chapterNumber; }\r
- }\r
+ public int ChapterNumber { get; private set; }\r
\r
/// <summary>\r
/// Gets The length in time this Chapter spans\r
/// </summary>\r
- public TimeSpan Duration\r
- {\r
- get { return duration; }\r
- }\r
+ public TimeSpan Duration { get; private set; }\r
\r
/// <summary>\r
/// Parse a CLI string to a Chapter object\r
{\r
var thisChapter = new Chapter\r
{\r
- chapterNumber = int.Parse(m.Groups[1].Value.Trim()), \r
- duration = TimeSpan.Parse(m.Groups[5].Value)\r
+ ChapterNumber = int.Parse(m.Groups[1].Value.Trim()), \r
+ Duration = TimeSpan.Parse(m.Groups[5].Value)\r
};\r
return thisChapter;\r
}\r
/// <returns>A string formatted as: {chapter #}</returns>\r
public override string ToString()\r
{\r
- return chapterNumber.ToString();\r
+ return ChapterNumber.ToString();\r
}\r
}\r
}
\ No newline at end of file
-/* DVD.cs $\r
- \r
- This file is part of the HandBrake source code.\r
+/* DVD.cs $ This file is part of the HandBrake source code.\r
Homepage: <http://handbrake.fr>.\r
It may be used under the terms of the GNU General Public License. */\r
\r
/// </summary>\r
public class DVD\r
{\r
- private readonly List<Title> titles;\r
-\r
/// <summary>\r
/// Initializes a new instance of the <see cref="DVD"/> class. \r
/// Default constructor for this object\r
/// </summary>\r
public DVD()\r
{\r
- titles = new List<Title>();\r
+ Titles = new List<Title>();\r
}\r
\r
/// <summary>\r
- /// Collection of Titles associated with this DVD\r
+ /// Gets Titles. A list of titles from the source\r
/// </summary>\r
- public List<Title> Titles\r
- {\r
- get { return titles; }\r
- }\r
+ public List<Title> Titles { get; private set; }\r
\r
+ /// <summary>\r
+ /// Parse the StreamReader output into a List of Titles\r
+ /// </summary>\r
+ /// <param name="output">\r
+ /// The output.\r
+ /// </param>\r
+ /// <returns>\r
+ /// A DVD object which contains a list of title inforamtion\r
+ /// </returns>\r
public static DVD Parse(StreamReader output)\r
{\r
var thisDVD = new DVD();\r
while (!output.EndOfStream)\r
{\r
if ((char) output.Peek() == '+')\r
- thisDVD.titles.AddRange(Title.ParseList(output.ReadToEnd()));\r
+ thisDVD.Titles.AddRange(Title.ParseList(output.ReadToEnd()));\r
else\r
output.ReadLine();\r
}\r
/// <summary>\r
/// The Buffer StringBuilder\r
/// </summary>\r
- private StringBuilder buffer = new StringBuilder(string.Empty);\r
+ private readonly StringBuilder buffer = new StringBuilder(string.Empty);\r
\r
/// <summary>\r
/// Initializes a new instance of the <see cref="Parser"/> class. \r
public class Subtitle\r
{\r
/// <summary>\r
- /// The Language\r
- /// </summary>\r
- private string language;\r
-\r
- /// <summary>\r
- /// The Track Number\r
- /// </summary>\r
- private int trackNumber;\r
-\r
- /// <summary>\r
- /// The type of subtitle\r
- /// </summary>\r
- private string type;\r
-\r
- /// <summary>\r
- /// The typecode\r
- /// </summary>\r
- private string typecode;\r
-\r
- /// <summary>\r
/// Gets the track number of this Subtitle\r
/// </summary>\r
- public int TrackNumber\r
- {\r
- get { return trackNumber; }\r
- }\r
+ public int TrackNumber { get; private set; }\r
\r
/// <summary>\r
/// Gets the The language (if detected) of this Subtitle\r
/// </summary>\r
- public string Language\r
- {\r
- get { return language; }\r
- }\r
+ public string Language { get; private set; }\r
\r
/// <summary>\r
/// Gets the Langauage Code\r
/// </summary>\r
- public string LanguageCode\r
- {\r
- get { return typecode; }\r
- }\r
+ public string LanguageCode { get; private set; }\r
\r
/// <summary>\r
/// Gets the Subtitle Type\r
/// </summary>\r
- public string Type\r
- {\r
- get { return type; }\r
- }\r
+ public string Type { get; private set; }\r
\r
/// <summary>\r
/// Parse the input strings related to subtitles\r
{\r
var thisSubtitle = new Subtitle\r
{\r
- trackNumber = int.Parse(m.Groups[1].Value.Trim()), \r
- language = m.Groups[2].Value, \r
- typecode = m.Groups[3].Value, \r
- type = m.Groups[4].Value\r
+ TrackNumber = int.Parse(m.Groups[1].Value.Trim()), \r
+ Language = m.Groups[2].Value, \r
+ LanguageCode = m.Groups[3].Value, \r
+ Type = m.Groups[4].Value\r
};\r
return thisSubtitle;\r
}\r
/// <returns>A string formatted as: {track #} {language}</returns>\r
public override string ToString()\r
{\r
- return string.Format("{0} {1} ({2})", trackNumber, language, type);\r
+ return string.Format("{0} {1} ({2})", TrackNumber, Language, Type);\r
}\r
}\r
}
\ No newline at end of file
private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
\r
/// <summary>\r
- /// A collection of Audio Tracks\r
- /// </summary>\r
- private readonly List<AudioTrack> audioTracks;\r
-\r
- /// <summary>\r
- /// A Collection of Chapters\r
- /// </summary>\r
- private readonly List<Chapter> chapters;\r
-\r
- /// <summary>\r
- /// A Collection of Subtitles\r
- /// </summary>\r
- private readonly List<Subtitle> subtitles;\r
-\r
- /// <summary>\r
- /// A collection of angles \r
- /// </summary>\r
- private List<string> angles = new List<string>();\r
-\r
- /// <summary>\r
- /// The source aspect ratio\r
- /// </summary>\r
- private float aspectRatio;\r
-\r
- /// <summary>\r
- /// The source framerate\r
- /// </summary>\r
- private float fps;\r
-\r
- /// <summary>\r
- /// Source autocrop values\r
- /// </summary>\r
- private int[] autoCrop;\r
-\r
- /// <summary>\r
- /// Source name\r
- /// </summary>\r
- private string source;\r
-\r
- /// <summary>\r
- /// The duration of the source\r
- /// </summary>\r
- private TimeSpan duration;\r
-\r
- /// <summary>\r
- /// The source resolution\r
- /// </summary>\r
- private Size resolution;\r
-\r
- /// <summary>\r
- /// The Title number\r
- /// </summary>\r
- private int titleNumber;\r
-\r
- /// <summary>\r
- /// Is A Main Title\r
- /// </summary>\r
- private bool mainTitle;\r
-\r
- /// <summary>\r
- /// The par values for this title.\r
- /// </summary>\r
- private Size parVal;\r
-\r
- /// <summary>\r
/// Initializes a new instance of the <see cref="Title"/> class. \r
/// The constructor for this object\r
/// </summary>\r
public Title()\r
{\r
- audioTracks = new List<AudioTrack>();\r
- chapters = new List<Chapter>();\r
- subtitles = new List<Subtitle>();\r
+ Angles = new List<string>();\r
+ AudioTracks = new List<AudioTrack>();\r
+ Chapters = new List<Chapter>();\r
+ Subtitles = new List<Subtitle>();\r
}\r
\r
/// <summary>\r
/// Gets a Collection of chapters in this Title\r
/// </summary>\r
- public List<Chapter> Chapters\r
- {\r
- get { return chapters; }\r
- }\r
+ public List<Chapter> Chapters { get; private set; }\r
\r
/// <summary>\r
/// Gets a Collection of audio tracks associated with this Title\r
/// </summary>\r
- public List<AudioTrack> AudioTracks\r
- {\r
- get { return audioTracks; }\r
- }\r
+ public List<AudioTrack> AudioTracks { get; private set; }\r
\r
/// <summary>\r
/// Gets aCollection of subtitles associated with this Title\r
/// </summary>\r
- public List<Subtitle> Subtitles\r
- {\r
- get { return subtitles; }\r
- }\r
+ public List<Subtitle> Subtitles { get; private set; }\r
\r
/// <summary>\r
/// Gets The track number of this Title\r
/// </summary>\r
- public int TitleNumber\r
- {\r
- get { return this.titleNumber; }\r
- }\r
+ public int TitleNumber { get; private set; }\r
\r
/// <summary>\r
/// Gets a value indicating whether this is a MainTitle.\r
/// </summary>\r
- public bool MainTitle\r
- {\r
- get { return this.mainTitle; }\r
- }\r
+ public bool MainTitle { get; private set; }\r
\r
/// <summary>\r
/// Gets the Source Name\r
/// </summary>\r
- public string SourceName\r
- {\r
- get { return source; }\r
- }\r
+ public string SourceName { get; private set; }\r
\r
/// <summary>\r
/// Gets the length in time of this Title\r
/// </summary>\r
- public TimeSpan Duration\r
- {\r
- get { return duration; }\r
- }\r
+ public TimeSpan Duration { get; private set; }\r
\r
/// <summary>\r
/// Gets the resolution (width/height) of this Title\r
/// </summary>\r
- public Size Resolution\r
- {\r
- get { return resolution; }\r
- }\r
+ public Size Resolution { get; private set; }\r
\r
/// <summary>\r
/// Gets the aspect ratio of this Title\r
/// </summary>\r
- public float AspectRatio\r
- {\r
- get { return aspectRatio; }\r
- }\r
+ public float AspectRatio { get; private set; }\r
\r
/// <summary>\r
/// Gets Par Value\r
/// </summary>\r
- public Size ParVal\r
- {\r
- get { return parVal; }\r
- }\r
+ public Size ParVal { get; private set; }\r
\r
/// <summary>\r
/// Gets the automatically detected crop region for this Title.\r
/// This is an int array with 4 items in it as so:\r
- /// 0: \r
- /// 1: \r
- /// 2: \r
- /// 3: \r
+ /// 0: T\r
+ /// 1: B\r
+ /// 2: L\r
+ /// 3: R\r
/// </summary>\r
- public int[] AutoCropDimensions\r
- {\r
- get { return autoCrop; }\r
- }\r
+ public int[] AutoCropDimensions { get; private set; }\r
\r
/// <summary>\r
/// Gets a Collection of Angles in this Title\r
/// </summary>\r
- public List<string> Angles\r
- {\r
- get { return angles; }\r
- }\r
+ public List<string> Angles { get; private set; }\r
\r
/// <summary>\r
/// Gets the FPS of the source.\r
/// </summary>\r
- public float Fps\r
- {\r
- get { return fps; }\r
- }\r
+ public float Fps { get; private set; }\r
\r
/// <summary>\r
/// Parse the Title Information\r
Match m = Regex.Match(output.ReadLine(), @"^\+ title ([0-9]*):");\r
// Match track number for this title\r
if (m.Success)\r
- thisTitle.titleNumber = int.Parse(m.Groups[1].Value.Trim());\r
+ thisTitle.TitleNumber = int.Parse(m.Groups[1].Value.Trim());\r
\r
// If we are scanning a groupd of files, we'll want to get the source name.\r
string path = output.ReadLine();\r
m = Regex.Match(path, @" \+ Main Feature");\r
if (m.Success)\r
{\r
- thisTitle.mainTitle = true;\r
+ thisTitle.MainTitle = true;\r
path = output.ReadLine();\r
}\r
\r
m = Regex.Match(path, @"^ \+ stream:");\r
if (m.Success)\r
- thisTitle.source = path.Replace("+ stream:", string.Empty).Trim();\r
+ thisTitle.SourceName = path.Replace("+ stream:", string.Empty).Trim();\r
\r
if (!Properties.Settings.Default.noDvdNav)\r
{\r
int.TryParse(angleList, out angleCount);\r
\r
for (int i = 1; i <= angleCount; i++)\r
- thisTitle.angles.Add(i.ToString());\r
+ thisTitle.Angles.Add(i.ToString());\r
}\r
}\r
\r
// Get duration for this title\r
m = Regex.Match(output.ReadLine(), @"^ \+ duration: ([0-9]{2}:[0-9]{2}:[0-9]{2})");\r
if (m.Success)\r
- thisTitle.duration = TimeSpan.Parse(m.Groups[1].Value);\r
+ thisTitle.Duration = TimeSpan.Parse(m.Groups[1].Value);\r
\r
// Get resolution, aspect ratio and FPS for this title\r
m = Regex.Match(output.ReadLine(), @"^ \+ size: ([0-9]*)x([0-9]*), pixel aspect: ([0-9]*)/([0-9]*), display aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");\r
if (m.Success)\r
{\r
- thisTitle.resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
- thisTitle.parVal = new Size(int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value));\r
- thisTitle.aspectRatio = float.Parse(m.Groups[5].Value, Culture);\r
- thisTitle.fps = float.Parse(m.Groups[6].Value, Culture);\r
+ thisTitle.Resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));\r
+ thisTitle.ParVal = new Size(int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value));\r
+ thisTitle.AspectRatio = float.Parse(m.Groups[5].Value, Culture);\r
+ thisTitle.Fps = float.Parse(m.Groups[6].Value, Culture);\r
}\r
\r
// Get autocrop region for this title\r
m = Regex.Match(output.ReadLine(), @"^ \+ autocrop: ([0-9]*)/([0-9]*)/([0-9]*)/([0-9]*)");\r
if (m.Success)\r
- thisTitle.autoCrop = new[]\r
+ thisTitle.AutoCropDimensions = new[]\r
{\r
int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value), \r
int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value)\r
};\r
\r
- thisTitle.chapters.AddRange(Chapter.ParseList(output));\r
+ thisTitle.Chapters.AddRange(Chapter.ParseList(output));\r
\r
- thisTitle.audioTracks.AddRange(AudioTrack.ParseList(output));\r
+ thisTitle.AudioTracks.AddRange(AudioTrack.ParseList(output));\r
\r
- thisTitle.subtitles.AddRange(Subtitle.ParseList(output));\r
+ thisTitle.Subtitles.AddRange(Subtitle.ParseList(output));\r
\r
return thisTitle;\r
}\r
/// <returns>A string representing this track in the format: {title #} (00:00:00)</returns>\r
public override string ToString()\r
{\r
- return string.Format("{0} ({1:00}:{2:00}:{3:00})", titleNumber, duration.Hours, duration.Minutes, duration.Seconds);\r
+ return string.Format("{0} ({1:00}:{2:00}:{3:00})", TitleNumber, Duration.Hours, Duration.Minutes, Duration.Seconds);\r
}\r
}\r
}
\ No newline at end of file