diff --git a/CodeLegacy/Flowframes.csproj b/CodeLegacy/Flowframes.csproj
index c6466f9..5d4a68e 100644
--- a/CodeLegacy/Flowframes.csproj
+++ b/CodeLegacy/Flowframes.csproj
@@ -493,6 +493,7 @@
+
diff --git a/CodeLegacy/Forms/Main/Form1.cs b/CodeLegacy/Forms/Main/Form1.cs
index f5498a0..8c9dc2f 100644
--- a/CodeLegacy/Forms/Main/Form1.cs
+++ b/CodeLegacy/Forms/Main/Form1.cs
@@ -16,6 +16,7 @@ using Flowframes.MiscUtils;
using System.Threading.Tasks;
using System.Linq;
using System.Runtime.InteropServices;
+using Flowframes.Media;
#pragma warning disable IDE1006
@@ -118,7 +119,7 @@ namespace Flowframes.Forms.Main
{
comboxOutputEncoder.Items.Clear();
Config.Set(Config.Key.PerformedHwEncCheck, false.ToString());
- await StartupChecks.DetectHwEncoders();
+ await HwEncCheck.DetectHwEncoders();
UpdateOutputUi();
}
@@ -179,8 +180,7 @@ namespace Flowframes.Forms.Main
Task.Run(() => Servers.Init());
await Python.CheckCompression();
await StartupChecks.SymlinksCheck();
- await StartupChecks.DetectHwEncoders();
-
+ await HwEncCheck.DetectHwEncoders();
}
catch (Exception e)
{
diff --git a/CodeLegacy/Forms/SplashForm.cs b/CodeLegacy/Forms/SplashForm.cs
index 6a131c7..38bc0fe 100644
--- a/CodeLegacy/Forms/SplashForm.cs
+++ b/CodeLegacy/Forms/SplashForm.cs
@@ -1,16 +1,19 @@
-using System.Windows.Forms;
+using System.Drawing;
+using System.Windows.Forms;
namespace Flowframes.Forms
{
public partial class SplashForm : Form
{
- public static SplashForm Inst;
+ public enum TextSize { Small, Medium, Large }
+ private static readonly string[] fontPresets = { "Yu Gothic UI, 14pt", "Yu Gothic UI, 18pt", "Yu Gothic UI, 21.75pt" };
- public SplashForm(string status = "")
+ public SplashForm(string status = "", bool topMost = true, TextSize textSize = TextSize.Large)
{
- Inst = this;
InitializeComponent();
SetStatus(status);
+ TopMost = topMost;
+ statusLabel.Font = (Font)new FontConverter().ConvertFromInvariantString(fontPresets[(int)textSize]);
}
private void SplashForm_Load(object sender, System.EventArgs e)
diff --git a/CodeLegacy/Media/HwEncCheck.cs b/CodeLegacy/Media/HwEncCheck.cs
new file mode 100644
index 0000000..68b777c
--- /dev/null
+++ b/CodeLegacy/Media/HwEncCheck.cs
@@ -0,0 +1,75 @@
+using Flowframes.Forms;
+using Flowframes.IO;
+using Flowframes.MiscUtils;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Enc = Flowframes.Data.Enums.Encoding.Encoder;
+
+namespace Flowframes.Media
+{
+ internal class HwEncCheck
+ {
+ public static async Task DetectHwEncoders(bool hideMainForm = true, bool onlyShowAvail = true, int waitMs = 0)
+ {
+ if (Config.GetBool(Config.Key.PerformedHwEncCheck))
+ return;
+
+ Logger.Log($"Detecting hardare encoding support...");
+ SplashForm statusForm = new SplashForm("Checking hardware encoders...", textSize: SplashForm.TextSize.Medium);
+ statusForm.Show();
+
+ var previousMainFormOpacity = Program.mainForm.Opacity;
+
+ if (hideMainForm)
+ {
+ Program.mainForm.Opacity = 0;
+ }
+
+ try
+ {
+ var encoders = new[] { Enc.Nvenc264, Enc.Nvenc265, Enc.NvencAv1, Enc.Qsv264, Enc.Qsv265, Enc.Amf264, Enc.Amf265 };
+ var encoderNames = encoders.Select(x => OutputUtils.GetEncoderInfoVideo(x).Name);
+ var compatEncoders = new List();
+
+ foreach (string e in encoderNames)
+ {
+ bool compat = await FfmpegCommands.IsEncoderCompatible(e);
+
+ if (compat)
+ {
+ compatEncoders.Add(e);
+ Logger.Log($"HW Encoder supported: {e}", true);
+ }
+
+ if(!compat && onlyShowAvail)
+ continue;
+
+ statusForm.SetStatus($"Checking hardware encoders...\n{(compat ? "Available" : "Not available")}: {e.Replace("_", " ").Upper()}");
+ }
+
+ var compEncsPretty = compatEncoders.Select(e => e.Replace("_", " ").Upper());
+
+ if(waitMs > 0)
+ {
+ string availNvidia = string.Join(", ", compEncsPretty.Where(e => e.Contains("NVENC")).Select(e => e.Replace("NVENC", "").Trim())) + "\n";
+ string availAmd = string.Join(", ", compEncsPretty.Where(e => e.Contains("AMF")).Select(e => e.Replace("AMF", "").Trim())) + "\n";
+ string availIntel = string.Join(", ", compEncsPretty.Where(e => e.Contains("QSV")).Select(e => e.Replace("QSV", "").Trim())) + "\n";
+ if (availNvidia.IsEmpty()) availNvidia = "None";
+ if (availAmd.IsEmpty()) availAmd = "None";
+ if (availIntel.IsEmpty()) availIntel = "None";
+ statusForm.SetStatus($"Nvidia NVENC: {availNvidia}AMD AMF: {availAmd}Intel QuickSync: {availIntel}".Trim());
+ await Task.Delay(waitMs);
+ }
+
+ Logger.Log($"Available hardware encoders: {string.Join(", ", compEncsPretty)}");
+ Config.Set(Config.Key.SupportedHwEncoders, string.Join(",", compatEncoders));
+ Config.Set(Config.Key.PerformedHwEncCheck, true.ToString());
+ }
+ catch { }
+
+ statusForm.Close();
+ Program.mainForm.Opacity = previousMainFormOpacity;
+ }
+ }
+}
diff --git a/CodeLegacy/Os/StartupChecks.cs b/CodeLegacy/Os/StartupChecks.cs
index cbdcfa6..79a2c04 100644
--- a/CodeLegacy/Os/StartupChecks.cs
+++ b/CodeLegacy/Os/StartupChecks.cs
@@ -1,14 +1,10 @@
using System;
-using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Flowframes.IO;
-using Flowframes.MiscUtils;
using Flowframes.Ui;
-using Enc = Flowframes.Data.Enums.Encoding.Encoder;
namespace Flowframes.Os
{
@@ -125,31 +121,5 @@ namespace Flowframes.Os
IoUtils.TryDeleteIfExists(devmodeBatchPath);
}
}
-
- public static async Task DetectHwEncoders ()
- {
- if (Config.GetBool(Config.Key.PerformedHwEncCheck))
- return;
-
- Logger.Log($"Detecting hardare encoding support...");
- var encoders = new[] { Enc.Nvenc264, Enc.Nvenc265, Enc.NvencAv1, Enc.Qsv264, Enc.Qsv265, Enc.Amf264, Enc.Amf265 };
- var encoderNames = encoders.Select(x => OutputUtils.GetEncoderInfoVideo(x).Name);
- var compatEncoders = new List();
-
- foreach(string e in encoderNames)
- {
- bool compat = await FfmpegCommands.IsEncoderCompatible(e);
-
- if (compat)
- {
- compatEncoders.Add(e);
- Logger.Log($"HW Encoder supported: {e}", true);
- }
- }
-
- Logger.Log($"Available hardware encoders: {string.Join(", ", compatEncoders.Select(e => e.Replace("_", " ").Upper()))}");
- Config.Set(Config.Key.SupportedHwEncoders, string.Join(",", compatEncoders));
- Config.Set(Config.Key.PerformedHwEncCheck, true.ToString());
- }
}
}