From 2e37037bbf0f7a29e64be48df36066cb0c9c3318 Mon Sep 17 00:00:00 2001 From: Alkl58 <34812414+Alkl58@users.noreply.github.com> Date: Tue, 17 Mar 2020 21:01:16 +0100 Subject: [PATCH] Added Check for Dependencies before Encode --- NotEnoughAV1Encodes/MainWindow.xaml.cs | 84 ++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/NotEnoughAV1Encodes/MainWindow.xaml.cs b/NotEnoughAV1Encodes/MainWindow.xaml.cs index e2d596f..1f3e380 100644 --- a/NotEnoughAV1Encodes/MainWindow.xaml.cs +++ b/NotEnoughAV1Encodes/MainWindow.xaml.cs @@ -418,6 +418,88 @@ public void CheckFfprobe() } } + public void CheckDependencies() + { + bool aomencExist = false; + bool ffmpegExist = false; + bool ffprobeExist = false; + bool ravieExist = false; + bool svtav1Exist = false; + + if (ComboBoxEncoder.Text == "aomenc") + { + if(CheckBoxCustomAomencPath.IsChecked == false) + { + aomencExist = File.Exists("aomenc.exe"); + }else if (CheckBoxCustomAomencPath.IsChecked == true) + { + aomencExist = File.Exists(TextBoxCustomAomencPath.Text + "\\aomenc.exe"); + } + }else if (ComboBoxEncoder.Text == "RAV1E") + { + if (CheckBoxCustomRaviePath.IsChecked == false) + { + ravieExist = File.Exists("rav1e.exe"); + } + else if (CheckBoxCustomRaviePath.IsChecked == true) + { + ravieExist = File.Exists(TextBoxCustomRaviePath.Text + "\\rav1e.exe"); + } + }else if (ComboBoxEncoder.Text == "SVT-AV1") + { + if (CheckBoxCustomSVTPath.IsChecked == false) + { + svtav1Exist = File.Exists("SvtAv1EncApp.exe"); + } + else if (CheckBoxCustomSVTPath.IsChecked == true) + { + svtav1Exist = File.Exists(TextBoxCustomRaviePath.Text + "\\SvtAv1EncApp.exe"); + } + } + + if (CheckBoxCustomFfmpegPath.IsChecked == false) + { + ffmpegExist = File.Exists("ffmpeg.exe"); + }else if (CheckBoxCustomFfmpegPath.IsChecked == true) + { + ffmpegExist = File.Exists(TextBoxCustomFfmpegPath.Text + "\\ffmpeg.exe"); + } + + if (CheckBoxCustomFfprobePath.IsChecked == false) + { + ffprobeExist = File.Exists("ffprobe.exe"); + } + else if (CheckBoxCustomFfprobePath.IsChecked == true) + { + ffprobeExist = File.Exists(TextBoxCustomFfmpegPath.Text + "\\ffprobe.exe"); + } + + if (ComboBoxEncoder.Text == "aomenc") + { + if (aomencExist == false || ffmpegExist == false || ffprobeExist == false) + { + MessageBox.Show("Couldn't find all depedencies: \n aomenc found: " + aomencExist + "\n ffmpeg found: " + ffmpegExist + " \n ffprobe found: " + ffprobeExist); + SmallScripts.Cancel.CancelAll = true; + } + }else if (ComboBoxEncoder.Text == "RAV1E") + { + if (ravieExist == false || ffmpegExist == false || ffprobeExist == false) + { + MessageBox.Show("Couldn't find all depedencies: \n rav1e found: " + ravieExist + "\n ffmpeg found: " + ffmpegExist + " \n ffprobe found: " + ffprobeExist); + SmallScripts.Cancel.CancelAll = true; + } + } + else if (ComboBoxEncoder.Text == "SVT-AV1") + { + if (svtav1Exist == false || ffmpegExist == false || ffprobeExist == false) + { + MessageBox.Show("Couldn't find all depedencies: \n SVT-AV1 found: " + svtav1Exist + "\n ffmpeg found: " + ffmpegExist + " \n ffprobe found: " + ffprobeExist); + SmallScripts.Cancel.CancelAll = true; + } + } + + } + //-------------------------------------------------------------------------------------------------|| //------------------------------------- Encoder Settings ------------------------------------------|| @@ -521,6 +603,7 @@ public void SetParametersBeforeEncode() { shutDownAfterEncode = true; } + CheckDependencies(); } public void SetAomencParameters() @@ -1431,6 +1514,7 @@ private void ButtonOpenSource_Click(object sender, RoutedEventArgs e) { if (CheckBoxBatchEncoding.IsChecked == false) { + CheckDependencies(); //Open the OpenFileDialog to set the Videoinput OpenFileDialog openVideoFileDialog = new OpenFileDialog();