2 using System.Collections.Generic;
\r
3 using System.ComponentModel;
\r
5 using System.Drawing;
\r
7 using System.Windows.Forms;
\r
10 using System.Diagnostics;
\r
11 using System.Threading;
\r
16 public partial class frmMain : Form
\r
18 private Process hbProc;
\r
19 private Parsing.DVD thisDVD;
\r
21 // --------------------------------------------------------------
\r
22 // Some windows that require only 1 instance.
\r
23 // --------------------------------------------------------------
\r
24 private frmQueue queueWindow = new frmQueue();
\r
26 // --------------------------------------------------------------
\r
27 // Stuff that needs doing on startup.
\r
28 // - Load users default settings. (if required)
\r
29 // - Do an update check (if required)
\r
30 // --------------------------------------------------------------
\r
31 private frmDvdInfo dvdInfoWindow = new frmDvdInfo();
\r
40 ThreadPool.QueueUserWorkItem(showSplash);
\r
43 InitializeComponent();
\r
45 // This is a quick Hack fix for the cross-thread problem with frmDvdIndo ************************
\r
46 dvdInfoWindow.Show();
\r
47 dvdInfoWindow.Hide();
\r
48 // **********************************************************************************************
\r
51 // Set the Version number lable to the corect version.
\r
52 Version.Text = "Version " + Properties.Settings.Default.GuiVersion;
\r
54 // Run the update checker.
\r
57 // Now load the users default if required.
\r
60 // Display the quick start window if required.
\r
63 //MessageBox.Show(System.Environment.OSVersion.Version.ToString());
\r
67 public void showSplash(object sender)
\r
69 Form splash = new frmSplashScreen();
\r
75 public void loadUserDefaults()
\r
79 if (Properties.Settings.Default.defaultSettings == "Checked")
\r
82 text_source.Text = Properties.Settings.Default.DVDSource;
\r
83 drp_dvdtitle.Text = Properties.Settings.Default.DVDTitle;
\r
84 drop_chapterStart.Text = Properties.Settings.Default.ChapterStart;
\r
85 drop_chapterFinish.Text = Properties.Settings.Default.ChapterFinish;
\r
88 text_destination.Text = Properties.Settings.Default.VideoDest;
\r
89 drp_videoEncoder.Text = Properties.Settings.Default.VideoEncoder;
\r
90 drp_audioCodec.Text = Properties.Settings.Default.AudioEncoder;
\r
91 text_width.Text = Properties.Settings.Default.Width;
\r
92 text_height.Text = Properties.Settings.Default.Height;
\r
94 // Picture Settings Tab
\r
95 drp_crop.Text = Properties.Settings.Default.CroppingOption;
\r
96 text_top.Text = Properties.Settings.Default.CropTop;
\r
97 text_bottom.Text = Properties.Settings.Default.CropBottom;
\r
98 text_left.Text = Properties.Settings.Default.CropLeft;
\r
99 text_right.Text = Properties.Settings.Default.CropRight;
\r
100 drp_subtitle.Text = Properties.Settings.Default.Subtitles;
\r
102 // Video Settings Tab
\r
103 text_bitrate.Text = Properties.Settings.Default.VideoBitrate;
\r
104 text_filesize.Text = Properties.Settings.Default.VideoFilesize;
\r
105 slider_videoQuality.Value = Properties.Settings.Default.VideoQuality;
\r
107 if (Properties.Settings.Default.TwoPass == "Checked")
\r
109 check_2PassEncode.CheckState = CheckState.Checked;
\r
112 drp_deInterlace_option.Text = Properties.Settings.Default.DeInterlace;
\r
113 drp_deNoise.Text = Properties.Settings.Default.denoise;
\r
115 if (Properties.Settings.Default.detelecine == "Checked")
\r
117 check_detelecine.CheckState = CheckState.Checked;
\r
120 if (Properties.Settings.Default.detelecine == "Checked")
\r
122 check_deblock.CheckState = CheckState.Checked;
\r
126 if (Properties.Settings.Default.Grayscale == "Checked")
\r
128 check_grayscale.CheckState = CheckState.Checked;
\r
131 drp_videoFramerate.Text = Properties.Settings.Default.Framerate;
\r
133 if (Properties.Settings.Default.PixelRatio == "Checked")
\r
135 CheckPixelRatio.CheckState = CheckState.Checked;
\r
137 if (Properties.Settings.Default.turboFirstPass == "Checked")
\r
139 check_turbo.CheckState = CheckState.Checked;
\r
141 if (Properties.Settings.Default.largeFile == "Checked")
\r
143 check_largeFile.CheckState = CheckState.Checked;
\r
145 // Audio Settings Tab
\r
146 drp_audioBitrate.Text = Properties.Settings.Default.AudioBitrate;
\r
147 drp_audioSampleRate.Text = Properties.Settings.Default.AudioSampleRate;
\r
148 drp_audioChannels.Text = Properties.Settings.Default.AudioChannels;
\r
151 if (Properties.Settings.Default.CRF == "Checked")
\r
153 CheckCRF.CheckState = CheckState.Checked;
\r
155 rtf_h264advanced.Text = Properties.Settings.Default.H264;
\r
160 // No real need to alert the user. Try/Catch only in just incase there is a problem reading the settings xml file.
\r
164 public void updateCheck()
\r
166 if (Properties.Settings.Default.updateStatus == "Checked")
\r
170 String updateFile = Properties.Settings.Default.updateFile;
\r
171 WebClient client = new WebClient();
\r
172 String data = client.DownloadString(updateFile);
\r
173 String[] versionData = data.Split('\n');
\r
175 if ((versionData[0] != Properties.Settings.Default.GuiVersion) || (versionData[1] != Properties.Settings.Default.CliVersion))
\r
177 lbl_update.Visible = true;
\r
182 // Silently ignore the error
\r
187 public void quickStart()
\r
189 if ((Properties.Settings.Default.QuickStartWindow == "Checked") || (Properties.Settings.Default.QuickStartWindow == ""))
\r
191 frmQuickStart quickstart = new frmQuickStart();
\r
192 quickstart.ShowDialog();
\r
197 // --------------------------------------------------------------
\r
198 // The main Menu bar.
\r
199 // --------------------------------------------------------------
\r
203 private void mnu_open_Click(object sender, EventArgs e)
\r
206 File_Open.ShowDialog();
\r
207 filename = File_Open.FileName;
\r
208 if (filename != "")
\r
212 // Create StreamReader & open file
\r
213 StreamReader line = new StreamReader(filename);
\r
214 string temporyLine; // Used for reading the line into a varible before processing on the checkState items below.
\r
216 // Read in the data and set the correct GUI component with the setting.
\r
217 text_source.Text = line.ReadLine();
\r
218 drp_dvdtitle.Text = line.ReadLine();
\r
219 drop_chapterStart.Text = line.ReadLine();
\r
220 drop_chapterFinish.Text = line.ReadLine();
\r
221 text_destination.Text = line.ReadLine();
\r
222 drp_videoEncoder.Text = line.ReadLine();
\r
223 drp_audioCodec.Text = line.ReadLine();
\r
224 text_width.Text = line.ReadLine();
\r
225 text_height.Text = line.ReadLine();
\r
226 text_top.Text = line.ReadLine();
\r
227 text_bottom.Text = line.ReadLine();
\r
228 text_left.Text = line.ReadLine();
\r
229 text_right.Text = line.ReadLine();
\r
230 drp_subtitle.Text = line.ReadLine();
\r
231 text_bitrate.Text = line.ReadLine();
\r
232 text_filesize.Text = line.ReadLine();
\r
233 slider_videoQuality.Value = int.Parse(line.ReadLine());
\r
235 temporyLine = line.ReadLine();
\r
236 if (temporyLine == "Checked")
\r
238 check_2PassEncode.CheckState = CheckState.Checked;
\r
241 drp_deInterlace_option.Text = line.ReadLine();
\r
243 temporyLine = line.ReadLine();
\r
244 if (temporyLine == "Checked")
\r
246 check_grayscale.CheckState = CheckState.Checked;
\r
249 drp_videoFramerate.Text = line.ReadLine();
\r
251 temporyLine = line.ReadLine();
\r
252 if (temporyLine == "Checked")
\r
254 Check_ChapterMarkers.CheckState = CheckState.Checked;
\r
257 temporyLine = line.ReadLine();
\r
258 if (temporyLine == "Checked")
\r
260 CheckPixelRatio.CheckState = CheckState.Checked;
\r
263 temporyLine = line.ReadLine();
\r
264 if (temporyLine == "Checked")
\r
266 check_turbo.CheckState = CheckState.Checked;
\r
269 temporyLine = line.ReadLine();
\r
270 if (temporyLine == "Checked")
\r
272 check_largeFile.CheckState = CheckState.Checked;
\r
275 drp_audioBitrate.Text = line.ReadLine();
\r
276 drp_audioSampleRate.Text = line.ReadLine();
\r
277 drp_audioChannels.Text = line.ReadLine();
\r
278 drp_audioMixDown.Text = line.ReadLine();
\r
280 // Advanced H264 Options
\r
281 temporyLine = line.ReadLine();
\r
282 if (temporyLine == "Checked")
\r
284 CheckCRF.CheckState = CheckState.Checked;
\r
286 rtf_h264advanced.Text = line.ReadLine();
\r
288 // Close the stream
\r
292 // Fix for SliderValue not appearing when Opening saved file
\r
293 SliderValue.Text = slider_videoQuality.Value + "%";
\r
295 } catch (Exception){
\r
296 MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
\r
301 private void mnu_save_Click(object sender, EventArgs e)
\r
305 File_Save.ShowDialog();
\r
306 filename = File_Save.FileName;
\r
307 if (filename != "")
\r
311 // Create a StreamWriter and open the file
\r
312 StreamWriter line = new StreamWriter(filename);
\r
315 line.WriteLine(text_source.Text);
\r
316 line.WriteLine(drp_dvdtitle.Text);
\r
317 line.WriteLine(drop_chapterStart.Text);
\r
318 line.WriteLine(drop_chapterFinish.Text);
\r
320 line.WriteLine(text_destination.Text);
\r
321 line.WriteLine(drp_videoEncoder.Text);
\r
322 line.WriteLine(drp_audioCodec.Text);
\r
323 line.WriteLine(text_width.Text);
\r
324 line.WriteLine(text_height.Text);
\r
325 //Picture Settings Tab
\r
326 line.WriteLine(text_top.Text);
\r
327 line.WriteLine(text_bottom.Text);
\r
328 line.WriteLine(text_left.Text);
\r
329 line.WriteLine(text_right.Text);
\r
330 line.WriteLine(drp_subtitle.Text);
\r
331 //Video Settings Tab
\r
332 line.WriteLine(text_bitrate.Text);
\r
333 line.WriteLine(text_filesize.Text);
\r
334 line.WriteLine(slider_videoQuality.Value.ToString());
\r
335 line.WriteLine(check_2PassEncode.CheckState.ToString());
\r
336 line.WriteLine(drp_deInterlace_option.Text);
\r
337 line.WriteLine(check_grayscale.CheckState.ToString());
\r
338 line.WriteLine(drp_videoFramerate.Text);
\r
339 line.WriteLine(Check_ChapterMarkers.CheckState.ToString());
\r
340 line.WriteLine(CheckPixelRatio.CheckState.ToString());
\r
341 line.WriteLine(check_turbo.CheckState.ToString());
\r
342 line.WriteLine(check_largeFile.CheckState.ToString());
\r
343 //Audio Settings Tab
\r
344 line.WriteLine(drp_audioBitrate.Text);
\r
345 line.WriteLine(drp_audioSampleRate.Text);
\r
346 line.WriteLine(drp_audioChannels.Text);
\r
347 line.WriteLine(drp_audioMixDown.Text);
\r
349 line.WriteLine(CheckCRF.CheckState.ToString());
\r
350 line.WriteLine(rtf_h264advanced.Text);
\r
351 // close the stream
\r
353 MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
357 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
363 private void mnu_update_Click(object sender, EventArgs e)
\r
365 Form Update = new frmUpdate();
\r
366 Update.ShowDialog();
\r
369 private void mnu_exit_Click(object sender, EventArgs e)
\r
378 private void mnu_encode_Click(object sender, EventArgs e)
\r
384 private void mnu_viewDVDdata_Click(object sender, EventArgs e)
\r
388 dvdInfoWindow.Show();
\r
393 // No action required
\r
396 // BUG *******************************************************
\r
397 // Cross-thread operation not valid: Control 'rtf_dvdInfo' accessed from a thread other than the thread it was created on.
\r
398 // This happens when the DVD is scanned and this item is then selected.
\r
399 // If this item is selected so a blank copy of the window appears, then a DVD is scanned, there is no cross-thread issue.
\r
400 // NOTE: Try/catch added to prevent final build crashing.
\r
401 // NOTE2: Included a quick fix in frmMain(). Simply show and hide the window when starting the app.
\r
402 // Note3: Suspect the problem lies with line 30.
\r
403 // ***********************************************************
\r
407 private void mnu_options_Click(object sender, EventArgs e)
\r
409 Form Options = new frmOptions();
\r
410 Options.ShowDialog();
\r
415 #region Presets Menu
\r
417 private void mnu_preset_ipod133_Click(object sender, EventArgs e)
\r
419 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
420 text_width.Text = "640";
\r
421 text_height.Text = "Auto";
\r
422 drp_videoEncoder.Text = "H.264 (iPod)";
\r
423 text_bitrate.Text = "1000";
\r
424 text_filesize.Text = "";
\r
425 slider_videoQuality.Value = 0;
\r
426 SliderValue.Text = "0%";
\r
427 drp_audioBitrate.Text = "160";
\r
428 rtf_h264advanced.Text = "";
\r
429 drp_crop.Text = "No Crop";
\r
434 private void mnu_appleTv_Click(object sender, EventArgs e)
\r
436 text_width.Text = "";
\r
437 text_height.Text = "";
\r
438 drp_videoEncoder.Text = "H.264";
\r
439 text_bitrate.Text = "3000";
\r
440 text_filesize.Text = "";
\r
441 slider_videoQuality.Value = 0;
\r
442 SliderValue.Text = "0%";
\r
443 drp_audioBitrate.Text = "160";
\r
444 CheckPixelRatio.CheckState = CheckState.Checked;
\r
445 drp_audioSampleRate.Text = "48";
\r
446 rtf_h264advanced.Text = "bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:no-dct-decimate=1:trellis=2";
\r
447 drp_crop.Text = "No Crop";
\r
451 private void mnu_presetPS3_Click(object sender, EventArgs e)
\r
453 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
454 text_width.Text = "";
\r
455 text_height.Text = "";
\r
456 drp_videoEncoder.Text = "H.264";
\r
457 text_bitrate.Text = "3000";
\r
458 text_filesize.Text = "";
\r
459 slider_videoQuality.Value = 0;
\r
460 SliderValue.Text = "0%";
\r
461 drp_audioBitrate.Text = "160";
\r
462 CheckPixelRatio.CheckState = CheckState.Checked;
\r
463 drp_audioSampleRate.Text = "48";
\r
464 rtf_h264advanced.Text = "level=41";
\r
465 drp_crop.Text = "No Crop";
\r
468 //------------------------------NEW PRESETS START HERE---------------------------
\r
469 private void mnu_normal_Click(object sender, EventArgs e)
\r
471 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
472 text_width.Text = "";
\r
473 text_height.Text = "";
\r
474 drp_videoEncoder.Text = "H.264";
\r
475 text_bitrate.Text = "3000";
\r
476 text_filesize.Text = "";
\r
477 slider_videoQuality.Value = 0;
\r
478 SliderValue.Text = "0%";
\r
479 drp_audioBitrate.Text = "160";
\r
480 CheckPixelRatio.CheckState = CheckState.Checked;
\r
481 drp_audioSampleRate.Text = "48";
\r
482 rtf_h264advanced.Text = "level=41";
\r
483 drp_crop.Text = "No Crop";
\r
486 private void mnu_Classic_Click(object sender, EventArgs e)
\r
488 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
489 text_width.Text = "";
\r
490 text_height.Text = "";
\r
491 drp_videoEncoder.Text = "H.264";
\r
492 text_bitrate.Text = "3000";
\r
493 text_filesize.Text = "";
\r
494 slider_videoQuality.Value = 0;
\r
495 SliderValue.Text = "0%";
\r
496 drp_audioBitrate.Text = "160";
\r
497 CheckPixelRatio.CheckState = CheckState.Checked;
\r
498 drp_audioSampleRate.Text = "48";
\r
499 rtf_h264advanced.Text = "level=41";
\r
500 drp_crop.Text = "No Crop";
\r
503 private void mnu_film_Click(object sender, EventArgs e)
\r
505 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
506 text_width.Text = "";
\r
507 text_height.Text = "";
\r
508 drp_videoEncoder.Text = "H.264";
\r
509 text_bitrate.Text = "3000";
\r
510 text_filesize.Text = "";
\r
511 slider_videoQuality.Value = 0;
\r
512 SliderValue.Text = "0%";
\r
513 drp_audioBitrate.Text = "160";
\r
514 CheckPixelRatio.CheckState = CheckState.Checked;
\r
515 drp_audioSampleRate.Text = "48";
\r
516 rtf_h264advanced.Text = "level=41";
\r
517 drp_crop.Text = "No Crop";
\r
520 private void mnu_television_Click(object sender, EventArgs e)
\r
522 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
523 text_width.Text = "";
\r
524 text_height.Text = "";
\r
525 drp_videoEncoder.Text = "H.264";
\r
526 text_bitrate.Text = "3000";
\r
527 text_filesize.Text = "";
\r
528 slider_videoQuality.Value = 0;
\r
529 SliderValue.Text = "0%";
\r
530 drp_audioBitrate.Text = "160";
\r
531 CheckPixelRatio.CheckState = CheckState.Checked;
\r
532 drp_audioSampleRate.Text = "48";
\r
533 rtf_h264advanced.Text = "level=41";
\r
534 drp_crop.Text = "No Crop";
\r
537 private void mnu_qt_Click(object sender, EventArgs e)
\r
539 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
540 text_width.Text = "";
\r
541 text_height.Text = "";
\r
542 drp_videoEncoder.Text = "H.264";
\r
543 text_bitrate.Text = "3000";
\r
544 text_filesize.Text = "";
\r
545 slider_videoQuality.Value = 0;
\r
546 SliderValue.Text = "0%";
\r
547 drp_audioBitrate.Text = "160";
\r
548 CheckPixelRatio.CheckState = CheckState.Checked;
\r
549 drp_audioSampleRate.Text = "48";
\r
550 rtf_h264advanced.Text = "level=41";
\r
551 drp_crop.Text = "No Crop";
\r
554 private void mnu_psp_Click(object sender, EventArgs e)
\r
556 CheckPixelRatio.CheckState = CheckState.Unchecked;
\r
557 text_width.Text = "";
\r
558 text_height.Text = "";
\r
559 drp_videoEncoder.Text = "H.264";
\r
560 text_bitrate.Text = "3000";
\r
561 text_filesize.Text = "";
\r
562 slider_videoQuality.Value = 0;
\r
563 SliderValue.Text = "0%";
\r
564 drp_audioBitrate.Text = "160";
\r
565 CheckPixelRatio.CheckState = CheckState.Checked;
\r
566 drp_audioSampleRate.Text = "48";
\r
567 rtf_h264advanced.Text = "level=41";
\r
568 drp_crop.Text = "No Crop";
\r
572 private void mnu_ProgramDefaultOptions_Click(object sender, EventArgs e)
\r
575 Properties.Settings.Default.DVDSource = text_source.Text;
\r
576 Properties.Settings.Default.DVDTitle = drp_dvdtitle.Text;
\r
577 Properties.Settings.Default.ChapterStart = drop_chapterStart.Text;
\r
578 Properties.Settings.Default.ChapterFinish = drop_chapterFinish.Text;
\r
580 Properties.Settings.Default.VideoDest = text_destination.Text;
\r
581 Properties.Settings.Default.VideoEncoder = drp_videoEncoder.Text;
\r
582 Properties.Settings.Default.AudioEncoder = drp_audioCodec.Text;
\r
583 Properties.Settings.Default.Width = text_width.Text;
\r
584 Properties.Settings.Default.Height = text_height.Text;
\r
585 //Picture Settings Tab
\r
586 Properties.Settings.Default.CroppingOption = drp_crop.Text;
\r
587 Properties.Settings.Default.CropTop = text_top.Text;
\r
588 Properties.Settings.Default.CropBottom = text_bottom.Text;
\r
589 Properties.Settings.Default.CropLeft = text_left.Text;
\r
590 Properties.Settings.Default.CropRight = text_right.Text;
\r
591 Properties.Settings.Default.Subtitles = drp_subtitle.Text;
\r
592 //Video Settings Tab
\r
593 Properties.Settings.Default.VideoBitrate = text_bitrate.Text;
\r
594 Properties.Settings.Default.VideoFilesize = text_filesize.Text;
\r
595 Properties.Settings.Default.VideoQuality = slider_videoQuality.Value;
\r
596 Properties.Settings.Default.TwoPass = check_2PassEncode.CheckState.ToString();
\r
597 Properties.Settings.Default.DeInterlace = drp_deInterlace_option.Text;
\r
598 Properties.Settings.Default.Grayscale = check_grayscale.CheckState.ToString();
\r
599 Properties.Settings.Default.Framerate = drp_videoFramerate.Text;
\r
600 Properties.Settings.Default.PixelRatio = CheckPixelRatio.CheckState.ToString();
\r
601 Properties.Settings.Default.turboFirstPass = check_turbo.CheckState.ToString();
\r
602 Properties.Settings.Default.largeFile = check_largeFile.CheckState.ToString();
\r
603 Properties.Settings.Default.detelecine = check_detelecine.CheckState.ToString();
\r
604 Properties.Settings.Default.denoise = drp_deNoise.Text;
\r
605 Properties.Settings.Default.deblock = check_deblock.CheckState.ToString();
\r
606 //Audio Settings Tab
\r
607 Properties.Settings.Default.AudioBitrate = drp_audioBitrate.Text;
\r
608 Properties.Settings.Default.AudioSampleRate = drp_audioSampleRate.Text;
\r
609 Properties.Settings.Default.AudioChannels = drp_audioChannels.Text;
\r
611 Properties.Settings.Default.CRF = CheckCRF.CheckState.ToString();
\r
612 Properties.Settings.Default.H264 = rtf_h264advanced.Text;
\r
613 Properties.Settings.Default.Save();
\r
620 private void mnu_wiki_Click(object sender, EventArgs e)
\r
622 Process.Start("http://handbrake.m0k.org/trac");
\r
625 private void mnu_onlineDocs_Click(object sender, EventArgs e)
\r
627 Process.Start("http://handbrake.m0k.org/?page_id=11");
\r
630 private void mnu_faq_Click(object sender, EventArgs e)
\r
632 Process.Start("http://handbrake.m0k.org/trac/wiki/WindowsGuiFaq");
\r
635 private void mnu_homepage_Click(object sender, EventArgs e)
\r
637 Process.Start("http://handbrake.m0k.org");
\r
640 private void mnu_forum_Click(object sender, EventArgs e)
\r
642 Process.Start("http://handbrake.m0k.org/forum");
\r
645 private void mnu_about_Click(object sender, EventArgs e)
\r
647 Form About = new frmAbout();
\r
648 About.ShowDialog();
\r
653 // --------------------------------------------------------------
\r
654 // Buttons on the main Window
\r
655 // --------------------------------------------------------------
\r
658 private void btn_Browse_Click(object sender, EventArgs e)
\r
660 String filename ="";
\r
661 text_source.Text = "";
\r
663 if (RadioDVD.Checked)
\r
665 DVD_Open.ShowDialog();
\r
666 filename = DVD_Open.SelectedPath;
\r
667 if (filename != "")
\r
669 Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
\r
670 text_source.Text = filename;
\r
671 frmRD.ShowDialog();
\r
676 ISO_Open.ShowDialog();
\r
677 filename = ISO_Open.FileName;
\r
678 if (filename != "")
\r
680 Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
\r
681 text_source.Text = filename;
\r
682 frmRD.ShowDialog();
\r
686 // Check if there was titles in the dvd title dropdown
\r
687 if (filename == "")
\r
689 text_source.Text = "Click 'Browse' to continue";
\r
692 if (drp_dvdtitle.Items.Count == 0)
\r
694 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
698 private void btn_destBrowse_Click(object sender, EventArgs e)
\r
700 // TODO: Need to write some code to check if there is a reasonable amount of disk space left.
\r
702 DVD_Save.ShowDialog();
\r
703 text_destination.Text = DVD_Save.FileName;
\r
705 if (Check_ChapterMarkers.Checked)
\r
707 string destination = text_destination.Text;
\r
708 destination = destination.Replace(".mp4", ".m4v");
\r
709 text_destination.Text = destination;
\r
713 private void btn_h264Clear_Click(object sender, EventArgs e)
\r
715 rtf_h264advanced.Text = "";
\r
718 private void GenerateQuery_Click(object sender, EventArgs e)
\r
720 String query = GenerateTheQuery();
\r
721 QueryEditorText.Text = query;
\r
724 private void btn_ClearQuery_Click(object sender, EventArgs e)
\r
726 QueryEditorText.Text = "";
\r
729 private void btn_queue_Click(object sender, EventArgs e)
\r
731 if (text_destination.Text != "" && text_source.Text != "")
\r
734 if (QueryEditorText.Text == "")
\r
736 query = GenerateTheQuery();
\r
740 query = QueryEditorText.Text;
\r
742 queueWindow.list_queue.Items.Add(query);
\r
743 queueWindow.Show();
\r
747 MessageBox.Show("No Source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
751 private void showQueue()
\r
753 queueWindow.Show();
\r
758 //---------------------------------------------------
\r
759 // Encode / Cancel Buttons
\r
760 // Encode Progress Text Handler
\r
761 //---------------------------------------------------
\r
765 Functions.CLI process = new Functions.CLI();
\r
767 private void btn_encode_Click(object sender, EventArgs e)
\r
769 btn_eCancel.Enabled = true;
\r
771 lbl_encode.Visible = false;
\r
773 if (QueryEditorText.Text == "")
\r
775 query = GenerateTheQuery();
\r
779 query = QueryEditorText.Text;
\r
782 ThreadPool.QueueUserWorkItem(procMonitor, query);
\r
783 lbl_encode.Text = "Encoding Started";
\r
786 private void btn_eCancel_Click(object sender, EventArgs e)
\r
790 lbl_encode.Text = "Encoding Canceled";
\r
793 private void procMonitor(object state)
\r
795 // Make sure we are not already encoding and if we are then display an error.
\r
796 if (hbProc != null)
\r
798 MessageBox.Show("Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
802 hbProc = process.runCli(this, (string)state, false, false, false, false);
\r
803 MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
804 hbProc.WaitForExit();
\r
809 //*****************************************************************************************
\r
811 // When the below code is used and standard error is set to true, hbcli is outputing a
\r
812 // video stream which has mild corruption issues every few seconds.
\r
813 // Maybe an issue with the Parser cauing the CLI to hickup/pause?
\r
814 //*****************************************************************************************
\r
817 /*Parsing.Parser encode = new Parsing.Parser(hbProc.StandardError.BaseStream);
\r
818 encode.OnEncodeProgress += encode_OnEncodeProgress;
\r
819 while (!encode.EndOfStream)
\r
824 hbProc.WaitForExit();
\r
825 process.closeCLI();
\r
833 MessageBox.Show("The encode process has now ended.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
838 private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
\r
840 if (this.InvokeRequired)
\r
842 this.BeginInvoke(new Parsing.EncodeProgressEventHandler(encode_OnEncodeProgress),
\r
843 new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });
\r
846 lbl_encode.Text = string.Format("Encode Progress: {0}%, FPS: {1}, Avg FPS: {2}, Time Remaining: {3} ", PercentComplete, CurrentFps, AverageFps, TimeRemaining);
\r
851 //---------------------------------------------------
\r
852 // Items that require actions on frmMain
\r
853 //---------------------------------------------------
\r
855 #region frmMain Actions
\r
857 private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)
\r
859 lbl_chptWarn.Visible = false;
\r
860 QueryEditorText.Text = "";
\r
861 if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
\r
865 int chapterFinish = int.Parse(drop_chapterFinish.Text);
\r
866 int chapterStart = int.Parse(drop_chapterStart.Text);
\r
868 if (chapterFinish < chapterStart)
\r
870 lbl_chptWarn.Visible = true;
\r
871 lbl_chptWarn.Text = "Invalid Chapter Range!";
\r
876 lbl_chptWarn.Visible = true;
\r
877 lbl_chptWarn.Text = "Invalid Chapter Range!";
\r
884 private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)
\r
886 lbl_chptWarn.Visible = false;
\r
887 QueryEditorText.Text = "";
\r
888 if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
\r
892 int chapterFinish = int.Parse(drop_chapterFinish.Text);
\r
893 int chapterStart = int.Parse(drop_chapterStart.Text);
\r
895 if (chapterFinish < chapterStart)
\r
897 lbl_chptWarn.Visible = true;
\r
898 lbl_chptWarn.Text = "Invalid Chapter Range!";
\r
903 lbl_chptWarn.Visible = true;
\r
904 lbl_chptWarn.Text = "Invalid Chapter Range!";
\r
909 private void text_bitrate_TextChanged(object sender, EventArgs e)
\r
911 text_filesize.Text = "";
\r
912 slider_videoQuality.Value = 0;
\r
913 SliderValue.Text = "0%";
\r
914 CheckCRF.CheckState = CheckState.Unchecked;
\r
915 CheckCRF.Enabled = false;
\r
918 private void text_filesize_TextChanged(object sender, EventArgs e)
\r
920 text_bitrate.Text = "";
\r
921 slider_videoQuality.Value = 0;
\r
922 SliderValue.Text = "0%";
\r
923 CheckCRF.CheckState = CheckState.Unchecked;
\r
924 CheckCRF.Enabled = false;
\r
927 private void slider_videoQuality_Scroll(object sender, EventArgs e)
\r
929 SliderValue.Text = slider_videoQuality.Value.ToString() + "%";
\r
930 text_bitrate.Text = "";
\r
931 text_filesize.Text = "";
\r
932 CheckCRF.Enabled = true;
\r
935 private void label_h264_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
\r
937 Process.Start("http://handbrake.m0k.org/trac/wiki/x264Options");
\r
940 private void text_width_TextChanged(object sender, EventArgs e)
\r
945 if (CheckPixelRatio.Checked)
\r
947 text_width.Text = "";
\r
948 text_width.BackColor = Color.White;
\r
952 if ((int.Parse(text_width.Text) % 16) != 0)
\r
954 text_width.BackColor = Color.LightCoral;
\r
958 text_width.BackColor = Color.LightGreen;
\r
962 if (lbl_Aspect.Text != "Select a Title")
\r
964 double height = int.Parse(text_width.Text) / double.Parse(lbl_Aspect.Text);
\r
965 double mod16 = height % 16;
\r
966 height = height - mod16;
\r
968 if (text_width.Text == "")
\r
970 text_height.Text = "";
\r
971 text_width.BackColor = Color.White;
\r
975 text_height.Text = height.ToString();
\r
981 // No need to throw an error here.
\r
987 private void text_height_TextChanged(object sender, EventArgs e)
\r
991 if (text_height.Text != "Auto")
\r
993 if (CheckPixelRatio.Checked)
\r
995 text_height.Text = "";
\r
996 text_width.BackColor = Color.White;
\r
1000 if ((int.Parse(text_height.Text) % 16) != 0)
\r
1002 text_height.BackColor = Color.LightCoral;
\r
1006 text_height.BackColor = Color.LightGreen;
\r
1010 } catch(Exception){
\r
1011 // No need to alert the user.
\r
1015 private void drp_crop_SelectedIndexChanged(object sender, EventArgs e)
\r
1017 if ((string)drp_crop.SelectedItem == "Manual")
\r
1019 text_left.Enabled = true;
\r
1020 text_right.Enabled = true;
\r
1021 text_top.Enabled = true;
\r
1022 text_bottom.Enabled = true;
\r
1025 if ((string)drp_crop.SelectedItem == "Auto Crop")
\r
1027 text_left.Enabled = false;
\r
1028 text_right.Enabled = false;
\r
1029 text_top.Enabled = false;
\r
1030 text_bottom.Enabled = false;
\r
1031 text_left.Text = "";
\r
1032 text_right.Text = "";
\r
1033 text_top.Text = "";
\r
1034 text_bottom.Text = "";
\r
1036 if (lbl_RecomendedCrop.Text != "Select a Title")
\r
1038 string[] temp = new string[4];
\r
1039 temp = lbl_RecomendedCrop.Text.Split('/');
\r
1040 text_left.Text = temp[2];
\r
1041 text_right.Text = temp[3];
\r
1042 text_top.Text = temp[0];
\r
1043 text_bottom.Text = temp[1];
\r
1047 if ((string)drp_crop.SelectedItem == "No Crop")
\r
1049 text_left.Enabled = false;
\r
1050 text_right.Enabled = false;
\r
1051 text_top.Enabled = false;
\r
1052 text_bottom.Enabled = false;
\r
1053 text_left.Text = "0";
\r
1054 text_right.Text = "0";
\r
1055 text_top.Text = "0";
\r
1056 text_bottom.Text = "0";
\r
1061 private void CheckPixelRatio_CheckedChanged(object sender, EventArgs e)
\r
1063 text_width.Text = "";
\r
1064 text_height.Text = "";
\r
1065 text_width.BackColor = Color.White;
\r
1066 text_height.BackColor = Color.White;
\r
1069 private void drp_dvdtitle_Click(object sender, EventArgs e)
\r
1071 if (drp_dvdtitle.Items.Count == 1)
\r
1073 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
1077 private void drp_audioCodec_SelectedIndexChanged(object sender, EventArgs e)
\r
1080 //CLI Audio mixdown Names: mono stereo dpl1 dpl2 6ch
\r
1082 drp_audioMixDown.Items.Clear();
\r
1084 if (drp_audioCodec.Text == "AAC")
\r
1086 drp_audioMixDown.Items.Clear();
\r
1087 drp_audioMixDown.Items.Add("Mono");
\r
1088 drp_audioMixDown.Items.Add("Stereo");
\r
1089 drp_audioMixDown.Items.Add("Dolby Surround");
\r
1090 drp_audioMixDown.Items.Add("Dolby Pro Logic II");
\r
1091 drp_audioMixDown.Items.Add("6 Channel Discrete");
\r
1093 drp_audioBitrate.Items.Clear();
\r
1094 drp_audioBitrate.Items.Add("32");
\r
1095 drp_audioBitrate.Items.Add("40");
\r
1096 drp_audioBitrate.Items.Add("48");
\r
1097 drp_audioBitrate.Items.Add("56");
\r
1098 drp_audioBitrate.Items.Add("64");
\r
1099 drp_audioBitrate.Items.Add("80");
\r
1100 drp_audioBitrate.Items.Add("86");
\r
1101 drp_audioBitrate.Items.Add("112");
\r
1102 drp_audioBitrate.Items.Add("128");
\r
1103 drp_audioBitrate.Items.Add("160");
\r
1108 drp_audioMixDown.Items.Clear();
\r
1109 drp_audioMixDown.Items.Add("Stereo");
\r
1110 drp_audioMixDown.Items.Add("Dolby Surround");
\r
1111 drp_audioMixDown.Items.Add("Dolby Pro Logic II");
\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
1132 private void drp_audioMixDown_SelectedIndexChanged(object sender, EventArgs e)
\r
1134 if (drp_audioCodec.Text == "AAC")
\r
1136 if (drp_audioMixDown.Text == "6 Channel Discrete")
\r
1139 drp_audioBitrate.Items.Clear();
\r
1140 drp_audioBitrate.Items.Add("32");
\r
1141 drp_audioBitrate.Items.Add("40");
\r
1142 drp_audioBitrate.Items.Add("48");
\r
1143 drp_audioBitrate.Items.Add("56");
\r
1144 drp_audioBitrate.Items.Add("64");
\r
1145 drp_audioBitrate.Items.Add("80");
\r
1146 drp_audioBitrate.Items.Add("86");
\r
1147 drp_audioBitrate.Items.Add("112");
\r
1148 drp_audioBitrate.Items.Add("128");
\r
1149 drp_audioBitrate.Items.Add("160");
\r
1150 drp_audioBitrate.Items.Add("192");
\r
1151 drp_audioBitrate.Items.Add("224");
\r
1152 drp_audioBitrate.Items.Add("256");
\r
1153 drp_audioBitrate.Items.Add("320");
\r
1154 drp_audioBitrate.Items.Add("384");
\r
1159 private void Check_ChapterMarkers_CheckedChanged(object sender, EventArgs e)
\r
1161 if (Check_ChapterMarkers.Checked)
\r
1163 string destination = text_destination.Text;
\r
1164 destination = destination.Replace(".mp4", ".m4v");
\r
1165 text_destination.Text = destination;
\r
1169 private void check_largeFile_CheckedChanged(object sender, EventArgs e)
\r
1171 if (!text_destination.Text.Contains(".mp4"))
\r
1173 MessageBox.Show("This option is only compatible with the mp4 file container.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
1174 check_largeFile.CheckState = CheckState.Unchecked;
\r
1178 private void drp_videoEncoder_SelectedIndexChanged(object sender, EventArgs e)
\r
1180 //Turn off some options which are H.264 only when the user selects a non h.264 encoder
\r
1181 if (!drp_videoEncoder.Text.Contains("H.264"))
\r
1183 check_turbo.CheckState = CheckState.Unchecked;
\r
1184 CheckCRF.CheckState = CheckState.Unchecked;
\r
1185 CheckCRF.Enabled = false;
\r
1186 check_turbo.Enabled = false;
\r
1187 h264Tab.Enabled = false;
\r
1191 CheckCRF.Enabled = true;
\r
1192 check_turbo.Enabled = true;
\r
1193 h264Tab.Enabled = true;
\r
1198 public void setStreamReader(Parsing.DVD dvd)
\r
1200 this.thisDVD = dvd;
\r
1203 private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e)
\r
1205 // Reset some values on the form
\r
1206 lbl_Aspect.Text = "Select a Title";
\r
1207 lbl_RecomendedCrop.Text = "Select a Title";
\r
1208 drop_chapterStart.Items.Clear();
\r
1209 drop_chapterFinish.Items.Clear();
\r
1210 QueryEditorText.Text = "";
\r
1212 // If the dropdown is set to automatic nothing else needs to be done.
\r
1213 // Otheriwse if its not, title data has to be loased from parsing.
\r
1214 if (drp_dvdtitle.Text != "Automatic")
\r
1216 Parsing.Title selectedTitle = drp_dvdtitle.SelectedItem as Parsing.Title;
\r
1218 // Set the Aspect Ratio
\r
1219 lbl_Aspect.Text = selectedTitle.AspectRatio.ToString();
\r
1221 // Set the Recommended Cropping values
\r
1222 lbl_RecomendedCrop.Text = string.Format("{0}/{1}/{2}/{3}", selectedTitle.AutoCropDimensions[0], selectedTitle.AutoCropDimensions[1], selectedTitle.AutoCropDimensions[2], selectedTitle.AutoCropDimensions[3]);
\r
1224 // Populate the Start chapter Dropdown
\r
1225 drop_chapterStart.Items.Clear();
\r
1226 drop_chapterStart.Items.AddRange(selectedTitle.Chapters.ToArray());
\r
1227 if (drop_chapterStart.Items.Count > 0)
\r
1229 drop_chapterStart.Text = drop_chapterStart.Items[0].ToString();
\r
1232 // Populate the Final Chapter Dropdown
\r
1233 drop_chapterFinish.Items.Clear();
\r
1234 drop_chapterFinish.Items.AddRange(selectedTitle.Chapters.ToArray());
\r
1235 if (drop_chapterFinish.Items.Count > 0)
\r
1237 drop_chapterFinish.Text = drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString();
\r
1240 // Populate the Audio Channels Dropdown
\r
1241 drp_audioChannels.Items.Clear();
\r
1242 drp_audioChannels.Items.Add("Automatic");
\r
1243 drp_audioChannels.Items.AddRange(selectedTitle.AudioTracks.ToArray());
\r
1244 if (drp_audioChannels.Items.Count > 0)
\r
1246 drp_audioChannels.Text = drp_audioChannels.Items[0].ToString();
\r
1249 // Populate the Subtitles dropdown
\r
1250 drp_subtitle.Items.Clear();
\r
1251 drp_subtitle.Items.Add("None");
\r
1252 drp_subtitle.Items.AddRange(selectedTitle.Subtitles.ToArray());
\r
1253 if (drp_subtitle.Items.Count > 0)
\r
1255 drp_subtitle.Text = drp_subtitle.Items[0].ToString();
\r
1263 * ---------------------------------------------------
\r
1265 * The query Generation function.
\r
1267 * ---------------------------------------------------
\r
1270 #region Program Functions
\r
1272 public string GenerateTheQuery()
\r
1274 string source = text_source.Text;
\r
1275 string dvdTitle = drp_dvdtitle.Text;
\r
1276 string chapterStart = drop_chapterStart.Text;
\r
1277 string chapterFinish = drop_chapterFinish.Text;
\r
1278 int totalChapters = drop_chapterFinish.Items.Count - 1;
\r
1279 string dvdChapter = "";
\r
1282 MessageBox.Show("No Source has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
1285 source = " -i " + '"' + source+ '"'; //'"'+
\r
1288 if (dvdTitle == "Automatic")
\r
1292 string[] titleInfo = dvdTitle.Split(' ');
\r
1293 dvdTitle = " -t "+ titleInfo[0];
\r
1296 if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))
\r
1298 else if (chapterFinish == chapterStart)
\r
1299 dvdChapter = " -c " + chapterStart;
\r
1301 dvdChapter = " -c " + chapterStart + "-" + chapterFinish;
\r
1303 string querySource = source+ dvdTitle+ dvdChapter;
\r
1304 // ----------------------------------------------------------------------
\r
1308 string destination = text_destination.Text;
\r
1309 string videoEncoder = drp_videoEncoder.Text;
\r
1310 string audioEncoder = drp_audioCodec.Text;
\r
1311 string width = text_width.Text;
\r
1312 string height = text_height.Text;
\r
1314 if (destination == "")
\r
1315 MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
\r
1317 destination = " -o " + '"' + destination + '"'; //'"'+
\r
1320 switch (videoEncoder)
\r
1323 videoEncoder = " -e ffmpeg";
\r
1326 videoEncoder = " -e xvid";
\r
1329 videoEncoder = " -e x264";
\r
1331 case "H.264 Baseline 1.3":
\r
1332 videoEncoder = " -e x264b13";
\r
1334 case "H.264 (iPod)":
\r
1335 videoEncoder = " -e x264b30";
\r
1338 videoEncoder = " -e x264";
\r
1342 switch (audioEncoder)
\r
1345 audioEncoder = " -E faac";
\r
1348 audioEncoder = " -E lame";
\r
1351 audioEncoder = " -E vorbis";
\r
1354 audioEncoder = " -E ac3";
\r
1357 audioEncoder = " -E faac";
\r
1362 width = " -w "+ width;
\r
1365 if (height == "Auto")
\r
1369 else if (height != "")
\r
1371 height = " -l " + height;
\r
1375 string queryDestination = destination+ videoEncoder+ audioEncoder+ width+ height;
\r
1376 // ----------------------------------------------------------------------
\r
1378 // Picture Settings Tab
\r
1380 string cropSetting = drp_crop.Text;
\r
1381 string cropTop = text_top.Text;
\r
1382 string cropBottom = text_bottom.Text;
\r
1383 string cropLeft = text_left.Text;
\r
1384 string cropRight = text_right.Text;
\r
1385 string subtitles = drp_subtitle.Text;
\r
1386 string cropOut = "";
\r
1387 string deInterlace_Option = drp_deInterlace_option.Text;
\r
1388 string deinterlace = "";
\r
1389 string grayscale = "";
\r
1390 string pixelRatio = "";
\r
1391 string ChapterMarkers = "";
\r
1392 // Returns Crop Query
\r
1394 if (cropSetting == "Auto Crop")
\r
1396 else if (cropSetting == "No Crop")
\r
1397 cropOut = " --crop 0:0:0:0 ";
\r
1399 cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
\r
1401 if (subtitles == "None")
\r
1403 else if (subtitles == "")
\r
1408 tempSub = subtitles.Split(' ');
\r
1409 subtitles = " -s "+ tempSub[0];
\r
1412 switch (deInterlace_Option)
\r
1417 case "Origional (Fast)":
\r
1418 deinterlace = " --deinterlace";
\r
1420 case "yadif (Slow)":
\r
1421 deinterlace = " --deinterlace=" + '"' + "1" + '"';
\r
1423 case "yadif + mcdeint (Slower)":
\r
1424 deinterlace = " --deinterlace=" + '"' + "1:-1:1" + '"';
\r
1426 case "yadif + mcdeint (Slowest)":
\r
1427 deinterlace = " --deinterlace=" + '"' + "3:-1:2" + '"';
\r
1430 deinterlace = " --deinterlace=";
\r
1434 if (check_grayscale.Checked)
\r
1435 grayscale = " -g ";
\r
1437 if (CheckPixelRatio.Checked)
\r
1438 pixelRatio = " -p ";
\r
1440 if (Check_ChapterMarkers.Checked)
\r
1441 ChapterMarkers = " -m ";
\r
1443 string queryPictureSettings = cropOut + subtitles + deinterlace + grayscale + pixelRatio + ChapterMarkers;
\r
1444 // ----------------------------------------------------------------------
\r
1446 // Video Settings Tab
\r
1448 string videoBitrate = text_bitrate.Text;
\r
1449 string videoFilesize = text_filesize.Text;
\r
1450 double videoQuality = slider_videoQuality.Value;
\r
1451 string vidQSetting = "";
\r
1452 string twoPassEncoding = "";
\r
1453 string videoFramerate = drp_videoFramerate.Text;
\r
1454 string turboH264 = "";
\r
1455 string largeFile = "";
\r
1456 string deblock = "";
\r
1457 string detelecine = "";
\r
1458 string denoise = "";
\r
1459 string CRF = CheckCRF.CheckState.ToString();
\r
1462 if ((CRF == "Checked"))
\r
1467 if (videoBitrate != "")
\r
1468 videoBitrate = " -b "+ videoBitrate;
\r
1470 if (videoFilesize != "")
\r
1471 videoFilesize = " -S "+ videoFilesize;
\r
1473 // Video Quality Setting
\r
1475 if ((videoQuality == 0))
\r
1479 MessageBox.Show(videoQuality.ToString());
\r
1480 videoQuality = videoQuality / 100;
\r
1481 MessageBox.Show(videoQuality.ToString());
\r
1482 if (videoQuality == 1)
\r
1484 vidQSetting = "1.0";
\r
1487 vidQSetting = " -q " + videoQuality.ToString();
\r
1490 if (check_2PassEncode.Checked)
\r
1491 twoPassEncoding = " -2 ";
\r
1493 if (videoFramerate == "Automatic")
\r
1494 videoFramerate = "";
\r
1496 videoFramerate = " -r "+ videoFramerate;
\r
1498 if (check_turbo.Checked)
\r
1499 turboH264 = " -T ";
\r
1501 if (check_largeFile.Checked)
\r
1502 largeFile = " -4 ";
\r
1504 if (check_deblock.Checked)
\r
1505 deblock = " --deblock";
\r
1507 if (check_detelecine.Checked)
\r
1508 detelecine = " --detelecine";
\r
1510 switch (drp_deNoise.Text)
\r
1516 denoise = " --denoise=3:2:3:3";
\r
1519 denoise = " --denoise=7:7:5:5";
\r
1526 string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + twoPassEncoding + videoFramerate + turboH264 + largeFile + deblock + detelecine + denoise;
\r
1527 // ----------------------------------------------------------------------
\r
1529 // Audio Settings Tab
\r
1531 string audioBitrate = drp_audioBitrate.Text;
\r
1532 string audioSampleRate = drp_audioSampleRate.Text;
\r
1533 string audioChannels = drp_audioChannels.Text;
\r
1534 string Mixdown = drp_audioMixDown.Text;
\r
1535 string SixChannelAudio = "";
\r
1537 if (audioBitrate != "")
\r
1538 audioBitrate = " -B "+ audioBitrate;
\r
1540 if (audioSampleRate != "")
\r
1541 audioSampleRate = " -R "+ audioSampleRate;
\r
1543 if (audioChannels == "Automatic")
\r
1544 audioChannels = "";
\r
1545 else if (audioChannels == "")
\r
1546 audioChannels = "";
\r
1550 tempSub = audioChannels.Split(' ');
\r
1551 audioChannels = " -a "+ tempSub[0];
\r
1563 Mixdown = "stereo";
\r
1565 case "Dolby Surround":
\r
1568 case "Dolby Pro Logic II":
\r
1571 case "6 Channel Discrete":
\r
1575 Mixdown = "stero";
\r
1579 if (Mixdown != "")
\r
1580 SixChannelAudio = " -6 "+ Mixdown;
\r
1582 SixChannelAudio = "";
\r
1584 string queryAudioSettings = audioBitrate+ audioSampleRate+ audioChannels+ SixChannelAudio;
\r
1585 // ----------------------------------------------------------------------
\r
1590 string h264Advanced = rtf_h264advanced.Text;
\r
1592 if ((h264Advanced == ""))
\r
1593 h264Advanced = "";
\r
1595 h264Advanced = " -x "+ h264Advanced;
\r
1598 string h264Settings = h264Advanced;
\r
1599 // ----------------------------------------------------------------------
\r
1601 // Processors (Program Settings)
\r
1603 string processors = Properties.Settings.Default.Processors;
\r
1604 // Number of Processors Handler
\r
1606 if (processors == "Automatic")
\r
1609 processors = " -C "+ processors+ " ";
\r
1612 string queryAdvancedSettings = processors;
\r
1613 // ----------------------------------------------------------------------
\r
1615 // Verbose option (Program Settings)
\r
1617 string verbose = "";
\r
1618 if (Properties.Settings.Default.verbose == "Checked")
\r
1621 // ----------------------------------------------------------------------
\r
1623 return querySource+ queryDestination+ queryPictureSettings+ queryVideoSettings+ h264Settings+ queryAudioSettings+ queryAdvancedSettings+ verbose;
\r
1632 // This is the END of the road ------------------------------------------------------------------------------
\r