diff options
author | sr55 <[email protected]> | 2015-01-19 21:00:04 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-01-19 21:00:04 +0000 |
commit | e92de31ae2e15317e95c5ecf13a2105916348881 (patch) | |
tree | 3267a6332b0f90b1e74dce8dd4b39d12f5fa34d2 /win/CS/HandBrake.ApplicationServices | |
parent | 03806044c2982cf163b758a5205bef49777dfc26 (diff) |
WinGui: Adding additional logging around LibHB scan / encode to track down why it's not starting for some users.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6774 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
3 files changed, 67 insertions, 19 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs index 65ef02ed3..3c78835ae 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs @@ -362,6 +362,17 @@ namespace HandBrake.ApplicationServices.Services.Encode }
/// <summary>
+ /// The service log message.
+ /// </summary>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ protected void ServiceLogMessage(string message)
+ {
+ this.ProcessLogMessage(string.Format("# {0}", message));
+ }
+
+ /// <summary>
/// Process an Incomming Log Message.
/// </summary>
/// <param name="message">
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs index 215b05e02..516be8932 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs @@ -136,10 +136,12 @@ namespace HandBrake.ApplicationServices.Services.Encode HandBrakeUtils.SetDvdNav(!job.Configuration.IsDvdNavDisabled);
+ ServiceLogMessage("Scanning title for encoding ... ");
this.instance.StartScan(job.Task.Source, job.Configuration.PreviewScanCount, job.Task.Title);
}
catch (Exception exc)
{
+ ServiceLogMessage("Scan Failed ... " + Environment.NewLine + exc);
this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "An Error has occured.", this.currentTask.Task.Destination));
}
}
@@ -152,6 +154,7 @@ namespace HandBrake.ApplicationServices.Services.Encode if (this.instance != null)
{
this.instance.PauseEncode();
+ ServiceLogMessage("Encode Paused");
this.IsPasued = true;
}
}
@@ -164,6 +167,7 @@ namespace HandBrake.ApplicationServices.Services.Encode if (this.instance != null)
{
this.instance.ResumeEncode();
+ ServiceLogMessage("Encode Resumed");
this.IsPasued = false;
}
}
@@ -177,6 +181,7 @@ namespace HandBrake.ApplicationServices.Services.Encode {
this.IsEncoding = false;
this.instance.StopEncode();
+ ServiceLogMessage("Encode Stopped");
}
catch (Exception)
{
@@ -203,6 +208,8 @@ namespace HandBrake.ApplicationServices.Services.Encode /// </param>
private void ScanCompleted(QueueTask job, IHandBrakeInstance instance)
{
+ ServiceLogMessage("Scan Completed. Setting up the job for encoding ...");
+
// Get an EncodeJob object for the Interop Library
EncodeJob encodeJob = InteropModelCreator.GetEncodeJob(job);
@@ -210,6 +217,7 @@ namespace HandBrake.ApplicationServices.Services.Encode Title title = this.scannedSource.Titles.FirstOrDefault(t => t.TitleNumber == job.Task.Title);
if (title == null)
{
+ ServiceLogMessage("Title not found.");
throw new Exception("Unable to get title for encoding. Encode Failed.");
}
@@ -222,7 +230,16 @@ namespace HandBrake.ApplicationServices.Services.Encode };
// TODO fix this tempory hack to pass in the required title information into the factory.
- instance.StartEncode(encodeJob, scannedTitle, job.Configuration.PreviewScanCount);
+ try
+ {
+ ServiceLogMessage("Starting Encode ...");
+ instance.StartEncode(encodeJob, scannedTitle, job.Configuration.PreviewScanCount);
+ }
+ catch (Exception exc)
+ {
+ ServiceLogMessage("Failed to start encoding ..." + Environment.NewLine + exc);
+ this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", job.Task.Source));
+ }
// Fire the Encode Started Event
this.InvokeEncodeStarted(System.EventArgs.Empty);
@@ -323,6 +340,7 @@ namespace HandBrake.ApplicationServices.Services.Encode private void InstanceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
{
this.IsEncoding = false;
+ ServiceLogMessage("Encode Completed ...");
this.InvokeEncodeCompleted(
e.Error
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs index 650b07516..796ef5db5 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs @@ -239,6 +239,7 @@ namespace HandBrake.ApplicationServices.Services.Scan /// </summary>
public void Stop()
{
+ ServiceLogMessage("Stopping Scan.");
this.instance.StopScan();
try
@@ -331,10 +332,12 @@ namespace HandBrake.ApplicationServices.Services.Scan HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled);
+ this.ServiceLogMessage("Starting Scan ...");
this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0);
}
catch (Exception exc)
{
+ this.ServiceLogMessage("Scan Failed ..." + Environment.NewLine + exc);
this.Stop();
if (this.ScanCompleted != null)
@@ -356,6 +359,8 @@ namespace HandBrake.ApplicationServices.Services.Scan /// </param>
private void InstanceScanCompleted(object sender, System.EventArgs e)
{
+ this.ServiceLogMessage("Starting Completed ...");
+
// Write the log file out before we start processing incase we crash.
try
{
@@ -427,15 +432,7 @@ namespace HandBrake.ApplicationServices.Services.Scan /// </param>
private void HandBrakeInstanceErrorLogged(object sender, MessageLoggedEventArgs e)
{
- lock (LogLock)
- {
- if (this.scanLog != null)
- {
- this.scanLog.WriteLine(e.Message);
- }
-
- this.logging.AppendLine(e.Message);
- }
+ this.LogMessage(e.Message);
}
/// <summary>
@@ -449,15 +446,7 @@ namespace HandBrake.ApplicationServices.Services.Scan /// </param>
private void HandBrakeInstanceMessageLogged(object sender, MessageLoggedEventArgs e)
{
- lock (LogLock)
- {
- if (this.scanLog != null)
- {
- this.scanLog.WriteLine(e.Message);
- }
-
- this.logging.AppendLine(e.Message);
- }
+ this.LogMessage(e.Message);
}
/// <summary>
@@ -544,6 +533,36 @@ namespace HandBrake.ApplicationServices.Services.Scan return titleList;
}
+
+ /// <summary>
+ /// The log message.
+ /// </summary>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ private void LogMessage(string message)
+ {
+ lock (LogLock)
+ {
+ if (this.scanLog != null)
+ {
+ this.scanLog.WriteLine(message);
+ }
+
+ this.logging.AppendLine(message);
+ }
+ }
+
+ /// <summary>
+ /// The service log message.
+ /// </summary>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ protected void ServiceLogMessage(string message)
+ {
+ this.LogMessage(string.Format("# {0}", message));
+ }
#endregion
}
}
\ No newline at end of file |