2 using System.Collections.Generic;
\r
3 using System.Collections.Specialized;
\r
4 using System.ComponentModel;
\r
6 using System.Drawing;
\r
8 using System.Windows.Forms;
\r
11 using System.Diagnostics;
\r
12 using System.Threading;
\r
13 using System.Runtime.InteropServices;
\r
14 using System.Globalization;
\r
15 using System.Text.RegularExpressions;
\r
20 public partial class frmMain : Form
\r
22 // --------------------------------------------------------------
\r
23 // Applicaiton Startup Stuff
\r
24 // --------------------------------------------------------------
\r
26 #region Application Startup
\r
28 // Some stuff that needs to be Initialized.
\r
29 private Process hbProc;
\r
30 private Parsing.DVD thisDVD;
\r
31 private frmQueue queueWindow = new frmQueue();
\r
33 // The main window beings here...
\r
36 // Load the splash screen in this thread
\r
37 Form splash = new frmSplashScreen();
\r
40 //Create a label that can be updated from the parent thread.
\r
41 Label lblStatus = new Label();
\r
44 lblStatus.Size = new Size(250, 20);
\r
46 //Position the label
\r
47 lblStatus.Location = new Point(10, 280);
\r
49 //Put the label on the splash form
\r
50 splash.Controls.Add(lblStatus);
\r
52 //Fire a thread to wait for 2 seconds. The splash screen will exit when the time expires
\r
53 Thread timer = new Thread(splashTimer);
\r
56 InitializeComponent();
\r
58 // show the form, but leave disabled until preloading is complete
\r
59 this.Enabled = false;
\r
61 // Show the main form
\r
64 // Forces frmMain to draw
\r
65 Application.DoEvents();
\r
67 // Set the Version number lable to the corect version.
\r
68 Version.Text = "Version " + Properties.Settings.Default.CliVersion;
\r
70 // update the status
\r
71 lblStatus.Text = "Checking for updates ...";
\r
72 // redraw the splash screen
\r
73 Application.DoEvents();
\r
74 // Run the update checker.
\r
78 // Update the presets
\r
79 lblStatus.Text = "Updaing Presets ...";
\r
80 Application.DoEvents();
\r
84 // Now load the users default if required. (Will overide the above setting)
\r
85 lblStatus.Text = "Loading User Default Settings...";
\r
86 Application.DoEvents();
\r
91 // Enable or disable tooltips
\r
92 lblStatus.Text = "Loading Tooltips ...";
\r
93 Application.DoEvents();
\r
97 // Hide the preset bar if required.
\r
101 lblStatus.Text = "Loading Complete!";
\r
102 Application.DoEvents();
\r
105 // Wait until splash screen is done
\r
106 while (timer.IsAlive)
\r
107 { Thread.Sleep(100); }
\r
109 //Close the splash screen
\r
113 // Turn the interface back to the user
\r
114 this.Enabled = true;
\r
117 private void splashTimer(object sender)
\r
119 Thread.Sleep(2000); //sit for 2 seconds then exit
\r
122 private void showSplash(object sender)
\r
124 // Display splash screen for 1.5 Seconds
\r
125 Form splash = new frmSplashScreen();
\r
127 Thread.Sleep(1500);
\r
128 splash.Close(); // Then close.
\r
131 private void loadNormalPreset()
\r
133 ListViewItem item = listview_presets.FindItemWithText("Normal");
\r
137 listview_presets.SelectedItems.Clear();
\r
138 item.Selected = true;
\r
142 private void loadUserDefaults()
\r
144 string userDefaults = Properties.Settings.Default.defaultUserSettings;
\r
147 // Some things that need to be done to reset some gui components:
\r
148 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
150 // Send the query from the file to the Query Parser class
\r
151 Functions.QueryParser presetQuery = Functions.QueryParser.Parse(userDefaults);
\r
153 // Now load the preset
\r
154 presetLoader(presetQuery, "User Defaults ");
\r
156 catch (Exception exc)
\r
158 MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
\r
159 MessageBox.Show(exc.ToString());
\r
163 private Boolean updateCheck()
\r
167 if (Properties.Settings.Default.updateStatus == "Checked")
\r
169 String updateFile = Properties.Settings.Default.updateFile;
\r
170 WebClient client = new WebClient();
\r
171 String data = client.DownloadString(updateFile);
\r
172 String[] versionData = data.Split('\n');
\r
174 int verdata = int.Parse(versionData[0].Replace(".", ""));
\r
175 int vergui = int.Parse(Properties.Settings.Default.GuiVersion.Replace(".", ""));
\r
176 int verd1 = int.Parse(versionData[1].Replace(".", ""));
\r
177 int cliversion = int.Parse(Properties.Settings.Default.CliVersion.Replace(".", ""));
\r
179 Boolean update = ((verdata > vergui) || (verd1 > cliversion));
\r
181 //lbl_update.Visible = update;
\r
192 // Silently ignore the error
\r
197 private void tooltip()
\r
199 if (Properties.Settings.Default.tooltipEnable == "Checked")
\r
201 ToolTip.Active = true;
\r
205 private void hidePresetBar()
\r
207 if (Properties.Settings.Default.hidePresets == "Checked")
\r
209 btn_presets.Visible = true;
\r
217 // --------------------------------------------------------------
\r
218 // The main Menu bar.
\r
219 // --------------------------------------------------------------
\r
222 private void mnu_open_Click(object sender, EventArgs e)
\r
225 File_Open.ShowDialog();
\r
226 filename = File_Open.FileName;
\r
228 if (filename != "")
\r
232 // Some things that need to be done to reset some gui components:
\r
233 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
235 //---------------------------
\r
237 // ---------------------------
\r
239 // Create StreamReader & open file
\r
240 StreamReader line = new StreamReader(filename);
\r
242 // Send the query from the file to the Query Parser class
\r
243 Functions.QueryParser presetQuery = Functions.QueryParser.Parse(line.ReadLine());
\r
245 // Now load the preset
\r
246 presetLoader(presetQuery, filename);
\r
248 // Close the stream
\r
251 catch (Exception exc)
\r
253 MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
\r
254 MessageBox.Show(exc.ToString());
\r
259 private void mnu_save_Click(object sender, EventArgs e)
\r
262 File_Save.ShowDialog();
\r
263 filename = File_Save.FileName;
\r
264 if (filename != "")
\r
268 // Create a StreamWriter and open the file
\r
269 StreamWriter line = new StreamWriter(filename);
\r
271 // Generate and write the query string to the file
\r
272 String query = GenerateTheQuery();
\r
273 line.WriteLine(query);
\r
275 // close the stream
\r
277 MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
281 MessageBox.Show("Unable to write to the file. Please make sure the location has the correct permissions for file writing.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
\r
287 private void mnu_exit_Click(object sender, EventArgs e)
\r
289 Application.Exit();
\r
296 private void mnu_encode_Click(object sender, EventArgs e)
\r
301 private void mnu_viewDVDdata_Click(object sender, EventArgs e)
\r
303 frmDvdInfo dvdInfoWindow = new frmDvdInfo();
\r
304 dvdInfoWindow.Show();
\r
307 private void mnu_options_Click(object sender, EventArgs e)
\r
309 Form Options = new frmOptions();
\r
310 Options.ShowDialog();
\r
315 #region Presets Menu
\r
317 private void mnu_presetReset_Click(object sender, EventArgs e)
\r
319 listview_presets.Items.Clear();
\r
321 MessageBox.Show("Presets have been updated", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
\r
324 private void mnu_SelectDefault_Click(object sender, EventArgs e)
\r
326 ListViewItem item = listview_presets.FindItemWithText("Normal");
\r
330 listview_presets.SelectedItems.Clear();
\r
331 item.Selected = true;
\r
334 if (presetStatus == false)
\r
337 presetStatus = true;
\r
338 btn_presets.Text = "Hide Presets";
\r
347 private void mnu_quickStart_Click(object sender, EventArgs e)
\r
349 Form QuickStart = new frmQuickStart();
\r
350 QuickStart.ShowDialog();
\r
353 private void mnu_wiki_Click(object sender, EventArgs e)
\r
355 Process.Start("http://handbrake.m0k.org/trac");
\r
358 private void mnu_faq_Click(object sender, EventArgs e)
\r
360 Process.Start("http://handbrake.m0k.org/trac/wiki/WindowsGuiFaq");
\r
363 private void mnu_onlineDocs_Click(object sender, EventArgs e)
\r
365 Process.Start("http://handbrake.m0k.org/?page_id=11");
\r
368 private void mnu_homepage_Click(object sender, EventArgs e)
\r
370 Process.Start("http://handbrake.m0k.org");
\r
373 private void mnu_forum_Click(object sender, EventArgs e)
\r
375 Process.Start("http://handbrake.m0k.org/forum");
\r
378 private void mnu_UpdateCheck_Click(object sender, EventArgs e)
\r
380 Boolean update = updateCheck();
\r
381 if (update == true)
\r
383 MessageBox.Show("There is a new update available. Please visit http://handbrake.m0k.org for details!", "Update Check", MessageBoxButtons.OK, MessageBoxIcon.Information);
\r
387 MessageBox.Show("There are no new updates at this time.", "Update Check", MessageBoxButtons.OK, MessageBoxIcon.Information);
\r
391 private void mnu_about_Click(object sender, EventArgs e)
\r
393 Form About = new frmAbout();
\r
394 About.ShowDialog();
\r
399 // --------------------------------------------------------------
\r
400 // Buttons on the main Window
\r
401 // --------------------------------------------------------------
\r
405 private void btn_Browse_Click(object sender, EventArgs e)
\r
407 String filename = "";
\r
408 text_source.Text = "";
\r
409 frmDvdInfo dvdInfoWindow = new frmDvdInfo();
\r
411 if (RadioDVD.Checked)
\r
413 DVD_Open.ShowDialog();
\r
414 filename = DVD_Open.SelectedPath;
\r
415 if (filename != "")
\r
417 Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
\r
418 text_source.Text = filename;
\r
419 frmRD.ShowDialog();
\r
424 ISO_Open.ShowDialog();
\r
425 filename = ISO_Open.FileName;
\r
426 if (filename != "")
\r
428 Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
\r
429 text_source.Text = filename;
\r
430 frmRD.ShowDialog();
\r
434 // Check if there was titles in the dvd title dropdown
\r
435 if (filename == "")
\r
437 text_source.Text = "Click 'Browse' to continue";
\r
440 // If there are no titles in the dropdown menu then the scan has obviously failed. Display an error message explaining to the user.
\r
441 if (drp_dvdtitle.Items.Count == 0)
\r
443 MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source. Please refer to the FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
\r
447 private void btn_destBrowse_Click(object sender, EventArgs e)
\r
449 // This removes the file extension from the filename box on the save file dialog.
\r
450 // It's daft but some users don't realise that typing an extension overrides the dropdown extension selected.
\r
451 // Should be a nicer way to do this.
\r
452 DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", "").Replace(".ogm", "").Replace(".avi", "");
\r
454 // Show the dialog and set the main form file path
\r
455 DVD_Save.ShowDialog();
\r
456 text_destination.Text = DVD_Save.FileName;
\r
458 // Quicktime requires .m4v file for chapter markers to work. If checked, change the extension to .m4v (mp4 and m4v are the same thing)
\r
459 if (Check_ChapterMarkers.Checked)
\r
461 string destination = text_destination.Text;
\r
462 destination = destination.Replace(".mp4", ".m4v");
\r
463 text_destination.Text = destination;
\r
467 private void btn_h264Clear_Click(object sender, EventArgs e)
\r
469 rtf_h264advanced.Text = "";
\r
472 private void GenerateQuery_Click(object sender, EventArgs e)
\r
474 String query = GenerateTheQuery();
\r
475 QueryEditorText.Text = query;
\r
478 private void btn_ClearQuery_Click(object sender, EventArgs e)
\r
480 QueryEditorText.Text = "";
\r
483 private void btn_queue_Click(object sender, EventArgs e)
\r
486 if (text_source.Text == "" || text_source.Text == "Click 'Browse' to continue" || text_destination.Text == "")
\r
487 MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
491 if (QueryEditorText.Text == "")
\r
493 query = GenerateTheQuery();
\r
497 query = QueryEditorText.Text;
\r
499 queueWindow.list_queue.Items.Add(query);
\r
500 queueWindow.Show();
\r
504 private void btn_copy_Click(object sender, EventArgs e)
\r
506 if (QueryEditorText.Text != "")
\r
507 Clipboard.SetText(QueryEditorText.Text, TextDataFormat.Text);
\r
510 private void showQueue()
\r
512 queueWindow.Show();
\r
517 // --------------------------------------------------------------
\r
518 // Main Window Preset System
\r
519 // --------------------------------------------------------------
\r
521 #region Preset System
\r
523 // Import Current Presets
\r
524 private void updatePresets()
\r
526 string[] presets = new string[17];
\r
527 presets[0] = "Animation";
\r
528 presets[1] = "AppleTV";
\r
529 presets[2] = "Bedlam";
\r
530 presets[3] = "Blind";
\r
531 presets[4] = "Broke";
\r
532 presets[5] = "Classic";
\r
533 presets[6] = "Constant Quality Rate";
\r
534 presets[7] = "Deux Six Quatre";
\r
535 presets[8] = "Film";
\r
536 presets[9] = "iPhone / iPod Touch";
\r
537 presets[10] = "iPod High-Rez";
\r
538 presets[11] = "iPod Low-Rez";
\r
539 presets[12] = "Normal";
\r
540 presets[13] = "PS3";
\r
541 presets[14] = "PSP";
\r
542 presets[15] = "QuickTime";
\r
543 presets[16] = "Television";
\r
545 ListViewItem preset_listview = new ListViewItem();
\r
546 string[] presetList = new string[1];
\r
548 foreach (string preset in presets)
\r
550 presetList[0] = preset;
\r
551 preset_listview = new ListViewItem(presetList);
\r
553 // Now Fill Out List View with Items
\r
554 listview_presets.Items.Add(preset_listview);
\r
557 string appPath = Application.StartupPath.ToString() + "\\";
\r
558 string strCmdLine = "cmd /c " + '"' + '"' + appPath + "HandBrakeCLI.exe" + '"' + " --preset-list >" + '"' + appPath + "presets.dat" + '"' + " 2>&1" + '"';
\r
559 Process hbproc = Process.Start("CMD.exe", strCmdLine);
\r
560 hbproc.WaitForExit();
\r
567 private Boolean presetStatus = false;
\r
570 private void btn_presets_Click(object sender, EventArgs e)
\r
572 if (presetStatus == false)
\r
575 presetStatus = true;
\r
576 btn_presets.Text = "Hide Presets";
\r
581 presetStatus = false;
\r
582 btn_presets.Text = "Show Presets";
\r
587 private void btn_setDefault_Click(object sender, EventArgs e)
\r
589 String query = GenerateTheQuery();
\r
590 Properties.Settings.Default.defaultUserSettings = query;
\r
591 // Save the new default Settings
\r
592 Properties.Settings.Default.Save();
\r
593 MessageBox.Show("New default settings saved.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
596 // Preset Selection
\r
597 private void listview_presets_SelectedIndexChanged(object sender, EventArgs e)
\r
600 string selectedPreset = null;
\r
601 ListView.SelectedListViewItemCollection name = null;
\r
602 name = listview_presets.SelectedItems;
\r
604 if (listview_presets.SelectedItems.Count != 0)
\r
605 selectedPreset = name[0].SubItems[0].Text;
\r
609 string appPath = Application.StartupPath.ToString() + "\\";
\r
610 StreamReader presetInput = new StreamReader(appPath + "presets.dat");
\r
612 while (!presetInput.EndOfStream)
\r
614 if ((char)presetInput.Peek() == '+')
\r
616 string preset = presetInput.ReadLine().Replace("+ ", "");
\r
617 Regex r = new Regex("(: )"); // Split on hyphens.
\r
618 string[] presetName = r.Split(preset);
\r
620 if (selectedPreset == "iPhone / iPod Touch")
\r
622 selectedPreset = "iPhone";
\r
625 if (selectedPreset == presetName[0])
\r
627 // Need to disable anamorphic now, otherwise it may overide the width / height values later.
\r
628 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
630 // Send the query from the file to the Query Parser class
\r
631 Functions.QueryParser presetQuery = Functions.QueryParser.Parse(preset);
\r
633 // Now load the preset
\r
634 presetLoader(presetQuery, selectedPreset);
\r
640 presetInput.ReadLine();
\r
644 catch (Exception exc)
\r
646 MessageBox.Show(exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
653 //---------------------------------------------------
\r
654 // Encode / Cancel Buttons
\r
655 // Encode Progress Text Handler
\r
656 //---------------------------------------------------
\r
660 Functions.CLI process = new Functions.CLI();
\r
662 private void btn_encode_Click(object sender, EventArgs e)
\r
664 if (text_source.Text == "" || text_source.Text == "Click 'Browse' to continue" || text_destination.Text == "")
\r
665 MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
668 btn_eCancel.Enabled = true;
\r
670 if (QueryEditorText.Text == "")
\r
672 query = GenerateTheQuery();
\r
676 query = QueryEditorText.Text;
\r
679 ThreadPool.QueueUserWorkItem(procMonitor, query);
\r
680 lbl_encode.Visible = true;
\r
681 lbl_encode.Text = "Encoding in Progress";
\r
685 private void btn_eCancel_Click(object sender, EventArgs e)
\r
689 lbl_encode.Text = "Encoding Canceled";
\r
692 [DllImport("user32.dll")]
\r
693 public static extern void LockWorkStation();
\r
694 [DllImport("user32.dll")]
\r
695 public static extern int ExitWindowsEx(int uFlags, int dwReason);
\r
697 private void procMonitor(object state)
\r
699 // Make sure we are not already encoding and if we are then display an error.
\r
700 if (hbProc != null)
\r
702 MessageBox.Show("Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
706 hbProc = process.runCli(this, (string)state, false, false, false, false);
\r
707 hbProc.WaitForExit();
\r
712 //*****************************************************************************************
\r
714 // When the below code is used and standard error is set to true, hbcli is outputing a
\r
715 // video stream which has mild corruption issues every few seconds.
\r
716 // Maybe an issue with the Parser cauing the CLI to hickup/pause?
\r
717 //*****************************************************************************************
\r
720 Parsing.Parser encode = new Parsing.Parser(hbProc.StandardOutput.BaseStream);
\r
721 encode.OnEncodeProgress += encode_OnEncodeProgress;
\r
722 while (!encode.EndOfStream)
\r
727 hbProc.WaitForExit();
\r
728 process.closeCLI();
\r
732 catch (Exception exc)
\r
735 MessageBox.Show(exc.ToString());
\r
742 // Do something whent he encode ends.
\r
743 switch (Properties.Settings.Default.CompletionOption)
\r
746 System.Diagnostics.Process.Start("Shutdown", "-s -t 60");
\r
749 ExitWindowsEx(0, 0);
\r
752 Application.SetSuspendState(PowerState.Suspend, true, true);
\r
755 Application.SetSuspendState(PowerState.Hibernate, true, true);
\r
757 case "Lock System":
\r
760 case "Quit HandBrake":
\r
761 Application.Exit();
\r
769 private delegate void UpdateUIHandler();
\r
771 private void setEncodeLabel()
\r
773 if (this.InvokeRequired)
\r
775 this.BeginInvoke(new UpdateUIHandler(setEncodeLabel));
\r
778 lbl_encode.Text = "Encoding Finished";
\r
781 private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
\r
784 if (this.InvokeRequired)
\r
786 this.BeginInvoke(new Parsing.EncodeProgressEventHandler(encode_OnEncodeProgress),
\r
787 new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });
\r
790 lbl_encode.Text = string.Format("Encode Progress: {0}%, FPS: {1}, Avg FPS: {2}, Time Remaining: {3} ", PercentComplete, CurrentFps, AverageFps, TimeRemaining);
\r
795 //---------------------------------------------------
\r
796 // Items that require actions on frmMain
\r
797 //---------------------------------------------------
\r
799 #region frmMain Actions
\r
801 private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)
\r
803 drop_chapterStart.BackColor = Color.White;
\r
804 QueryEditorText.Text = "";
\r
805 if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
\r
809 int chapterFinish = int.Parse(drop_chapterFinish.Text);
\r
810 int chapterStart = int.Parse(drop_chapterStart.Text);
\r
812 if (chapterFinish < chapterStart)
\r
814 drop_chapterStart.BackColor = Color.LightCoral;
\r
819 drop_chapterStart.BackColor = Color.LightCoral;
\r
826 private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)
\r
828 drop_chapterFinish.BackColor = Color.White;
\r
829 QueryEditorText.Text = "";
\r
830 if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
\r
834 int chapterFinish = int.Parse(drop_chapterFinish.Text);
\r
835 int chapterStart = int.Parse(drop_chapterStart.Text);
\r
837 if (chapterFinish < chapterStart)
\r
839 drop_chapterFinish.BackColor = Color.LightCoral;
\r
844 drop_chapterFinish.BackColor = Color.LightCoral;
\r
849 private void text_bitrate_TextChanged(object sender, EventArgs e)
\r
851 text_filesize.Text = "";
\r
852 slider_videoQuality.Value = 0;
\r
853 SliderValue.Text = "0%";
\r
854 CheckCRF.CheckState = CheckState.Unchecked;
\r
855 CheckCRF.Enabled = false;
\r
858 private void text_filesize_TextChanged(object sender, EventArgs e)
\r
860 text_bitrate.Text = "";
\r
861 slider_videoQuality.Value = 0;
\r
862 SliderValue.Text = "0%";
\r
863 CheckCRF.CheckState = CheckState.Unchecked;
\r
864 CheckCRF.Enabled = false;
\r
867 private void slider_videoQuality_Scroll(object sender, EventArgs e)
\r
869 SliderValue.Text = slider_videoQuality.Value.ToString() + "%";
\r
870 text_bitrate.Text = "";
\r
871 text_filesize.Text = "";
\r
872 CheckCRF.Enabled = true;
\r
875 private void label_h264_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
\r
877 Process.Start("http://handbrake.m0k.org/trac/wiki/x264Options");
\r
880 private void text_width_TextChanged(object sender, EventArgs e)
\r
884 if (CheckPixelRatio.Checked)
\r
886 text_width.Text = "";
\r
887 text_width.BackColor = Color.LightCoral;
\r
888 CheckPixelRatio.BackColor = Color.LightCoral;
\r
892 if ((int.Parse(text_width.Text) % 16) != 0)
\r
894 text_width.BackColor = Color.LightCoral;
\r
898 text_width.BackColor = Color.LightGreen;
\r
902 if (lbl_Aspect.Text != "Select a Title")
\r
904 double height = int.Parse(text_width.Text) / double.Parse(lbl_Aspect.Text);
\r
905 double mod16 = height % 16;
\r
906 height = height - mod16;
\r
908 if (text_width.Text == "")
\r
910 text_height.Text = "";
\r
911 text_width.BackColor = Color.White;
\r
915 text_height.Text = height.ToString();
\r
916 text_width.BackColor = Color.LightGreen;
\r
922 // No need to throw an error here.
\r
923 // Note on non english systems, this will throw an error because of double.Parse(lbl_Aspect.Text); not working.
\r
929 private void text_height_TextChanged(object sender, EventArgs e)
\r
933 if (CheckPixelRatio.Checked)
\r
935 text_height.Text = "";
\r
936 text_height.BackColor = Color.LightCoral;
\r
937 CheckPixelRatio.BackColor = Color.LightCoral;
\r
941 if ((int.Parse(text_height.Text) % 16) != 0)
\r
943 text_height.BackColor = Color.LightCoral;
\r
947 text_height.BackColor = Color.LightGreen;
\r
954 // No need to alert the user.
\r
958 private void drp_crop_SelectedIndexChanged(object sender, EventArgs e)
\r
960 if ((string)drp_crop.SelectedItem == "Manual")
\r
962 text_left.Enabled = true;
\r
963 text_right.Enabled = true;
\r
964 text_top.Enabled = true;
\r
965 text_bottom.Enabled = true;
\r
968 if ((string)drp_crop.SelectedItem == "Auto Crop")
\r
970 text_left.Enabled = false;
\r
971 text_right.Enabled = false;
\r
972 text_top.Enabled = false;
\r
973 text_bottom.Enabled = false;
\r
974 text_left.Text = "";
\r
975 text_right.Text = "";
\r
976 text_top.Text = "";
\r
977 text_bottom.Text = "";
\r
979 if (lbl_RecomendedCrop.Text != "Select a Title")
\r
981 string[] temp = new string[4];
\r
982 temp = lbl_RecomendedCrop.Text.Split('/');
\r
983 text_left.Text = temp[2];
\r
984 text_right.Text = temp[3];
\r
985 text_top.Text = temp[0];
\r
986 text_bottom.Text = temp[1];
\r
990 if ((string)drp_crop.SelectedItem == "No Crop")
\r
992 text_left.Enabled = false;
\r
993 text_right.Enabled = false;
\r
994 text_top.Enabled = false;
\r
995 text_bottom.Enabled = false;
\r
996 text_left.Text = "0";
\r
997 text_right.Text = "0";
\r
998 text_top.Text = "0";
\r
999 text_bottom.Text = "0";
\r
1004 private void CheckPixelRatio_CheckedChanged(object sender, EventArgs e)
\r
1006 text_width.Text = "";
\r
1007 text_height.Text = "";
\r
1008 text_width.BackColor = Color.White;
\r
1009 text_height.BackColor = Color.White;
\r
1010 CheckPixelRatio.BackColor = TabPage1.BackColor;
\r
1013 private void check_2PassEncode_CheckedChanged(object sender, EventArgs e)
\r
1015 if (check_2PassEncode.CheckState.ToString() == "Checked")
\r
1017 if (drp_videoEncoder.Text.Contains("H.264"))
\r
1019 check_turbo.Enabled = true;
\r
1024 check_turbo.Enabled = false;
\r
1025 check_turbo.CheckState = CheckState.Unchecked;
\r
1029 private void check_largeFile_CheckedChanged(object sender, EventArgs e)
\r
1031 if (!text_destination.Text.Contains(".mp4"))
\r
1033 lbl_largeMp4Warning.Text = "Warning: Only mp4 files are supported";
\r
1034 lbl_largeMp4Warning.ForeColor = Color.Red;
\r
1035 check_largeFile.CheckState = CheckState.Unchecked;
\r
1039 lbl_largeMp4Warning.Text = "Warning: Breaks iPod, @TV, PS3 compatibility.";
\r
1040 lbl_largeMp4Warning.ForeColor = Color.Black;
\r
1044 private void drp_dvdtitle_Click(object sender, EventArgs e)
\r
1046 if (drp_dvdtitle.Items.Count == 0)
\r
1048 MessageBox.Show("There are no titles to select. Please scan the DVD by clicking the 'browse' button above before trying to select a title.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
1052 private void drp_audioCodec_SelectedIndexChanged(object sender, EventArgs e)
\r
1055 //CLI Audio mixdown Names: mono stereo dpl1 dpl2 6ch
\r
1057 drp_audioMixDown.Items.Clear();
\r
1059 if (drp_audioCodec.Text == "AAC")
\r
1061 drp_audioMixDown.Items.Clear();
\r
1062 drp_audioMixDown.Items.Add("Mono");
\r
1063 drp_audioMixDown.Items.Add("Stereo");
\r
1064 drp_audioMixDown.Items.Add("Dolby Surround");
\r
1065 drp_audioMixDown.Items.Add("Dolby Pro Logic II");
\r
1066 drp_audioMixDown.Items.Add("6 Channel Discrete");
\r
1068 drp_audioBitrate.Items.Clear();
\r
1069 drp_audioBitrate.Items.Add("32");
\r
1070 drp_audioBitrate.Items.Add("40");
\r
1071 drp_audioBitrate.Items.Add("48");
\r
1072 drp_audioBitrate.Items.Add("56");
\r
1073 drp_audioBitrate.Items.Add("64");
\r
1074 drp_audioBitrate.Items.Add("80");
\r
1075 drp_audioBitrate.Items.Add("86");
\r
1076 drp_audioBitrate.Items.Add("112");
\r
1077 drp_audioBitrate.Items.Add("128");
\r
1078 drp_audioBitrate.Items.Add("160");
\r
1083 drp_audioMixDown.Items.Clear();
\r
1084 drp_audioMixDown.Items.Add("Stereo");
\r
1085 drp_audioMixDown.Items.Add("Dolby Surround");
\r
1086 drp_audioMixDown.Items.Add("Dolby Pro Logic II");
\r
1088 drp_audioBitrate.Items.Clear();
\r
1089 drp_audioBitrate.Items.Add("32");
\r
1090 drp_audioBitrate.Items.Add("40");
\r
1091 drp_audioBitrate.Items.Add("48");
\r
1092 drp_audioBitrate.Items.Add("56");
\r
1093 drp_audioBitrate.Items.Add("64");
\r
1094 drp_audioBitrate.Items.Add("80");
\r
1095 drp_audioBitrate.Items.Add("86");
\r
1096 drp_audioBitrate.Items.Add("112");
\r
1097 drp_audioBitrate.Items.Add("128");
\r
1098 drp_audioBitrate.Items.Add("160");
\r
1099 drp_audioBitrate.Items.Add("192");
\r
1100 drp_audioBitrate.Items.Add("224");
\r
1101 drp_audioBitrate.Items.Add("256");
\r
1102 drp_audioBitrate.Items.Add("320");
\r
1106 private void drp_audioMixDown_SelectedIndexChanged(object sender, EventArgs e)
\r
1108 if (drp_audioCodec.Text == "AAC")
\r
1110 if (drp_audioMixDown.Text == "6 Channel Discrete")
\r
1113 drp_audioBitrate.Items.Clear();
\r
1114 drp_audioBitrate.Items.Add("32");
\r
1115 drp_audioBitrate.Items.Add("40");
\r
1116 drp_audioBitrate.Items.Add("48");
\r
1117 drp_audioBitrate.Items.Add("56");
\r
1118 drp_audioBitrate.Items.Add("64");
\r
1119 drp_audioBitrate.Items.Add("80");
\r
1120 drp_audioBitrate.Items.Add("86");
\r
1121 drp_audioBitrate.Items.Add("112");
\r
1122 drp_audioBitrate.Items.Add("128");
\r
1123 drp_audioBitrate.Items.Add("160");
\r
1124 drp_audioBitrate.Items.Add("192");
\r
1125 drp_audioBitrate.Items.Add("224");
\r
1126 drp_audioBitrate.Items.Add("256");
\r
1127 drp_audioBitrate.Items.Add("320");
\r
1128 drp_audioBitrate.Items.Add("384");
\r
1133 private void Check_ChapterMarkers_CheckedChanged(object sender, EventArgs e)
\r
1135 if (Check_ChapterMarkers.Checked)
\r
1137 string destination = text_destination.Text;
\r
1138 destination = destination.Replace(".mp4", ".m4v");
\r
1139 text_destination.Text = destination;
\r
1143 string destination = text_destination.Text;
\r
1144 destination = destination.Replace(".m4v", ".mp4");
\r
1145 text_destination.Text = destination;
\r
1149 private void drp_videoEncoder_SelectedIndexChanged(object sender, EventArgs e)
\r
1151 //Turn off some options which are H.264 only when the user selects a non h.264 encoder
\r
1152 if (!drp_videoEncoder.Text.Contains("H.264"))
\r
1154 check_turbo.CheckState = CheckState.Unchecked;
\r
1155 CheckCRF.CheckState = CheckState.Unchecked;
\r
1156 CheckCRF.Enabled = false;
\r
1157 check_turbo.Enabled = false;
\r
1158 h264Tab.Enabled = false;
\r
1159 rtf_h264advanced.Text = "";
\r
1163 CheckCRF.Enabled = true;
\r
1164 if (check_2PassEncode.CheckState.ToString() == "Checked")
\r
1166 check_turbo.Enabled = true;
\r
1168 h264Tab.Enabled = true;
\r
1173 public void setStreamReader(Parsing.DVD dvd)
\r
1175 this.thisDVD = dvd;
\r
1178 private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e)
\r
1180 // Reset some values on the form
\r
1181 lbl_Aspect.Text = "Select a Title";
\r
1182 lbl_RecomendedCrop.Text = "Select a Title";
\r
1183 drop_chapterStart.Items.Clear();
\r
1184 drop_chapterFinish.Items.Clear();
\r
1185 QueryEditorText.Text = "";
\r
1187 // If the dropdown is set to automatic nothing else needs to be done.
\r
1188 // Otheriwse if its not, title data has to be loased from parsing.
\r
1189 if (drp_dvdtitle.Text != "Automatic")
\r
1191 Parsing.Title selectedTitle = drp_dvdtitle.SelectedItem as Parsing.Title;
\r
1193 // Set the Aspect Ratio
\r
1194 lbl_Aspect.Text = selectedTitle.AspectRatio.ToString();
\r
1196 // Set the Recommended Cropping values
\r
1197 lbl_RecomendedCrop.Text = string.Format("{0}/{1}/{2}/{3}", selectedTitle.AutoCropDimensions[0], selectedTitle.AutoCropDimensions[1], selectedTitle.AutoCropDimensions[2], selectedTitle.AutoCropDimensions[3]);
\r
1199 // Populate the Start chapter Dropdown
\r
1200 drop_chapterStart.Items.Clear();
\r
1201 drop_chapterStart.Items.AddRange(selectedTitle.Chapters.ToArray());
\r
1202 if (drop_chapterStart.Items.Count > 0)
\r
1204 drop_chapterStart.Text = drop_chapterStart.Items[0].ToString();
\r
1207 // Populate the Final Chapter Dropdown
\r
1208 drop_chapterFinish.Items.Clear();
\r
1209 drop_chapterFinish.Items.AddRange(selectedTitle.Chapters.ToArray());
\r
1210 if (drop_chapterFinish.Items.Count > 0)
\r
1212 drop_chapterFinish.Text = drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString();
\r
1215 // Populate the Audio Channels Dropdown
\r
1216 drp_audioChannels.Items.Clear();
\r
1217 drp_audioChannels.Items.Add("Automatic");
\r
1218 drp_audioChannels.Items.AddRange(selectedTitle.AudioTracks.ToArray());
\r
1219 if (drp_audioChannels.Items.Count > 0)
\r
1221 drp_audioChannels.Text = drp_audioChannels.Items[0].ToString();
\r
1224 // Populate the Subtitles dropdown
\r
1225 drp_subtitle.Items.Clear();
\r
1226 drp_subtitle.Items.Add("None");
\r
1227 drp_subtitle.Items.AddRange(selectedTitle.Subtitles.ToArray());
\r
1228 if (drp_subtitle.Items.Count > 0)
\r
1230 drp_subtitle.Text = drp_subtitle.Items[0].ToString();
\r
1237 //---------------------------------------------------
\r
1239 // - Query Generation
\r
1240 //---------------------------------------------------
\r
1242 #region Program Functions
\r
1244 // Generate a CLI Query String
\r
1245 public string GenerateTheQuery()
\r
1247 string source = text_source.Text;
\r
1248 string dvdTitle = drp_dvdtitle.Text;
\r
1249 string chapterStart = drop_chapterStart.Text;
\r
1250 string chapterFinish = drop_chapterFinish.Text;
\r
1251 int totalChapters = drop_chapterFinish.Items.Count - 1;
\r
1252 string dvdChapter = "";
\r
1254 source = " -i " + '"' + source + '"';
\r
1256 if (dvdTitle == "Automatic")
\r
1260 string[] titleInfo = dvdTitle.Split(' ');
\r
1261 dvdTitle = " -t " + titleInfo[0];
\r
1264 if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))
\r
1266 else if (chapterFinish == chapterStart)
\r
1267 dvdChapter = " -c " + chapterStart;
\r
1269 dvdChapter = " -c " + chapterStart + "-" + chapterFinish;
\r
1271 string querySource = source + dvdTitle + dvdChapter;
\r
1272 // ----------------------------------------------------------------------
\r
1276 string destination = text_destination.Text;
\r
1277 string videoEncoder = drp_videoEncoder.Text;
\r
1278 string audioEncoder = drp_audioCodec.Text;
\r
1279 string width = text_width.Text;
\r
1280 string height = text_height.Text;
\r
1282 if (destination == "")
\r
1283 MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
1285 destination = " -o " + '"' + destination + '"'; //'"'+
\r
1288 switch (videoEncoder)
\r
1291 videoEncoder = " -e ffmpeg";
\r
1294 videoEncoder = " -e xvid";
\r
1297 videoEncoder = " -e x264";
\r
1299 case "H.264 Baseline 1.3":
\r
1300 videoEncoder = " -e x264b13";
\r
1302 case "H.264 (iPod)":
\r
1303 videoEncoder = " -e x264b30";
\r
1306 videoEncoder = " -e x264";
\r
1310 switch (audioEncoder)
\r
1313 audioEncoder = " -E faac";
\r
1316 audioEncoder = " -E lame";
\r
1319 audioEncoder = " -E vorbis";
\r
1322 audioEncoder = " -E ac3";
\r
1325 audioEncoder = " -E faac";
\r
1330 width = " -w " + width;
\r
1333 if (height == "Auto")
\r
1337 else if (height != "")
\r
1339 height = " -l " + height;
\r
1343 string queryDestination = destination + videoEncoder + audioEncoder + width + height;
\r
1344 // ----------------------------------------------------------------------
\r
1346 // Picture Settings Tab
\r
1348 string cropSetting = drp_crop.Text;
\r
1349 string cropTop = text_top.Text;
\r
1350 string cropBottom = text_bottom.Text;
\r
1351 string cropLeft = text_left.Text;
\r
1352 string cropRight = text_right.Text;
\r
1353 string subtitles = drp_subtitle.Text;
\r
1354 string cropOut = "";
\r
1355 string deInterlace_Option = drp_deInterlace_option.Text;
\r
1356 string deinterlace = "";
\r
1357 string grayscale = "";
\r
1358 string pixelRatio = "";
\r
1359 string ChapterMarkers = "";
\r
1360 // Returns Crop Query
\r
1362 if (cropSetting == "Auto Crop")
\r
1364 else if (cropSetting == "No Crop")
\r
1365 cropOut = " --crop 0:0:0:0 ";
\r
1368 if (text_top.Text == "")
\r
1370 if (text_bottom.Text == "")
\r
1372 if (text_left.Text == "")
\r
1374 if (text_right.Text == "")
\r
1377 cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
\r
1380 if (subtitles == "None")
\r
1382 else if (subtitles == "")
\r
1387 tempSub = subtitles.Split(' ');
\r
1388 subtitles = " -s " + tempSub[0];
\r
1391 switch (deInterlace_Option)
\r
1396 case "Original (Fast)":
\r
1397 deinterlace = " --deinterlace=fast";
\r
1399 case "yadif (Slow)":
\r
1400 deinterlace = " --deinterlace=slow";
\r
1402 case "yadif + mcdeint (Slower)":
\r
1403 deinterlace = " --deinterlace=slower";
\r
1405 case "yadif + mcdeint (Slowest)":
\r
1406 deinterlace = " --deinterlace=slowest";
\r
1413 if (check_grayscale.Checked)
\r
1414 grayscale = " -g ";
\r
1416 if (CheckPixelRatio.Checked)
\r
1417 pixelRatio = " -p ";
\r
1419 if (Check_ChapterMarkers.Checked)
\r
1420 ChapterMarkers = " -m ";
\r
1422 string queryPictureSettings = cropOut + subtitles + deinterlace + grayscale + pixelRatio + ChapterMarkers;
\r
1423 // ----------------------------------------------------------------------
\r
1425 // Video Settings Tab
\r
1427 string videoBitrate = text_bitrate.Text;
\r
1428 string videoFilesize = text_filesize.Text;
\r
1429 double videoQuality = slider_videoQuality.Value;
\r
1430 string vidQSetting = "";
\r
1431 string twoPassEncoding = "";
\r
1432 string videoFramerate = drp_videoFramerate.Text;
\r
1433 string turboH264 = "";
\r
1434 string largeFile = "";
\r
1435 string deblock = "";
\r
1436 string detelecine = "";
\r
1437 string denoise = "";
\r
1438 string CRF = CheckCRF.CheckState.ToString();
\r
1440 if (CRF == "Checked")
\r
1445 if (videoBitrate != "")
\r
1446 videoBitrate = " -b " + videoBitrate;
\r
1448 if (videoFilesize != "")
\r
1449 videoFilesize = " -S " + videoFilesize;
\r
1451 // Video Quality Setting
\r
1453 if ((videoQuality == 0))
\r
1457 videoQuality = videoQuality / 100;
\r
1458 if (videoQuality == 1)
\r
1460 vidQSetting = "1.0";
\r
1462 vidQSetting = " -q " + videoQuality.ToString(new CultureInfo("en-US"));
\r
1465 if (check_2PassEncode.Checked)
\r
1466 twoPassEncoding = " -2 ";
\r
1468 if (videoFramerate == "Automatic")
\r
1469 videoFramerate = "";
\r
1471 videoFramerate = " -r " + videoFramerate;
\r
1473 if (check_turbo.Checked)
\r
1474 turboH264 = " -T ";
\r
1476 if (check_largeFile.Checked)
\r
1477 largeFile = " -4 ";
\r
1479 if (check_deblock.Checked)
\r
1480 deblock = " --deblock";
\r
1482 if (check_detelecine.Checked)
\r
1483 detelecine = " --detelecine";
\r
1485 switch (drp_deNoise.Text)
\r
1491 denoise = " --denoise=weak";
\r
1494 denoise = " --denoise=medium";
\r
1497 denoise = " --denoise=strong";
\r
1504 string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + CRF + twoPassEncoding + videoFramerate + turboH264 + largeFile + deblock + detelecine + denoise;
\r
1505 // ----------------------------------------------------------------------
\r
1507 // Audio Settings Tab
\r
1509 string audioBitrate = drp_audioBitrate.Text;
\r
1510 string audioSampleRate = drp_audioSampleRate.Text;
\r
1511 string audioChannels = drp_audioChannels.Text;
\r
1512 string Mixdown = drp_audioMixDown.Text;
\r
1513 string SixChannelAudio = "";
\r
1515 if (audioBitrate != "")
\r
1516 audioBitrate = " -B " + audioBitrate;
\r
1518 if (audioSampleRate != "")
\r
1519 audioSampleRate = " -R " + audioSampleRate;
\r
1521 if (audioChannels == "Automatic")
\r
1522 audioChannels = "";
\r
1523 else if (audioChannels == "")
\r
1524 audioChannels = "";
\r
1528 tempSub = audioChannels.Split(' ');
\r
1529 audioChannels = " -a " + tempSub[0];
\r
1541 Mixdown = "stereo";
\r
1543 case "Dolby Surround":
\r
1546 case "Dolby Pro Logic II":
\r
1549 case "6 Channel Discrete":
\r
1557 if (Mixdown != "")
\r
1558 SixChannelAudio = " -6 " + Mixdown;
\r
1560 SixChannelAudio = "";
\r
1562 string queryAudioSettings = audioBitrate + audioSampleRate + audioChannels + SixChannelAudio;
\r
1563 // ----------------------------------------------------------------------
\r
1568 string h264Advanced = rtf_h264advanced.Text;
\r
1570 if ((h264Advanced == ""))
\r
1571 h264Advanced = "";
\r
1573 h264Advanced = " -x " + h264Advanced;
\r
1576 string h264Settings = h264Advanced;
\r
1577 // ----------------------------------------------------------------------
\r
1579 // Processors (Program Settings)
\r
1581 string processors = Properties.Settings.Default.Processors;
\r
1582 // Number of Processors Handler
\r
1584 if (processors == "Automatic")
\r
1587 processors = " -C " + processors + " ";
\r
1590 string queryAdvancedSettings = processors;
\r
1591 // ----------------------------------------------------------------------
\r
1593 // Verbose option (Program Settings)
\r
1595 string verbose = "";
\r
1596 if (Properties.Settings.Default.verbose == "Checked")
\r
1599 // ----------------------------------------------------------------------
\r
1601 return querySource + queryDestination + queryPictureSettings + queryVideoSettings + h264Settings + queryAudioSettings + queryAdvancedSettings + verbose;
\r
1605 private void presetLoader(Functions.QueryParser presetQuery, string name)
\r
1607 // ---------------------------
\r
1609 // ---------------------------
\r
1613 if (presetQuery.Source != "")
\r
1614 text_source.Text = presetQuery.Source;
\r
1616 if (presetQuery.DVDTitle != 0)
\r
1617 drp_dvdtitle.Text = presetQuery.DVDTitle.ToString();
\r
1619 if (presetQuery.DVDChapterStart != 0)
\r
1620 drop_chapterStart.Text = presetQuery.DVDChapterStart.ToString();
\r
1622 if (presetQuery.DVDChapterFinish != 0)
\r
1623 drop_chapterFinish.Text = presetQuery.DVDChapterFinish.ToString();
\r
1625 if (presetQuery.Format != "")
\r
1627 string destination = text_destination.Text;
\r
1628 destination = destination.Replace(".mp4", "." + presetQuery.Format);
\r
1629 destination = destination.Replace(".m4v", "." + presetQuery.Format);
\r
1630 destination = destination.Replace(".avi", "." + presetQuery.Format);
\r
1631 destination = destination.Replace(".mkv", "." + presetQuery.Format);
\r
1632 destination = destination.Replace(".ogm", "." + presetQuery.Format);
\r
1633 text_destination.Text = destination;
\r
1638 // Destination tab
\r
1639 #region destination
\r
1641 if (presetQuery.Destination != "")
\r
1642 text_destination.Text = presetQuery.Destination;
\r
1644 drp_videoEncoder.Text = presetQuery.VideoEncoder;
\r
1645 drp_audioCodec.Text = presetQuery.AudioEncoder;
\r
1646 if (presetQuery.Width != 0)
\r
1648 text_width.Text = presetQuery.Width.ToString();
\r
1653 text_width.Text = "";
\r
1654 text_width.BackColor = Color.White;
\r
1657 if (presetQuery.Height != 0)
\r
1659 text_height.Text = presetQuery.Height.ToString();
\r
1663 text_height.Text = "";
\r
1664 text_height.BackColor = Color.White;
\r
1668 // Picture Settings Tab
\r
1670 drp_crop.Text = "Manual";
\r
1671 text_top.Text = presetQuery.CropTop;
\r
1672 text_bottom.Text = presetQuery.CropBottom;
\r
1673 text_left.Text = presetQuery.CropLeft;
\r
1674 text_right.Text = presetQuery.CropRight;
\r
1676 drp_deInterlace_option.Text = presetQuery.DeInterlace;
\r
1677 drp_deNoise.Text = presetQuery.DeNoise;
\r
1679 if (presetQuery.DeTelecine == true)
\r
1681 check_detelecine.CheckState = CheckState.Checked;
\r
1685 check_detelecine.CheckState = CheckState.Unchecked;
\r
1689 if (presetQuery.DeBlock == true)
\r
1691 check_deblock.CheckState = CheckState.Checked;
\r
1695 check_deblock.CheckState = CheckState.Unchecked;
\r
1698 if (presetQuery.ChapterMarkers == true)
\r
1700 Check_ChapterMarkers.CheckState = CheckState.Checked;
\r
1704 Check_ChapterMarkers.CheckState = CheckState.Unchecked;
\r
1707 if (presetQuery.Anamorphic == true)
\r
1709 CheckPixelRatio.CheckState = CheckState.Checked;
\r
1713 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
1717 // Video Settings Tab
\r
1719 text_bitrate.Text = presetQuery.AverageVideoBitrate;
\r
1720 text_filesize.Text = presetQuery.VideoTargetSize;
\r
1721 slider_videoQuality.Value = presetQuery.VideoQuality;
\r
1722 if (slider_videoQuality.Value != 0)
\r
1724 CheckCRF.Enabled = true;
\r
1725 int ql = presetQuery.VideoQuality;
\r
1726 SliderValue.Text = ql.ToString() + "%";
\r
1729 if (presetQuery.TwoPass == true)
\r
1731 check_2PassEncode.CheckState = CheckState.Checked;
\r
1735 check_2PassEncode.CheckState = CheckState.Unchecked;
\r
1738 if (presetQuery.Grayscale == true)
\r
1740 check_grayscale.CheckState = CheckState.Checked;
\r
1744 check_grayscale.CheckState = CheckState.Unchecked;
\r
1747 drp_videoFramerate.Text = presetQuery.VideoFramerate;
\r
1749 if (presetQuery.TurboFirstPass == true)
\r
1751 check_turbo.CheckState = CheckState.Checked;
\r
1755 check_turbo.CheckState = CheckState.Unchecked;
\r
1758 if (presetQuery.LargeMP4 == true)
\r
1760 check_largeFile.CheckState = CheckState.Checked;
\r
1764 check_largeFile.CheckState = CheckState.Unchecked;
\r
1766 if (presetQuery.CRF == true)
\r
1768 CheckCRF.CheckState = CheckState.Checked;
\r
1772 CheckCRF.CheckState = CheckState.Unchecked;
\r
1776 // Audio Settings Tab
\r
1778 drp_audioBitrate.Text = presetQuery.AudioBitrate;
\r
1779 drp_audioSampleRate.Text = presetQuery.AudioSampleBitrate;
\r
1780 drp_audioChannels.Text = presetQuery.AudioTrack1;
\r
1781 drp_audioMixDown.Text = presetQuery.AudioTrackMix;
\r
1782 drp_subtitle.Text = presetQuery.Subtitles;
\r
1785 // H264 Tab & Preset Name
\r
1787 rtf_h264advanced.Text = presetQuery.H264Query;
\r
1789 // Set the preset name
\r
1790 groupBox_output.Text = "Output Settings (Preset: " + name + ")";
\r
1795 // This is the END of the road ------------------------------------------------------------------------------
\r