summaryrefslogtreecommitdiffstats
path: root/win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-10-01 16:31:13 +0000
committersr55 <[email protected]>2010-10-01 16:31:13 +0000
commit987a133a592c191ea0ec416da61faceb9b54f5ff (patch)
tree3df06d3faa2c3f872ccf4e560e7eac04ed3efce9 /win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs
parente4a8a2d7fbb5280613de16197524715316522e5e (diff)
WinGui:
- Some refactoring of the Subtitle panel. Added support for subtitle type display to the subtitle dropdown and burn in support for SSA. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3560 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs')
-rw-r--r--win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs42
1 files changed, 35 insertions, 7 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs b/win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs
index f4cd65768..f6ecc1287 100644
--- a/win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs
+++ b/win/C#/HandBrake.ApplicationServices/Parsing/Subtitle.cs
@@ -10,6 +10,7 @@ namespace HandBrake.ApplicationServices.Parsing
using System.Text.RegularExpressions;
using HandBrake.ApplicationServices.Model;
+ using HandBrake.Framework.Helpers;
/// <summary>
/// An object that represents a subtitle associated with a Title, in a DVD
@@ -43,7 +44,7 @@ namespace HandBrake.ApplicationServices.Parsing
{
get
{
- return this.SubtitleType == SubtitleType.Picture ? "Bitmap" : "Text";
+ return EnumHelper.GetDescription(this.SubtitleType);
}
}
@@ -60,16 +61,43 @@ namespace HandBrake.ApplicationServices.Parsing
{
string curLine = output.ReadLine();
- Match m = Regex.Match(curLine, @"^ \+ ([0-9]*), ([A-Za-z, ]*) \((.*)\) \(([a-zA-Z]*)\)");
+ // + 1, English (iso639-2: eng) (Text)(SSA)
+ Match m = Regex.Match(curLine, @"^ \+ ([0-9]*), ([A-Za-z, ]*) \((.*)\) \(([a-zA-Z]*)\)\(([a-zA-Z]*)\)");
+
if (m.Success && !curLine.Contains("HandBrake has exited."))
{
var thisSubtitle = new Subtitle
{
- TrackNumber = int.Parse(m.Groups[1].Value.Trim()),
- Language = m.Groups[2].Value,
- LanguageCode = m.Groups[3].Value,
- SubtitleType = m.Groups[4].Value.Contains("Text") ? SubtitleType.Text : SubtitleType.Picture
+ TrackNumber = int.Parse(m.Groups[1].Value.Trim()),
+ Language = m.Groups[2].Value,
+ LanguageCode = m.Groups[3].Value,
};
+
+ switch (m.Groups[5].Value)
+ {
+ case "VOBSUB":
+ thisSubtitle.SubtitleType = SubtitleType.VobSub;
+ break;
+ case "SRT":
+ thisSubtitle.SubtitleType = SubtitleType.SRT;
+ break;
+ case "CC":
+ thisSubtitle.SubtitleType = SubtitleType.CC;
+ break;
+ case "UTF-8":
+ thisSubtitle.SubtitleType = SubtitleType.UTF8Sub;
+ break;
+ case "TX3G":
+ thisSubtitle.SubtitleType = SubtitleType.TX3G;
+ break;
+ case "SSA":
+ thisSubtitle.SubtitleType = SubtitleType.SSA;
+ break;
+ default:
+ thisSubtitle.SubtitleType = SubtitleType.Unknown;
+ break;
+ }
+
return thisSubtitle;
}
return null;
@@ -87,7 +115,7 @@ namespace HandBrake.ApplicationServices.Parsing
public static IEnumerable<Subtitle> ParseList(StringReader output)
{
var subtitles = new List<Subtitle>();
- while ((char) output.Peek() != '+')
+ while ((char)output.Peek() != '+')
{
Subtitle thisSubtitle = Parse(output);