OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 22 Jul 2010 19:05:27 +0000 (19:05 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 22 Jul 2010 19:05:27 +0000 (19:05 +0000)
- Fix an issue that would cause the in-gui encode status to screw up if the encoding time was over 24 hours.

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

win/C#/HandBrake.ApplicationServices/EncodeProgressEventArgs.cs
win/C#/HandBrake.ApplicationServices/Parsing/Parser.cs
win/C#/HandBrake.ApplicationServices/Services/Encode.cs

index f51b3ab..8c46f87 100644 (file)
@@ -30,7 +30,7 @@ namespace HandBrake.ApplicationServices
         /// <summary>\r
         /// Gets or sets EstimatedTimeLeft.\r
         /// </summary>\r
-        public TimeSpan EstimatedTimeLeft { get; set; }\r
+        public string EstimatedTimeLeft { get; set; }\r
 \r
         /// <summary>\r
         /// Gets or sets Task.\r
index 1e6329d..e46afea 100644 (file)
@@ -36,7 +36,7 @@ namespace HandBrake.ApplicationServices.Parsing
     /// <param name="currentFps">The current encoding fps</param>\r
     /// <param name="averageFps">The average encoding fps for this task</param>\r
     /// <param name="timeRemaining">The estimated time remaining for this task to complete</param>\r
-    public delegate void EncodeProgressEventHandler(object sender, int currentTask, int taskCount, float percentComplete, float currentFps, float averageFps, TimeSpan timeRemaining);\r
+    public delegate void EncodeProgressEventHandler(object sender, int currentTask, int taskCount, float percentComplete, float currentFps, float averageFps, string timeRemaining);\r
 \r
     /// <summary>\r
     /// A simple wrapper around a StreamReader to keep track of the entire output from a cli process\r
@@ -124,7 +124,6 @@ namespace HandBrake.ApplicationServices.Parsing
             string tmp = base.ReadToEnd();\r
 \r
             buffer.Append(tmp + Environment.NewLine);\r
-\r
             if (OnReadToEnd != null)\r
                 OnReadToEnd(this, tmp);\r
 \r
@@ -147,11 +146,16 @@ namespace HandBrake.ApplicationServices.Parsing
                 float percent = float.Parse(m.Groups[3].Value, culture);\r
                 float currentFps = m.Groups[5].Value == string.Empty ? 0.0F : float.Parse(m.Groups[5].Value, culture);\r
                 float avgFps = m.Groups[6].Value == string.Empty ? 0.0F : float.Parse(m.Groups[6].Value, culture);\r
-                TimeSpan remaining = TimeSpan.Zero;\r
+                string remaining = string.Empty;\r
                 if (m.Groups[7].Value != string.Empty)\r
                 {\r
-                    remaining = TimeSpan.Parse(m.Groups[7].Value + ":" + m.Groups[8].Value + ":" + m.Groups[9].Value);\r
+                    remaining = m.Groups[7].Value + ":" + m.Groups[8].Value + ":" + m.Groups[9].Value;\r
+                }\r
+                if (string.IsNullOrEmpty(remaining))\r
+                {\r
+                    remaining = "Calculating ...";\r
                 }\r
+\r
                 OnEncodeProgress(this, currentTask, totalTasks, percent, currentFps, avgFps, remaining);\r
             }\r
         }\r
index 87b0e00..09099ba 100644 (file)
@@ -498,7 +498,7 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="currentFps">Current encode speed in fps</param>\r
         /// <param name="avg">Avg encode speed</param>\r
         /// <param name="timeRemaining">Time Left</param>\r
-        private void EncodeOnEncodeProgress(object sender, int currentTask, int taskCount, float percentComplete, float currentFps, float avg, TimeSpan timeRemaining)\r
+        private void EncodeOnEncodeProgress(object sender, int currentTask, int taskCount, float percentComplete, float currentFps, float avg, string timeRemaining)\r
         {\r
             EncodeProgressEventArgs eventArgs = new EncodeProgressEventArgs\r
                 {\r