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(1000); //sit for 1 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 mnu_showPresets.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
316 Boolean presetStatus;
\r
318 private void mnu_showPresets_Click(object sender, EventArgs e)
\r
320 if (presetStatus == false)
\r
323 presetStatus = true;
\r
324 mnu_showPresets.Text = "Hide Presets";
\r
329 presetStatus = false;
\r
330 mnu_showPresets.Text = "Show Presets";
\r
334 private void mnu_presetReset_Click(object sender, EventArgs e)
\r
336 listview_presets.Items.Clear();
\r
338 MessageBox.Show("Presets have been updated", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
\r
341 private void mnu_SelectDefault_Click(object sender, EventArgs e)
\r
343 ListViewItem item = listview_presets.FindItemWithText("Normal");
\r
347 listview_presets.SelectedItems.Clear();
\r
348 item.Selected = true;
\r
357 private void mnu_quickStart_Click(object sender, EventArgs e)
\r
359 Form QuickStart = new frmQuickStart();
\r
360 QuickStart.ShowDialog();
\r
363 private void mnu_wiki_Click(object sender, EventArgs e)
\r
365 Process.Start("http://handbrake.m0k.org/trac");
\r
368 private void mnu_faq_Click(object sender, EventArgs e)
\r
370 Process.Start("http://handbrake.m0k.org/trac/wiki/WindowsGuiFaq");
\r
373 private void mnu_onlineDocs_Click(object sender, EventArgs e)
\r
375 Process.Start("http://handbrake.m0k.org/?page_id=11");
\r
378 private void mnu_homepage_Click(object sender, EventArgs e)
\r
380 Process.Start("http://handbrake.m0k.org");
\r
383 private void mnu_forum_Click(object sender, EventArgs e)
\r
385 Process.Start("http://handbrake.m0k.org/forum");
\r
388 private void mnu_UpdateCheck_Click(object sender, EventArgs e)
\r
390 Boolean update = updateCheck();
\r
391 if (update == true)
\r
393 MessageBox.Show("There is a new update available. Please visit http://handbrake.m0k.org for details!", "Update Check", MessageBoxButtons.OK, MessageBoxIcon.Information);
\r
397 MessageBox.Show("There are no new updates at this time.", "Update Check", MessageBoxButtons.OK, MessageBoxIcon.Information);
\r
401 private void mnu_about_Click(object sender, EventArgs e)
\r
403 Form About = new frmAbout();
\r
404 About.ShowDialog();
\r
409 // --------------------------------------------------------------
\r
410 // Buttons on the main Window
\r
411 // --------------------------------------------------------------
\r
415 private void btn_Browse_Click(object sender, EventArgs e)
\r
417 String filename = "";
\r
418 text_source.Text = "";
\r
419 frmDvdInfo dvdInfoWindow = new frmDvdInfo();
\r
421 if (RadioDVD.Checked)
\r
423 DVD_Open.ShowDialog();
\r
424 filename = DVD_Open.SelectedPath;
\r
425 if (filename != "")
\r
427 Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
\r
428 text_source.Text = filename;
\r
429 frmRD.ShowDialog();
\r
434 ISO_Open.ShowDialog();
\r
435 filename = ISO_Open.FileName;
\r
436 if (filename != "")
\r
438 Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
\r
439 text_source.Text = filename;
\r
440 frmRD.ShowDialog();
\r
444 // Check if there was titles in the dvd title dropdown
\r
445 if (filename == "")
\r
447 text_source.Text = "Click 'Browse' to continue";
\r
450 // If there are no titles in the dropdown menu then the scan has obviously failed. Display an error message explaining to the user.
\r
451 if (drp_dvdtitle.Items.Count == 0)
\r
453 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
457 private void btn_destBrowse_Click(object sender, EventArgs e)
\r
459 // This removes the file extension from the filename box on the save file dialog.
\r
460 // It's daft but some users don't realise that typing an extension overrides the dropdown extension selected.
\r
461 // Should be a nicer way to do this.
\r
462 DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", "").Replace(".ogm", "").Replace(".avi", "");
\r
464 // Show the dialog and set the main form file path
\r
465 DVD_Save.ShowDialog();
\r
466 text_destination.Text = DVD_Save.FileName;
\r
468 // Quicktime requires .m4v file for chapter markers to work. If checked, change the extension to .m4v (mp4 and m4v are the same thing)
\r
469 if (Check_ChapterMarkers.Checked)
\r
471 string destination = text_destination.Text;
\r
472 destination = destination.Replace(".mp4", ".m4v");
\r
473 text_destination.Text = destination;
\r
477 private void btn_h264Clear_Click(object sender, EventArgs e)
\r
479 rtf_h264advanced.Text = "";
\r
482 private void GenerateQuery_Click(object sender, EventArgs e)
\r
484 String query = GenerateTheQuery();
\r
485 QueryEditorText.Text = query;
\r
488 private void btn_ClearQuery_Click(object sender, EventArgs e)
\r
490 QueryEditorText.Text = "";
\r
493 private void btn_queue_Click(object sender, EventArgs e)
\r
496 if (text_source.Text == "" || text_source.Text == "Click 'Browse' to continue" || text_destination.Text == "")
\r
497 MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
501 if (QueryEditorText.Text == "")
\r
503 query = GenerateTheQuery();
\r
507 query = QueryEditorText.Text;
\r
509 queueWindow.list_queue.Items.Add(query);
\r
510 queueWindow.Show();
\r
514 private void btn_copy_Click(object sender, EventArgs e)
\r
516 if (QueryEditorText.Text != "")
\r
517 Clipboard.SetText(QueryEditorText.Text, TextDataFormat.Text);
\r
520 private void showQueue()
\r
522 queueWindow.Show();
\r
527 // --------------------------------------------------------------
\r
528 // Main Window Preset System
\r
529 // --------------------------------------------------------------
\r
531 #region Preset System
\r
533 // Import Current Presets
\r
534 private void updatePresets()
\r
536 string[] presets = new string[17];
\r
537 presets[0] = "Animation";
\r
538 presets[1] = "AppleTV";
\r
539 presets[2] = "Bedlam";
\r
540 presets[3] = "Blind";
\r
541 presets[4] = "Broke";
\r
542 presets[5] = "Classic";
\r
543 presets[6] = "Constant Quality Rate";
\r
544 presets[7] = "Deux Six Quatre";
\r
545 presets[8] = "Film";
\r
546 presets[9] = "iPhone / iPod Touch";
\r
547 presets[10] = "iPod High-Rez";
\r
548 presets[11] = "iPod Low-Rez";
\r
549 presets[12] = "Normal";
\r
550 presets[13] = "PS3";
\r
551 presets[14] = "PSP";
\r
552 presets[15] = "QuickTime";
\r
553 presets[16] = "Television";
\r
555 ListViewItem preset_listview = new ListViewItem();
\r
556 string[] presetList = new string[1];
\r
558 foreach (string preset in presets)
\r
560 presetList[0] = preset;
\r
561 preset_listview = new ListViewItem(presetList);
\r
563 // Now Fill Out List View with Items
\r
564 listview_presets.Items.Add(preset_listview);
\r
567 string appPath = Application.StartupPath.ToString() + "\\";
\r
568 string strCmdLine = "cmd /c " + '"' + '"' + appPath + "HandBrakeCLI.exe" + '"' + " --preset-list >" + '"' + appPath + "presets.dat" + '"' + " 2>&1" + '"';
\r
569 Process hbproc = Process.Start("CMD.exe", strCmdLine);
\r
570 hbproc.WaitForExit();
\r
577 private void btn_setDefault_Click(object sender, EventArgs e)
\r
579 String query = GenerateTheQuery();
\r
580 Properties.Settings.Default.defaultUserSettings = query;
\r
581 // Save the new default Settings
\r
582 Properties.Settings.Default.Save();
\r
583 MessageBox.Show("New default settings saved.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
586 // Preset Selection
\r
587 private void listview_presets_SelectedIndexChanged(object sender, EventArgs e)
\r
590 string selectedPreset = null;
\r
591 ListView.SelectedListViewItemCollection name = null;
\r
592 name = listview_presets.SelectedItems;
\r
594 if (listview_presets.SelectedItems.Count != 0)
\r
595 selectedPreset = name[0].SubItems[0].Text;
\r
599 string appPath = Application.StartupPath.ToString() + "\\";
\r
600 StreamReader presetInput = new StreamReader(appPath + "presets.dat");
\r
602 while (!presetInput.EndOfStream)
\r
604 if ((char)presetInput.Peek() == '+')
\r
606 string preset = presetInput.ReadLine().Replace("+ ", "");
\r
607 Regex r = new Regex("(: )"); // Split on hyphens.
\r
608 string[] presetName = r.Split(preset);
\r
610 if (selectedPreset == "iPhone / iPod Touch")
\r
612 selectedPreset = "iPhone";
\r
615 if (selectedPreset == presetName[0])
\r
617 // Need to disable anamorphic now, otherwise it may overide the width / height values later.
\r
618 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
620 // Send the query from the file to the Query Parser class
\r
621 Functions.QueryParser presetQuery = Functions.QueryParser.Parse(preset);
\r
623 // Now load the preset
\r
624 presetLoader(presetQuery, selectedPreset);
\r
630 presetInput.ReadLine();
\r
634 catch (Exception exc)
\r
636 MessageBox.Show(exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
644 //---------------------------------------------------
\r
645 // Encode / Cancel Buttons
\r
646 // Encode Progress Text Handler
\r
647 //---------------------------------------------------
\r
651 Functions.CLI process = new Functions.CLI();
\r
653 private void btn_encode_Click(object sender, EventArgs e)
\r
655 if (text_source.Text == "" || text_source.Text == "Click 'Browse' to continue" || text_destination.Text == "")
\r
656 MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
659 btn_eCancel.Enabled = true;
\r
661 if (QueryEditorText.Text == "")
\r
663 query = GenerateTheQuery();
\r
667 query = QueryEditorText.Text;
\r
670 ThreadPool.QueueUserWorkItem(procMonitor, query);
\r
671 lbl_encode.Visible = true;
\r
672 lbl_encode.Text = "Encoding in Progress";
\r
676 private void btn_eCancel_Click(object sender, EventArgs e)
\r
680 lbl_encode.Text = "Encoding Canceled";
\r
683 [DllImport("user32.dll")]
\r
684 public static extern void LockWorkStation();
\r
685 [DllImport("user32.dll")]
\r
686 public static extern int ExitWindowsEx(int uFlags, int dwReason);
\r
688 private void procMonitor(object state)
\r
690 // Make sure we are not already encoding and if we are then display an error.
\r
691 if (hbProc != null)
\r
693 MessageBox.Show("Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
697 hbProc = process.runCli(this, (string)state, false, false, false, false);
\r
698 hbProc.WaitForExit();
\r
703 //*****************************************************************************************
\r
705 // When the below code is used and standard error is set to true, hbcli is outputing a
\r
706 // video stream which has mild corruption issues every few seconds.
\r
707 // Maybe an issue with the Parser cauing the CLI to hickup/pause?
\r
708 //*****************************************************************************************
\r
711 Parsing.Parser encode = new Parsing.Parser(hbProc.StandardOutput.BaseStream);
\r
712 encode.OnEncodeProgress += encode_OnEncodeProgress;
\r
713 while (!encode.EndOfStream)
\r
718 hbProc.WaitForExit();
\r
719 process.closeCLI();
\r
723 catch (Exception exc)
\r
726 MessageBox.Show(exc.ToString());
\r
733 // Do something whent he encode ends.
\r
734 switch (Properties.Settings.Default.CompletionOption)
\r
737 System.Diagnostics.Process.Start("Shutdown", "-s -t 60");
\r
740 ExitWindowsEx(0, 0);
\r
743 Application.SetSuspendState(PowerState.Suspend, true, true);
\r
746 Application.SetSuspendState(PowerState.Hibernate, true, true);
\r
748 case "Lock System":
\r
751 case "Quit HandBrake":
\r
752 Application.Exit();
\r
760 private delegate void UpdateUIHandler();
\r
762 private void setEncodeLabel()
\r
764 if (this.InvokeRequired)
\r
766 this.BeginInvoke(new UpdateUIHandler(setEncodeLabel));
\r
769 lbl_encode.Text = "Encoding Finished";
\r
772 private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
\r
775 if (this.InvokeRequired)
\r
777 this.BeginInvoke(new Parsing.EncodeProgressEventHandler(encode_OnEncodeProgress),
\r
778 new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });
\r
781 lbl_encode.Text = string.Format("Encode Progress: {0}%, FPS: {1}, Avg FPS: {2}, Time Remaining: {3} ", PercentComplete, CurrentFps, AverageFps, TimeRemaining);
\r
786 //---------------------------------------------------
\r
787 // Items that require actions on frmMain
\r
788 //---------------------------------------------------
\r
790 #region frmMain Actions
\r
792 private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)
\r
794 drop_chapterStart.BackColor = Color.White;
\r
795 QueryEditorText.Text = "";
\r
796 if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
\r
800 int chapterFinish = int.Parse(drop_chapterFinish.Text);
\r
801 int chapterStart = int.Parse(drop_chapterStart.Text);
\r
803 if (chapterFinish < chapterStart)
\r
805 drop_chapterStart.BackColor = Color.LightCoral;
\r
810 drop_chapterStart.BackColor = Color.LightCoral;
\r
817 private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)
\r
819 drop_chapterFinish.BackColor = Color.White;
\r
820 QueryEditorText.Text = "";
\r
821 if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
\r
825 int chapterFinish = int.Parse(drop_chapterFinish.Text);
\r
826 int chapterStart = int.Parse(drop_chapterStart.Text);
\r
828 if (chapterFinish < chapterStart)
\r
830 drop_chapterFinish.BackColor = Color.LightCoral;
\r
835 drop_chapterFinish.BackColor = Color.LightCoral;
\r
840 private void text_bitrate_TextChanged(object sender, EventArgs e)
\r
842 text_filesize.Text = "";
\r
843 slider_videoQuality.Value = 0;
\r
844 SliderValue.Text = "0%";
\r
845 CheckCRF.CheckState = CheckState.Unchecked;
\r
846 CheckCRF.Enabled = false;
\r
849 private void text_filesize_TextChanged(object sender, EventArgs e)
\r
851 text_bitrate.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 slider_videoQuality_Scroll(object sender, EventArgs e)
\r
860 SliderValue.Text = slider_videoQuality.Value.ToString() + "%";
\r
861 text_bitrate.Text = "";
\r
862 text_filesize.Text = "";
\r
863 CheckCRF.Enabled = true;
\r
866 private void label_h264_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
\r
868 Process.Start("http://handbrake.m0k.org/trac/wiki/x264Options");
\r
871 private void text_width_TextChanged(object sender, EventArgs e)
\r
875 if (CheckPixelRatio.Checked)
\r
877 text_width.Text = "";
\r
878 text_width.BackColor = Color.LightCoral;
\r
879 CheckPixelRatio.BackColor = Color.LightCoral;
\r
883 if ((int.Parse(text_width.Text) % 16) != 0)
\r
885 text_width.BackColor = Color.LightCoral;
\r
889 text_width.BackColor = Color.LightGreen;
\r
893 if (lbl_Aspect.Text != "Select a Title")
\r
895 double height = int.Parse(text_width.Text) / double.Parse(lbl_Aspect.Text);
\r
896 double mod16 = height % 16;
\r
897 height = height - mod16;
\r
899 if (text_width.Text == "")
\r
901 text_height.Text = "";
\r
902 text_width.BackColor = Color.White;
\r
906 text_height.Text = height.ToString();
\r
907 text_width.BackColor = Color.LightGreen;
\r
913 // No need to throw an error here.
\r
914 // Note on non english systems, this will throw an error because of double.Parse(lbl_Aspect.Text); not working.
\r
920 private void text_height_TextChanged(object sender, EventArgs e)
\r
924 if (CheckPixelRatio.Checked)
\r
926 text_height.Text = "";
\r
927 text_height.BackColor = Color.LightCoral;
\r
928 CheckPixelRatio.BackColor = Color.LightCoral;
\r
932 if ((int.Parse(text_height.Text) % 16) != 0)
\r
934 text_height.BackColor = Color.LightCoral;
\r
938 text_height.BackColor = Color.LightGreen;
\r
945 // No need to alert the user.
\r
949 private void drp_crop_SelectedIndexChanged(object sender, EventArgs e)
\r
951 if ((string)drp_crop.SelectedItem == "Manual")
\r
953 text_left.Enabled = true;
\r
954 text_right.Enabled = true;
\r
955 text_top.Enabled = true;
\r
956 text_bottom.Enabled = true;
\r
959 if ((string)drp_crop.SelectedItem == "Auto Crop")
\r
961 text_left.Enabled = false;
\r
962 text_right.Enabled = false;
\r
963 text_top.Enabled = false;
\r
964 text_bottom.Enabled = false;
\r
965 text_left.Text = "";
\r
966 text_right.Text = "";
\r
967 text_top.Text = "";
\r
968 text_bottom.Text = "";
\r
970 if (lbl_RecomendedCrop.Text != "Select a Title")
\r
972 string[] temp = new string[4];
\r
973 temp = lbl_RecomendedCrop.Text.Split('/');
\r
974 text_left.Text = temp[2];
\r
975 text_right.Text = temp[3];
\r
976 text_top.Text = temp[0];
\r
977 text_bottom.Text = temp[1];
\r
981 if ((string)drp_crop.SelectedItem == "No Crop")
\r
983 text_left.Enabled = false;
\r
984 text_right.Enabled = false;
\r
985 text_top.Enabled = false;
\r
986 text_bottom.Enabled = false;
\r
987 text_left.Text = "0";
\r
988 text_right.Text = "0";
\r
989 text_top.Text = "0";
\r
990 text_bottom.Text = "0";
\r
995 private void CheckPixelRatio_CheckedChanged(object sender, EventArgs e)
\r
997 text_width.Text = "";
\r
998 text_height.Text = "";
\r
999 text_width.BackColor = Color.White;
\r
1000 text_height.BackColor = Color.White;
\r
1001 CheckPixelRatio.BackColor = TabPage1.BackColor;
\r
1004 private void check_2PassEncode_CheckedChanged(object sender, EventArgs e)
\r
1006 if (check_2PassEncode.CheckState.ToString() == "Checked")
\r
1008 if (drp_videoEncoder.Text.Contains("H.264"))
\r
1010 check_turbo.Enabled = true;
\r
1015 check_turbo.Enabled = false;
\r
1016 check_turbo.CheckState = CheckState.Unchecked;
\r
1020 private void check_largeFile_CheckedChanged(object sender, EventArgs e)
\r
1022 if (!text_destination.Text.Contains(".mp4"))
\r
1024 lbl_largeMp4Warning.Text = "Warning: Only mp4 files are supported";
\r
1025 lbl_largeMp4Warning.ForeColor = Color.Red;
\r
1026 check_largeFile.CheckState = CheckState.Unchecked;
\r
1030 lbl_largeMp4Warning.Text = "Warning: Breaks iPod, @TV, PS3 compatibility.";
\r
1031 lbl_largeMp4Warning.ForeColor = Color.Black;
\r
1035 private void drp_dvdtitle_Click(object sender, EventArgs e)
\r
1037 if (drp_dvdtitle.Items.Count == 0)
\r
1039 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
1043 private void drp_audioCodec_SelectedIndexChanged(object sender, EventArgs e)
\r
1046 //CLI Audio mixdown Names: mono stereo dpl1 dpl2 6ch
\r
1048 drp_audioMixDown.Items.Clear();
\r
1050 if (drp_audioCodec.Text == "AAC")
\r
1052 drp_audioMixDown.Items.Clear();
\r
1053 drp_audioMixDown.Items.Add("Mono");
\r
1054 drp_audioMixDown.Items.Add("Stereo");
\r
1055 drp_audioMixDown.Items.Add("Dolby Surround");
\r
1056 drp_audioMixDown.Items.Add("Dolby Pro Logic II");
\r
1057 drp_audioMixDown.Items.Add("6 Channel Discrete");
\r
1059 drp_audioBitrate.Items.Clear();
\r
1060 drp_audioBitrate.Items.Add("32");
\r
1061 drp_audioBitrate.Items.Add("40");
\r
1062 drp_audioBitrate.Items.Add("48");
\r
1063 drp_audioBitrate.Items.Add("56");
\r
1064 drp_audioBitrate.Items.Add("64");
\r
1065 drp_audioBitrate.Items.Add("80");
\r
1066 drp_audioBitrate.Items.Add("86");
\r
1067 drp_audioBitrate.Items.Add("112");
\r
1068 drp_audioBitrate.Items.Add("128");
\r
1069 drp_audioBitrate.Items.Add("160");
\r
1074 drp_audioMixDown.Items.Clear();
\r
1075 drp_audioMixDown.Items.Add("Stereo");
\r
1076 drp_audioMixDown.Items.Add("Dolby Surround");
\r
1077 drp_audioMixDown.Items.Add("Dolby Pro Logic II");
\r
1079 drp_audioBitrate.Items.Clear();
\r
1080 drp_audioBitrate.Items.Add("32");
\r
1081 drp_audioBitrate.Items.Add("40");
\r
1082 drp_audioBitrate.Items.Add("48");
\r
1083 drp_audioBitrate.Items.Add("56");
\r
1084 drp_audioBitrate.Items.Add("64");
\r
1085 drp_audioBitrate.Items.Add("80");
\r
1086 drp_audioBitrate.Items.Add("86");
\r
1087 drp_audioBitrate.Items.Add("112");
\r
1088 drp_audioBitrate.Items.Add("128");
\r
1089 drp_audioBitrate.Items.Add("160");
\r
1090 drp_audioBitrate.Items.Add("192");
\r
1091 drp_audioBitrate.Items.Add("224");
\r
1092 drp_audioBitrate.Items.Add("256");
\r
1093 drp_audioBitrate.Items.Add("320");
\r
1097 private void drp_audioMixDown_SelectedIndexChanged(object sender, EventArgs e)
\r
1099 if (drp_audioCodec.Text == "AAC")
\r
1101 if (drp_audioMixDown.Text == "6 Channel Discrete")
\r
1104 drp_audioBitrate.Items.Clear();
\r
1105 drp_audioBitrate.Items.Add("32");
\r
1106 drp_audioBitrate.Items.Add("40");
\r
1107 drp_audioBitrate.Items.Add("48");
\r
1108 drp_audioBitrate.Items.Add("56");
\r
1109 drp_audioBitrate.Items.Add("64");
\r
1110 drp_audioBitrate.Items.Add("80");
\r
1111 drp_audioBitrate.Items.Add("86");
\r
1112 drp_audioBitrate.Items.Add("112");
\r
1113 drp_audioBitrate.Items.Add("128");
\r
1114 drp_audioBitrate.Items.Add("160");
\r
1115 drp_audioBitrate.Items.Add("192");
\r
1116 drp_audioBitrate.Items.Add("224");
\r
1117 drp_audioBitrate.Items.Add("256");
\r
1118 drp_audioBitrate.Items.Add("320");
\r
1119 drp_audioBitrate.Items.Add("384");
\r
1124 private void Check_ChapterMarkers_CheckedChanged(object sender, EventArgs e)
\r
1126 if (Check_ChapterMarkers.Checked)
\r
1128 string destination = text_destination.Text;
\r
1129 destination = destination.Replace(".mp4", ".m4v");
\r
1130 text_destination.Text = destination;
\r
1134 string destination = text_destination.Text;
\r
1135 destination = destination.Replace(".m4v", ".mp4");
\r
1136 text_destination.Text = destination;
\r
1140 private void drp_videoEncoder_SelectedIndexChanged(object sender, EventArgs e)
\r
1142 //Turn off some options which are H.264 only when the user selects a non h.264 encoder
\r
1143 if (!drp_videoEncoder.Text.Contains("H.264"))
\r
1145 check_turbo.CheckState = CheckState.Unchecked;
\r
1146 CheckCRF.CheckState = CheckState.Unchecked;
\r
1147 CheckCRF.Enabled = false;
\r
1148 check_turbo.Enabled = false;
\r
1149 h264Tab.Enabled = false;
\r
1150 rtf_h264advanced.Text = "";
\r
1154 CheckCRF.Enabled = true;
\r
1155 if (check_2PassEncode.CheckState.ToString() == "Checked")
\r
1157 check_turbo.Enabled = true;
\r
1159 h264Tab.Enabled = true;
\r
1164 public void setStreamReader(Parsing.DVD dvd)
\r
1166 this.thisDVD = dvd;
\r
1169 private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e)
\r
1171 // Reset some values on the form
\r
1172 lbl_Aspect.Text = "Select a Title";
\r
1173 lbl_RecomendedCrop.Text = "Select a Title";
\r
1174 drop_chapterStart.Items.Clear();
\r
1175 drop_chapterFinish.Items.Clear();
\r
1176 QueryEditorText.Text = "";
\r
1178 // If the dropdown is set to automatic nothing else needs to be done.
\r
1179 // Otheriwse if its not, title data has to be loased from parsing.
\r
1180 if (drp_dvdtitle.Text != "Automatic")
\r
1182 Parsing.Title selectedTitle = drp_dvdtitle.SelectedItem as Parsing.Title;
\r
1184 // Set the Aspect Ratio
\r
1185 lbl_Aspect.Text = selectedTitle.AspectRatio.ToString();
\r
1187 // Set the Recommended Cropping values
\r
1188 lbl_RecomendedCrop.Text = string.Format("{0}/{1}/{2}/{3}", selectedTitle.AutoCropDimensions[0], selectedTitle.AutoCropDimensions[1], selectedTitle.AutoCropDimensions[2], selectedTitle.AutoCropDimensions[3]);
\r
1190 // Populate the Start chapter Dropdown
\r
1191 drop_chapterStart.Items.Clear();
\r
1192 drop_chapterStart.Items.AddRange(selectedTitle.Chapters.ToArray());
\r
1193 if (drop_chapterStart.Items.Count > 0)
\r
1195 drop_chapterStart.Text = drop_chapterStart.Items[0].ToString();
\r
1198 // Populate the Final Chapter Dropdown
\r
1199 drop_chapterFinish.Items.Clear();
\r
1200 drop_chapterFinish.Items.AddRange(selectedTitle.Chapters.ToArray());
\r
1201 if (drop_chapterFinish.Items.Count > 0)
\r
1203 drop_chapterFinish.Text = drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString();
\r
1206 // Populate the Audio Channels Dropdown
\r
1207 drp_audioChannels.Items.Clear();
\r
1208 drp_audioChannels.Items.Add("Automatic");
\r
1209 drp_audioChannels.Items.AddRange(selectedTitle.AudioTracks.ToArray());
\r
1210 if (drp_audioChannels.Items.Count > 0)
\r
1212 drp_audioChannels.Text = drp_audioChannels.Items[0].ToString();
\r
1215 // Populate the Subtitles dropdown
\r
1216 drp_subtitle.Items.Clear();
\r
1217 drp_subtitle.Items.Add("None");
\r
1218 drp_subtitle.Items.AddRange(selectedTitle.Subtitles.ToArray());
\r
1219 if (drp_subtitle.Items.Count > 0)
\r
1221 drp_subtitle.Text = drp_subtitle.Items[0].ToString();
\r
1228 //---------------------------------------------------
\r
1230 // - Query Generation
\r
1231 //---------------------------------------------------
\r
1233 #region Program Functions
\r
1235 // Generate a CLI Query String
\r
1236 public string GenerateTheQuery()
\r
1238 string source = text_source.Text;
\r
1239 string dvdTitle = drp_dvdtitle.Text;
\r
1240 string chapterStart = drop_chapterStart.Text;
\r
1241 string chapterFinish = drop_chapterFinish.Text;
\r
1242 int totalChapters = drop_chapterFinish.Items.Count - 1;
\r
1243 string dvdChapter = "";
\r
1245 source = " -i " + '"' + source + '"';
\r
1247 if (dvdTitle == "Automatic")
\r
1251 string[] titleInfo = dvdTitle.Split(' ');
\r
1252 dvdTitle = " -t " + titleInfo[0];
\r
1255 if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))
\r
1257 else if (chapterFinish == chapterStart)
\r
1258 dvdChapter = " -c " + chapterStart;
\r
1260 dvdChapter = " -c " + chapterStart + "-" + chapterFinish;
\r
1262 string querySource = source + dvdTitle + dvdChapter;
\r
1263 // ----------------------------------------------------------------------
\r
1267 string destination = text_destination.Text;
\r
1268 string videoEncoder = drp_videoEncoder.Text;
\r
1269 string audioEncoder = drp_audioCodec.Text;
\r
1270 string width = text_width.Text;
\r
1271 string height = text_height.Text;
\r
1273 if (destination == "")
\r
1274 MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
1276 destination = " -o " + '"' + destination + '"'; //'"'+
\r
1279 switch (videoEncoder)
\r
1282 videoEncoder = " -e ffmpeg";
\r
1285 videoEncoder = " -e xvid";
\r
1288 videoEncoder = " -e x264";
\r
1290 case "H.264 Baseline 1.3":
\r
1291 videoEncoder = " -e x264b13";
\r
1293 case "H.264 (iPod)":
\r
1294 videoEncoder = " -e x264b30";
\r
1297 videoEncoder = " -e x264";
\r
1301 switch (audioEncoder)
\r
1304 audioEncoder = " -E faac";
\r
1307 audioEncoder = " -E lame";
\r
1310 audioEncoder = " -E vorbis";
\r
1313 audioEncoder = " -E ac3";
\r
1316 audioEncoder = " -E faac";
\r
1321 width = " -w " + width;
\r
1324 if (height == "Auto")
\r
1328 else if (height != "")
\r
1330 height = " -l " + height;
\r
1334 string queryDestination = destination + videoEncoder + audioEncoder + width + height;
\r
1335 // ----------------------------------------------------------------------
\r
1337 // Picture Settings Tab
\r
1339 string cropSetting = drp_crop.Text;
\r
1340 string cropTop = text_top.Text;
\r
1341 string cropBottom = text_bottom.Text;
\r
1342 string cropLeft = text_left.Text;
\r
1343 string cropRight = text_right.Text;
\r
1344 string subtitles = drp_subtitle.Text;
\r
1345 string cropOut = "";
\r
1346 string deInterlace_Option = drp_deInterlace_option.Text;
\r
1347 string deinterlace = "";
\r
1348 string grayscale = "";
\r
1349 string pixelRatio = "";
\r
1350 string ChapterMarkers = "";
\r
1351 // Returns Crop Query
\r
1353 if (cropSetting == "Auto Crop")
\r
1355 else if (cropSetting == "No Crop")
\r
1356 cropOut = " --crop 0:0:0:0 ";
\r
1359 if (text_top.Text == "")
\r
1361 if (text_bottom.Text == "")
\r
1363 if (text_left.Text == "")
\r
1365 if (text_right.Text == "")
\r
1368 cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
\r
1371 if (subtitles == "None")
\r
1373 else if (subtitles == "")
\r
1378 tempSub = subtitles.Split(' ');
\r
1379 subtitles = " -s " + tempSub[0];
\r
1382 switch (deInterlace_Option)
\r
1387 case "Original (Fast)":
\r
1388 deinterlace = " --deinterlace=fast";
\r
1390 case "yadif (Slow)":
\r
1391 deinterlace = " --deinterlace=slow";
\r
1393 case "yadif + mcdeint (Slower)":
\r
1394 deinterlace = " --deinterlace=slower";
\r
1396 case "yadif + mcdeint (Slowest)":
\r
1397 deinterlace = " --deinterlace=slowest";
\r
1404 if (check_grayscale.Checked)
\r
1405 grayscale = " -g ";
\r
1407 if (CheckPixelRatio.Checked)
\r
1408 pixelRatio = " -p ";
\r
1410 if (Check_ChapterMarkers.Checked)
\r
1411 ChapterMarkers = " -m ";
\r
1413 string queryPictureSettings = cropOut + subtitles + deinterlace + grayscale + pixelRatio + ChapterMarkers;
\r
1414 // ----------------------------------------------------------------------
\r
1416 // Video Settings Tab
\r
1418 string videoBitrate = text_bitrate.Text;
\r
1419 string videoFilesize = text_filesize.Text;
\r
1420 double videoQuality = slider_videoQuality.Value;
\r
1421 string vidQSetting = "";
\r
1422 string twoPassEncoding = "";
\r
1423 string videoFramerate = drp_videoFramerate.Text;
\r
1424 string turboH264 = "";
\r
1425 string largeFile = "";
\r
1426 string deblock = "";
\r
1427 string detelecine = "";
\r
1428 string denoise = "";
\r
1429 string CRF = CheckCRF.CheckState.ToString();
\r
1431 if (CRF == "Checked")
\r
1436 if (videoBitrate != "")
\r
1437 videoBitrate = " -b " + videoBitrate;
\r
1439 if (videoFilesize != "")
\r
1440 videoFilesize = " -S " + videoFilesize;
\r
1442 // Video Quality Setting
\r
1444 if ((videoQuality == 0))
\r
1448 videoQuality = videoQuality / 100;
\r
1449 if (videoQuality == 1)
\r
1451 vidQSetting = "1.0";
\r
1453 vidQSetting = " -q " + videoQuality.ToString(new CultureInfo("en-US"));
\r
1456 if (check_2PassEncode.Checked)
\r
1457 twoPassEncoding = " -2 ";
\r
1459 if (videoFramerate == "Automatic")
\r
1460 videoFramerate = "";
\r
1462 videoFramerate = " -r " + videoFramerate;
\r
1464 if (check_turbo.Checked)
\r
1465 turboH264 = " -T ";
\r
1467 if (check_largeFile.Checked)
\r
1468 largeFile = " -4 ";
\r
1470 if (check_deblock.Checked)
\r
1471 deblock = " --deblock";
\r
1473 if (check_detelecine.Checked)
\r
1474 detelecine = " --detelecine";
\r
1476 switch (drp_deNoise.Text)
\r
1482 denoise = " --denoise=weak";
\r
1485 denoise = " --denoise=medium";
\r
1488 denoise = " --denoise=strong";
\r
1495 string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + CRF + twoPassEncoding + videoFramerate + turboH264 + largeFile + deblock + detelecine + denoise;
\r
1496 // ----------------------------------------------------------------------
\r
1498 // Audio Settings Tab
\r
1500 string audioBitrate = drp_audioBitrate.Text;
\r
1501 string audioSampleRate = drp_audioSampleRate.Text;
\r
1502 string audioChannels = drp_audioChannels.Text;
\r
1503 string Mixdown = drp_audioMixDown.Text;
\r
1504 string SixChannelAudio = "";
\r
1506 if (audioBitrate != "")
\r
1507 audioBitrate = " -B " + audioBitrate;
\r
1509 if (audioSampleRate != "")
\r
1510 audioSampleRate = " -R " + audioSampleRate;
\r
1512 if (audioChannels == "Automatic")
\r
1513 audioChannels = "";
\r
1514 else if (audioChannels == "")
\r
1515 audioChannels = "";
\r
1519 tempSub = audioChannels.Split(' ');
\r
1520 audioChannels = " -a " + tempSub[0];
\r
1532 Mixdown = "stereo";
\r
1534 case "Dolby Surround":
\r
1537 case "Dolby Pro Logic II":
\r
1540 case "6 Channel Discrete":
\r
1548 if (Mixdown != "")
\r
1549 SixChannelAudio = " -6 " + Mixdown;
\r
1551 SixChannelAudio = "";
\r
1553 string queryAudioSettings = audioBitrate + audioSampleRate + audioChannels + SixChannelAudio;
\r
1554 // ----------------------------------------------------------------------
\r
1559 string h264Advanced = rtf_h264advanced.Text;
\r
1561 if ((h264Advanced == ""))
\r
1562 h264Advanced = "";
\r
1564 h264Advanced = " -x " + h264Advanced;
\r
1567 string h264Settings = h264Advanced;
\r
1568 // ----------------------------------------------------------------------
\r
1570 // Processors (Program Settings)
\r
1572 string processors = Properties.Settings.Default.Processors;
\r
1573 // Number of Processors Handler
\r
1575 if (processors == "Automatic")
\r
1578 processors = " -C " + processors + " ";
\r
1581 string queryAdvancedSettings = processors;
\r
1582 // ----------------------------------------------------------------------
\r
1584 // Verbose option (Program Settings)
\r
1586 string verbose = "";
\r
1587 if (Properties.Settings.Default.verbose == "Checked")
\r
1590 // ----------------------------------------------------------------------
\r
1592 return querySource + queryDestination + queryPictureSettings + queryVideoSettings + h264Settings + queryAudioSettings + queryAdvancedSettings + verbose;
\r
1596 private void presetLoader(Functions.QueryParser presetQuery, string name)
\r
1598 // ---------------------------
\r
1600 // ---------------------------
\r
1604 if (presetQuery.Source != "")
\r
1605 text_source.Text = presetQuery.Source;
\r
1607 if (presetQuery.DVDTitle != 0)
\r
1608 drp_dvdtitle.Text = presetQuery.DVDTitle.ToString();
\r
1610 if (presetQuery.DVDChapterStart != 0)
\r
1611 drop_chapterStart.Text = presetQuery.DVDChapterStart.ToString();
\r
1613 if (presetQuery.DVDChapterFinish != 0)
\r
1614 drop_chapterFinish.Text = presetQuery.DVDChapterFinish.ToString();
\r
1616 if (presetQuery.Format != "")
\r
1618 string destination = text_destination.Text;
\r
1619 destination = destination.Replace(".mp4", "." + presetQuery.Format);
\r
1620 destination = destination.Replace(".m4v", "." + presetQuery.Format);
\r
1621 destination = destination.Replace(".avi", "." + presetQuery.Format);
\r
1622 destination = destination.Replace(".mkv", "." + presetQuery.Format);
\r
1623 destination = destination.Replace(".ogm", "." + presetQuery.Format);
\r
1624 text_destination.Text = destination;
\r
1629 // Destination tab
\r
1630 #region destination
\r
1632 if (presetQuery.Destination != "")
\r
1633 text_destination.Text = presetQuery.Destination;
\r
1635 drp_videoEncoder.Text = presetQuery.VideoEncoder;
\r
1636 drp_audioCodec.Text = presetQuery.AudioEncoder;
\r
1637 if (presetQuery.Width != 0)
\r
1639 text_width.Text = presetQuery.Width.ToString();
\r
1644 text_width.Text = "";
\r
1645 text_width.BackColor = Color.White;
\r
1648 if (presetQuery.Height != 0)
\r
1650 text_height.Text = presetQuery.Height.ToString();
\r
1654 text_height.Text = "";
\r
1655 text_height.BackColor = Color.White;
\r
1659 // Picture Settings Tab
\r
1661 drp_crop.Text = "Manual";
\r
1662 text_top.Text = presetQuery.CropTop;
\r
1663 text_bottom.Text = presetQuery.CropBottom;
\r
1664 text_left.Text = presetQuery.CropLeft;
\r
1665 text_right.Text = presetQuery.CropRight;
\r
1667 drp_deInterlace_option.Text = presetQuery.DeInterlace;
\r
1668 drp_deNoise.Text = presetQuery.DeNoise;
\r
1670 if (presetQuery.DeTelecine == true)
\r
1672 check_detelecine.CheckState = CheckState.Checked;
\r
1676 check_detelecine.CheckState = CheckState.Unchecked;
\r
1680 if (presetQuery.DeBlock == true)
\r
1682 check_deblock.CheckState = CheckState.Checked;
\r
1686 check_deblock.CheckState = CheckState.Unchecked;
\r
1689 if (presetQuery.ChapterMarkers == true)
\r
1691 Check_ChapterMarkers.CheckState = CheckState.Checked;
\r
1695 Check_ChapterMarkers.CheckState = CheckState.Unchecked;
\r
1698 if (presetQuery.Anamorphic == true)
\r
1700 CheckPixelRatio.CheckState = CheckState.Checked;
\r
1704 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
1708 // Video Settings Tab
\r
1710 text_bitrate.Text = presetQuery.AverageVideoBitrate;
\r
1711 text_filesize.Text = presetQuery.VideoTargetSize;
\r
1712 slider_videoQuality.Value = presetQuery.VideoQuality;
\r
1713 if (slider_videoQuality.Value != 0)
\r
1715 CheckCRF.Enabled = true;
\r
1716 int ql = presetQuery.VideoQuality;
\r
1717 SliderValue.Text = ql.ToString() + "%";
\r
1720 if (presetQuery.TwoPass == true)
\r
1722 check_2PassEncode.CheckState = CheckState.Checked;
\r
1726 check_2PassEncode.CheckState = CheckState.Unchecked;
\r
1729 if (presetQuery.Grayscale == true)
\r
1731 check_grayscale.CheckState = CheckState.Checked;
\r
1735 check_grayscale.CheckState = CheckState.Unchecked;
\r
1738 drp_videoFramerate.Text = presetQuery.VideoFramerate;
\r
1740 if (presetQuery.TurboFirstPass == true)
\r
1742 check_turbo.CheckState = CheckState.Checked;
\r
1746 check_turbo.CheckState = CheckState.Unchecked;
\r
1749 if (presetQuery.LargeMP4 == true)
\r
1751 check_largeFile.CheckState = CheckState.Checked;
\r
1755 check_largeFile.CheckState = CheckState.Unchecked;
\r
1757 if (presetQuery.CRF == true)
\r
1759 CheckCRF.CheckState = CheckState.Checked;
\r
1763 CheckCRF.CheckState = CheckState.Unchecked;
\r
1767 // Audio Settings Tab
\r
1769 drp_audioBitrate.Text = presetQuery.AudioBitrate;
\r
1770 drp_audioSampleRate.Text = presetQuery.AudioSampleBitrate;
\r
1771 drp_audioChannels.Text = presetQuery.AudioTrack1;
\r
1772 drp_audioMixDown.Text = presetQuery.AudioTrackMix;
\r
1773 drp_subtitle.Text = presetQuery.Subtitles;
\r
1776 // H264 Tab & Preset Name
\r
1778 rtf_h264advanced.Text = presetQuery.H264Query;
\r
1780 // Set the preset name
\r
1781 groupBox_output.Text = "Output Settings (Preset: " + name + ")";
\r
1786 // This is the END of the road ------------------------------------------------------------------------------
\r