/// Generates a full CLI query for either encoding or previe encoeds if duration and preview are defined.\r
/// </summary>\r
/// <param name="mainWindow"></param>\r
+ /// <param name="mode"></param>\r
/// <param name="duration"></param>\r
/// <param name="preview"></param>\r
/// <returns></returns>\r
- public string GenerateCLIQuery(frmMain mainWindow, int duration, string preview)\r
+ public string GenerateCLIQuery(frmMain mainWindow, int mode, int duration, string preview)\r
{\r
string query = "";\r
-\r
- if (!string.IsNullOrEmpty(mainWindow.sourcePath))\r
- if (mainWindow.sourcePath.Trim() != "Select \"Source\" to continue")\r
- query = " -i " + '"' + mainWindow.sourcePath + '"';\r
+ \r
+ if (!string.IsNullOrEmpty(mainWindow.sourcePath) && mainWindow.sourcePath.Trim() != "Select \"Source\" to continue")\r
+ query = " -i " + '"' + mainWindow.sourcePath + '"';\r
\r
if (mainWindow.drp_dvdtitle.Text != "")\r
{\r
query += " -t " + titleInfo[0];\r
}\r
\r
- if (!Properties.Settings.Default.noDvdNav)\r
- if (mainWindow.drop_angle.Items.Count != 0)\r
- query += " --angle " + mainWindow.drop_angle.SelectedItem;\r
-\r
+ if (!Properties.Settings.Default.noDvdNav && mainWindow.drop_angle.Items.Count != 0)\r
+ query += " --angle " + mainWindow.drop_angle.SelectedItem;\r
\r
- if (duration != 0 && preview != null) // Preivew Query\r
+ // Decide what part of the video we want to encode.\r
+ switch (mode)\r
{\r
- query += " --previews " + Properties.Settings.Default.previewScanCount + " ";\r
- query += " --start-at-preview " + preview;\r
- query += " --stop-at duration:" + duration + " ";\r
+ case 0: // Chapters\r
+ if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text && mainWindow.drop_chapterStart.Text != "")\r
+ query += string.Format(" -c {0}", mainWindow.drop_chapterStart.Text);\r
+ else if (mainWindow.drop_chapterStart.Text != "" && mainWindow.drop_chapterFinish.Text != "")\r
+ query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text, mainWindow.drop_chapterFinish.Text);\r
+ break;\r
+ case 1: // Seconds\r
+ int start, end;\r
+ int.TryParse(mainWindow.drop_chapterStart.Text, out start);\r
+ int.TryParse(mainWindow.drop_chapterFinish.Text, out end);\r
+ int calculatedDuration = end - start;\r
\r
- if (mainWindow.text_destination.Text != "")\r
- query += " -o " + '"' + mainWindow.text_destination.Text.Replace(".m", "_sample.m") + '"';\r
- }\r
- else // Non Preview Query\r
- {\r
- if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text && mainWindow.drop_chapterStart.Text != "")\r
- query += " -c " + mainWindow.drop_chapterStart.Text;\r
- else if (mainWindow.drop_chapterStart.Text == "Auto" && mainWindow.drop_chapterFinish.Text != "Auto")\r
- query += " -c " + "0-" + mainWindow.drop_chapterFinish.Text;\r
- else if (mainWindow.drop_chapterStart.Text != "Auto" && mainWindow.drop_chapterFinish.Text != "Auto" && mainWindow.drop_chapterStart.Text != "")\r
- query += " -c " + mainWindow.drop_chapterStart.Text + "-" + mainWindow.drop_chapterFinish.Text;\r
-\r
- if (mainWindow.text_destination.Text != "")\r
- query += " -o " + '"' + mainWindow.text_destination.Text + '"';\r
+ query += string.Format(" --start-at duration:{0} --stop-at duration:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);\r
+ break;\r
+ case 2: // Frames\r
+ int.TryParse(mainWindow.drop_chapterStart.Text, out start);\r
+ int.TryParse(mainWindow.drop_chapterFinish.Text, out end);\r
+ calculatedDuration = end - start;\r
+\r
+ query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);\r
+ break;\r
+ case 3: // Preview\r
+ query += " --previews " + Properties.Settings.Default.previewScanCount + " ";\r
+ query += " --start-at-preview " + preview;\r
+ query += " --stop-at duration:" + duration + " ";\r
+\r
+ if (mainWindow.text_destination.Text != "")\r
+ query += string.Format(" -o \"{0}\" ", mainWindow.text_destination.Text.Replace(".m", "_sample.m"));\r
+ break;\r
+ default:\r
+ break;\r
}\r
+ if (mode != 3)\r
+ query += string.Format(" -o \"{0}\" ", mainWindow.text_destination.Text);\r
\r
query += GenerateTabbedComponentsQuery(mainWindow);\r
\r
\r
// Audio Codec (-E)\r
if (row.SubItems[2].Text != String.Empty)\r
- codecs.Add(getAudioEncoder(row.SubItems[2].Text));\r
+ codecs.Add(GetAudioEncoder(row.SubItems[2].Text));\r
\r
// Audio Mixdown (-6)\r
if (row.SubItems[3].Text != String.Empty)\r
- mixdowns.Add(getMixDown(row.SubItems[3].Text));\r
+ mixdowns.Add(GetMixDown(row.SubItems[3].Text));\r
\r
// Sample Rate (-R)\r
if (row.SubItems[4].Text != String.Empty)\r
string subtitleForced = String.Empty;\r
string subtitleBurn = String.Empty;\r
string subtitleDefault = String.Empty;\r
- \r
+\r
// SRT\r
string srtFile = String.Empty;\r
string srtCodeset = String.Empty;\r
? Path.Combine(Path.GetTempPath(), dest_name + "-" + source_title + "-chapters.csv")\r
: Path.Combine(Path.GetTempPath(), dest_name + "-chapters.csv");\r
\r
- if (chapterCSVSave(mainWindow, path) == false)\r
+ if (ChapterCSVSave(mainWindow, path) == false)\r
query += " -m ";\r
else\r
query += " --markers=" + "\"" + path + "\"";\r
return query;\r
}\r
\r
- private static string getMixDown(string selectedAudio)\r
+ private static string GetMixDown(string selectedAudio)\r
{\r
switch (selectedAudio)\r
{\r
return "auto";\r
}\r
}\r
- private static string getAudioEncoder(string selectedEncoder)\r
+ private static string GetAudioEncoder(string selectedEncoder)\r
{\r
switch (selectedEncoder)\r
{\r
return "";\r
}\r
}\r
- private static Boolean chapterCSVSave(frmMain mainWindow, string filePathName)\r
+ private static Boolean ChapterCSVSave(frmMain mainWindow, string filePathName)\r
{\r
try\r
{\r
public event EventHandler ScanCompleted;\r
public event EventHandler ScanStatusChanged;\r
\r
- public void ScanSource(string sourcePath)\r
+ public void ScanSource(string sourcePath, int title)\r
{\r
- Thread t = new Thread(new ParameterizedThreadStart(RunScan));\r
- t.Start(sourcePath);\r
+ Thread t = new Thread(unused => RunScan(sourcePath, title));\r
+ t.Start();\r
}\r
\r
public DVD SouceData()\r
return _hbProc;\r
}\r
\r
- private void RunScan(object sourcePath)\r
+ private void RunScan(object sourcePath, int title)\r
{\r
try\r
{\r
StartInfo =\r
{\r
FileName = handbrakeCLIPath,\r
- Arguments = String.Format(@" -i ""{0}"" -t0 {1} -v ", sourcePath, dvdnav),\r
+ Arguments = String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, dvdnav),\r
RedirectStandardOutput = true,\r
RedirectStandardError = true,\r
UseShellExecute = false,\r
this.drop_angle = new System.Windows.Forms.ComboBox();\r
this.drp_dvdtitle = new System.Windows.Forms.ComboBox();\r
this.btn_importChapters = new System.Windows.Forms.Button();\r
+ this.drop_mode = new System.Windows.Forms.ComboBox();\r
this.DVD_Open = new System.Windows.Forms.FolderBrowserDialog();\r
this.File_Open = new System.Windows.Forms.OpenFileDialog();\r
this.ISO_Open = new System.Windows.Forms.OpenFileDialog();\r
this.Label47 = new System.Windows.Forms.Label();\r
this.Label3 = new System.Windows.Forms.Label();\r
this.tab_audio = new System.Windows.Forms.TabPage();\r
- this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);\r
this.tab_video = new System.Windows.Forms.TabPage();\r
this.lbl_qualityValue = new System.Windows.Forms.Label();\r
this.lbl_SliderValue = new System.Windows.Forms.Label();\r
this.Label46 = new System.Windows.Forms.Label();\r
this.tab_picture = new System.Windows.Forms.TabPage();\r
- this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox();\r
this.tabs_panel = new System.Windows.Forms.TabControl();\r
this.tab_filters = new System.Windows.Forms.TabPage();\r
- this.Filters = new Handbrake.Controls.Filters();\r
this.tab_subtitles = new System.Windows.Forms.TabPage();\r
- this.Subtitles = new Handbrake.Controls.Subtitles();\r
this.tab_chapters = new System.Windows.Forms.TabPage();\r
this.label31 = new System.Windows.Forms.Label();\r
this.tab_advanced = new System.Windows.Forms.TabPage();\r
- this.x264Panel = new Handbrake.Controls.x264Panel();\r
this.tab_query = new System.Windows.Forms.TabPage();\r
this.btn_clear = new System.Windows.Forms.Button();\r
this.label34 = new System.Windows.Forms.Label();\r
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();\r
this.Label10 = new System.Windows.Forms.Label();\r
this.lbl_angle = new System.Windows.Forms.Label();\r
- this.Label9 = new System.Windows.Forms.Label();\r
this.Label13 = new System.Windows.Forms.Label();\r
this.label_duration = new System.Windows.Forms.Label();\r
this.lbl_duration = new System.Windows.Forms.Label();\r
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();\r
this.openPreset = new System.Windows.Forms.OpenFileDialog();\r
this.File_ChapterImport = new System.Windows.Forms.OpenFileDialog();\r
+ this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
+ this.Filters = new Handbrake.Controls.Filters();\r
+ this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
+ this.Subtitles = new Handbrake.Controls.Subtitles();\r
+ this.x264Panel = new Handbrake.Controls.x264Panel();\r
notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
notifyIconMenu.SuspendLayout();\r
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();\r
// \r
this.drop_chapterFinish.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
this.drop_chapterFinish.FormattingEnabled = true;\r
- this.drop_chapterFinish.Location = new System.Drawing.Point(447, 3);\r
+ this.drop_chapterFinish.Location = new System.Drawing.Point(509, 3);\r
this.drop_chapterFinish.Name = "drop_chapterFinish";\r
this.drop_chapterFinish.Size = new System.Drawing.Size(69, 21);\r
this.drop_chapterFinish.TabIndex = 10;\r
// \r
this.drop_chapterStart.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
this.drop_chapterStart.FormattingEnabled = true;\r
- this.drop_chapterStart.Location = new System.Drawing.Point(321, 3);\r
+ this.drop_chapterStart.Location = new System.Drawing.Point(383, 3);\r
this.drop_chapterStart.Name = "drop_chapterStart";\r
this.drop_chapterStart.Size = new System.Drawing.Size(69, 21);\r
this.drop_chapterStart.TabIndex = 9;\r
this.btn_importChapters.UseVisualStyleBackColor = true;\r
this.btn_importChapters.Click += new System.EventHandler(this.btn_importChapters_Click);\r
// \r
+ // drop_mode\r
+ // \r
+ this.drop_mode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+ this.drop_mode.FormattingEnabled = true;\r
+ this.drop_mode.Items.AddRange(new object[] {\r
+ "Chapters",\r
+ "Seconds",\r
+ "Frames"});\r
+ this.drop_mode.Location = new System.Drawing.Point(295, 3);\r
+ this.drop_mode.Name = "drop_mode";\r
+ this.drop_mode.Size = new System.Drawing.Size(77, 21);\r
+ this.drop_mode.TabIndex = 46;\r
+ this.drop_mode.SelectedIndexChanged += new System.EventHandler(this.drop_mode_SelectedIndexChanged);\r
+ // \r
// DVD_Open\r
// \r
this.DVD_Open.Description = "Select the \"VIDEO_TS\" folder from your DVD Drive.";\r
this.tab_audio.Text = "Audio";\r
this.tab_audio.UseVisualStyleBackColor = true;\r
// \r
- // AudioSettings\r
- // \r
- this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
- this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
- this.AudioSettings.Name = "AudioSettings";\r
- this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
- this.AudioSettings.TabIndex = 0;\r
- // \r
// AudioMenuRowHeightHack\r
// \r
this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;\r
this.tab_picture.Text = "Picture";\r
this.tab_picture.UseVisualStyleBackColor = true;\r
// \r
- // PictureSettings\r
- // \r
- this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
- this.PictureSettings.Enabled = false;\r
- this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
- this.PictureSettings.Name = "PictureSettings";\r
- this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
- this.PictureSettings.TabIndex = 0;\r
- // \r
// Check_ChapterMarkers\r
// \r
this.Check_ChapterMarkers.AutoSize = true;\r
this.tab_filters.Text = "Video Filters";\r
this.tab_filters.UseVisualStyleBackColor = true;\r
// \r
- // Filters\r
- // \r
- this.Filters.BackColor = System.Drawing.Color.Transparent;\r
- this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.Filters.Location = new System.Drawing.Point(0, 0);\r
- this.Filters.Name = "Filters";\r
- this.Filters.Size = new System.Drawing.Size(713, 310);\r
- this.Filters.TabIndex = 0;\r
- // \r
// tab_subtitles\r
// \r
this.tab_subtitles.Controls.Add(this.Subtitles);\r
this.tab_subtitles.Text = "Subtitles";\r
this.tab_subtitles.UseVisualStyleBackColor = true;\r
// \r
- // Subtitles\r
- // \r
- this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
- this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
- this.Subtitles.Name = "Subtitles";\r
- this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
- this.Subtitles.TabIndex = 0;\r
- // \r
// tab_chapters\r
// \r
this.tab_chapters.BackColor = System.Drawing.Color.Transparent;\r
this.tab_advanced.Text = "Advanced";\r
this.tab_advanced.UseVisualStyleBackColor = true;\r
// \r
- // x264Panel\r
- // \r
- this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
- this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
- this.x264Panel.Name = "x264Panel";\r
- this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
- this.x264Panel.TabIndex = 0;\r
- this.x264Panel.x264Query = "";\r
- // \r
// tab_query\r
// \r
this.tab_query.Controls.Add(this.btn_clear);\r
// tableLayoutPanel1\r
// \r
this.tableLayoutPanel1.AutoSize = true;\r
- this.tableLayoutPanel1.ColumnCount = 10;\r
+ this.tableLayoutPanel1.ColumnCount = 12;\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F));\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5F));\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
this.tableLayoutPanel1.Controls.Add(this.drp_dvdtitle, 1, 0);\r
this.tableLayoutPanel1.Controls.Add(this.lbl_angle, 2, 0);\r
this.tableLayoutPanel1.Controls.Add(this.drop_angle, 3, 0);\r
- this.tableLayoutPanel1.Controls.Add(this.Label9, 4, 0);\r
- this.tableLayoutPanel1.Controls.Add(this.drop_chapterStart, 5, 0);\r
- this.tableLayoutPanel1.Controls.Add(this.Label13, 6, 0);\r
- this.tableLayoutPanel1.Controls.Add(this.drop_chapterFinish, 7, 0);\r
- this.tableLayoutPanel1.Controls.Add(this.label_duration, 8, 0);\r
- this.tableLayoutPanel1.Controls.Add(this.lbl_duration, 9, 0);\r
+ this.tableLayoutPanel1.Controls.Add(this.drop_chapterStart, 7, 0);\r
+ this.tableLayoutPanel1.Controls.Add(this.Label13, 8, 0);\r
+ this.tableLayoutPanel1.Controls.Add(this.drop_chapterFinish, 9, 0);\r
+ this.tableLayoutPanel1.Controls.Add(this.label_duration, 10, 0);\r
+ this.tableLayoutPanel1.Controls.Add(this.lbl_duration, 11, 0);\r
+ this.tableLayoutPanel1.Controls.Add(this.drop_mode, 5, 0);\r
this.tableLayoutPanel1.Location = new System.Drawing.Point(21, 86);\r
this.tableLayoutPanel1.Name = "tableLayoutPanel1";\r
this.tableLayoutPanel1.RowCount = 1;\r
this.lbl_angle.TabIndex = 44;\r
this.lbl_angle.Text = "Angle:";\r
// \r
- // Label9\r
- // \r
- this.Label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));\r
- this.Label9.AutoSize = true;\r
- this.Label9.ForeColor = System.Drawing.Color.Black;\r
- this.Label9.Location = new System.Drawing.Point(260, 7);\r
- this.Label9.Name = "Label9";\r
- this.Label9.Size = new System.Drawing.Size(55, 13);\r
- this.Label9.TabIndex = 8;\r
- this.Label9.Text = "Chapters:";\r
- // \r
// Label13\r
// \r
this.Label13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));\r
this.Label13.AutoSize = true;\r
- this.Label13.Location = new System.Drawing.Point(396, 7);\r
+ this.Label13.Location = new System.Drawing.Point(458, 7);\r
this.Label13.Name = "Label13";\r
this.Label13.Size = new System.Drawing.Size(45, 13);\r
this.Label13.TabIndex = 10;\r
this.label_duration.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));\r
this.label_duration.AutoSize = true;\r
this.label_duration.BackColor = System.Drawing.Color.Transparent;\r
- this.label_duration.Location = new System.Drawing.Point(522, 7);\r
+ this.label_duration.Location = new System.Drawing.Point(584, 7);\r
this.label_duration.Name = "label_duration";\r
this.label_duration.Size = new System.Drawing.Size(52, 13);\r
this.label_duration.TabIndex = 42;\r
this.lbl_duration.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
this.lbl_duration.AutoSize = true;\r
this.lbl_duration.BackColor = System.Drawing.Color.Transparent;\r
- this.lbl_duration.Location = new System.Drawing.Point(580, 7);\r
+ this.lbl_duration.Location = new System.Drawing.Point(642, 7);\r
this.lbl_duration.Name = "lbl_duration";\r
this.lbl_duration.Size = new System.Drawing.Size(39, 13);\r
this.lbl_duration.TabIndex = 43;\r
// \r
this.File_ChapterImport.Filter = "CSV Files|*.csv";\r
// \r
+ // PictureSettings\r
+ // \r
+ this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
+ this.PictureSettings.Enabled = false;\r
+ this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
+ this.PictureSettings.Name = "PictureSettings";\r
+ this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
+ this.PictureSettings.TabIndex = 0;\r
+ // \r
+ // Filters\r
+ // \r
+ this.Filters.BackColor = System.Drawing.Color.Transparent;\r
+ this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.Filters.Location = new System.Drawing.Point(0, 0);\r
+ this.Filters.Name = "Filters";\r
+ this.Filters.Size = new System.Drawing.Size(713, 310);\r
+ this.Filters.TabIndex = 0;\r
+ // \r
+ // AudioSettings\r
+ // \r
+ this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
+ this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
+ this.AudioSettings.Name = "AudioSettings";\r
+ this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
+ this.AudioSettings.TabIndex = 0;\r
+ // \r
+ // Subtitles\r
+ // \r
+ this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
+ this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
+ this.Subtitles.Name = "Subtitles";\r
+ this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
+ this.Subtitles.TabIndex = 0;\r
+ // \r
+ // x264Panel\r
+ // \r
+ this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
+ this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
+ this.x264Panel.Name = "x264Panel";\r
+ this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
+ this.x264Panel.TabIndex = 0;\r
+ this.x264Panel.x264Query = "";\r
+ // \r
// frmMain\r
// \r
this.AllowDrop = true;\r
this.Controls.Add(this.labelPreset);\r
this.Controls.Add(this.groupBox2);\r
this.Controls.Add(this.StatusStrip);\r
- this.Controls.Add(this.labelStaticDestination);\r
this.Controls.Add(this.tableLayoutPanel1);\r
this.Controls.Add(this.tabs_panel);\r
+ this.Controls.Add(this.labelStaticDestination);\r
this.DoubleBuffered = true;\r
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));\r
private TableLayoutPanel tableLayoutPanel1;\r
internal Label lbl_angle;\r
internal ComboBox drop_angle;\r
- internal Label Label9;\r
internal ComboBox drop_chapterStart;\r
internal Label Label13;\r
internal ComboBox drop_chapterFinish;\r
private ToolStripMenuItem pmnu_import;\r
private ToolStripSeparator toolStripSeparator2;\r
internal Label lbl_qualityValue;\r
+ internal ComboBox drop_mode;\r
}\r
}
\ No newline at end of file
loadPresetPanel(); // Load the Preset Panel\r
treeView_presets.ExpandAll();\r
lbl_encode.Text = "";\r
+ drop_mode.SelectedIndex = 0;\r
queueWindow = new frmQueue(encodeQueue); // Prepare the Queue\r
if (!Properties.Settings.Default.QueryEditorTab)\r
tabs_panel.TabPages.RemoveAt(7); // Remove the query editor tab if the user does not want it enabled.\r
if (fileList != null)\r
{\r
if (fileList[0] != "")\r
- StartScan(fileList[0]);\r
+ {\r
+ this.selectedSourceType = SourceType.VideoFile;\r
+ StartScan(fileList[0], 0);\r
+ }\r
else\r
UpdateSourceLabel();\r
}\r
}\r
private void btn_new_preset_Click(object sender, EventArgs e)\r
{\r
- Form preset = new frmAddPreset(this, queryGen.GenerateCLIQuery(this, 0, null), presetHandler);\r
+ Form preset = new frmAddPreset(this, queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null), presetHandler);\r
preset.ShowDialog();\r
}\r
#endregion\r
if (result == DialogResult.Yes)\r
{\r
PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);\r
- presetHandler.Update(parsed.PresetName + " (Imported)", queryGen.GenerateCLIQuery(this, 0, null),\r
+ presetHandler.Update(parsed.PresetName + " (Imported)", queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null),\r
parsed.UsesPictureSettings);\r
}\r
}\r
else\r
{\r
PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);\r
- presetHandler.Add(parsed.PresetName, queryGen.GenerateCLIQuery(this, 0, null), parsed.UsesPictureSettings);\r
+ presetHandler.Add(parsed.PresetName, queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null), parsed.UsesPictureSettings);\r
\r
- if (presetHandler.Add(parsed.PresetName + " (Imported)", queryGen.GenerateCLIQuery(this, 0, null), parsed.UsesPictureSettings))\r
+ if (presetHandler.Add(parsed.PresetName + " (Imported)", queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null), parsed.UsesPictureSettings))\r
{\r
TreeNode preset_treeview = new TreeNode(parsed.PresetName + " (Imported)") { ForeColor = Color.Black };\r
treeView_presets.Nodes.Add(preset_treeview);\r
{\r
if (encodeQueue.Count != 0 || (!string.IsNullOrEmpty(sourcePath) && !string.IsNullOrEmpty(text_destination.Text)))\r
{\r
- string generatedQuery = queryGen.GenerateCLIQuery(this, 0, null);\r
- string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : queryGen.GenerateCLIQuery(this, 0, null);\r
+ string generatedQuery = queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null);\r
+ string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null);\r
string query = string.Empty;\r
\r
// Check to make sure the generated query matches the GUI settings\r
MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
{\r
- String query = queryGen.GenerateCLIQuery(this, 0, null);\r
+ String query = queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null);\r
if (rtf_query.Text != "")\r
query = rtf_query.Text;\r
\r
if (DVD_Open.ShowDialog() == DialogResult.OK)\r
{\r
this.selectedSourceType = SourceType.Folder;\r
- selectSource(DVD_Open.SelectedPath);\r
+ SelectSource(DVD_Open.SelectedPath);\r
}\r
else\r
UpdateSourceLabel();\r
if (ISO_Open.ShowDialog() == DialogResult.OK)\r
{\r
this.selectedSourceType = SourceType.VideoFile;\r
- selectSource(ISO_Open.FileName);\r
+ SelectSource(ISO_Open.FileName);\r
}\r
else\r
UpdateSourceLabel();\r
{\r
if (this.dvdDrivePath == null) return;\r
this.selectedSourceType = SourceType.DvdDrive;\r
- selectSource(this.dvdDrivePath);\r
+ SelectSource(this.dvdDrivePath);\r
}\r
- private void selectSource(string file)\r
+ private void SelectSource(string file)\r
{\r
Check_ChapterMarkers.Enabled = true;\r
lastAction = "scan";\r
}\r
\r
sourcePath = Path.GetFileName(file);\r
- StartScan(file);\r
+ StartScan(file,0);\r
}\r
private void drp_dvdtitle_Click(object sender, EventArgs e)\r
{\r
}\r
private void chapersChanged(object sender, EventArgs e)\r
{\r
+ if (drop_mode.SelectedIndex != 0) // Function is not used if we are not in chapters mode.\r
+ return;\r
+\r
Control ctl = (Control)sender;\r
int chapterStart, chapterEnd;\r
int.TryParse(drop_chapterStart.Text, out chapterStart);\r
}\r
}\r
}\r
+ private void drop_mode_SelectedIndexChanged(object sender, EventArgs e)\r
+ {\r
+ if (drop_mode.SelectedIndex == 0) return;\r
+\r
+ if (drop_mode.SelectedIndex != 0)\r
+ drop_mode.SelectedIndex = 0;\r
+\r
+ MessageBox.Show("This feature is not implemented yet! Switching Back to Chapters Mode.", "",\r
+ MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ }\r
\r
//Destination\r
private void btn_destBrowse_Click(object sender, EventArgs e)\r
// Query Editor Tab\r
private void btn_generate_Query_Click(object sender, EventArgs e)\r
{\r
- rtf_query.Text = queryGen.GenerateCLIQuery(this, 0, null);\r
+ rtf_query.Text = queryGen.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null);\r
}\r
private void btn_clear_Click(object sender, EventArgs e)\r
{\r
public Boolean isScanning { get; set; }\r
private Scan SourceScan;\r
\r
- private void StartScan(String filename)\r
+ private void StartScan(String filename, int title)\r
{\r
// Setup the GUI components for the scan.\r
sourcePath = filename;\r
// Start the Scan\r
try\r
{\r
- // if (ActivityWindow != null)\r
- // ActivityWindow.SetupLogViewer(true);\r
isScanning = true;\r
SourceScan = new Scan();\r
- SourceScan.ScanSource(sourcePath);\r
+ SourceScan.ScanSource(sourcePath, title);\r
SourceScan.ScanStatusChanged += new EventHandler(SourceScan_ScanStatusChanged);\r
SourceScan.ScanCompleted += new EventHandler(SourceScan_ScanCompleted);\r
}\r
{\r
public partial class frmPreview : Form\r
{\r
-\r
- QueryGenerator hb_common_func = new QueryGenerator();\r
- EncodeAndQueueHandler process = new EncodeAndQueueHandler();\r
+ readonly QueryGenerator HbCommonFunc = new QueryGenerator();\r
+ readonly EncodeAndQueueHandler Process = new EncodeAndQueueHandler();\r
private delegate void UpdateUIHandler();\r
- String currently_playing = "";\r
- readonly frmMain mainWindow;\r
- private Thread player;\r
- private Boolean noQT;\r
+ String CurrentlyPlaying = "";\r
+ readonly frmMain MainWindow;\r
+ private Thread Player;\r
+ private readonly Boolean NoQT;\r
\r
public frmPreview(frmMain mw)\r
{\r
}\r
catch (Exception)\r
{\r
- noQT = true;\r
+ NoQT = true;\r
}\r
- this.mainWindow = mw;\r
+ this.MainWindow = mw;\r
cb_preview.SelectedIndex = 0;\r
cb_duration.SelectedIndex = 1;\r
\r
lbl_status.Visible = true;\r
try\r
{\r
- if (!noQT)\r
+ if (!NoQT)\r
QTControl.URL = "";\r
\r
- if (File.Exists(currently_playing))\r
- File.Delete(currently_playing);\r
+ if (File.Exists(CurrentlyPlaying))\r
+ File.Delete(CurrentlyPlaying);\r
}\r
catch (Exception)\r
{\r
lbl_status.Text = "Encoding Sample for (VLC) ...";\r
int duration;\r
int.TryParse(cb_duration.Text, out duration);\r
- String query = hb_common_func.GenerateCLIQuery(mainWindow, duration, cb_preview.Text);\r
- ThreadPool.QueueUserWorkItem(procMonitor, query);\r
+ String query = HbCommonFunc.GenerateCLIQuery(MainWindow, 3, duration, cb_preview.Text);\r
+ ThreadPool.QueueUserWorkItem(ProcMonitor, query);\r
}\r
private void btn_playQT_Click(object sender, EventArgs e)\r
{\r
- if (noQT)\r
+ if (NoQT)\r
{\r
MessageBox.Show(this, "It would appear QuickTime 7 is not installed or not accessible. Please (re)install QuickTime.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
return;\r
}\r
- if (mainWindow.text_destination.Text.Contains(".mkv"))\r
+ if (MainWindow.text_destination.Text.Contains(".mkv"))\r
{\r
MessageBox.Show(this,\r
"The QuickTime Control does not support MKV files, It is recommended you use VLC option instead.",\r
try\r
{\r
QTControl.URL = "";\r
- if (File.Exists(currently_playing))\r
- File.Delete(currently_playing);\r
+ if (File.Exists(CurrentlyPlaying))\r
+ File.Delete(CurrentlyPlaying);\r
}\r
catch (Exception)\r
{\r
lbl_status.Text = "Encoding Sample for (QT) ...";\r
int duration;\r
int.TryParse(cb_duration.Text, out duration);\r
- String query = hb_common_func.GenerateCLIQuery(mainWindow, duration, cb_preview.Text);\r
+ String query = HbCommonFunc.GenerateCLIQuery(MainWindow, 3, duration, cb_preview.Text);\r
\r
- ThreadPool.QueueUserWorkItem(procMonitor, query);\r
+ ThreadPool.QueueUserWorkItem(ProcMonitor, query);\r
}\r
}\r
- private void procMonitor(object state)\r
+ private void ProcMonitor(object state)\r
{\r
// Make sure we are not already encoding and if we are then display an error.\r
- if (process.hbProcess != null)\r
+ if (Process.hbProcess != null)\r
MessageBox.Show(this, "Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
{\r
- process.RunCli((string)state);\r
- if (process.hbProcess != null)\r
+ Process.RunCli((string)state);\r
+ if (Process.hbProcess != null)\r
{\r
- process.hbProcess.WaitForExit();\r
- process.hbProcess = null;\r
+ Process.hbProcess.WaitForExit();\r
+ Process.hbProcess = null;\r
}\r
- encodeCompleted();\r
+ EncodeCompleted();\r
}\r
}\r
- private void encodeCompleted()\r
+ private void EncodeCompleted()\r
{\r
try\r
{\r
if (InvokeRequired)\r
{\r
- BeginInvoke(new UpdateUIHandler(encodeCompleted));\r
+ BeginInvoke(new UpdateUIHandler(EncodeCompleted));\r
return;\r
}\r
- if (!noQT)\r
+ if (!NoQT)\r
btn_playQT.Enabled = true;\r
btn_playVLC.Enabled = true;\r
\r
- // Decide which player to use.\r
+ // Decide which Player to use.\r
String playerSelection = lbl_status.Text.Contains("QT") ? "QT" : "VLC";\r
\r
lbl_status.Text = "Loading Clip ...";\r
\r
// Get the sample filename\r
- if (mainWindow.text_destination.Text != "")\r
- currently_playing = mainWindow.text_destination.Text.Replace(".mp4", "_sample.mp4").Replace(".m4v", "_sample.m4v").Replace(".mkv", "_sample.mkv"); ;\r
+ if (MainWindow.text_destination.Text != "")\r
+ CurrentlyPlaying = MainWindow.text_destination.Text.Replace(".mp4", "_sample.mp4").Replace(".m4v", "_sample.m4v").Replace(".mkv", "_sample.mkv"); ;\r
\r
// Play back in QT or VLC\r
if (playerSelection == "QT")\r
- play();\r
+ Play();\r
else\r
- playVLC();\r
+ PlayVLC();\r
\r
lbl_status.Text = "";\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show(this, "frmPreview.cs encodeCompleted " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show(this, "frmPreview.cs EncodeCompleted " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
#endregion\r
/// <summary>\r
/// Play the video back in the QuickTime control\r
/// </summary>\r
- private void play()\r
+ private void Play()\r
{\r
- player = new Thread(OpenMovie) { IsBackground = true };\r
- player.Start();\r
+ Player = new Thread(OpenMovie) { IsBackground = true };\r
+ Player.Start();\r
lbl_status.Visible = false;\r
}\r
\r
/// <summary>\r
- /// Play the video back in an external VLC player\r
+ /// Play the video back in an external VLC Player\r
/// </summary>\r
- private void playVLC()\r
+ private void PlayVLC()\r
{\r
- // Launch VLC and play video.\r
- if (currently_playing != "")\r
+ // Launch VLC and Play video.\r
+ if (CurrentlyPlaying != "")\r
{\r
- if (File.Exists(currently_playing))\r
+ if (File.Exists(CurrentlyPlaying))\r
{\r
// Attempt to find VLC if it doesn't exist in the default set location.\r
+ string vlcPath;\r
+ \r
+ if (8 == IntPtr.Size || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))\r
+ vlcPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");\r
+ else\r
+ vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");\r
+ \r
+ vlcPath = vlcPath != null ? vlcPath + @"\VideoLAN\VLC\vlc.exe" : @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";\r
+ \r
if (!File.Exists(Properties.Settings.Default.VLC_Path))\r
{\r
- if (File.Exists("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe"))\r
+ if (File.Exists(vlcPath))\r
{\r
Properties.Settings.Default.VLC_Path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";\r
Properties.Settings.Default.Save(); // Save this new path if it does\r
\r
if (File.Exists(Properties.Settings.Default.VLC_Path))\r
{\r
- String args = "\"" + currently_playing + "\"";\r
+ String args = "\"" + CurrentlyPlaying + "\"";\r
ProcessStartInfo vlc = new ProcessStartInfo(Properties.Settings.Default.VLC_Path, args);\r
- Process.Start(vlc);\r
+ System.Diagnostics.Process.Start(vlc);\r
lbl_status.Text = "VLC will now launch.";\r
}\r
- \r
+\r
}\r
else\r
MessageBox.Show(this, "Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.", "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
BeginInvoke(new UpdateUIHandler(OpenMovie));\r
return;\r
}\r
- QTControl.URL = currently_playing;\r
+ QTControl.URL = CurrentlyPlaying;\r
QTControl.SetSizing(QTSizingModeEnum.qtControlFitsMovie, true);\r
- QTControl.URL = currently_playing;\r
+ QTControl.URL = CurrentlyPlaying;\r
QTControl.Show();\r
\r
this.ClientSize = QTControl.Size;\r