// Set the Recommended Cropping values, but only if a preset doesn't have hard set picture settings.\r
if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) || CurrentlySelectedPreset == null)\r
{\r
- crop_top.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[0]);\r
- crop_bottom.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[1]);\r
- crop_left.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[2]);\r
- crop_right.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[3]);\r
+ crop_top.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Top);\r
+ crop_bottom.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Bottom);\r
+ crop_left.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Left);\r
+ crop_right.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions.Right);\r
}\r
\r
SetPresetCropWarningLabel(CurrentlySelectedPreset);\r
\r
if (Source != null)\r
{\r
- crop_top.Value = Source.AutoCropDimensions[0];\r
- crop_bottom.Value = Source.AutoCropDimensions[1];\r
- crop_left.Value = Source.AutoCropDimensions[2];\r
- crop_right.Value = Source.AutoCropDimensions[3];\r
+ crop_top.Value = Source.AutoCropDimensions.Top;\r
+ crop_bottom.Value = Source.AutoCropDimensions.Bottom;\r
+ crop_left.Value = Source.AutoCropDimensions.Left;\r
+ crop_right.Value = Source.AutoCropDimensions.Right;\r
}\r
}\r
\r
<HintPath>libraries\Growl.CoreLibrary.dll</HintPath>\r
<Private>True</Private>\r
</Reference>\r
+ <Reference Include="HandBrakeInterop, Version=1.3.0.0, Culture=neutral, processorArchitecture=x86">\r
+ <SpecificVersion>False</SpecificVersion>\r
+ <HintPath>libraries\HandBrakeInterop.dll</HintPath>\r
+ </Reference>\r
<Reference Include="PresentationCore">\r
<RequiredTargetFramework>3.0</RequiredTargetFramework>\r
</Reference>\r
<DependentUpon>frmExceptionWindow.cs</DependentUpon>\r
</Compile>\r
<Compile Include="Model\ActivityLogMode.cs" />\r
+ <Compile Include="Model\Cropping.cs" />\r
+ <Compile Include="Model\SubtitleType.cs" />\r
<Compile Include="Properties\AssemblyInfo.cs" />\r
<Compile Include="Services\Encode.cs" />\r
<Compile Include="frmPreview.cs">\r
--- /dev/null
+/* Cropping.cs $\r
+ 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
+namespace Handbrake.Model\r
+{\r
+ /// <summary>\r
+ /// Cropping T B L R\r
+ /// </summary>\r
+ public class Cropping\r
+ {\r
+ /// <summary>\r
+ /// Gets or sets Top.\r
+ /// </summary>\r
+ public int Top { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Bottom.\r
+ /// </summary>\r
+ public int Bottom { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Left.\r
+ /// </summary>\r
+ public int Left { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Right.\r
+ /// </summary>\r
+ public int Right { get; set; }\r
+\r
+ /// <summary>\r
+ /// Create a cropping object\r
+ /// </summary>\r
+ /// <param name="top">\r
+ /// The top.\r
+ /// </param>\r
+ /// <param name="bottom">\r
+ /// The bottom.\r
+ /// </param>\r
+ /// <param name="left">\r
+ /// The left.\r
+ /// </param>\r
+ /// <param name="right">\r
+ /// The right.\r
+ /// </param>\r
+ /// <returns>\r
+ /// A Cropping object\r
+ /// </returns>\r
+ public static Cropping CreateCroppingObject(int top, int bottom, int left, int right)\r
+ {\r
+ return new Cropping { Top = top, Bottom = bottom, Left = left, Right = right };\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/* SubtitleType.cs $\r
+ 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
+namespace Handbrake.Model\r
+{\r
+ /// <summary>\r
+ /// Subtitle Type. \r
+ /// 0: Picture\r
+ /// 1: Text\r
+ /// </summary>\r
+ public enum SubtitleType\r
+ {\r
+ Picture,\r
+ Text\r
+ }\r
+}\r
public string Language { get; private set; }\r
\r
/// <summary>\r
- /// Gets The primary format of this Audio Track\r
+ /// Gets or sets LanguageCode.\r
/// </summary>\r
- public string Format { get; private set; }\r
+ public string LanguageCode { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Description.\r
+ /// </summary>\r
+ public string Description { get; set; }\r
\r
/// <summary>\r
- /// Gets Additional format info for this Audio Track\r
+ /// Gets The primary format of this Audio Track\r
/// </summary>\r
- public string SubFormat { get; private set; }\r
+ public string Format { get; private set; }\r
\r
/// <summary>\r
/// Gets The frequency (in MHz) of this Audio Track\r
/// </summary>\r
- public int Frequency { get; private set; }\r
+ public int SampleRate { get; private set; }\r
\r
/// <summary>\r
/// Gets The bitrate (in kbps) of this Audio Track\r
public int Bitrate { get; private set; }\r
\r
/// <summary>\r
- /// Gets ISO639_2.\r
+ /// Create a new Audio Track object\r
/// </summary>\r
- public string ISO639_2 { get; private set; }\r
+ /// <param name="track">\r
+ /// The track.\r
+ /// </param>\r
+ /// <param name="lang">\r
+ /// The lang.\r
+ /// </param>\r
+ /// <param name="langCode">\r
+ /// The lang code.\r
+ /// </param>\r
+ /// <param name="desc">\r
+ /// The desc.\r
+ /// </param>\r
+ /// <param name="format">\r
+ /// The format.\r
+ /// </param>\r
+ /// <param name="samplerate">\r
+ /// The samplerate.\r
+ /// </param>\r
+ /// <param name="bitrate">\r
+ /// The bitrate.\r
+ /// </param>\r
+ /// <returns>\r
+ /// A new Audio Track\r
+ /// </returns>\r
+ public static AudioTrack CreateAudioTrack(int track, string lang, string langCode, string desc, string format, int samplerate, int bitrate)\r
+ {\r
+ AudioTrack newTrack = new AudioTrack\r
+ {\r
+ TrackNumber = track,\r
+ Language = lang,\r
+ LanguageCode = langCode,\r
+ Description = desc,\r
+ Format = format,\r
+ SampleRate = samplerate,\r
+ Bitrate = bitrate\r
+ };\r
+\r
+ return newTrack;\r
+\r
+ }\r
\r
/// <summary>\r
/// Parse the CLI input to an Audio Track object\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
- iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)\r
+ Format = m.Groups[3].Value,\r
+ Description = subformat, \r
+ SampleRate = int.Parse(samplerateVal), \r
+ Bitrate = int.Parse(bitrateVal),\r
+ LanguageCode = iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)\r
};\r
return thisTrack;\r
}\r
/// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>\r
public override string ToString()\r
{\r
- if (SubFormat == null)\r
+ if (Description == 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, Description);\r
}\r
}\r
}
\ No newline at end of file
/// </summary>\r
public TimeSpan Duration { get; private set; }\r
\r
+ /// <summary>\r
+ /// Create a chapter Object\r
+ /// </summary>\r
+ /// <param name="number">\r
+ /// The number.\r
+ /// </param>\r
+ /// <param name="duration">\r
+ /// The duration.\r
+ /// </param>\r
+ /// <returns>\r
+ /// A new Chapter Object\r
+ /// </returns>\r
+ public static Chapter CreateChapterOjbect(int number, TimeSpan duration)\r
+ {\r
+ return new Chapter { ChapterNumber = number, Duration = duration };\r
+ }\r
+\r
/// <summary>\r
/// Parse a CLI string to a Chapter object\r
/// </summary>\r
using System.IO;\r
using System.Text.RegularExpressions;\r
\r
+ using Handbrake.Model;\r
+\r
/// <summary>\r
/// An object that represents a subtitle associated with a Title, in a DVD\r
/// </summary>\r
/// <summary>\r
/// Gets the Subtitle Type\r
/// </summary>\r
- public string Type { get; private set; }\r
+ public SubtitleType SubtitleType { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets Subtitle Type\r
+ /// </summary>\r
+ public string TypeString\r
+ {\r
+ get\r
+ {\r
+ return this.SubtitleType == SubtitleType.Picture ? "Bitmap" : "Text";\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Create a new Subtitle Object\r
+ /// </summary>\r
+ /// <param name="track">\r
+ /// The track.\r
+ /// </param>\r
+ /// <param name="lang">\r
+ /// The lang.\r
+ /// </param>\r
+ /// <param name="langCode">\r
+ /// The lang code.\r
+ /// </param>\r
+ /// <param name="type">\r
+ /// The type.\r
+ /// </param>\r
+ /// <returns>\r
+ /// A Subtitle Object\r
+ /// </returns>\r
+ public static Subtitle CreateSubtitleObject(int track, string lang, string langCode, SubtitleType type)\r
+ {\r
+ return new Subtitle { TrackNumber = track, Language = lang, LanguageCode = langCode, SubtitleType = type };\r
+ }\r
\r
/// <summary>\r
/// Parse the input strings related to subtitles\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
+ SubtitleType = m.Groups[4].Value.Contains("Text") ? SubtitleType.Text : SubtitleType.Picture\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, TypeString);\r
}\r
}\r
}
\ No newline at end of file
using System.IO;\r
using System.Text.RegularExpressions;\r
\r
+ using Handbrake.Model;\r
+\r
/// <summary>\r
/// An object that represents a single Title of a DVD\r
/// </summary>\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
- Angles = new List<string>();\r
AudioTracks = new List<AudioTrack>();\r
Chapters = new List<Chapter>();\r
Subtitles = new List<Subtitle>();\r
}\r
\r
+ #region Properties\r
+\r
/// <summary>\r
/// Gets a Collection of chapters in this Title\r
/// </summary>\r
/// </summary>\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 { get; private set; }\r
-\r
- /// <summary>\r
- /// Gets the Source Name\r
- /// </summary>\r
- public string SourceName { get; private set; }\r
-\r
/// <summary>\r
/// Gets the length in time of this Title\r
/// </summary>\r
/// <summary>\r
/// Gets the aspect ratio of this Title\r
/// </summary>\r
- public float AspectRatio { get; private set; }\r
+ public double AspectRatio { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets AngleCount.\r
+ /// </summary>\r
+ public int AngleCount { get; private set; }\r
\r
/// <summary>\r
/// Gets Par Value\r
/// 2: L\r
/// 3: R\r
/// </summary>\r
- public int[] AutoCropDimensions { get; private set; }\r
+ public Cropping AutoCropDimensions { get; private set; }\r
\r
/// <summary>\r
- /// Gets a Collection of Angles in this Title\r
+ /// Gets the FPS of the source.\r
/// </summary>\r
- public List<string> Angles { get; private set; }\r
+ public double Fps { get; private set; }\r
\r
/// <summary>\r
- /// Gets the FPS of the source.\r
+ /// Gets a value indicating whether this is a MainTitle.\r
/// </summary>\r
- public float Fps { get; private set; }\r
+ public bool MainTitle { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the Source Name\r
+ /// </summary>\r
+ public string SourceName { get; private set; }\r
+\r
+ #endregion\r
+\r
+ /// <summary>\r
+ /// Creates a Title\r
+ /// </summary>\r
+ /// <param name="angles">\r
+ /// The angles.\r
+ /// </param>\r
+ /// <param name="aspectRatio">\r
+ /// The aspect Ratio.\r
+ /// </param>\r
+ /// <param name="audioTracks">\r
+ /// The audio Tracks.\r
+ /// </param>\r
+ /// <param name="crop">\r
+ /// The crop.\r
+ /// </param>\r
+ /// <param name="chapters">\r
+ /// The chapters.\r
+ /// </param>\r
+ /// <param name="duration">\r
+ /// The duration.\r
+ /// </param>\r
+ /// <param name="fps">\r
+ /// The fps.\r
+ /// </param>\r
+ /// <param name="mainTitle">\r
+ /// The main Title.\r
+ /// </param>\r
+ /// <param name="parVal">\r
+ /// The par Val.\r
+ /// </param>\r
+ /// <param name="resolution">\r
+ /// The resolution.\r
+ /// </param>\r
+ /// <param name="sourceName">\r
+ /// The source Name.\r
+ /// </param>\r
+ /// <param name="subtitles">\r
+ /// The subtitles.\r
+ /// </param>\r
+ /// <param name="titleNumber">\r
+ /// The title Number.\r
+ /// </param>\r
+ /// <returns>\r
+ /// A Title Object\r
+ /// </returns>\r
+ public static Title CreateTitle(int angles, double aspectRatio, List<AudioTrack> audioTracks, Cropping crop, List<Chapter> chapters,\r
+ TimeSpan duration, float fps, bool mainTitle, Size parVal, Size resolution, string sourceName, List<Subtitle> subtitles,\r
+ int titleNumber)\r
+ {\r
+ Title title = new Title\r
+ {\r
+ AngleCount = angles,\r
+ AspectRatio = aspectRatio,\r
+ AudioTracks = audioTracks,\r
+ AutoCropDimensions = crop,\r
+ Chapters = chapters,\r
+ Duration = duration,\r
+ Fps = fps,\r
+ MainTitle = mainTitle,\r
+ ParVal = parVal,\r
+ Resolution = resolution,\r
+ SourceName = sourceName,\r
+ Subtitles = subtitles,\r
+ TitleNumber = titleNumber\r
+ };\r
+\r
+ return title;\r
+ }\r
\r
/// <summary>\r
/// Parse the Title Information\r
int angleCount;\r
int.TryParse(angleList, out angleCount);\r
\r
- for (int i = 1; i <= angleCount; i++)\r
- thisTitle.Angles.Add(i.ToString());\r
+ thisTitle.AngleCount = angleCount;\r
}\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.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.AutoCropDimensions = new Cropping\r
+ {\r
+ Top = int.Parse(m.Groups[1].Value),\r
+ Bottom = int.Parse(m.Groups[2].Value),\r
+ Left = int.Parse(m.Groups[3].Value),\r
+ Right = int.Parse(m.Groups[4].Value)\r
+ };\r
+ }\r
\r
thisTitle.Chapters.AddRange(Chapter.ParseList(output));\r
\r
{\r
return string.Format("{0} ({1:00}:{2:00}:{3:00})", TitleNumber, Duration.Hours, Duration.Minutes, Duration.Seconds);\r
}\r
+\r
}\r
}
\ No newline at end of file
<StyleCopSettings Version="4.3">\r
- <GlobalSettings>\r
- <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>\r
- </GlobalSettings>\r
<Parsers>\r
<Parser ParserId="Microsoft.StyleCop.CSharp.CsParser">\r
<ParserSettings>\r
<Analyzers>\r
<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules">\r
<Rules>\r
- <Rule Name="FileHeaderMustShowCopyright">\r
+ <Rule Name="PropertyDocumentationMustHaveValueText">\r
+ <RuleSettings>\r
+ <BooleanProperty Name="Enabled">True</BooleanProperty>\r
+ </RuleSettings>\r
+ </Rule>\r
+ <Rule Name="DocumentationTextMustMeetMinimumCharacterLength">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="FileHeaderMustHaveCopyrightText">\r
+ <Rule Name="DocumentationTextMustContainWhitespace">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="FileHeaderMustContainFileName">\r
+ <Rule Name="EnumerationItemsMustBeDocumented">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">\r
+ <Rule Name="FileMustHaveHeader">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="FileHeaderMustHaveValidCompanyText">\r
+ <Rule Name="FileHeaderMustShowCopyright">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="FileMustHaveHeader">\r
+ <Rule Name="FileHeaderMustHaveCopyrightText">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="PropertyDocumentationMustHaveValueText">\r
+ <Rule Name="FileHeaderMustContainFileName">\r
<RuleSettings>\r
- <BooleanProperty Name="Enabled">True</BooleanProperty>\r
+ <BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="DocumentationTextMustMeetMinimumCharacterLength">\r
+ <Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
- <Rule Name="DocumentationTextMustContainWhitespace">\r
+ <Rule Name="FileHeaderMustHaveValidCompanyText">\r
<RuleSettings>\r
<BooleanProperty Name="Enabled">False</BooleanProperty>\r
</RuleSettings>\r
</Rule>\r
</Rules>\r
<AnalyzerSettings>\r
- <StringProperty Name="CompanyName">HandBrake Project</StringProperty>\r
- <StringProperty Name="Copyright">Copyright 2010 HandBrake Team - It may be used under the terms of the GNU General Public License.</StringProperty>\r
+ <StringProperty Name="CompanyName">HandBrake Project (http://handbrake.fr)</StringProperty>\r
+ <StringProperty Name="Copyright">This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.</StringProperty>\r
</AnalyzerSettings>\r
</Analyzer>\r
<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.MaintainabilityRules">\r
{\r
drop_angle.Visible = true;\r
lbl_angle.Visible = true;\r
- drop_angle.Items.AddRange(selectedTitle.Angles.ToArray());\r
+\r
+ for (int i = 1; i <= selectedTitle.AngleCount; i++)\r
+ drop_angle.Items.Add(i.ToString());\r
+\r
if (drop_angle.Items.Count != 0)\r
drop_angle.SelectedIndex = 0;\r
}\r