diff options
author | sr55 <[email protected]> | 2009-05-13 19:50:47 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-05-13 19:50:47 +0000 |
commit | 43b29fa60d2d30aa1802a7b913436f86cfe3d73f (patch) | |
tree | 80770c72e687ccebbf3cbe23679ab715c814cbce /win/C#/frmMain.cs | |
parent | 78db7280456c556a3015f93ec54d579e2935085a (diff) |
WinGui:
- The CLI status information can now optionally be displayed in the encode status bar in the GUI.
- Fixed Scan and Encode cancel functions with a hack. It was killing CMD.exe, not HandBrakeCLI.exe
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2416 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmMain.cs')
-rw-r--r-- | win/C#/frmMain.cs | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index edea6c54f..02fe25a1e 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -214,6 +214,14 @@ namespace Handbrake {
lastAction = "encode";
setEncodeStarted();
+
+ // Experimental HBProc Process Monitoring.
+ if (Properties.Settings.Default.enocdeStatusInGui == "Checked")
+ {
+ HBProcess = encodeQueue.hbProc;
+ Thread EncodeMon = new Thread(encodeMonitorThread);
+ EncodeMon.Start();
+ }
}
private void encodeEnded(object sender, EventArgs e)
{
@@ -597,15 +605,7 @@ namespace Handbrake {
// Pause The Queue
encodeQueue.pauseEncode();
-
- // Kill the current process.
- Process[] aProc = Process.GetProcessesByName("HandBrakeCLI");
- Process HandBrakeCLI;
- if (aProc.Length > 0)
- {
- HandBrakeCLI = aProc[0];
- HandBrakeCLI.Kill();
- }
+ encodeQueue.endEncode();
// Update the GUI
setEncodeFinished();
@@ -632,11 +632,9 @@ namespace Handbrake setEncodeStarted(); // Encode is running, so setup the GUI appropriately
encodeQueue.startEncode(); // Start The Queue Encoding Process
-
}
else if (text_source.Text == string.Empty || text_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-
}
}
private void btn_add2Queue_Click(object sender, EventArgs e)
@@ -1666,7 +1664,8 @@ namespace Handbrake Boolean cleanExit = true;
using (hbproc = Process.Start(hbParseDvd))
{
- scanProcessID = hbproc.Id;
+ Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.
+ scanProcessID = Main.getCliProcess(before);
hbproc.WaitForExit();
if (hbproc.ExitCode != 0)
cleanExit = false;
@@ -1770,7 +1769,7 @@ namespace Handbrake {
enableGUI();
resetGUI();
-
+
Process[] prs = Process.GetProcesses();
foreach (Process process in prs)
{
@@ -2071,6 +2070,39 @@ namespace Handbrake }
#endregion
+ #region In-GUI Encode Status (Experimental)
+ private Process HBProcess { get; set; }
+
+ private void encodeMonitorThread()
+ {
+ try
+ {
+ Parser encode = new Parser(HBProcess.StandardOutput.BaseStream);
+ encode.OnEncodeProgress += encode_OnEncodeProgress;
+ while (!encode.EndOfStream)
+ {
+ encode.readEncodeStatus();
+ }
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
+ }
+
+ private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new EncodeProgressEventHandler(encode_OnEncodeProgress),
+ new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });
+ return;
+ }
+ lbl_encode.Text = string.Format("Encode Progress: {0}%, FPS: {1}, Avg FPS: {2}, Time Remaining: {3} ", PercentComplete, CurrentFps, AverageFps, TimeRemaining);
+ }
+ #endregion
+
+
// This is the END of the road ****************************************
}
}
\ No newline at end of file |