From 121b5fedcc7a8f91bb7584389c7d1b8c3ebb8bb3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 26 Jul 2007 19:15:56 +0000 Subject: [PATCH] WinGui: - Disabled Encode progress on GUI Window. CLI now allowed to appear and standard error is no longer re-directed. (BUG: Standard error causing video distortions when used) - If scanning a Source fails, the GUI will now attempt to scan the title a 2nd time automatically. Same issue, Standard error causing hbcli to randomly fail. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@743 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/frmMain.Designer.cs | 7 ++--- win/C#/frmMain.cs | 55 +++++++++++++++++++++++++++----------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 30b8af7a0..58c767175 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -1638,9 +1638,9 @@ namespace Handbrake this.btn_queue.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_queue.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_queue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_queue.Location = new System.Drawing.Point(335, 589); + this.btn_queue.Location = new System.Drawing.Point(415, 589); this.btn_queue.Name = "btn_queue"; - this.btn_queue.Size = new System.Drawing.Size(124, 22); + this.btn_queue.Size = new System.Drawing.Size(115, 22); this.btn_queue.TabIndex = 416; this.btn_queue.TabStop = false; this.btn_queue.Text = "Add to Queue"; @@ -1692,13 +1692,14 @@ namespace Handbrake this.btn_eCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_eCancel.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_eCancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_eCancel.Location = new System.Drawing.Point(465, 589); + this.btn_eCancel.Location = new System.Drawing.Point(344, 589); this.btn_eCancel.Name = "btn_eCancel"; this.btn_eCancel.Size = new System.Drawing.Size(65, 22); this.btn_eCancel.TabIndex = 419; this.btn_eCancel.TabStop = false; this.btn_eCancel.Text = "Cancel"; this.btn_eCancel.UseVisualStyleBackColor = false; + this.btn_eCancel.Visible = false; this.btn_eCancel.Click += new System.EventHandler(this.btn_eCancel_Click); // // frmMain diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index f2471baad..ddb94b184 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -548,6 +548,8 @@ namespace Handbrake String filename =""; text_source.Text = ""; + + int scanTwice = 0; if (RadioDVD.Checked) { @@ -555,9 +557,9 @@ namespace Handbrake filename = DVD_Open.SelectedPath; if (filename != "") { + Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); text_source.Text = filename; - Form frmReadDVD = new frmReadDVD(filename, this, dvdInfoWindow); - frmReadDVD.ShowDialog(); + frmRD.ShowDialog(); } } else @@ -566,18 +568,26 @@ namespace Handbrake filename = ISO_Open.FileName; if (filename != "") { + Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); text_source.Text = filename; - Form frmReadDVD = new frmReadDVD(filename, this, dvdInfoWindow); - frmReadDVD.ShowDialog(); + frmRD.ShowDialog(); } } - // Quick check to make sure some titles were found. + // Check if there was titles in the dvd title dropdown + // If there isn't any, rescan the DVD. hbcli occasionally fails (see bug in encode) with standard error. if (filename != "") { - if (drp_dvdtitle.Items.Count == 0) + if (drp_dvdtitle.Items.Count == 0) { - MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source. Please refer to the FAQ for details..", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); + MessageBox.Show(scanTwice.ToString()); + if (scanTwice == 0) + { + MessageBox.Show("Scan Failed. Will attempt to scan the source 1 more time.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); + Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); + frmRD.ShowDialog(); + scanTwice = 1; + } } } else @@ -585,6 +595,11 @@ namespace Handbrake text_source.Text = "Click 'Browse' to continue"; } + if (drp_dvdtitle.Items.Count == 0) + { + MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source. Please refer to the FAQ for details.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + } private void btn_destBrowse_Click(object sender, EventArgs e) @@ -665,6 +680,7 @@ namespace Handbrake } ThreadPool.QueueUserWorkItem(procMonitor, query); + lbl_encode.Text = "Encoding Started"; } private void btn_eCancel_Click(object sender, EventArgs e) @@ -683,22 +699,30 @@ namespace Handbrake } else { - hbProc = process.runCli(this, (string)state, true, true, false, true); + hbProc = process.runCli(this, (string)state, false, false, false, false); MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); try { - Parsing.Parser encode = new Parsing.Parser(hbProc.StandardError.BaseStream); - encode.OnEncodeProgress += encode_OnEncodeProgress; - while (!encode.EndOfStream) - { - encode.ReadLine(); - } + + //***************************************************************************************** + // BUG! + // When the below code is used and standard error is set to true, hbcli is outputing a + // video stream which has mild corruption issues every few seconds. + // Maybe an issue with the Parser cauing the CLI to hickup/pause? + //***************************************************************************************** + + //Parsing.Parser encode = new Parsing.Parser(hbProc.StandardError.BaseStream); + //encode.OnEncodeProgress += encode_OnEncodeProgress; + //while (!encode.EndOfStream) + //{ + // encode.ReadLine(); + //} hbProc.WaitForExit(); process.closeCLI(); - hbProc = null; + } catch (Exception) { @@ -706,6 +730,7 @@ namespace Handbrake } MessageBox.Show("The encode process has now ended.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + hbProc = null; } } -- 2.40.0