From d0d06731c765a1a4c43558639405533d2af088b7 Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 18 Apr 2011 20:47:02 +0000 Subject: [PATCH] WinGui: - added mpeg2 option to the encoders list. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3938 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/Controls/AudioPanel.cs | 27 +++++++++++++++++++ win/CS/Functions/PresetLoader.cs | 10 ++++--- win/CS/Functions/QueryGenerator.cs | 4 +++ .../Functions/Converters.cs | 4 +++ .../Model/Encoding/VideoEncoder.cs | 3 +++ win/CS/frmMain.Designer.cs | 23 ++++++++-------- win/CS/frmMain.cs | 2 ++ win/CS/frmMain.resx | 21 ++++++++------- 8 files changed, 71 insertions(+), 23 deletions(-) diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs index 471ac9d2f..5e6341641 100644 --- a/win/CS/Controls/AudioPanel.cs +++ b/win/CS/Controls/AudioPanel.cs @@ -8,6 +8,7 @@ namespace Handbrake.Controls using System; using System.Collections.Generic; using System.ComponentModel; + using System.Drawing; using System.Linq; using System.Windows.Forms; @@ -76,6 +77,32 @@ namespace Handbrake.Controls } } + /// + /// Gets the Estimated Bitrate for Tracks and Passthru Tracks + /// Returns a Size object (Encoded Tracks, Passthru Trask) + /// + public Size EstimatedBitrate + { + get + { + int encodedTracks = 0; + int passthruTracks = 0; + foreach (AudioTrack track in this.AudioTracks) + { + if (track.Encoder == AudioEncoder.Ac3Passthrough || track.Encoder == AudioEncoder.DtsPassthrough) + { + passthruTracks += track.ScannedTrack.Bitrate; + } + else + { + encodedTracks += track.Bitrate; + } + } + + return new Size(encodedTracks, passthruTracks); + } + } + #endregion #region Public Methods diff --git a/win/CS/Functions/PresetLoader.cs b/win/CS/Functions/PresetLoader.cs index 78965f1f9..b3c213469 100644 --- a/win/CS/Functions/PresetLoader.cs +++ b/win/CS/Functions/PresetLoader.cs @@ -196,14 +196,17 @@ namespace Handbrake.Functions switch (presetQuery.VideoEncoder) { case VideoEncoder.X264: - mainWindow.drp_videoEncoder.SelectedIndex = 1; + mainWindow.drp_videoEncoder.SelectedIndex = 0; break; case VideoEncoder.FFMpeg: - mainWindow.drp_videoEncoder.SelectedIndex = 0; + mainWindow.drp_videoEncoder.SelectedIndex = 1; break; - case VideoEncoder.Theora: + case VideoEncoder.FFMpeg2: mainWindow.drp_videoEncoder.SelectedIndex = 2; break; + case VideoEncoder.Theora: + mainWindow.drp_videoEncoder.SelectedIndex = 3; + break; } // Quality @@ -299,6 +302,7 @@ namespace Handbrake.Functions switch (videoEncoder) { case VideoEncoder.FFMpeg: + case VideoEncoder.FFMpeg2: sliderValue = 32 - (int)value; break; case VideoEncoder.X264: diff --git a/win/CS/Functions/QueryGenerator.cs b/win/CS/Functions/QueryGenerator.cs index 5487e7b00..975a2a5c3 100644 --- a/win/CS/Functions/QueryGenerator.cs +++ b/win/CS/Functions/QueryGenerator.cs @@ -302,6 +302,9 @@ namespace Handbrake.Functions case "MPEG-4 (FFmpeg)": query += " -e ffmpeg"; break; + case "MPEG-2 (FFmpeg)": + query += " -e ffmpeg2"; + break; case "H.264 (x264)": query += " -e x264"; break; @@ -325,6 +328,7 @@ namespace Handbrake.Functions switch (mainWindow.drp_videoEncoder.Text) { case "MPEG-4 (FFmpeg)": + case "MPEG-2 (FFmpeg)": value = 31 - (mainWindow.slider_videoQuality.Value - 1); query += " -q " + value.ToString(new CultureInfo("en-US")); break; diff --git a/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs b/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs index eab003504..2259abb8c 100644 --- a/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs +++ b/win/CS/HandBrake.ApplicationServices/Functions/Converters.cs @@ -248,6 +248,8 @@ namespace HandBrake.ApplicationServices.Functions { case "ffmpeg": return VideoEncoder.FFMpeg; + case "ffmpeg2": + return VideoEncoder.FFMpeg2; case "x264": return VideoEncoder.X264; case "theora": @@ -272,6 +274,8 @@ namespace HandBrake.ApplicationServices.Functions { case VideoEncoder.FFMpeg: return "ffmpeg"; + case VideoEncoder.FFMpeg2: + return "ffmpeg2"; case VideoEncoder.X264: return "x264"; case VideoEncoder.Theora: diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs index b5a2556e3..766fa09aa 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/VideoEncoder.cs @@ -18,6 +18,9 @@ namespace HandBrake.ApplicationServices.Model.Encoding [Description("MPEG-4 (FFMpeg)")] FFMpeg, + [Description("MPEG-2 (FFMpeg)")] + FFMpeg2, + [Description("VP3 (Theora)")] Theora } diff --git a/win/CS/frmMain.Designer.cs b/win/CS/frmMain.Designer.cs index 1171afa78..c84dc6b62 100644 --- a/win/CS/frmMain.Designer.cs +++ b/win/CS/frmMain.Designer.cs @@ -39,7 +39,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container(); System.Windows.Forms.ContextMenuStrip notifyIconMenu; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.btn_restore = new System.Windows.Forms.ToolStripMenuItem(); this.DVD_Save = new System.Windows.Forms.SaveFileDialog(); this.ToolTip = new System.Windows.Forms.ToolTip(this.components); @@ -255,8 +255,9 @@ namespace Handbrake this.drp_videoEncoder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.drp_videoEncoder.FormattingEnabled = true; this.drp_videoEncoder.Items.AddRange(new object[] { - "MPEG-4 (FFmpeg)", "H.264 (x264)", + "MPEG-4 (FFmpeg)", + "MPEG-2 (FFmpeg)", "VP3 (Theora)"}); this.drp_videoEncoder.Location = new System.Drawing.Point(125, 35); this.drp_videoEncoder.Name = "drp_videoEncoder"; @@ -286,7 +287,7 @@ namespace Handbrake this.check_turbo.Enabled = false; this.check_turbo.Location = new System.Drawing.Point(495, 134); this.check_turbo.Name = "check_turbo"; - this.check_turbo.Size = new System.Drawing.Size(99, 17); + this.check_turbo.Size = new System.Drawing.Size(101, 17); this.check_turbo.TabIndex = 9; this.check_turbo.Text = "Turbo first Pass"; this.ToolTip.SetToolTip(this.check_turbo, "Makes the first pass of a 2 pass encode faster."); @@ -386,9 +387,9 @@ namespace Handbrake // // number // - dataGridViewCellStyle1.Format = "N0"; - dataGridViewCellStyle1.NullValue = null; - this.number.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Format = "N0"; + dataGridViewCellStyle2.NullValue = null; + this.number.DefaultCellStyle = dataGridViewCellStyle2; this.number.Frozen = true; this.number.HeaderText = "Chapter Number"; this.number.MaxInputLength = 3; @@ -556,7 +557,7 @@ namespace Handbrake this.radio_cq.BackColor = System.Drawing.Color.Transparent; this.radio_cq.Location = new System.Drawing.Point(366, 37); this.radio_cq.Name = "radio_cq"; - this.radio_cq.Size = new System.Drawing.Size(105, 17); + this.radio_cq.Size = new System.Drawing.Size(110, 17); this.radio_cq.TabIndex = 3; this.radio_cq.Text = "Constant Quality:"; this.ToolTip.SetToolTip(this.radio_cq, resources.GetString("radio_cq.ToolTip")); @@ -570,7 +571,7 @@ namespace Handbrake this.radio_avgBitrate.Checked = true; this.radio_avgBitrate.Location = new System.Drawing.Point(367, 108); this.radio_avgBitrate.Name = "radio_avgBitrate"; - this.radio_avgBitrate.Size = new System.Drawing.Size(112, 17); + this.radio_avgBitrate.Size = new System.Drawing.Size(116, 17); this.radio_avgBitrate.TabIndex = 4; this.radio_avgBitrate.TabStop = true; this.radio_avgBitrate.Text = "Avg Bitrate (kbps):"; @@ -584,7 +585,7 @@ namespace Handbrake this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent; this.check_2PassEncode.Location = new System.Drawing.Point(385, 134); this.check_2PassEncode.Name = "check_2PassEncode"; - this.check_2PassEncode.Size = new System.Drawing.Size(106, 17); + this.check_2PassEncode.Size = new System.Drawing.Size(104, 17); this.check_2PassEncode.TabIndex = 10; this.check_2PassEncode.Text = "2-Pass Encoding"; this.ToolTip.SetToolTip(this.check_2PassEncode, resources.GetString("check_2PassEncode.ToolTip")); @@ -872,7 +873,7 @@ namespace Handbrake this.radio_constantFramerate.Checked = true; this.radio_constantFramerate.Location = new System.Drawing.Point(0, 0); this.radio_constantFramerate.Name = "radio_constantFramerate"; - this.radio_constantFramerate.Size = new System.Drawing.Size(117, 17); + this.radio_constantFramerate.Size = new System.Drawing.Size(122, 17); this.radio_constantFramerate.TabIndex = 17; this.radio_constantFramerate.TabStop = true; this.radio_constantFramerate.Text = "Constant Framerate"; @@ -884,7 +885,7 @@ namespace Handbrake this.radio_peakAndVariable.BackColor = System.Drawing.Color.Transparent; this.radio_peakAndVariable.Location = new System.Drawing.Point(0, 23); this.radio_peakAndVariable.Name = "radio_peakAndVariable"; - this.radio_peakAndVariable.Size = new System.Drawing.Size(113, 17); + this.radio_peakAndVariable.Size = new System.Drawing.Size(116, 17); this.radio_peakAndVariable.TabIndex = 19; this.radio_peakAndVariable.Text = "Variable Framerate"; this.radio_peakAndVariable.UseVisualStyleBackColor = false; diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index 268a297b2..b0c9fb298 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -1748,6 +1748,7 @@ namespace Handbrake switch (drp_videoEncoder.Text) { case "MPEG-4 (FFmpeg)": + case "MPEG-2 (FFmpeg)": if (slider_videoQuality.Value > 31) slider_videoQuality.Value = 20; // Just reset to 70% QP 10 on encode change. slider_videoQuality.Minimum = 1; @@ -1862,6 +1863,7 @@ namespace Handbrake switch (drp_videoEncoder.Text) { case "MPEG-4 (FFmpeg)": + case "MPEG-2 (FFmpeg)": lbl_SliderValue.Text = "QP:" + (32 - slider_videoQuality.Value); break; case "H.264 (x264)": diff --git a/win/CS/frmMain.resx b/win/CS/frmMain.resx index a737bb095..9ec365918 100644 --- a/win/CS/frmMain.resx +++ b/win/CS/frmMain.resx @@ -640,6 +640,18 @@ Clear the text box below to return to the internal query generation. 98 + + 664, 15 + + + 310, 54 + + + 423, 54 + + + 98 + AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA @@ -1019,13 +1031,4 @@ Clear the text box below to return to the internal query generation. AAD6AQAA4AEAAMABAACAAQAAgAEAAMBBAADAYQAAjGEAAIRhAADc+wAA3/8AAA== - - 664, 15 - - - 310, 54 - - - 423, 54 - \ No newline at end of file -- 2.40.0