using System.Windows.Forms;\r
using System.Net;\r
using System.IO;\r
+using System.Diagnostics;\r
+using System.Threading;\r
\r
namespace Handbrake\r
{\r
public partial class frmMain : Form\r
{\r
- public frmMain()\r
- {\r
- InitializeComponent();\r
- }\r
+ private Process hbProc;\r
+ private Parsing.DVD thisDVD;\r
\r
// --------------------------------------------------------------\r
- // onLoad - setup the program ready for use.\r
+ // Some windows that require only 1 instance.\r
// --------------------------------------------------------------\r
- private void frmMain_Load(object sender, EventArgs e)\r
+ private frmQueue queueWindow = new frmQueue(); \r
+ \r
+ // -------------------------------------------------------------- \r
+ // Stuff that needs doing on startup.\r
+ // - Load users default settings. (if required)\r
+ // - Do an update check (if required)\r
+ // --------------------------------------------------------------\r
+ private frmDvdInfo dvdInfoWindow = new frmDvdInfo();\r
+ \r
+ public frmMain()\r
{\r
+ \r
+ ThreadPool.QueueUserWorkItem(showSplash);\r
+ Thread.Sleep(3000);\r
+\r
+ InitializeComponent();\r
+\r
+ // This is a quick Hack fix for the cross-thread problem with frmDvdIndo ************************\r
+ dvdInfoWindow.Show();\r
+ dvdInfoWindow.Hide();\r
+ // **********************************************************************************************\r
+\r
+\r
// Set the Version number lable to the corect version.\r
Version.Text = "Version " + Properties.Settings.Default.GuiVersion;\r
\r
\r
// Now load the users default if required.\r
loadUserDefaults();\r
- \r
+\r
+ // Display the quick start window if required.\r
+ quickStart();\r
+ }\r
+\r
+ public void showSplash(object sender)\r
+ {\r
+ Form splash = new frmSplashScreen();\r
+ splash.Show();\r
+ Thread.Sleep(3000);\r
+ splash.Close();\r
}\r
\r
public void loadUserDefaults()\r
{\r
if (Properties.Settings.Default.defaultSettings == "Checked")\r
{\r
- //Source\r
+ // Source\r
text_source.Text = Properties.Settings.Default.DVDSource;\r
drp_dvdtitle.Text = Properties.Settings.Default.DVDTitle;\r
drop_chapterStart.Text = Properties.Settings.Default.ChapterStart;\r
drop_chapterFinish.Text = Properties.Settings.Default.ChapterFinish;\r
- //Destination\r
+\r
+ // Destination\r
text_destination.Text = Properties.Settings.Default.VideoDest;\r
drp_videoEncoder.Text = Properties.Settings.Default.VideoEncoder;\r
drp_audioCodec.Text = Properties.Settings.Default.AudioEncoder;\r
text_width.Text = Properties.Settings.Default.Width;\r
text_height.Text = Properties.Settings.Default.Height;\r
- //Picture Settings Tab\r
+\r
+ // Picture Settings Tab\r
drp_crop.Text = Properties.Settings.Default.CroppingOption;\r
text_top.Text = Properties.Settings.Default.CropTop;\r
text_bottom.Text = Properties.Settings.Default.CropBottom;\r
text_left.Text = Properties.Settings.Default.CropLeft;\r
text_right.Text = Properties.Settings.Default.CropRight;\r
drp_subtitle.Text = Properties.Settings.Default.Subtitles;\r
- //Video Settings Tab\r
+\r
+ // Video Settings Tab\r
text_bitrate.Text = Properties.Settings.Default.VideoBitrate;\r
text_filesize.Text = Properties.Settings.Default.VideoFilesize;\r
slider_videoQuality.Value = Properties.Settings.Default.VideoQuality;\r
+\r
if (Properties.Settings.Default.TwoPass == "Checked")\r
{\r
check_2PassEncode.CheckState = CheckState.Checked;\r
}\r
- if (Properties.Settings.Default.DeInterlace == "Checked")\r
+ \r
+ drp_deInterlace_option.Text = Properties.Settings.Default.DeInterlace;\r
+ drp_deNoise.Text = Properties.Settings.Default.denoise;\r
+\r
+ if (Properties.Settings.Default.detelecine == "Checked")\r
+ {\r
+ check_detelecine.CheckState = CheckState.Checked;\r
+ }\r
+\r
+ if (Properties.Settings.Default.detelecine == "Checked")\r
{\r
- check_DeInterlace.CheckState = CheckState.Checked;\r
+ check_deblock.CheckState = CheckState.Checked;\r
}\r
+\r
+\r
if (Properties.Settings.Default.Grayscale == "Checked")\r
{\r
check_grayscale.CheckState = CheckState.Checked;\r
{\r
check_largeFile.CheckState = CheckState.Checked;\r
}\r
- //Audio Settings Tab\r
+ // Audio Settings Tab\r
drp_audioBitrate.Text = Properties.Settings.Default.AudioBitrate;\r
drp_audioSampleRate.Text = Properties.Settings.Default.AudioSampleRate;\r
drp_audioChannels.Text = Properties.Settings.Default.AudioChannels;\r
- //H264 Tab\r
+\r
+ // H264 Tab\r
if (Properties.Settings.Default.CRF == "Checked")\r
{\r
CheckCRF.CheckState = CheckState.Checked;\r
{\r
if (Properties.Settings.Default.updateStatus == "Checked")\r
{\r
-\r
try\r
{\r
String updateFile = Properties.Settings.Default.updateFile;\r
lbl_update.Visible = true;\r
}\r
}\r
- //else fail displaying an error message.\r
catch (Exception)\r
{\r
- //Silently ignore the error\r
+ // Silently ignore the error\r
}\r
}\r
}\r
\r
+ public void quickStart()\r
+ {\r
+ if ((Properties.Settings.Default.QuickStartWindow == "Checked") || (Properties.Settings.Default.QuickStartWindow == ""))\r
+ {\r
+ frmQuickStart quickstart = new frmQuickStart();\r
+ quickstart.ShowDialog();\r
+ }\r
+ }\r
+\r
\r
+ // -------------------------------------------------------------- \r
+ // The main Menu bar.\r
+ // -------------------------------------------------------------- \r
\r
- // --------------------------------------------------------------\r
- // The Menu Bar\r
- // --------------------------------------------------------------\r
+ #region File Menu\r
\r
- // FILE MENU --------------------------------------------------------------\r
private void mnu_open_Click(object sender, EventArgs e)\r
{\r
string filename;\r
check_2PassEncode.CheckState = CheckState.Checked;\r
}\r
\r
- temporyLine = line.ReadLine();\r
- if (temporyLine == "Checked")\r
- {\r
- check_DeInterlace.CheckState = CheckState.Checked;\r
- }\r
+ drp_deInterlace_option.Text = line.ReadLine();\r
\r
temporyLine = line.ReadLine();\r
if (temporyLine == "Checked")\r
\r
private void mnu_save_Click(object sender, EventArgs e)\r
{\r
- // Note : All these declarations are not really needed and should be removed at some point.\r
- // The values can simply be added directly to the WriteLine statments.\r
- \r
- //Source\r
- string source = text_source.Text;\r
- string dvdTitle = drp_dvdtitle.Text;\r
- string ChapterStart = drop_chapterStart.Text;\r
- string ChapterFinish = drop_chapterFinish.Text;\r
- //Destination\r
- string destination = text_destination.Text;\r
- string videoEncoder = drp_videoEncoder.Text;\r
- string audioEncoder = drp_audioCodec.Text;\r
- string width = text_width.Text;\r
- string height = text_height.Text;\r
- //Picture Settings Tab\r
- string cropTop = text_top.Text;\r
- string cropBottom = text_bottom.Text;\r
- string cropLeft = text_left.Text;\r
- string cropRight = text_right.Text;\r
- string subtitles = drp_subtitle.Text;\r
- //Video Settings Tab\r
- string videoBitrate = text_bitrate.Text;\r
- string videoFilesize = text_filesize.Text;\r
- string videoQuality = slider_videoQuality.Value.ToString();\r
- string twoPassEncoding = check_2PassEncode.CheckState.ToString();\r
- string deinterlace = check_DeInterlace.CheckState.ToString();\r
- string grayscale = check_grayscale.CheckState.ToString();\r
- string videoFramerate = drp_videoFramerate.Text;\r
- string pixelRation = CheckPixelRatio.CheckState.ToString();\r
- string ChapterMarkers = Check_ChapterMarkers.CheckState.ToString();\r
- string turboH264 = check_turbo.CheckState.ToString();\r
- string largeFile = check_largeFile.CheckState.ToString();\r
- //Audio Settings Tab\r
- string audioBitrate = drp_audioBitrate.Text;\r
- string audioSampleRate = drp_audioSampleRate.Text;\r
- string audioChannels = drp_audioChannels.Text;\r
- string AudioMixDown = drp_audioMixDown.Text;\r
- //H264 Tab\r
- string CRF = CheckCRF.CheckState.ToString();\r
- string advH264 = rtf_h264advanced.Text;\r
\r
string filename;\r
File_Save.ShowDialog();\r
// Create a StreamWriter and open the file\r
StreamWriter line = new StreamWriter(filename);\r
\r
- line.WriteLine(source);\r
- line.WriteLine(dvdTitle);\r
- line.WriteLine(ChapterStart);\r
- line.WriteLine(ChapterFinish);\r
- line.WriteLine(destination);\r
- line.WriteLine(videoEncoder);\r
- line.WriteLine(audioEncoder);\r
- line.WriteLine(width);\r
- line.WriteLine(height);\r
- line.WriteLine(cropTop);\r
- line.WriteLine(cropBottom);\r
- line.WriteLine(cropLeft);\r
- line.WriteLine(cropRight);\r
- line.WriteLine(subtitles);\r
- line.WriteLine(videoBitrate);\r
- line.WriteLine(videoFilesize);\r
- line.WriteLine(videoQuality);\r
- line.WriteLine(twoPassEncoding);\r
- line.WriteLine(deinterlace);\r
- line.WriteLine(grayscale);\r
- line.WriteLine(videoFramerate);\r
- line.WriteLine(ChapterMarkers);\r
- line.WriteLine(pixelRation);\r
- line.WriteLine(turboH264);\r
- line.WriteLine(largeFile);\r
- line.WriteLine(audioBitrate);\r
- line.WriteLine(audioSampleRate);\r
- line.WriteLine(audioChannels);\r
- line.WriteLine(AudioMixDown);\r
- line.WriteLine(CRF);\r
- line.WriteLine(advH264);\r
- // close the stream\r
- line.Close();\r
- MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
+ //Source\r
+ line.WriteLine(text_source.Text);\r
+ line.WriteLine(drp_dvdtitle.Text);\r
+ line.WriteLine(drop_chapterStart.Text);\r
+ line.WriteLine(drop_chapterFinish.Text);\r
+ //Destination\r
+ line.WriteLine(text_destination.Text);\r
+ line.WriteLine(drp_videoEncoder.Text);\r
+ line.WriteLine(drp_audioCodec.Text);\r
+ line.WriteLine(text_width.Text);\r
+ line.WriteLine(text_height.Text);\r
+ //Picture Settings Tab\r
+ line.WriteLine(text_top.Text);\r
+ line.WriteLine(text_bottom.Text);\r
+ line.WriteLine(text_left.Text);\r
+ line.WriteLine(text_right.Text);\r
+ line.WriteLine(drp_subtitle.Text);\r
+ //Video Settings Tab\r
+ line.WriteLine(text_bitrate.Text);\r
+ line.WriteLine(text_filesize.Text);\r
+ line.WriteLine(slider_videoQuality.Value.ToString());\r
+ line.WriteLine(check_2PassEncode.CheckState.ToString());\r
+ line.WriteLine(drp_deInterlace_option.Text);\r
+ line.WriteLine(check_grayscale.CheckState.ToString());\r
+ line.WriteLine(drp_videoFramerate.Text);\r
+ line.WriteLine(Check_ChapterMarkers.CheckState.ToString());\r
+ line.WriteLine(CheckPixelRatio.CheckState.ToString());\r
+ line.WriteLine(check_turbo.CheckState.ToString());\r
+ line.WriteLine(check_largeFile.CheckState.ToString());\r
+ //Audio Settings Tab\r
+ line.WriteLine(drp_audioBitrate.Text);\r
+ line.WriteLine(drp_audioSampleRate.Text);\r
+ line.WriteLine(drp_audioChannels.Text);\r
+ line.WriteLine(drp_audioMixDown.Text);\r
+ //H264 Tab\r
+ line.WriteLine(CheckCRF.CheckState.ToString());\r
+ line.WriteLine(rtf_h264advanced.Text);\r
+ // close the stream\r
+ line.Close();\r
+ MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
}\r
catch(Exception)\r
{\r
private void mnu_update_Click(object sender, EventArgs e)\r
{\r
Form Update = new frmUpdate();\r
- Update.Show();\r
+ Update.ShowDialog();\r
}\r
\r
private void mnu_exit_Click(object sender, EventArgs e)\r
this.Close();\r
}\r
\r
- // TOOLS MENU --------------------------------------------------------------\r
+ #endregion\r
+\r
+ #region Tools Menu\r
+\r
private void mnu_encode_Click(object sender, EventArgs e)\r
{\r
- Form Queue = new frmQueue();\r
- Queue.Show();\r
+ showQueue();\r
}\r
\r
+ \r
private void mnu_viewDVDdata_Click(object sender, EventArgs e)\r
{\r
- Form DVDData = new frmDVDData();\r
- DVDData.Show();\r
+ try\r
+ {\r
+ dvdInfoWindow.Show();\r
+ \r
+ }\r
+ catch (Exception)\r
+ {\r
+ }\r
+\r
+ // BUG *******************************************************\r
+ // Cross-thread operation not valid: Control 'rtf_dvdInfo' accessed from a thread other than the thread it was created on.\r
+ // This happens when the DVD is scanned and this item is then selected.\r
+ // 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
+ // NOTE: Try/catch added to prevent final build crashing.\r
+ // NOTE2: Included a quick fix in frmMain(). Simply show and hide the window when starting the app.\r
+ // Note3: Suspect the problem lies with line 30.\r
+ // ***********************************************************\r
+\r
}\r
\r
private void mnu_options_Click(object sender, EventArgs e)\r
{\r
Form Options = new frmOptions();\r
- Options.Show();\r
+ Options.ShowDialog();\r
}\r
\r
- // PRESETS MENU --------------------------------------------------------------\r
+ #endregion\r
+\r
+ #region Presets Menu\r
+\r
private void mnu_preset_ipod133_Click(object sender, EventArgs e)\r
{\r
CheckPixelRatio.CheckState = CheckState.Unchecked;\r
text_width.Text = "640";\r
- text_height.Text = "480";\r
+ text_height.Text = "Auto";\r
drp_videoEncoder.Text = "H.264 (iPod)";\r
text_bitrate.Text = "1000";\r
text_filesize.Text = "";\r
drp_crop.Text = "No Crop";\r
}\r
\r
- private void mnu_preset_ipod178_Click(object sender, EventArgs e)\r
+\r
+\r
+ private void mnu_appleTv_Click(object sender, EventArgs e)\r
+ {\r
+ text_width.Text = "";\r
+ text_height.Text = "";\r
+ drp_videoEncoder.Text = "H.264";\r
+ text_bitrate.Text = "3000";\r
+ text_filesize.Text = "";\r
+ slider_videoQuality.Value = 0;\r
+ SliderValue.Text = "0%";\r
+ drp_audioBitrate.Text = "160";\r
+ CheckPixelRatio.CheckState = CheckState.Checked;\r
+ drp_audioSampleRate.Text = "48";\r
+ rtf_h264advanced.Text = "bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:no-dct-decimate=1:trellis=2";\r
+ drp_crop.Text = "No Crop";\r
+ \r
+ }\r
+\r
+ private void mnu_presetPS3_Click(object sender, EventArgs e)\r
{\r
CheckPixelRatio.CheckState = CheckState.Unchecked;\r
- text_width.Text = "640";\r
- text_height.Text = "352";\r
- drp_videoEncoder.Text = "H.264 (iPod)";\r
- text_bitrate.Text = "1000";\r
+ text_width.Text = "";\r
+ text_height.Text = "";\r
+ drp_videoEncoder.Text = "H.264";\r
+ text_bitrate.Text = "3000";\r
text_filesize.Text = "";\r
slider_videoQuality.Value = 0;\r
SliderValue.Text = "0%";\r
drp_audioBitrate.Text = "160";\r
- rtf_h264advanced.Text = "";\r
+ CheckPixelRatio.CheckState = CheckState.Checked;\r
+ drp_audioSampleRate.Text = "48";\r
+ rtf_h264advanced.Text = "level=41";\r
drp_crop.Text = "No Crop";\r
}\r
\r
- private void mnu_preset_ipod235_Click(object sender, EventArgs e)\r
+ //------------------------------NEW PRESETS START HERE---------------------------\r
+ private void mnu_normal_Click(object sender, EventArgs e)\r
{\r
CheckPixelRatio.CheckState = CheckState.Unchecked;\r
- text_width.Text = "640";\r
- text_height.Text = "272";\r
- drp_videoEncoder.Text = "H.264 (iPod)";\r
- text_bitrate.Text = "1000";\r
+ text_width.Text = "";\r
+ text_height.Text = "";\r
+ drp_videoEncoder.Text = "H.264";\r
+ text_bitrate.Text = "3000";\r
text_filesize.Text = "";\r
slider_videoQuality.Value = 0;\r
SliderValue.Text = "0%";\r
drp_audioBitrate.Text = "160";\r
- rtf_h264advanced.Text = "";\r
+ CheckPixelRatio.CheckState = CheckState.Checked;\r
+ drp_audioSampleRate.Text = "48";\r
+ rtf_h264advanced.Text = "level=41";\r
drp_crop.Text = "No Crop";\r
}\r
\r
- private void mnu_appleTv_Click(object sender, EventArgs e)\r
+ private void mnu_Classic_Click(object sender, EventArgs e)\r
{\r
+ CheckPixelRatio.CheckState = CheckState.Unchecked;\r
text_width.Text = "";\r
text_height.Text = "";\r
drp_videoEncoder.Text = "H.264";\r
drp_audioBitrate.Text = "160";\r
CheckPixelRatio.CheckState = CheckState.Checked;\r
drp_audioSampleRate.Text = "48";\r
- rtf_h264advanced.Text = "bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:no-dct-decimate=1:trellis=2";\r
+ rtf_h264advanced.Text = "level=41";\r
drp_crop.Text = "No Crop";\r
- \r
}\r
\r
- private void mnu_presetPS3_Click(object sender, EventArgs e)\r
+ private void mnu_film_Click(object sender, EventArgs e)\r
+ {\r
+ CheckPixelRatio.CheckState = CheckState.Unchecked;\r
+ text_width.Text = "";\r
+ text_height.Text = "";\r
+ drp_videoEncoder.Text = "H.264";\r
+ text_bitrate.Text = "3000";\r
+ text_filesize.Text = "";\r
+ slider_videoQuality.Value = 0;\r
+ SliderValue.Text = "0%";\r
+ drp_audioBitrate.Text = "160";\r
+ CheckPixelRatio.CheckState = CheckState.Checked;\r
+ drp_audioSampleRate.Text = "48";\r
+ rtf_h264advanced.Text = "level=41";\r
+ drp_crop.Text = "No Crop";\r
+ }\r
+\r
+ private void mnu_television_Click(object sender, EventArgs e)\r
+ {\r
+ CheckPixelRatio.CheckState = CheckState.Unchecked;\r
+ text_width.Text = "";\r
+ text_height.Text = "";\r
+ drp_videoEncoder.Text = "H.264";\r
+ text_bitrate.Text = "3000";\r
+ text_filesize.Text = "";\r
+ slider_videoQuality.Value = 0;\r
+ SliderValue.Text = "0%";\r
+ drp_audioBitrate.Text = "160";\r
+ CheckPixelRatio.CheckState = CheckState.Checked;\r
+ drp_audioSampleRate.Text = "48";\r
+ rtf_h264advanced.Text = "level=41";\r
+ drp_crop.Text = "No Crop";\r
+ }\r
+\r
+ private void mnu_qt_Click(object sender, EventArgs e)\r
{\r
CheckPixelRatio.CheckState = CheckState.Unchecked;\r
text_width.Text = "";\r
drp_crop.Text = "No Crop";\r
}\r
\r
+ private void mnu_psp_Click(object sender, EventArgs e)\r
+ {\r
+ CheckPixelRatio.CheckState = CheckState.Unchecked;\r
+ text_width.Text = "";\r
+ text_height.Text = "";\r
+ drp_videoEncoder.Text = "H.264";\r
+ text_bitrate.Text = "3000";\r
+ text_filesize.Text = "";\r
+ slider_videoQuality.Value = 0;\r
+ SliderValue.Text = "0%";\r
+ drp_audioBitrate.Text = "160";\r
+ CheckPixelRatio.CheckState = CheckState.Checked;\r
+ drp_audioSampleRate.Text = "48";\r
+ rtf_h264advanced.Text = "level=41";\r
+ drp_crop.Text = "No Crop";\r
+ }\r
+\r
+\r
private void mnu_ProgramDefaultOptions_Click(object sender, EventArgs e)\r
{\r
//Source\r
Properties.Settings.Default.VideoFilesize = text_filesize.Text;\r
Properties.Settings.Default.VideoQuality = slider_videoQuality.Value;\r
Properties.Settings.Default.TwoPass = check_2PassEncode.CheckState.ToString();\r
- Properties.Settings.Default.DeInterlace = check_DeInterlace.CheckState.ToString();\r
+ Properties.Settings.Default.DeInterlace = drp_deInterlace_option.Text;\r
Properties.Settings.Default.Grayscale = check_grayscale.CheckState.ToString();\r
Properties.Settings.Default.Framerate = drp_videoFramerate.Text;\r
Properties.Settings.Default.PixelRatio = CheckPixelRatio.CheckState.ToString();\r
Properties.Settings.Default.turboFirstPass = check_turbo.CheckState.ToString();\r
Properties.Settings.Default.largeFile = check_largeFile.CheckState.ToString();\r
+ Properties.Settings.Default.detelecine = check_detelecine.CheckState.ToString();\r
+ Properties.Settings.Default.denoise = drp_deNoise.Text;\r
+ Properties.Settings.Default.deblock = check_deblock.CheckState.ToString();\r
//Audio Settings Tab\r
Properties.Settings.Default.AudioBitrate = drp_audioBitrate.Text;\r
Properties.Settings.Default.AudioSampleRate = drp_audioSampleRate.Text;\r
Properties.Settings.Default.Save();\r
}\r
\r
- // Help Menu --------------------------------------------------------------\r
+ #endregion\r
+\r
+ #region Help Menu\r
+\r
private void mnu_wiki_Click(object sender, EventArgs e)\r
{\r
- System.Diagnostics.Process.Start("http://handbrake.m0k.org/trac");\r
+ Process.Start("http://handbrake.m0k.org/trac");\r
}\r
\r
private void mnu_onlineDocs_Click(object sender, EventArgs e)\r
{\r
- System.Diagnostics.Process.Start("http://handbrake.m0k.org/?page_id=11");\r
+ Process.Start("http://handbrake.m0k.org/?page_id=11");\r
}\r
\r
private void mnu_faq_Click(object sender, EventArgs e)\r
{\r
- System.Diagnostics.Process.Start("http://handbrake.m0k.org/trac/wiki/WindowsGuiFaq");\r
+ Process.Start("http://handbrake.m0k.org/trac/wiki/WindowsGuiFaq");\r
}\r
\r
private void mnu_homepage_Click(object sender, EventArgs e)\r
{\r
- System.Diagnostics.Process.Start("http://handbrake.m0k.org");\r
+ Process.Start("http://handbrake.m0k.org");\r
}\r
\r
private void mnu_forum_Click(object sender, EventArgs e)\r
{\r
- System.Diagnostics.Process.Start("http://handbrake.m0k.org/forum");\r
+ Process.Start("http://handbrake.m0k.org/forum");\r
}\r
\r
private void mnu_about_Click(object sender, EventArgs e)\r
{\r
Form About = new frmAbout();\r
- About.Show();\r
+ About.ShowDialog();\r
}\r
\r
-\r
+ #endregion\r
\r
// -------------------------------------------------------------- \r
// Buttons on the main Window\r
// --------------------------------------------------------------\r
+\r
+ #region Buttons\r
private void btn_Browse_Click(object sender, EventArgs e)\r
{\r
- String filename ="";\r
- text_source.Text = "";\r
-\r
- if (RadioDVD.Checked)\r
- {\r
- DVD_Open.ShowDialog();\r
- filename = DVD_Open.SelectedPath;\r
- if (filename != "")\r
- {\r
- text_source.Text = filename;\r
- Form frmReadDVD = new frmReadDVD(filename, (frmMain)frmMain.ActiveForm);\r
- frmReadDVD.Show();\r
- }\r
-\r
- }\r
- else\r
- {\r
- ISO_Open.ShowDialog();\r
- filename = ISO_Open.FileName;\r
- if (filename != "")\r
- {\r
- text_source.Text = filename;\r
- Form frmReadDVD = new frmReadDVD(filename, (frmMain)frmMain.ActiveForm);\r
- frmReadDVD.Show();\r
- }\r
-\r
- }\r
-\r
- \r
+ String filename =""; \r
+ text_source.Text = ""; \r
+ \r
+ if (RadioDVD.Checked) \r
+ { \r
+ DVD_Open.ShowDialog(); \r
+ filename = DVD_Open.SelectedPath; \r
+ if (filename != "") \r
+ { \r
+ Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); \r
+ text_source.Text = filename; \r
+ frmRD.ShowDialog(); \r
+ } \r
+ } \r
+ else \r
+ { \r
+ ISO_Open.ShowDialog(); \r
+ filename = ISO_Open.FileName; \r
+ if (filename != "") \r
+ { \r
+ Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); \r
+ text_source.Text = filename; \r
+ frmRD.ShowDialog(); \r
+ } \r
+ } \r
+ \r
+ // Check if there was titles in the dvd title dropdown \r
+ if (filename == "") \r
+ { \r
+ text_source.Text = "Click 'Browse' to continue"; \r
+ } \r
+ \r
+ if (drp_dvdtitle.Items.Count == 0) \r
+ { \r
+ 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
+ } \r
}\r
\r
private void btn_destBrowse_Click(object sender, EventArgs e)\r
DVD_Save.ShowDialog();\r
text_destination.Text = DVD_Save.FileName;\r
\r
- if (Check_ChapterMarkers.CheckState.ToString() == "Checked")\r
+ if (Check_ChapterMarkers.Checked)\r
{\r
string destination = text_destination.Text;\r
destination = destination.Replace(".mp4", ".m4v");\r
\r
private void btn_queue_Click(object sender, EventArgs e)\r
{\r
- Form Queue = new frmQueue();\r
- Queue.Show();\r
+ if (text_destination.Text != "" && text_source.Text != "")\r
+ {\r
+ string query;\r
+ if (QueryEditorText.Text == "")\r
+ {\r
+ query = GenerateTheQuery();\r
+ }\r
+ else\r
+ {\r
+ query = QueryEditorText.Text;\r
+ }\r
+ queueWindow.list_queue.Items.Add(query);\r
+ queueWindow.Show();\r
+ } \r
+ else \r
+ {\r
+ MessageBox.Show("No Source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ }\r
+ }\r
+\r
+ private void showQueue()\r
+ {\r
+ queueWindow.Show();\r
}\r
\r
+ #endregion\r
+\r
+ //---------------------------------------------------\r
+ // Encode / Cancel Buttons\r
+ // Encode Progress Text Handler\r
+ //---------------------------------------------------\r
+\r
+ #region Encode/CLI\r
+\r
+ Functions.CLI process = new Functions.CLI();\r
+\r
private void btn_encode_Click(object sender, EventArgs e)\r
{\r
+ btn_eCancel.Enabled = true;\r
String query = "";\r
+ lbl_encode.Visible = false;\r
\r
if (QueryEditorText.Text == "")\r
{\r
query = GenerateTheQuery();\r
- MessageBox.Show(query);\r
}\r
else\r
{\r
query = QueryEditorText.Text;\r
}\r
\r
- System.Diagnostics.Process hbProc = new System.Diagnostics.Process();\r
- hbProc.StartInfo.FileName = "hbcli.exe";\r
- hbProc.StartInfo.Arguments = query;\r
- hbProc.StartInfo.UseShellExecute = false;\r
- hbProc.Start();\r
- \r
+ ThreadPool.QueueUserWorkItem(procMonitor, query);\r
+ lbl_encode.Text = "Encoding Started";\r
+ }\r
\r
- MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
- \r
- // TODO: Need to write a bit of code here to do process monitoring.\r
- // Note: hbProc.waitForExit will freeze the app, meaning one cannot add additional items to the queue during an encode.\r
+ private void btn_eCancel_Click(object sender, EventArgs e)\r
+ {\r
+ process.killCLI();\r
+ process.setNull();\r
+ lbl_encode.Text = "Encoding Canceled";\r
}\r
+ \r
+ private void procMonitor(object state)\r
+ {\r
+ // Make sure we are not already encoding and if we are then display an error.\r
+ if (hbProc != null)\r
+ {\r
+ MessageBox.Show("Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ }\r
+ else\r
+ {\r
+ hbProc = process.runCli(this, (string)state, false, false, false, false);\r
+ MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
+ hbProc.WaitForExit();\r
\r
- // -------------------------------------------------------------- \r
- // Items that require actions on frmMain\r
- // --------------------------------------------------------------\r
+ try\r
+ {\r
+\r
+ //*****************************************************************************************\r
+ // BUG!\r
+ // When the below code is used and standard error is set to true, hbcli is outputing a\r
+ // video stream which has mild corruption issues every few seconds.\r
+ // Maybe an issue with the Parser cauing the CLI to hickup/pause?\r
+ //*****************************************************************************************\r
+\r
+ \r
+ /*Parsing.Parser encode = new Parsing.Parser(hbProc.StandardError.BaseStream);\r
+ encode.OnEncodeProgress += encode_OnEncodeProgress;\r
+ while (!encode.EndOfStream)\r
+ {\r
+ encode.ReadLine();\r
+ }\r
+\r
+ hbProc.WaitForExit();\r
+ process.closeCLI();\r
+ */\r
+ }\r
+ catch (Exception)\r
+ {\r
+ // Do nothing\r
+ }\r
+\r
+ MessageBox.Show("The encode process has now ended.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
+ hbProc = null;\r
+ }\r
+ }\r
\r
+ private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)\r
+ {\r
+ if (this.InvokeRequired)\r
+ {\r
+ this.BeginInvoke(new Parsing.EncodeProgressEventHandler(encode_OnEncodeProgress),\r
+ new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });\r
+ return;\r
+ }\r
+ lbl_encode.Text = string.Format("Encode Progress: {0}%, FPS: {1}, Avg FPS: {2}, Time Remaining: {3} ", PercentComplete, CurrentFps, AverageFps, TimeRemaining);\r
+ }\r
+\r
+ #endregion\r
+\r
+ //---------------------------------------------------\r
+ // Items that require actions on frmMain\r
+ //---------------------------------------------------\r
+\r
+ #region frmMain Actions\r
\r
private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
+ lbl_chptWarn.Visible = false;\r
QueryEditorText.Text = "";\r
if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))\r
{\r
- int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
- int chapterStart = int.Parse(drop_chapterStart.Text);\r
-\r
try\r
{\r
+ int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
+ int chapterStart = int.Parse(drop_chapterStart.Text);\r
+\r
if (chapterFinish < chapterStart)\r
{\r
- MessageBox.Show("Invalid Chapter Range! - Final chapter can not be smaller than the starting chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ lbl_chptWarn.Visible = true;\r
+ lbl_chptWarn.Text = "Invalid Chapter Range!";\r
}\r
}\r
catch (Exception)\r
{\r
- MessageBox.Show("Invalid Character Entered!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
+ lbl_chptWarn.Visible = true;\r
+ lbl_chptWarn.Text = "Invalid Chapter Range!";\r
}\r
}\r
\r
\r
private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
+ lbl_chptWarn.Visible = false;\r
QueryEditorText.Text = "";\r
if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))\r
{\r
- int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
- int chapterStart = int.Parse(drop_chapterStart.Text);\r
-\r
try\r
{\r
- if (chapterFinish > chapterStart)\r
+ int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
+ int chapterStart = int.Parse(drop_chapterStart.Text);\r
+\r
+ if (chapterFinish < chapterStart)\r
{\r
- MessageBox.Show("Invalid Chapter Range! - Start chapter can not be larger than the Final chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ lbl_chptWarn.Visible = true;\r
+ lbl_chptWarn.Text = "Invalid Chapter Range!";\r
}\r
}\r
catch (Exception)\r
{\r
- MessageBox.Show("Invalid Character Entered!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
+ lbl_chptWarn.Visible = true;\r
+ lbl_chptWarn.Text = "Invalid Chapter Range!";\r
}\r
}\r
}\r
slider_videoQuality.Value = 0;\r
SliderValue.Text = "0%";\r
CheckCRF.CheckState = CheckState.Unchecked;\r
+ CheckCRF.Enabled = false;\r
}\r
\r
private void text_filesize_TextChanged(object sender, EventArgs e)\r
slider_videoQuality.Value = 0;\r
SliderValue.Text = "0%";\r
CheckCRF.CheckState = CheckState.Unchecked;\r
+ CheckCRF.Enabled = false;\r
}\r
\r
private void slider_videoQuality_Scroll(object sender, EventArgs e)\r
SliderValue.Text = slider_videoQuality.Value.ToString() + "%";\r
text_bitrate.Text = "";\r
text_filesize.Text = "";\r
+ CheckCRF.Enabled = true;\r
}\r
\r
private void label_h264_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)\r
{\r
- System.Diagnostics.Process.Start("http://handbrake.m0k.org/trac/wiki/x264Options");\r
+ Process.Start("http://handbrake.m0k.org/trac/wiki/x264Options");\r
}\r
\r
private void text_width_TextChanged(object sender, EventArgs e)\r
{\r
+\r
try\r
{\r
- if (CheckPixelRatio.CheckState.ToString() == "Checked") {\r
+ if (CheckPixelRatio.Checked)\r
+ {\r
text_width.Text = "";\r
- } else {\r
- if ((int.Parse(text_width.Text) % 16) != 0){\r
+ text_width.BackColor = Color.White;\r
+ }\r
+ else\r
+ {\r
+ if ((int.Parse(text_width.Text) % 16) != 0)\r
+ {\r
text_width.BackColor = Color.LightCoral;\r
- }else {\r
+ }\r
+ else\r
+ {\r
text_width.BackColor = Color.LightGreen;\r
}\r
}\r
\r
- if (!lbl_Aspect.Text.Equals("Select a Title")){\r
- int height = int.Parse(text_width.Text) / int.Parse(lbl_Aspect.Text);\r
- int mod16 = height % 16;\r
+ if (lbl_Aspect.Text != "Select a Title")\r
+ {\r
+ double height = int.Parse(text_width.Text) / double.Parse(lbl_Aspect.Text);\r
+ double mod16 = height % 16;\r
height = height - mod16;\r
- text_height.Text = height.ToString();\r
+\r
+ if (text_width.Text == "")\r
+ {\r
+ text_height.Text = "";\r
+ text_width.BackColor = Color.White;\r
+ }\r
+ else\r
+ {\r
+ text_height.Text = height.ToString();\r
+ }\r
}\r
- \r
- } catch(Exception){\r
}\r
+ catch (Exception)\r
+ {\r
+ // No need to throw an error here.\r
+ }\r
+ \r
+ \r
}\r
\r
private void text_height_TextChanged(object sender, EventArgs e)\r
{\r
try\r
{\r
- if (CheckPixelRatio.CheckState.ToString() == "Checked")\r
- {\r
- text_height.Text = "";\r
- }\r
- else\r
+ if (text_height.Text != "Auto")\r
{\r
- if ((int.Parse(text_height.Text) % 16) != 0)\r
+ if (CheckPixelRatio.Checked)\r
{\r
- text_height.BackColor = Color.LightCoral;\r
+ text_height.Text = "";\r
+ text_width.BackColor = Color.White;\r
}\r
else\r
{\r
- text_height.BackColor = Color.LightGreen;\r
+ if ((int.Parse(text_height.Text) % 16) != 0)\r
+ {\r
+ text_height.BackColor = Color.LightCoral;\r
+ }\r
+ else\r
+ {\r
+ text_height.BackColor = Color.LightGreen;\r
+ }\r
}\r
}\r
} catch(Exception){\r
+ // No need to alert the user.\r
}\r
}\r
\r
\r
if (drp_audioCodec.Text == "AAC")\r
{\r
+ drp_audioMixDown.Items.Clear();\r
drp_audioMixDown.Items.Add("Mono");\r
drp_audioMixDown.Items.Add("Stereo");\r
drp_audioMixDown.Items.Add("Dolby Surround");\r
drp_audioMixDown.Items.Add("Dolby Pro Logic II");\r
drp_audioMixDown.Items.Add("6 Channel Discrete");\r
+ \r
drp_audioBitrate.Items.Clear();\r
drp_audioBitrate.Items.Add("32");\r
drp_audioBitrate.Items.Add("40");\r
}\r
else\r
{\r
+ drp_audioMixDown.Items.Clear();\r
drp_audioMixDown.Items.Add("Stereo");\r
drp_audioMixDown.Items.Add("Dolby Surround");\r
drp_audioMixDown.Items.Add("Dolby Pro Logic II");\r
\r
private void Check_ChapterMarkers_CheckedChanged(object sender, EventArgs e)\r
{\r
- if (Check_ChapterMarkers.CheckState.ToString() == "Checked")\r
+ if (Check_ChapterMarkers.Checked)\r
{\r
string destination = text_destination.Text;\r
destination = destination.Replace(".mp4", ".m4v");\r
}\r
}\r
\r
- private void check_turbo_CheckedChanged(object sender, EventArgs e)\r
- {\r
- if (!drp_videoEncoder.Text.Contains("H.264"))\r
- {\r
- MessageBox.Show("This option is only compatible with the H.264 encoder's", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
- check_turbo.CheckState = CheckState.Unchecked;\r
- }\r
- }\r
-\r
private void drp_videoEncoder_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
//Turn off some options which are H.264 only when the user selects a non h.264 encoder\r
{\r
check_turbo.CheckState = CheckState.Unchecked;\r
CheckCRF.CheckState = CheckState.Unchecked;\r
+ CheckCRF.Enabled = false;\r
+ check_turbo.Enabled = false;\r
+ h264Tab.Enabled = false;\r
}\r
- }\r
-\r
- private void CheckCRF_CheckedChanged(object sender, EventArgs e)\r
- {\r
- if (slider_videoQuality.Value == 0)\r
+ else\r
{\r
- MessageBox.Show("This option is can only be used with the 'Video Quality' slider.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
- CheckCRF.CheckState = CheckState.Unchecked;\r
+ CheckCRF.Enabled = true;\r
+ check_turbo.Enabled = true;\r
+ h264Tab.Enabled = true;\r
}\r
+\r
}\r
\r
- Parsing.DVD thisDVD;\r
public void setStreamReader(Parsing.DVD dvd)\r
{\r
this.thisDVD = dvd;\r
// Reset some values on the form\r
lbl_Aspect.Text = "Select a Title";\r
lbl_RecomendedCrop.Text = "Select a Title";\r
+ drop_chapterStart.Items.Clear();\r
+ drop_chapterFinish.Items.Clear();\r
QueryEditorText.Text = "";\r
\r
// If the dropdown is set to automatic nothing else needs to be done.\r
// Otheriwse if its not, title data has to be loased from parsing.\r
if (drp_dvdtitle.Text != "Automatic")\r
{\r
- string[] temp;\r
- string title;\r
- temp = drp_dvdtitle.Text.Split(' ');\r
- title = temp[0].Trim();\r
- \r
- int count = thisDVD.Titles.Count - 1;\r
- int counter = 0;\r
-\r
- while (count >= counter)\r
+ Parsing.Title selectedTitle = drp_dvdtitle.SelectedItem as Parsing.Title;\r
+\r
+ // Set the Aspect Ratio\r
+ lbl_Aspect.Text = selectedTitle.AspectRatio.ToString();\r
+\r
+ // Set the Recommended Cropping values\r
+ lbl_RecomendedCrop.Text = string.Format("{0}/{1}/{2}/{3}", selectedTitle.AutoCropDimensions[0], selectedTitle.AutoCropDimensions[1], selectedTitle.AutoCropDimensions[2], selectedTitle.AutoCropDimensions[3]);\r
+ \r
+ // Populate the Start chapter Dropdown\r
+ drop_chapterStart.Items.Clear();\r
+ drop_chapterStart.Items.AddRange(selectedTitle.Chapters.ToArray());\r
+ if (drop_chapterStart.Items.Count > 0)\r
{\r
+ drop_chapterStart.Text = drop_chapterStart.Items[0].ToString();\r
+ }\r
\r
- if (thisDVD.Titles[counter].TitleNumber.ToString() == title)\r
- {\r
- lbl_Aspect.Text = thisDVD.Titles[counter].AspectRatio.ToString();\r
- lbl_RecomendedCrop.Text = thisDVD.Titles[counter].AutoCropDimensions[0] + "/" + thisDVD.Titles[counter].AutoCropDimensions[1] + "/" + thisDVD.Titles[counter].AutoCropDimensions[2] + "/" + thisDVD.Titles[counter].AutoCropDimensions[3];\r
- // Still need to set these up.\r
- MessageBox.Show(thisDVD.Titles[counter].AudioTracks[0].ToString());\r
- MessageBox.Show(thisDVD.Titles[counter].Chapters.ToString());\r
- MessageBox.Show(thisDVD.Titles[counter].Subtitles.ToString());\r
- }\r
- counter++;\r
+ // Populate the Final Chapter Dropdown\r
+ drop_chapterFinish.Items.Clear();\r
+ drop_chapterFinish.Items.AddRange(selectedTitle.Chapters.ToArray());\r
+ if (drop_chapterFinish.Items.Count > 0)\r
+ {\r
+ drop_chapterFinish.Text = drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString();\r
}\r
\r
+ // Populate the Audio Channels Dropdown\r
+ drp_audioChannels.Items.Clear();\r
+ drp_audioChannels.Items.Add("Automatic");\r
+ drp_audioChannels.Items.AddRange(selectedTitle.AudioTracks.ToArray());\r
+ if (drp_audioChannels.Items.Count > 0)\r
+ {\r
+ drp_audioChannels.Text = drp_audioChannels.Items[0].ToString();\r
+ }\r
\r
+ // Populate the Subtitles dropdown\r
+ drp_subtitle.Items.Clear();\r
+ drp_subtitle.Items.Add("None");\r
+ drp_subtitle.Items.AddRange(selectedTitle.Subtitles.ToArray());\r
+ if (drp_subtitle.Items.Count > 0)\r
+ {\r
+ drp_subtitle.Text = drp_subtitle.Items[0].ToString();\r
+ }\r
}\r
- \r
- } \r
+ }\r
\r
- //\r
- // The Query Generation Function\r
- //\r
+ #endregion\r
\r
+ /* \r
+ * ---------------------------------------------------\r
+ * \r
+ * The query Generation function.\r
+ * \r
+ * ---------------------------------------------------\r
+ */\r
+\r
+ #region Program Functions\r
\r
- // This function was imported from old vb.net version of this application.\r
- // It could probably do with being cleaned up a good deal at some point\r
public string GenerateTheQuery()\r
{\r
string source = text_source.Text;\r
string dvdChapter = "";\r
\r
if (source == "")\r
- {\r
MessageBox.Show("No Source has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
- }else{\r
+ else\r
+ {\r
source = " -i " + '"' + source+ '"'; //'"'+\r
}\r
\r
if (dvdTitle == "Automatic")\r
- {\r
dvdTitle = "";\r
- }else{\r
+ else\r
+ {\r
string[] titleInfo = dvdTitle.Split(' ');\r
dvdTitle = " -t "+ titleInfo[0];\r
}\r
\r
-\r
-\r
-\r
- if ((chapterFinish.Equals("Auto") && chapterStart.Equals("Auto")))\r
- {\r
+ if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))\r
dvdChapter = "";\r
- }\r
else if (chapterFinish == chapterStart)\r
- {\r
dvdChapter = " -c " + chapterStart;\r
- }\r
-\r
else\r
- {\r
dvdChapter = " -c " + chapterStart + "-" + chapterFinish;\r
- }\r
\r
string querySource = source+ dvdTitle+ dvdChapter;\r
// ----------------------------------------------------------------------\r
string audioEncoder = drp_audioCodec.Text;\r
string width = text_width.Text;\r
string height = text_height.Text;\r
- if ((destination == ""))\r
- {\r
- MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
- }\r
\r
+ if (destination == "")\r
+ MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
- {\r
destination = " -o " + '"' + destination + '"'; //'"'+ \r
- }\r
-\r
- if ((videoEncoder == "Mpeg 4"))\r
- {\r
- videoEncoder = " -e ffmpeg";\r
- }\r
-\r
- else if ((videoEncoder == "Xvid"))\r
- {\r
- videoEncoder = " -e xvid";\r
- }\r
-\r
- else if ((videoEncoder == "H.264"))\r
- {\r
- videoEncoder = " -e x264";\r
- }\r
\r
- else if ((videoEncoder == "H.264 Baseline 1.3"))\r
- {\r
- videoEncoder = " -e x264b13";\r
- }\r
-\r
- else if ((videoEncoder == "H.264 (iPod)"))\r
- {\r
- videoEncoder = " -e x264b30";\r
- }\r
-\r
- if ((audioEncoder == "AAC"))\r
- {\r
- audioEncoder = " -E faac";\r
- }\r
\r
- else if ((audioEncoder == "MP3"))\r
- {\r
- audioEncoder = " -E lame";\r
- }\r
-\r
- else if ((audioEncoder == "Vorbis"))\r
- {\r
- audioEncoder = " -E vorbis";\r
- }\r
+ switch (videoEncoder)\r
+ {\r
+ case "Mpeg 4":\r
+ videoEncoder = " -e ffmpeg";\r
+ break;\r
+ case "Xvid":\r
+ videoEncoder = " -e xvid";\r
+ break;\r
+ case "H.264":\r
+ videoEncoder = " -e x264";\r
+ break;\r
+ case "H.264 Baseline 1.3":\r
+ videoEncoder = " -e x264b13";\r
+ break;\r
+ case "H.264 (iPod)":\r
+ videoEncoder = " -e x264b30";\r
+ break;\r
+ default:\r
+ videoEncoder = " -e x264";\r
+ break;\r
+ }\r
+ \r
+ switch (audioEncoder)\r
+ {\r
+ case "AAC":\r
+ audioEncoder = " -E faac";\r
+ break;\r
+ case "MP3":\r
+ audioEncoder = " -E lame";\r
+ break;\r
+ case "Vorbis":\r
+ audioEncoder = " -E vorbis";\r
+ break;\r
+ case "AC3":\r
+ audioEncoder = " -E ac3";\r
+ break;\r
+ default:\r
+ audioEncoder = " -E faac";\r
+ break;\r
+ }\r
+\r
+ if (width != "")\r
+ width = " -w "+ width;\r
\r
- else if ((audioEncoder == "AC3"))\r
- {\r
- audioEncoder = " -E ac3";\r
- }\r
\r
- if ((width != ""))\r
+ if (height == "Auto")\r
{\r
- width = " -w "+ width;\r
+ height = "";\r
}\r
-\r
- if ((height != ""))\r
+ else if (height != "")\r
{\r
- height = " -l "+ height;\r
+ height = " -l " + height;\r
}\r
+ \r
\r
string queryDestination = destination+ videoEncoder+ audioEncoder+ width+ height;\r
// ----------------------------------------------------------------------\r
string cropRight = text_right.Text;\r
string subtitles = drp_subtitle.Text;\r
string cropOut = "";\r
+ string deInterlace_Option = drp_deInterlace_option.Text;\r
+ string deinterlace = "";\r
+ string grayscale = "";\r
+ string pixelRatio = "";\r
+ string ChapterMarkers = "";\r
// Returns Crop Query\r
\r
- if (cropSetting == "Auto Crop")\r
- {\r
+ if (cropSetting == "Auto Crop")\r
cropOut = "";\r
- }\r
-\r
- else if (cropSetting == "No Crop")\r
- {\r
+ else if (cropSetting == "No Crop")\r
cropOut = " --crop 0:0:0:0 ";\r
- }\r
-\r
else\r
- {\r
- cropOut = " --crop "+ cropTop+ ":"+ cropBottom+ ":"+ cropLeft+ ":"+ cropRight;\r
- }\r
+ cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;\r
\r
- if ((subtitles == "None"))\r
- {\r
+ if (subtitles == "None")\r
subtitles = "";\r
- }\r
-\r
- else if ((subtitles == ""))\r
- {\r
+ else if (subtitles == "")\r
subtitles = "";\r
- }\r
-\r
else\r
{\r
string[] tempSub;\r
subtitles = " -s "+ tempSub[0];\r
}\r
\r
- string queryPictureSettings = cropOut+ subtitles;\r
+ switch (deInterlace_Option)\r
+ {\r
+ case "None":\r
+ deinterlace = "";\r
+ break;\r
+ case "Origional (Fast)":\r
+ deinterlace = " --deinterlace";\r
+ break;\r
+ case "yadif (Slow)":\r
+ deinterlace = " --deinterlace=" + '"' + "1" + '"';\r
+ break;\r
+ case "yadif + mcdeint (Slower)":\r
+ deinterlace = " --deinterlace=" + '"' + "1:-1:1" + '"';\r
+ break;\r
+ case "yadif + mcdeint (Slowest)":\r
+ deinterlace = " --deinterlace=" + '"' + "3:-1:2" + '"';\r
+ break;\r
+ default:\r
+ deinterlace = " --deinterlace=";\r
+ break;\r
+ }\r
+\r
+ if (check_grayscale.Checked)\r
+ grayscale = " -g ";\r
+\r
+ if (CheckPixelRatio.Checked)\r
+ pixelRatio = " -p ";\r
+\r
+ if (Check_ChapterMarkers.Checked)\r
+ ChapterMarkers = " -m ";\r
+\r
+ string queryPictureSettings = cropOut + subtitles + deinterlace + grayscale + pixelRatio + ChapterMarkers;\r
// ----------------------------------------------------------------------\r
\r
// Video Settings Tab\r
string videoBitrate = text_bitrate.Text;\r
string videoFilesize = text_filesize.Text;\r
int videoQuality = slider_videoQuality.Value;\r
- string vidQSetting;\r
- string twoPassEncoding = check_2PassEncode.CheckState.ToString();\r
- string deinterlace = check_DeInterlace.CheckState.ToString();\r
- string grayscale = check_grayscale.CheckState.ToString();\r
+ string vidQSetting = "";\r
+ string twoPassEncoding = "";\r
string videoFramerate = drp_videoFramerate.Text;\r
- string pixelRatio = CheckPixelRatio.CheckState.ToString();\r
- string ChapterMarkers = Check_ChapterMarkers.CheckState.ToString();\r
- string turboH264 = check_turbo.CheckState.ToString();\r
- string largeFile = check_largeFile.CheckState.ToString();\r
+ string turboH264 = "";\r
+ string largeFile = "";\r
+ string deblock = "";\r
+ string detelecine = "";\r
+ string denoise = "";\r
\r
- if ((videoBitrate != ""))\r
- {\r
+ if (videoBitrate != "")\r
videoBitrate = " -b "+ videoBitrate;\r
- }\r
\r
- if ((videoFilesize != ""))\r
- {\r
+ if (videoFilesize != "")\r
videoFilesize = " -S "+ videoFilesize;\r
- }\r
\r
// Video Quality Setting\r
\r
if ((videoQuality == 0))\r
- {\r
vidQSetting = "";\r
- }\r
-\r
else\r
{\r
videoQuality = videoQuality/ 100;\r
vidQSetting = " -q " + videoQuality.ToString();\r
}\r
\r
- if ((twoPassEncoding == "1"))\r
- {\r
+ if (check_2PassEncode.Checked)\r
twoPassEncoding = " -2 ";\r
- }\r
-\r
- else\r
- {\r
- twoPassEncoding = "";\r
- }\r
-\r
- if ((deinterlace == "1"))\r
- {\r
- deinterlace = " -d ";\r
- }\r
-\r
- else\r
- {\r
- deinterlace = "";\r
- }\r
-\r
- if ((grayscale == "1"))\r
- {\r
- grayscale = " -g ";\r
- }\r
-\r
- else\r
- {\r
- grayscale = "";\r
- }\r
\r
- if ((videoFramerate == "Automatic"))\r
- {\r
+ if (videoFramerate == "Automatic")\r
videoFramerate = "";\r
- }\r
-\r
else\r
- {\r
videoFramerate = " -r "+ videoFramerate;\r
- }\r
-\r
- if ((pixelRatio == "1"))\r
- {\r
- pixelRatio = " -p ";\r
- }\r
-\r
- else\r
- {\r
- pixelRatio = "";\r
- }\r
\r
- if ((ChapterMarkers == "1"))\r
- {\r
- ChapterMarkers = " -m ";\r
- }\r
-\r
- else\r
- {\r
- ChapterMarkers = "";\r
- }\r
-\r
- if ((turboH264 == "1"))\r
- {\r
+ if (check_turbo.Checked)\r
turboH264 = " -T ";\r
- }\r
-\r
- else\r
- {\r
- turboH264 = "";\r
- }\r
\r
- if ((largeFile == "1"))\r
- {\r
+ if (check_largeFile.Checked)\r
largeFile = " -4 ";\r
- }\r
\r
- else\r
+ if (check_deblock.Checked)\r
+ deblock = " --deblock";\r
+\r
+ if (check_detelecine.Checked)\r
+ detelecine = " --detelecine";\r
+\r
+ switch (drp_deNoise.Text)\r
{\r
- largeFile = "";\r
+ case "None":\r
+ denoise = "";\r
+ break;\r
+ case "Weak":\r
+ denoise = " --denoise=3:2:3:3";\r
+ break;\r
+ case "Strong":\r
+ denoise = " --denoise=7:7:5:5";\r
+ break;\r
+ default:\r
+ denoise = "";\r
+ break;\r
}\r
\r
- string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + twoPassEncoding + deinterlace + grayscale + videoFramerate + pixelRatio + ChapterMarkers + turboH264 + largeFile;\r
+ string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + twoPassEncoding + videoFramerate + turboH264 + largeFile + deblock + detelecine + denoise;\r
// ----------------------------------------------------------------------\r
\r
// Audio Settings Tab\r
string audioChannels = drp_audioChannels.Text;\r
string Mixdown = drp_audioMixDown.Text;\r
string SixChannelAudio = "";\r
- if ((audioBitrate != ""))\r
- {\r
+\r
+ if (audioBitrate != "")\r
audioBitrate = " -B "+ audioBitrate;\r
- }\r
\r
- if ((audioSampleRate != ""))\r
- {\r
+ if (audioSampleRate != "")\r
audioSampleRate = " -R "+ audioSampleRate;\r
- }\r
\r
- if ((audioChannels == "Automatic"))\r
- {\r
+ if (audioChannels == "Automatic")\r
audioChannels = "";\r
- }\r
-\r
- else if ((audioChannels == ""))\r
- {\r
+ else if (audioChannels == "")\r
audioChannels = "";\r
- }\r
-\r
else\r
{\r
string[] tempSub;\r
audioChannels = " -a "+ tempSub[0];\r
}\r
\r
- if ((Mixdown == "Automatic"))\r
- {\r
- Mixdown = "";\r
- }\r
-\r
- else if (Mixdown == "Mono")\r
- {\r
- Mixdown = "mono";\r
- }\r
-\r
- else if (Mixdown == "Stereo")\r
- {\r
- Mixdown = "stereo";\r
- }\r
-\r
- else if (Mixdown == "Dolby Surround")\r
- {\r
- Mixdown = "dpl1";\r
- }\r
-\r
- else if (Mixdown == "Dolby Pro Logic II")\r
- {\r
- Mixdown = "dpl2";\r
- }\r
-\r
- else if (Mixdown == "6 Channel Discrete")\r
- {\r
- Mixdown = "6ch";\r
- }\r
-\r
- else\r
- {\r
- Mixdown = "stero";\r
- }\r
-\r
- if ((Mixdown != ""))\r
- {\r
+ switch (Mixdown)\r
+ {\r
+ case "Automatic":\r
+ Mixdown = "";\r
+ break;\r
+ case "Mono":\r
+ Mixdown = "mono";\r
+ break;\r
+ case "Stereo":\r
+ Mixdown = "stereo";\r
+ break;\r
+ case "Dolby Surround":\r
+ Mixdown = "dpl1";\r
+ break;\r
+ case "Dolby Pro Logic II":\r
+ Mixdown = "dpl2";\r
+ break;\r
+ case "6 Channel Discrete":\r
+ Mixdown = "6ch";\r
+ break;\r
+ default:\r
+ Mixdown = "stero";\r
+ break;\r
+ }\r
+\r
+ if (Mixdown != "")\r
SixChannelAudio = " -6 "+ Mixdown;\r
- }\r
-\r
else\r
- {\r
SixChannelAudio = "";\r
- }\r
\r
string queryAudioSettings = audioBitrate+ audioSampleRate+ audioChannels+ SixChannelAudio;\r
// ----------------------------------------------------------------------\r
string CRF = CheckCRF.CheckState.ToString();\r
string h264Advanced = rtf_h264advanced.Text;\r
if ((CRF == "1"))\r
- {\r
CRF = " -Q ";\r
- }\r
-\r
else\r
- {\r
CRF = "";\r
- }\r
\r
if ((h264Advanced == ""))\r
- {\r
h264Advanced = "";\r
- }\r
-\r
else\r
- {\r
h264Advanced = " -x "+ h264Advanced;\r
- }\r
+ \r
\r
string h264Settings = CRF+ h264Advanced;\r
// ----------------------------------------------------------------------\r
string processors = Properties.Settings.Default.Processors;\r
// Number of Processors Handler\r
\r
- if ((processors == "Automatic"))\r
- {\r
+ if (processors == "Automatic")\r
processors = "";\r
- }\r
-\r
else\r
- {\r
processors = " -C "+ processors+ " ";\r
- }\r
+\r
\r
string queryAdvancedSettings = processors;\r
// ----------------------------------------------------------------------\r
// Verbose option (Program Settings)\r
\r
string verbose = "";\r
- if ( Properties.Settings.Default.verbose == "1")\r
- {\r
+ if (Properties.Settings.Default.verbose == "Checked")\r
verbose = " -v ";\r
- }\r
\r
// ----------------------------------------------------------------------\r
\r
return querySource+ queryDestination+ queryPictureSettings+ queryVideoSettings+ h264Settings+ queryAudioSettings+ queryAdvancedSettings+ verbose;\r
}\r
\r
+ #endregion\r
+\r
+ \r
+\r
+\r
// This is the END of the road ------------------------------------------------------------------------------\r
}\r
}
\ No newline at end of file