OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 11 Sep 2010 15:36:32 +0000 (15:36 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 11 Sep 2010 15:36:32 +0000 (15:36 +0000)
- Further fixes to the Title parser to deal with changes made for blu-ray support.

git-svn-id: svn://localhost/HandBrake/trunk@3514 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/HandBrake.ApplicationServices/Parsing/Title.cs

index bca9814..3f165de 100644 (file)
@@ -116,30 +116,40 @@ namespace HandBrake.ApplicationServices.Parsing
         public static Title Parse(StringReader output)\r
         {\r
             var thisTitle = new Title();\r
+            string nextLine = output.ReadLine();\r
 \r
-            Match m = Regex.Match(output.ReadLine(), @"^\+ title ([0-9]*):");\r
-            // Match track number for this title\r
+            // Get the Title Number\r
+            Match m = Regex.Match(nextLine, @"^\+ title ([0-9]*):");\r
             if (m.Success)\r
                 thisTitle.TitleNumber = int.Parse(m.Groups[1].Value.Trim());\r
+            nextLine = output.ReadLine();\r
 \r
-            // If we are scanning a groupd of files, we'll want to get the source name.\r
-            string path = output.ReadLine();\r
-\r
-            m = Regex.Match(path, @"  \+ Main Feature");\r
+            // Detect if this is the main feature\r
+            m = Regex.Match(nextLine, @"  \+ Main Feature");\r
             if (m.Success)\r
             {\r
                 thisTitle.MainTitle = true;\r
-                path = output.ReadLine();\r
+                nextLine = output.ReadLine();\r
             }\r
 \r
-            m = Regex.Match(path, @"^  \+ stream:");\r
+            // Get the stream name for file import\r
+            m = Regex.Match(nextLine, @"^  \+ stream:");\r
             if (m.Success)\r
-                thisTitle.SourceName = path.Replace("+ stream:", string.Empty).Trim();\r
+            {\r
+                thisTitle.SourceName = nextLine.Replace("+ stream:", string.Empty).Trim();\r
+                nextLine = output.ReadLine();\r
+            }\r
 \r
-            string nextLine = output.ReadLine();\r
+            // Jump over the VTS and blocks line\r
+            m = Regex.Match(nextLine, @"^  \+ vts:");\r
+            if (nextLine.Contains("blocks") || nextLine.Contains("+ vts "))\r
+            {\r
+                nextLine = output.ReadLine();\r
+            }\r
+       \r
+            // Multi-Angle Support if LibDvdNav is enabled\r
             if (!Init.DisableDvdNav)\r
             {\r
-                // Get the Angles for the title.\r
                 m = Regex.Match(nextLine, @"  \+ angle\(s\) ([0-9])");\r
                 if (m.Success)\r
                 {\r