2024-08-21 20:46:28 +02:00
|
|
|
|
using Flowframes.IO;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
using Flowframes.Main;
|
2021-08-23 16:49:40 +02:00
|
|
|
|
using Flowframes.Os;
|
|
|
|
|
|
using Flowframes.Ui;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
|
|
|
|
|
using System;
|
2021-02-13 02:19:03 +01:00
|
|
|
|
using System.Collections.Generic;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using HTAlt.WinForms;
|
|
|
|
|
|
using Flowframes.Data;
|
2020-11-26 20:17:18 +01:00
|
|
|
|
using Microsoft.WindowsAPICodePack.Taskbar;
|
2021-01-30 13:09:59 +01:00
|
|
|
|
using Flowframes.MiscUtils;
|
2021-03-13 14:48:19 +01:00
|
|
|
|
using System.Threading.Tasks;
|
2021-06-23 15:21:52 +02:00
|
|
|
|
using System.Linq;
|
2022-05-01 22:26:53 +02:00
|
|
|
|
using System.Runtime.InteropServices;
|
2024-10-16 11:09:44 +02:00
|
|
|
|
using Flowframes.Media;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
|
2021-07-25 23:22:54 +02:00
|
|
|
|
#pragma warning disable IDE1006
|
|
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
namespace Flowframes.Forms.Main
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
|
|
|
|
|
public partial class Form1 : Form
|
|
|
|
|
|
{
|
2022-05-01 22:26:53 +02:00
|
|
|
|
[Flags]
|
|
|
|
|
|
public enum EXECUTION_STATE : uint { ES_AWAYMODE_REQUIRED = 0x00000040, ES_CONTINUOUS = 0x80000000, ES_DISPLAY_REQUIRED = 0x00000002, ES_SYSTEM_REQUIRED = 0x00000001 }
|
|
|
|
|
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
|
|
|
|
|
static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); // PREVENT WINDOWS FROM GOING TO SLEEP
|
|
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
private bool _initialized = false;
|
|
|
|
|
|
private bool _mainTabInitialized = false;
|
|
|
|
|
|
private bool _quickSettingsInitialized = false;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
|
2024-08-21 13:28:59 +02:00
|
|
|
|
public bool ShowModelDownloader = false;
|
|
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
private Enums.VfrMode prevVfrMode = (Enums.VfrMode)(-1);
|
|
|
|
|
|
|
2024-09-28 21:33:36 +02:00
|
|
|
|
protected override CreateParams CreateParams
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
CreateParams cp = base.CreateParams;
|
|
|
|
|
|
if (Program.CmdMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
const int WS_EX_TOOLWINDOW = 0x80;
|
|
|
|
|
|
cp.ExStyle |= WS_EX_TOOLWINDOW; // Makes the window not appear in Alt-Tab
|
|
|
|
|
|
}
|
|
|
|
|
|
return cp;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
public Form1()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
2024-09-28 21:33:36 +02:00
|
|
|
|
|
|
|
|
|
|
if (Program.CmdMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
ShowInTaskbar = false;
|
|
|
|
|
|
Opacity = 0;
|
|
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-26 11:45:21 +01:00
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2024-11-26 11:45:21 +01:00
|
|
|
|
CheckForIllegalCrossThreadCalls = Debugger.IsAttached;
|
2021-01-15 16:20:25 +01:00
|
|
|
|
AutoScaleMode = AutoScaleMode.None;
|
2023-01-08 02:00:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async void Form1_Shown(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2024-12-03 00:40:24 +01:00
|
|
|
|
Program.mainForm = this;
|
2023-01-08 02:00:40 +01:00
|
|
|
|
Refresh();
|
|
|
|
|
|
await Task.Delay(1);
|
2021-02-18 14:30:56 +01:00
|
|
|
|
|
2021-04-04 17:47:47 +02:00
|
|
|
|
StartupChecks.CheckOs();
|
2024-08-21 13:28:59 +02:00
|
|
|
|
Program.Cleanup();
|
2021-02-18 14:30:56 +01:00
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
// Main Tab
|
2021-08-23 16:49:40 +02:00
|
|
|
|
UiUtils.InitCombox(interpFactorCombox, 0);
|
2021-08-28 10:21:52 +02:00
|
|
|
|
UiUtils.InitCombox(outSpeedCombox, 0);
|
2024-11-25 18:51:43 +01:00
|
|
|
|
// Quick Settings
|
2024-12-03 00:40:24 +01:00
|
|
|
|
UiUtils.InitCombox(trimCombox, 0);
|
2024-11-25 18:51:43 +01:00
|
|
|
|
mpdecimateMode.FillFromEnum<Enums.Interpolation.MpDecimateSens>(useKeyNames: true);
|
2024-12-03 00:40:24 +01:00
|
|
|
|
vfrHandling.FillFromEnum<Enums.VfrMode>(stringMap: Strings.VfrMode);
|
|
|
|
|
|
vfrHandling.SelectedIndexChanged += (s, ev) => VfrModeChange();
|
2020-11-23 16:51:05 +01:00
|
|
|
|
|
|
|
|
|
|
Logger.textbox = logBox;
|
2023-12-21 21:05:23 +01:00
|
|
|
|
VulkanUtils.Init();
|
2021-02-24 14:56:47 +01:00
|
|
|
|
NvApi.Init();
|
2023-02-05 21:31:48 +01:00
|
|
|
|
await Checks();
|
2023-10-24 17:39:44 +02:00
|
|
|
|
InitOutputUi();
|
2023-02-05 21:31:48 +01:00
|
|
|
|
InitAis();
|
2021-02-21 12:39:25 +01:00
|
|
|
|
UpdateStepByStepControls();
|
2021-08-02 15:08:19 +02:00
|
|
|
|
HandleArgs();
|
2024-08-26 10:04:35 +02:00
|
|
|
|
Initialized();
|
2021-06-23 15:21:52 +02:00
|
|
|
|
|
2021-03-19 19:34:48 +01:00
|
|
|
|
if (Debugger.IsAttached)
|
|
|
|
|
|
{
|
2024-08-21 13:28:59 +02:00
|
|
|
|
Logger.Log("Debugger is attached.");
|
2021-03-19 19:34:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-08-01 15:57:35 +02:00
|
|
|
|
completionAction.SelectedIndex = 0;
|
2020-11-26 20:17:18 +01:00
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
private void VfrModeChange()
|
2023-01-15 17:23:49 +01:00
|
|
|
|
{
|
2024-12-03 00:40:24 +01:00
|
|
|
|
var oldMode = (Enums.VfrMode)Config.GetInt(Config.Key.vfrHandling);
|
|
|
|
|
|
var newMode = ParseUtils.GetEnum<Enums.VfrMode>(vfrHandling.Text, stringMap: Strings.VfrMode);
|
2024-01-09 15:49:47 +01:00
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
if (newMode != oldMode)
|
2024-01-09 15:49:47 +01:00
|
|
|
|
{
|
2024-12-03 00:40:24 +01:00
|
|
|
|
SaveQuickSettings();
|
|
|
|
|
|
HandleInputFiles(new[] { inputTbox.Text });
|
2024-01-09 15:49:47 +01:00
|
|
|
|
}
|
2023-01-15 17:23:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
private void InitOutputUi()
|
|
|
|
|
|
{
|
|
|
|
|
|
comboxOutputFormat.FillFromEnum<Enums.Output.Format>(Strings.OutputFormat, 0);
|
|
|
|
|
|
UpdateOutputUi();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-22 05:20:22 +01:00
|
|
|
|
public async void ResetOutputUi()
|
2023-10-24 17:39:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
comboxOutputEncoder.Items.Clear();
|
|
|
|
|
|
Config.Set(Config.Key.PerformedHwEncCheck, false.ToString());
|
2024-10-16 11:09:44 +02:00
|
|
|
|
await HwEncCheck.DetectHwEncoders();
|
2023-10-24 17:39:44 +02:00
|
|
|
|
UpdateOutputUi();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-15 17:23:49 +01:00
|
|
|
|
private void UpdateOutputUi()
|
|
|
|
|
|
{
|
|
|
|
|
|
var outMode = ParseUtils.GetEnum<Enums.Output.Format>(comboxOutputFormat.Text, true, Strings.OutputFormat);
|
|
|
|
|
|
comboxOutputEncoder.FillFromEnum(OutputUtils.GetAvailableEncoders(outMode), Strings.Encoder, 0);
|
2023-01-18 20:38:06 +01:00
|
|
|
|
comboxOutputEncoder.Visible = comboxOutputEncoder.Items.Count > 0;
|
2023-01-15 17:23:49 +01:00
|
|
|
|
UpdateOutputEncodingUi();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateOutputEncodingUi()
|
|
|
|
|
|
{
|
2023-01-18 20:38:06 +01:00
|
|
|
|
var infoStrings = new List<string>() { "Format" };
|
2023-01-15 17:23:49 +01:00
|
|
|
|
var encoder = ParseUtils.GetEnum<Enums.Encoding.Encoder>(comboxOutputEncoder.Text, true, Strings.Encoder);
|
2023-01-18 20:38:06 +01:00
|
|
|
|
bool hasEncoder = (int)encoder != -1;
|
2023-01-15 17:23:49 +01:00
|
|
|
|
|
2023-01-18 20:38:06 +01:00
|
|
|
|
comboxOutputQuality.Visible = hasEncoder;
|
|
|
|
|
|
comboxOutputColors.Visible = hasEncoder;
|
2023-01-15 17:23:49 +01:00
|
|
|
|
|
2023-01-18 20:38:06 +01:00
|
|
|
|
if (hasEncoder)
|
|
|
|
|
|
{
|
|
|
|
|
|
infoStrings.Add("Codec");
|
|
|
|
|
|
EncoderInfoVideo info = OutputUtils.GetEncoderInfoVideo(encoder);
|
2023-01-15 17:23:49 +01:00
|
|
|
|
|
2023-12-21 04:46:15 +01:00
|
|
|
|
bool adjustableQuality = !(info.Lossless == true) && info.QualityLevels != null && info.QualityLevels.Count > 0;
|
2023-01-18 20:38:06 +01:00
|
|
|
|
comboxOutputQuality.Visible = adjustableQuality;
|
|
|
|
|
|
comboxOutputQuality.Items.Clear();
|
2023-01-18 14:55:38 +01:00
|
|
|
|
|
2023-01-18 20:38:06 +01:00
|
|
|
|
if (info.QualityLevels.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
infoStrings.Add("Quality");
|
2023-12-21 04:46:15 +01:00
|
|
|
|
var exclude = info.Lossless == null ? new List<string> { Enums.Encoding.Quality.Common.Lossless.ToString() } : null;
|
|
|
|
|
|
comboxOutputQuality.FillFromStrings(info.QualityLevels, Strings.VideoQuality, info.QualityDefault, exclude);
|
2023-01-18 20:38:06 +01:00
|
|
|
|
}
|
2023-01-18 14:55:38 +01:00
|
|
|
|
|
2023-01-18 20:38:06 +01:00
|
|
|
|
var pixelFormats = info.PixelFormats;
|
|
|
|
|
|
comboxOutputColors.Visible = pixelFormats.Count > 0;
|
2023-01-31 11:41:39 +01:00
|
|
|
|
int defaultPixFmt = (int)info.PixelFormatDefault != -1 ? info.PixelFormats.IndexOf(info.PixelFormatDefault) : 0;
|
|
|
|
|
|
comboxOutputColors.FillFromEnum(pixelFormats, Strings.PixelFormat, defaultPixFmt);
|
2023-01-18 20:38:06 +01:00
|
|
|
|
comboxOutputColors.Width = adjustableQuality ? 117 : 223;
|
2023-01-18 14:55:38 +01:00
|
|
|
|
|
2023-02-20 15:59:47 +01:00
|
|
|
|
if (pixelFormats.Count > 0)
|
2023-01-18 20:38:06 +01:00
|
|
|
|
infoStrings.Add("Pixel Format");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
labelOutput.Text = $"Set {string.Join(", ", infoStrings)}";
|
2023-01-15 17:23:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
private async Task Checks()
|
2020-11-26 20:17:18 +01:00
|
|
|
|
{
|
2020-12-07 22:10:58 +01:00
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-10-16 13:38:15 +02:00
|
|
|
|
// Task.Run(() => Updater.UpdateModelList());
|
2024-12-31 19:08:28 +01:00
|
|
|
|
StartupChecks.GpuCheck();
|
2021-04-29 22:57:00 +02:00
|
|
|
|
Task.Run(() => Updater.AsyncUpdateCheck());
|
|
|
|
|
|
Task.Run(() => GetWebInfo.LoadNews(newsLabel));
|
|
|
|
|
|
Task.Run(() => GetWebInfo.LoadPatronListCsv(patronsLabel));
|
2024-10-16 13:38:15 +02:00
|
|
|
|
await Servers.InitAsync();
|
2021-04-29 22:57:00 +02:00
|
|
|
|
await StartupChecks.SymlinksCheck();
|
2024-10-16 11:09:44 +02:00
|
|
|
|
await HwEncCheck.DetectHwEncoders();
|
2024-10-16 13:38:15 +02:00
|
|
|
|
await Python.CheckCompression();
|
2020-12-07 22:10:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
{
|
2024-08-15 11:34:36 +02:00
|
|
|
|
Logger.Log($"Checks Error: {e.Message}\n{e.StackTrace}", true);
|
2021-02-13 02:19:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
private void HandleArgs()
|
2021-02-13 02:19:03 +01:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
// Input & interpolation settings
|
2022-07-19 21:30:10 +02:00
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.ValidFiles.Any())
|
2024-09-03 22:01:32 +02:00
|
|
|
|
{
|
|
|
|
|
|
Logger.Log($"[CLI] Loading file(s): {string.Join(", ", Cli.ValidFiles)}", true);
|
2024-12-03 00:40:24 +01:00
|
|
|
|
HandleInputFiles(Cli.ValidFiles.ToArray());
|
2024-09-03 22:01:32 +02:00
|
|
|
|
}
|
2022-07-19 21:30:10 +02:00
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.InterpAi != (Implementations.Ai)(-1))
|
2021-02-13 02:19:03 +01:00
|
|
|
|
{
|
2024-08-25 20:45:50 +02:00
|
|
|
|
string name = Implementations.GetAi(Cli.InterpAi).NameInternal;
|
2024-08-21 20:46:28 +02:00
|
|
|
|
aiCombox.SelectedIndex = Implementations.NetworksAvailable.IndexOf(Implementations.NetworksAvailable.Where(ai => ai.NameInternal == name).FirstOrDefault());
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Using AI implementation '{aiCombox.Text}' ('{Cli.InterpAi}')", true);
|
2021-08-03 13:06:27 +02:00
|
|
|
|
|
2024-08-21 20:46:28 +02:00
|
|
|
|
}
|
2021-08-02 15:08:19 +02:00
|
|
|
|
|
2024-09-03 22:01:32 +02:00
|
|
|
|
if (Cli.InterpModel.IsNotEmpty())
|
2024-08-21 20:46:28 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
aiModel.SelectedIndex = aiModel.Items.Cast<string>().Select((item, index) => new { item, index }).FirstOrDefault(x => x.item.Contains(Cli.InterpModel))?.index ?? -1;
|
|
|
|
|
|
Logger.Log($"[CLI] Using interpolation model '{aiModel.Text}'", true);
|
2024-08-21 20:46:28 +02:00
|
|
|
|
}
|
2021-08-02 15:08:19 +02:00
|
|
|
|
|
2024-09-03 22:01:32 +02:00
|
|
|
|
if (Cli.InterpFactor > 0)
|
2024-08-21 20:46:28 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
interpFactorCombox.Text = Cli.InterpFactor.ToString();
|
|
|
|
|
|
ValidateFactor();
|
|
|
|
|
|
Logger.Log($"[CLI] Using interpolation factor {interpFactorCombox.Text}", true);
|
2024-08-21 20:46:28 +02:00
|
|
|
|
}
|
2021-08-02 15:08:19 +02:00
|
|
|
|
|
2024-09-03 22:01:32 +02:00
|
|
|
|
// Output
|
|
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.OutputDir.IsNotEmpty())
|
2024-08-21 20:46:28 +02:00
|
|
|
|
{
|
2024-08-25 20:45:50 +02:00
|
|
|
|
outputTbox.Text = Cli.OutputDir;
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Directory.CreateDirectory(outputTbox.Text);
|
|
|
|
|
|
Logger.Log($"[CLI] Using output directory '{outputTbox.Text}'", true);
|
2021-08-02 15:08:19 +02:00
|
|
|
|
}
|
2024-08-23 16:11:38 +02:00
|
|
|
|
|
2024-09-03 22:01:32 +02:00
|
|
|
|
if (Cli.OutputFormat != (Enums.Output.Format)(-1))
|
2024-08-23 16:11:38 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
SetFormat(Cli.OutputFormat);
|
|
|
|
|
|
Logger.Log($"[CLI] Using output format '{comboxOutputFormat.Text}'", true);
|
2024-08-23 16:11:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.Encoder != (Enums.Encoding.Encoder)(-1))
|
2024-08-23 16:11:38 +02:00
|
|
|
|
{
|
|
|
|
|
|
comboxOutputEncoder.SelectedIndex = comboxOutputEncoder.Items.Cast<string>().Select((item, index) => new { item, index })
|
2024-08-25 20:45:50 +02:00
|
|
|
|
.FirstOrDefault(x => x.item == Strings.Encoder[Cli.Encoder.ToString()])?.index ?? -1;
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Using video encoder {comboxOutputEncoder.Text} ('{Cli.Encoder}')", true);
|
2024-08-23 16:11:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.PixFmt != (Enums.Encoding.PixelFormat)(-1))
|
2024-08-23 16:11:38 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
comboxOutputColors.SelectedIndex = comboxOutputColors.Items.Cast<string>().Select((item, index) => new { item, index })
|
2024-08-25 20:45:50 +02:00
|
|
|
|
.FirstOrDefault(x => x.item == Strings.PixelFormat[Cli.PixFmt.ToString()])?.index ?? -1;
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Using color format {comboxOutputColors.Text} ('{Cli.PixFmt}')", true);
|
2024-08-23 16:11:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-03 22:01:32 +02:00
|
|
|
|
// Video processing settings
|
|
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.MaxHeight >= 64 && Cli.MaxHeight <= 16384)
|
2024-08-23 16:11:38 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Set max video height to {Cli.MaxHeight} px", true);
|
2024-08-25 20:45:50 +02:00
|
|
|
|
Config.Set(Config.Key.maxVidHeight, Cli.MaxHeight.ToString());
|
2024-08-23 16:11:38 +02:00
|
|
|
|
}
|
2024-08-23 18:42:27 +02:00
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.Loop != null)
|
2024-08-23 18:42:27 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Set loop mode to {(Cli.Loop == true ? "Enabled" : "Disabled")}", true);
|
2024-08-25 20:45:50 +02:00
|
|
|
|
Config.Set(Config.Key.enableLoop, ((bool)Cli.Loop).ToString());
|
2024-08-23 18:42:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.FixSceneChanges != null)
|
2024-08-23 18:42:27 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Set scene change fix mode to {(Cli.FixSceneChanges == true ? "Enabled" : "Disabled")}", true);
|
|
|
|
|
|
Config.Set(Config.Key.scnDetect, ((bool)Cli.FixSceneChanges).ToString());
|
2024-08-23 18:42:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.FixSceneChangeVal > 0f)
|
2024-08-23 18:42:27 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Set scene change sensitivity value to {Cli.FixSceneChangeVal}", true);
|
2024-08-25 20:45:50 +02:00
|
|
|
|
Config.Set(Config.Key.scnDetectValue, Cli.FixSceneChangeVal.ToString());
|
2024-08-23 18:42:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-25 20:45:50 +02:00
|
|
|
|
if (Cli.MaxOutFps >= 1f)
|
2024-08-23 18:42:27 +02:00
|
|
|
|
{
|
2024-09-03 22:01:32 +02:00
|
|
|
|
Logger.Log($"[CLI] Set max output (encoding) FPS to {Cli.MaxOutFps}", true);
|
2024-08-25 20:45:50 +02:00
|
|
|
|
Config.Set(Config.Key.maxFps, Cli.MaxOutFps.ToString());
|
2024-08-23 18:42:27 +02:00
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public HTTabControl GetMainTabControl() { return mainTabControl; }
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public TextBox GetInputFpsTextbox() { return fpsInTbox; }
|
2021-04-29 22:57:00 +02:00
|
|
|
|
public Button GetPauseBtn() { return pauseBtn; }
|
2020-11-23 16:51:05 +01:00
|
|
|
|
|
2023-02-20 15:59:47 +01:00
|
|
|
|
public bool IsInFocus() { return ActiveForm == this; }
|
2020-11-23 16:51:05 +01:00
|
|
|
|
|
2020-12-03 22:06:58 +01:00
|
|
|
|
public void SetTab(string tabName)
|
2020-11-25 20:31:21 +01:00
|
|
|
|
{
|
2023-02-20 15:59:47 +01:00
|
|
|
|
var targetTab = mainTabControl.TabPages.Cast<TabPage>().Where(p => p.Name == tabName).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
if (targetTab == null)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
mainTabControl.SelectedTab = targetTab;
|
2020-11-25 20:31:21 +01:00
|
|
|
|
mainTabControl.Refresh();
|
|
|
|
|
|
mainTabControl.Update();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-06 20:38:18 +01:00
|
|
|
|
public InterpSettings GetCurrentSettings(string path = "")
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2023-02-15 18:25:41 +01:00
|
|
|
|
SetTab(interpOptsTab.Name);
|
2024-08-21 14:45:46 +02:00
|
|
|
|
AiInfo ai = GetAi();
|
2023-12-22 05:20:22 +01:00
|
|
|
|
|
|
|
|
|
|
var s = new InterpSettings()
|
|
|
|
|
|
{
|
2025-02-06 20:38:18 +01:00
|
|
|
|
inPath = path.IsNotEmpty() ? path : inputTbox.Text.Trim(),
|
2023-12-22 05:20:22 +01:00
|
|
|
|
outPath = outputTbox.Text.Trim(),
|
|
|
|
|
|
ai = ai,
|
2024-11-26 13:45:44 +01:00
|
|
|
|
dedupe = Config.GetInt(Config.Key.dedupMode) != 0,
|
2023-12-22 05:20:22 +01:00
|
|
|
|
inFpsDetected = currInFpsDetected,
|
|
|
|
|
|
inFps = currInFps,
|
|
|
|
|
|
interpFactor = interpFactorCombox.GetFloat(),
|
|
|
|
|
|
outItsScale = outSpeedCombox.GetInt().Clamp(1, 64),
|
|
|
|
|
|
outSettings = GetOutputSettings(),
|
|
|
|
|
|
model = GetModel(ai),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
s.InitArgs();
|
|
|
|
|
|
return s;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-12-17 11:32:45 +01:00
|
|
|
|
public void LoadBatchEntry(InterpSettings entry)
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
|
|
|
|
|
inputTbox.Text = entry.inPath;
|
2021-12-06 22:46:39 +01:00
|
|
|
|
MainUiFunctions.SetOutPath(outputTbox, entry.outPath);
|
2023-02-15 12:27:36 +01:00
|
|
|
|
fpsInTbox.Text = entry.inFps.ToString();
|
2020-11-23 16:51:05 +01:00
|
|
|
|
interpFactorCombox.Text = entry.interpFactor.ToString();
|
2022-07-21 10:08:53 +02:00
|
|
|
|
aiCombox.SelectedIndex = Implementations.NetworksAvailable.IndexOf(Implementations.NetworksAvailable.Where(x => x.NameInternal == entry.ai.NameInternal).FirstOrDefault());
|
2023-01-15 17:23:49 +01:00
|
|
|
|
SetFormat(entry.outSettings.Format);
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetStatus(string str)
|
|
|
|
|
|
{
|
|
|
|
|
|
Logger.Log(str, true);
|
|
|
|
|
|
statusLabel.Text = str;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public string GetStatus()
|
2021-03-19 19:48:16 +01:00
|
|
|
|
{
|
|
|
|
|
|
return statusLabel.Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
public void SetProgress(int percent)
|
|
|
|
|
|
{
|
2021-01-28 11:38:45 +01:00
|
|
|
|
percent = percent.Clamp(0, 100);
|
|
|
|
|
|
TaskbarManager.Instance.SetProgressValue(percent, 100);
|
|
|
|
|
|
longProgBar.Value = percent;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
longProgBar.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-18 12:32:01 +01:00
|
|
|
|
public Size currInRes;
|
2021-04-19 19:26:58 +02:00
|
|
|
|
public Fraction currInFpsDetected;
|
2021-04-02 14:36:08 +02:00
|
|
|
|
public Fraction currInFps;
|
2021-01-18 12:32:01 +01:00
|
|
|
|
public int currInFrames;
|
2021-01-30 13:09:59 +01:00
|
|
|
|
public long currInDuration;
|
2021-02-23 12:13:30 +01:00
|
|
|
|
public long currInDurationCut;
|
2021-02-27 14:59:50 +01:00
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public void UpdateInputInfo()
|
2021-01-18 12:32:01 +01:00
|
|
|
|
{
|
2021-04-02 14:36:08 +02:00
|
|
|
|
string str = $"Size: {(!currInRes.IsEmpty ? $"{currInRes.Width}x{currInRes.Height}" : "Unknown")} - ";
|
2024-10-13 16:58:06 +02:00
|
|
|
|
str += $"FPS: {(currInFpsDetected.Float > 0f ? FormatUtils.Fraction(currInFpsDetected) : "Unknown")} - ";
|
2021-04-02 14:36:08 +02:00
|
|
|
|
str += $"Frames: {(currInFrames > 0 ? $"{currInFrames}" : "Unknown")} - ";
|
2021-02-23 12:13:30 +01:00
|
|
|
|
str += $"Duration: {(currInDuration > 0 ? FormatUtils.MsToTimestamp(currInDuration) : "Unknown")}";
|
2021-01-18 12:32:01 +01:00
|
|
|
|
inputInfo.Text = str;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public void InterpolationDone()
|
2021-08-01 15:57:35 +02:00
|
|
|
|
{
|
|
|
|
|
|
SetStatus("Done interpolating!");
|
|
|
|
|
|
|
|
|
|
|
|
if (!BatchProcessing.busy)
|
|
|
|
|
|
CompletionAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public void CompletionAction()
|
2021-08-01 15:57:35 +02:00
|
|
|
|
{
|
2024-08-25 21:43:06 +02:00
|
|
|
|
if (Cli.AutoRun)
|
2021-08-02 15:08:19 +02:00
|
|
|
|
Application.Exit();
|
|
|
|
|
|
|
2021-08-01 15:57:35 +02:00
|
|
|
|
if (completionAction.SelectedIndex == 1)
|
2021-08-02 12:39:44 +02:00
|
|
|
|
new TimeoutForm(completionAction.Text, Application.Exit).ShowDialog();
|
2021-08-01 15:57:35 +02:00
|
|
|
|
|
|
|
|
|
|
if (completionAction.SelectedIndex == 2)
|
2021-08-23 16:49:40 +02:00
|
|
|
|
new TimeoutForm(completionAction.Text, OsUtils.Sleep).ShowDialog();
|
2021-08-01 15:57:35 +02:00
|
|
|
|
|
|
|
|
|
|
if (completionAction.SelectedIndex == 3)
|
2021-08-23 16:49:40 +02:00
|
|
|
|
new TimeoutForm(completionAction.Text, OsUtils.Hibernate).ShowDialog();
|
2021-08-02 12:39:44 +02:00
|
|
|
|
|
|
|
|
|
|
if (completionAction.SelectedIndex == 4)
|
2021-08-23 16:49:40 +02:00
|
|
|
|
new TimeoutForm(completionAction.Text, OsUtils.Shutdown).ShowDialog();
|
2021-08-01 15:57:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public void ResetInputInfo()
|
2021-01-28 20:04:08 +01:00
|
|
|
|
{
|
|
|
|
|
|
currInRes = new Size();
|
2021-04-19 19:26:58 +02:00
|
|
|
|
currInFpsDetected = new Fraction();
|
2021-04-02 14:36:08 +02:00
|
|
|
|
currInFps = new Fraction();
|
2021-01-28 20:04:08 +01:00
|
|
|
|
currInFrames = 0;
|
2021-01-30 13:09:59 +01:00
|
|
|
|
currInDuration = 0;
|
2021-02-23 12:13:30 +01:00
|
|
|
|
currInDurationCut = 0;
|
2021-01-30 22:00:44 +01:00
|
|
|
|
UpdateInputInfo();
|
2021-01-28 20:04:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
private void InitAis()
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2022-07-04 10:14:31 +02:00
|
|
|
|
bool pytorchAvailable = Python.IsPytorchReady();
|
2022-05-31 11:09:56 +02:00
|
|
|
|
|
2024-08-21 14:45:46 +02:00
|
|
|
|
foreach (AiInfo ai in Implementations.NetworksAvailable)
|
2022-06-04 12:43:48 +02:00
|
|
|
|
aiCombox.Items.Add(GetAiComboboxName(ai));
|
2022-05-31 11:09:56 +02:00
|
|
|
|
|
|
|
|
|
|
string lastUsedAiName = Config.Get(Config.Key.lastUsedAiName);
|
2022-07-21 10:08:53 +02:00
|
|
|
|
aiCombox.SelectedIndex = Implementations.NetworksAvailable.IndexOf(Implementations.NetworksAvailable.Where(x => x.NameInternal == lastUsedAiName).FirstOrDefault());
|
2022-05-31 11:09:56 +02:00
|
|
|
|
if (aiCombox.SelectedIndex < 0) aiCombox.SelectedIndex = 0;
|
2022-07-21 10:08:53 +02:00
|
|
|
|
Config.Set(Config.Key.lastUsedAiName, GetAi().NameInternal);
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-21 14:45:46 +02:00
|
|
|
|
private string GetAiComboboxName(AiInfo ai)
|
2022-06-04 12:43:48 +02:00
|
|
|
|
{
|
|
|
|
|
|
return ai.FriendlyName + " - " + ai.Description;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-22 05:20:22 +01:00
|
|
|
|
private void InitializeMainTab()
|
2023-02-21 12:00:07 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (_mainTabInitialized)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
LoadOutputSettings();
|
|
|
|
|
|
_mainTabInitialized = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-16 13:50:26 +02:00
|
|
|
|
public static void CloseAllSplashForms ()
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2024-08-26 10:04:35 +02:00
|
|
|
|
Application.OpenForms.OfType<SplashForm>().ToList().ForEach(f => f.Close());
|
2024-10-16 13:50:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Initialized()
|
|
|
|
|
|
{
|
|
|
|
|
|
CloseAllSplashForms();
|
2024-09-28 21:33:36 +02:00
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
_initialized = true;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
runBtn.Enabled = true;
|
2023-02-21 12:02:53 +01:00
|
|
|
|
SetStatus("Ready");
|
2024-10-15 16:45:49 +02:00
|
|
|
|
|
|
|
|
|
|
if (ShowModelDownloader)
|
|
|
|
|
|
{
|
|
|
|
|
|
new ModelDownloadForm().ShowDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!Program.CmdMode)
|
|
|
|
|
|
Opacity = 1.0f;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void browseInputBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-04-04 11:11:49 +02:00
|
|
|
|
CommonOpenFileDialog dialog = new CommonOpenFileDialog { InitialDirectory = inputTbox.Text.Trim(), IsFolderPicker = true };
|
|
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
2024-12-03 00:40:24 +01:00
|
|
|
|
HandleInputFiles(new string[] { dialog.FileName });
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void browseInputFileBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-04-04 11:11:49 +02:00
|
|
|
|
CommonOpenFileDialog dialog = new CommonOpenFileDialog { InitialDirectory = inputTbox.Text.Trim(), IsFolderPicker = false };
|
|
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
2024-12-03 00:40:24 +01:00
|
|
|
|
HandleInputFiles(new string[] { dialog.FileName });
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void browseOutBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2023-02-21 12:03:48 +01:00
|
|
|
|
CommonOpenFileDialog dialog = new CommonOpenFileDialog { InitialDirectory = outputTbox.Text.Trim(), IsFolderPicker = true };
|
2021-04-04 11:11:49 +02:00
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
|
|
|
|
|
outputTbox.Text = dialog.FileName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-16 09:18:53 +02:00
|
|
|
|
public async void runBtn_Click(object sender, EventArgs e)
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2022-07-20 21:48:30 +02:00
|
|
|
|
if (Interpolate.currentMediaFile == null || !Interpolate.currentMediaFile.Initialized)
|
2023-02-21 12:02:53 +01:00
|
|
|
|
{
|
|
|
|
|
|
SetTab(interpOptsTab.Name);
|
2022-07-20 21:48:30 +02:00
|
|
|
|
return;
|
2023-02-21 12:02:53 +01:00
|
|
|
|
}
|
2022-07-20 21:48:30 +02:00
|
|
|
|
|
2021-08-24 15:43:29 +02:00
|
|
|
|
ValidateFactor();
|
|
|
|
|
|
|
2022-08-16 09:18:53 +02:00
|
|
|
|
if (!BatchProcessing.busy) // Don't load values from GUI if batch processing is used
|
2022-07-20 18:10:31 +02:00
|
|
|
|
Interpolate.currentSettings = GetCurrentSettings();
|
2021-01-13 23:05:23 +01:00
|
|
|
|
|
2021-04-29 22:57:00 +02:00
|
|
|
|
AiProcessSuspend.Reset();
|
2023-02-21 12:00:07 +01:00
|
|
|
|
SaveOutputSettings();
|
2023-02-20 19:30:23 +01:00
|
|
|
|
|
2023-01-15 17:23:49 +01:00
|
|
|
|
if (Interpolate.currentSettings.outSettings.Format == Enums.Output.Format.Realtime)
|
2022-08-16 09:18:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
await Interpolate.Realtime();
|
|
|
|
|
|
SetProgress(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
await Interpolate.Start();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-22 05:20:22 +01:00
|
|
|
|
private void SaveOutputSettings()
|
2020-12-02 23:11:27 +01:00
|
|
|
|
{
|
2023-02-21 12:00:07 +01:00
|
|
|
|
var strings = new List<string>();
|
|
|
|
|
|
if (comboxOutputFormat.Visible) strings.Add(comboxOutputFormat.Text);
|
|
|
|
|
|
if (comboxOutputEncoder.Visible) strings.Add(comboxOutputEncoder.Text);
|
|
|
|
|
|
if (comboxOutputQuality.Visible) strings.Add(comboxOutputQuality.Text);
|
|
|
|
|
|
if (comboxOutputColors.Visible) strings.Add(comboxOutputColors.Text);
|
|
|
|
|
|
Config.Set(Config.Key.lastOutputSettings, string.Join(",", strings));
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
private void LoadOutputSettings()
|
2023-01-31 11:41:39 +01:00
|
|
|
|
{
|
2023-02-21 12:00:07 +01:00
|
|
|
|
string[] strings = Config.Get(Config.Key.lastOutputSettings).Split(',');
|
2023-01-31 11:41:39 +01:00
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
if (strings.Length < 4)
|
|
|
|
|
|
return;
|
2023-01-31 11:41:39 +01:00
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
if (comboxOutputFormat.Visible) comboxOutputFormat.Text = strings[0];
|
|
|
|
|
|
if (comboxOutputEncoder.Visible) comboxOutputEncoder.Text = strings[1];
|
|
|
|
|
|
if (comboxOutputQuality.Visible) comboxOutputQuality.Text = strings[2];
|
|
|
|
|
|
if (comboxOutputColors.Visible) comboxOutputColors.Text = strings[3];
|
2023-01-31 11:41:39 +01:00
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
|
2023-01-15 17:23:49 +01:00
|
|
|
|
public void SetFormat(Enums.Output.Format format)
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2023-01-18 20:38:06 +01:00
|
|
|
|
comboxOutputFormat.Text = Strings.OutputFormat.Get(format.ToString());
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void inputTbox_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
|
|
|
|
|
|
|
|
|
|
|
|
private void inputTbox_DragDrop(object sender, DragEventArgs e)
|
|
|
|
|
|
{
|
2024-12-03 00:40:24 +01:00
|
|
|
|
HandleInputFiles((string[])e.Data.GetData(DataFormats.FileDrop));
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void outputTbox_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
|
|
|
|
|
|
|
|
|
|
|
|
private void outputTbox_DragDrop(object sender, DragEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Program.busy) return;
|
|
|
|
|
|
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
|
|
|
|
outputTbox.Text = files[0];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void fpsInTbox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-04-05 11:58:07 +02:00
|
|
|
|
UpdateUiFps();
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-05 11:58:07 +02:00
|
|
|
|
public void UpdateUiFps()
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2021-04-05 11:58:07 +02:00
|
|
|
|
if (fpsInTbox.Text.Contains("/")) // Parse fraction
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] split = fpsInTbox.Text.Split('/');
|
|
|
|
|
|
Fraction frac = new Fraction(split[0].GetInt(), split[1].GetInt());
|
2021-08-28 10:21:52 +02:00
|
|
|
|
fpsOutTbox.Text = (frac * interpFactorCombox.GetFloat()).ToString() + " FPS";
|
2021-04-04 21:54:26 +02:00
|
|
|
|
|
2021-04-05 11:58:07 +02:00
|
|
|
|
if (!fpsInTbox.ReadOnly)
|
|
|
|
|
|
currInFps = frac;
|
|
|
|
|
|
}
|
|
|
|
|
|
else // Parse float
|
|
|
|
|
|
{
|
|
|
|
|
|
fpsInTbox.Text = fpsInTbox.Text.TrimNumbers(true);
|
2021-08-28 10:21:52 +02:00
|
|
|
|
fpsOutTbox.Text = (fpsInTbox.GetFloat() * interpFactorCombox.GetFloat()).ToString() + " FPS";
|
2021-04-05 11:58:07 +02:00
|
|
|
|
|
|
|
|
|
|
if (!fpsInTbox.ReadOnly)
|
|
|
|
|
|
currInFps = new Fraction(fpsInTbox.GetFloat());
|
|
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-04-05 11:58:07 +02:00
|
|
|
|
UpdateUiFps();
|
2021-08-24 15:43:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public void ValidateFactor()
|
2021-08-24 15:43:29 +02:00
|
|
|
|
{
|
2022-04-05 23:22:09 +02:00
|
|
|
|
interpFactorCombox.Text = $"x{MainUiFunctions.ValidateInterpFactor(interpFactorCombox.GetFloat())}";
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-04 14:27:34 +01:00
|
|
|
|
public void SetWorking(bool state, bool allowCancel = true)
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
2021-01-05 23:55:16 +01:00
|
|
|
|
Logger.Log($"SetWorking({state})", true);
|
2021-01-06 21:44:09 +01:00
|
|
|
|
SetProgress(-1);
|
2021-01-15 19:28:42 +01:00
|
|
|
|
Control[] controlsToDisable = new Control[] { runBtn, runStepBtn, stepSelector, settingsBtn };
|
2020-12-02 23:11:27 +01:00
|
|
|
|
Control[] controlsToHide = new Control[] { runBtn, runStepBtn, stepSelector };
|
|
|
|
|
|
progressCircle.Visible = state;
|
2021-04-29 22:57:00 +02:00
|
|
|
|
busyControlsPanel.Visible = state;
|
|
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
foreach (Control c in controlsToDisable)
|
|
|
|
|
|
c.Enabled = !state;
|
2021-04-29 22:57:00 +02:00
|
|
|
|
|
2020-12-02 23:11:27 +01:00
|
|
|
|
foreach (Control c in controlsToHide)
|
|
|
|
|
|
c.Visible = !state;
|
2021-04-29 22:57:00 +02:00
|
|
|
|
|
|
|
|
|
|
busyControlsPanel.Enabled = allowCancel;
|
2020-12-02 23:11:27 +01:00
|
|
|
|
Program.busy = state;
|
2021-02-21 12:39:25 +01:00
|
|
|
|
Program.mainForm.UpdateStepByStepControls();
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-14 00:39:49 +01:00
|
|
|
|
string lastAiComboxStr = "";
|
2020-11-23 16:51:05 +01:00
|
|
|
|
private void aiCombox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-01-14 00:39:49 +01:00
|
|
|
|
if (string.IsNullOrWhiteSpace(aiCombox.Text) || aiCombox.Text == lastAiComboxStr) return;
|
|
|
|
|
|
lastAiComboxStr = aiCombox.Text;
|
2021-02-28 11:56:09 +01:00
|
|
|
|
UpdateAiModelCombox();
|
2021-08-15 14:33:03 +02:00
|
|
|
|
|
|
|
|
|
|
interpFactorCombox.Items.Clear();
|
|
|
|
|
|
|
2022-05-31 22:17:22 +02:00
|
|
|
|
foreach (int factor in GetAi().SupportedFactors)
|
2021-08-15 14:33:03 +02:00
|
|
|
|
interpFactorCombox.Items.Add($"x{factor}");
|
|
|
|
|
|
|
|
|
|
|
|
interpFactorCombox.SelectedIndex = 0;
|
2021-09-29 11:22:43 +02:00
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
if (_initialized)
|
2022-07-21 10:08:53 +02:00
|
|
|
|
Config.Set(Config.Key.lastUsedAiName, GetAi().NameInternal);
|
2021-02-28 11:56:09 +01:00
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
interpFactorCombox_SelectedIndexChanged(null, null);
|
2024-08-21 14:45:46 +02:00
|
|
|
|
fpsOutTbox.ReadOnly = GetAi().FactorSupport != AiInfo.InterpFactorSupport.AnyFloat;
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public void UpdateAiModelCombox()
|
2021-02-28 11:56:09 +01:00
|
|
|
|
{
|
2021-08-23 16:49:40 +02:00
|
|
|
|
aiModel = UiUtils.LoadAiModelsIntoGui(aiModel, GetAi());
|
2021-02-28 11:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
|
{
|
2024-08-25 21:18:38 +02:00
|
|
|
|
if (!Program.busy)
|
2021-05-17 16:09:19 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
string reason = "";
|
|
|
|
|
|
|
|
|
|
|
|
if (Program.busy)
|
|
|
|
|
|
reason = "The program is still busy.";
|
|
|
|
|
|
|
2022-07-24 22:30:30 +02:00
|
|
|
|
DialogResult dialog = UiUtils.ShowMessageBox($"Are you sure you want to exit the program?\n\n{reason}", "Are you sure?", MessageBoxButtons.YesNo);
|
2021-05-17 16:09:19 +02:00
|
|
|
|
|
|
|
|
|
|
if (dialog == DialogResult.No)
|
|
|
|
|
|
e.Cancel = true;
|
2022-07-27 14:10:29 +02:00
|
|
|
|
|
|
|
|
|
|
Program.Cleanup();
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void licenseBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-03-11 12:58:18 +01:00
|
|
|
|
Process.Start("explorer.exe", Path.Combine(Paths.GetPkgPath(), Paths.licensesDir));
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Form1_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
|
|
|
|
|
|
|
2024-11-08 12:07:43 +01:00
|
|
|
|
private async void Form1_DragDrop(object sender, DragEventArgs e)
|
2020-12-03 22:21:44 +01:00
|
|
|
|
{
|
2024-11-08 12:07:43 +01:00
|
|
|
|
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
|
|
|
|
await Task.Delay(1); // Release drop
|
2024-12-03 00:40:24 +01:00
|
|
|
|
HandleInputFiles(files);
|
2020-12-03 22:21:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
public void HandleInputFiles(string[] files)
|
2020-11-23 16:51:05 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (Program.busy) return;
|
2020-12-03 22:21:44 +01:00
|
|
|
|
|
2024-08-25 21:43:06 +02:00
|
|
|
|
bool start = Program.initialRun && Cli.AutoRun;
|
2021-08-02 15:08:19 +02:00
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
if (files.Length > 1)
|
2020-12-03 22:21:44 +01:00
|
|
|
|
{
|
2023-02-20 15:59:47 +01:00
|
|
|
|
SetTab(interpOptsTab.Name);
|
2020-12-03 22:21:44 +01:00
|
|
|
|
queueBtn_Click(null, null);
|
2024-11-08 12:07:43 +01:00
|
|
|
|
BatchProcessing.currentBatchForm?.LoadDroppedPaths(files, start);
|
2020-12-03 22:21:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-02-15 18:25:41 +01:00
|
|
|
|
SetTab(interpOptsTab.Name);
|
2024-11-08 12:07:43 +01:00
|
|
|
|
Logger.Log($"Selected video/directory: {Path.GetFileName(files[0])}", true);
|
2020-12-03 22:21:44 +01:00
|
|
|
|
inputTbox.Text = files[0];
|
2021-02-01 18:05:50 +01:00
|
|
|
|
|
2023-01-31 11:45:12 +01:00
|
|
|
|
bool resume = Directory.Exists(files[0]) && IoUtils.GetAmountOfFiles(Path.Combine(files[0], Paths.resumeDir), true, "*.json") > 0;
|
2021-09-29 11:22:43 +02:00
|
|
|
|
AutoEncodeResume.resumeNextRun = resume;
|
2021-02-02 21:48:18 +01:00
|
|
|
|
|
|
|
|
|
|
if (resume)
|
2021-09-29 11:22:43 +02:00
|
|
|
|
AutoEncodeResume.LoadTempFolder(files[0]);
|
2021-02-01 18:05:50 +01:00
|
|
|
|
|
2021-02-23 12:13:30 +01:00
|
|
|
|
trimCombox.SelectedIndex = 0;
|
|
|
|
|
|
|
2021-08-02 15:08:19 +02:00
|
|
|
|
MainUiFunctions.InitInput(outputTbox, inputTbox, fpsInTbox, start);
|
2020-12-03 22:21:44 +01:00
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void cancelBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2022-07-24 22:30:30 +02:00
|
|
|
|
DialogResult dialog = UiUtils.ShowMessageBox($"Are you sure you want to cancel the interpolation?", "Are you sure?", MessageBoxButtons.YesNo);
|
2021-09-29 11:22:43 +02:00
|
|
|
|
|
2021-04-29 22:57:00 +02:00
|
|
|
|
if (dialog == DialogResult.Yes)
|
|
|
|
|
|
{
|
2023-02-15 18:25:41 +01:00
|
|
|
|
SetTab(interpOptsTab.Name);
|
2021-04-29 22:57:00 +02:00
|
|
|
|
Interpolate.Cancel();
|
|
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void discordBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-02-09 16:07:57 +01:00
|
|
|
|
Process.Start("https://discord.gg/eJHD2NSJRe");
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void paypalBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-02-09 16:07:57 +01:00
|
|
|
|
Process.Start("https://www.paypal.com/paypalme/nmkd/10");
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void patreonBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-02-09 16:07:57 +01:00
|
|
|
|
Process.Start("https://patreon.com/n00mkrad");
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void settingsBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
new SettingsForm().ShowDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void queueBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2021-08-24 15:43:29 +02:00
|
|
|
|
ValidateFactor();
|
|
|
|
|
|
|
2020-11-23 16:51:05 +01:00
|
|
|
|
if (BatchProcessing.currentBatchForm != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
BatchProcessing.currentBatchForm.WindowState = FormWindowState.Normal;
|
|
|
|
|
|
BatchProcessing.currentBatchForm.BringToFront();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
new BatchForm().Show();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async void updateBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
new UpdaterForm().ShowDialog();
|
|
|
|
|
|
}
|
2020-11-25 17:27:15 +01:00
|
|
|
|
|
2020-11-27 14:35:32 +01:00
|
|
|
|
private void welcomeLabel2_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2023-02-15 18:25:41 +01:00
|
|
|
|
SetTab(interpOptsTab.Name);
|
2020-11-27 14:35:32 +01:00
|
|
|
|
}
|
2020-11-29 16:10:31 +01:00
|
|
|
|
|
2021-02-21 12:39:25 +01:00
|
|
|
|
public void UpdateStepByStepControls()
|
2020-11-29 16:10:31 +01:00
|
|
|
|
{
|
2021-09-29 11:22:43 +02:00
|
|
|
|
if (stepSelector.SelectedIndex < 0)
|
2020-12-03 01:20:33 +01:00
|
|
|
|
stepSelector.SelectedIndex = 0;
|
2021-02-01 21:54:30 +01:00
|
|
|
|
|
2021-05-18 14:37:16 +02:00
|
|
|
|
bool stepByStep = Config.GetInt(Config.Key.processingMode) == 1;
|
2021-02-01 22:06:50 +01:00
|
|
|
|
runBtn.Visible = !stepByStep && !Program.busy;
|
2020-11-29 16:10:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async void runStepBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2022-04-18 06:24:14 +08:00
|
|
|
|
ValidateFactor();
|
2023-02-15 18:25:41 +01:00
|
|
|
|
SetTab(interpOptsTab.Name);
|
2020-11-29 16:10:31 +01:00
|
|
|
|
await InterpolateSteps.Run(stepSelector.Text);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void mainTabControl_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2023-02-21 12:00:07 +01:00
|
|
|
|
if (!_initialized) return;
|
|
|
|
|
|
|
2023-12-22 05:20:22 +01:00
|
|
|
|
if (mainTabControl.SelectedTab == interpOptsTab)
|
2023-02-21 12:00:07 +01:00
|
|
|
|
{
|
|
|
|
|
|
aiCombox_SelectedIndexChanged(null, null);
|
|
|
|
|
|
InitializeMainTab();
|
|
|
|
|
|
}
|
2020-11-29 16:10:31 +01:00
|
|
|
|
}
|
2021-02-23 12:13:30 +01:00
|
|
|
|
|
|
|
|
|
|
private void trimCombox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
QuickSettingsTab.trimEnabled = trimCombox.SelectedIndex > 0;
|
|
|
|
|
|
trimPanel.Visible = QuickSettingsTab.trimEnabled;
|
|
|
|
|
|
|
|
|
|
|
|
if (trimCombox.SelectedIndex == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
trimStartBox.Text = "00:00:00";
|
|
|
|
|
|
trimEndBox.Text = FormatUtils.MsToTimestamp(currInDuration);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void trimResetBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
trimCombox_SelectedIndexChanged(null, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void trimBox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
QuickSettingsTab.UpdateTrim(trimStartBox, trimEndBox);
|
|
|
|
|
|
}
|
2021-02-23 15:53:32 +01:00
|
|
|
|
|
|
|
|
|
|
#region Quick Settings
|
|
|
|
|
|
|
2024-12-03 00:40:24 +01:00
|
|
|
|
public void SaveQuickSettings(object sender = null, EventArgs e = null)
|
2021-02-23 15:53:32 +01:00
|
|
|
|
{
|
2023-02-21 12:00:07 +01:00
|
|
|
|
if (!_quickSettingsInitialized) return;
|
2021-02-24 15:12:49 +01:00
|
|
|
|
|
2021-02-28 13:46:50 +01:00
|
|
|
|
if (Program.busy)
|
|
|
|
|
|
LoadQuickSettings(); // Discard any changes if busy
|
|
|
|
|
|
|
2021-02-23 15:53:32 +01:00
|
|
|
|
ConfigParser.SaveGuiElement(maxVidHeight, ConfigParser.StringMode.Int);
|
|
|
|
|
|
ConfigParser.SaveComboxIndex(dedupMode);
|
|
|
|
|
|
ConfigParser.SaveComboxIndex(mpdecimateMode);
|
|
|
|
|
|
ConfigParser.SaveGuiElement(dedupThresh);
|
|
|
|
|
|
ConfigParser.SaveGuiElement(enableLoop);
|
|
|
|
|
|
ConfigParser.SaveGuiElement(scnDetect);
|
|
|
|
|
|
ConfigParser.SaveGuiElement(scnDetectValue);
|
2021-05-26 18:30:10 +02:00
|
|
|
|
ConfigParser.SaveGuiElement(maxFps);
|
2024-12-03 00:40:24 +01:00
|
|
|
|
ConfigParser.SaveComboxIndex(vfrHandling);
|
2021-02-23 15:53:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-29 11:22:43 +02:00
|
|
|
|
public void LoadQuickSettings(object sender = null, EventArgs e = null)
|
2021-02-23 15:53:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
ConfigParser.LoadGuiElement(maxVidHeight);
|
|
|
|
|
|
ConfigParser.LoadComboxIndex(dedupMode);
|
|
|
|
|
|
ConfigParser.LoadComboxIndex(mpdecimateMode);
|
|
|
|
|
|
ConfigParser.LoadGuiElement(dedupThresh);
|
|
|
|
|
|
ConfigParser.LoadGuiElement(enableLoop);
|
|
|
|
|
|
ConfigParser.LoadGuiElement(scnDetect);
|
|
|
|
|
|
ConfigParser.LoadGuiElement(scnDetectValue);
|
2021-05-26 18:30:10 +02:00
|
|
|
|
ConfigParser.LoadGuiElement(maxFps);
|
2024-12-03 00:40:24 +01:00
|
|
|
|
ConfigParser.LoadComboxIndex(vfrHandling);
|
2021-02-24 15:12:49 +01:00
|
|
|
|
|
2023-02-21 12:00:07 +01:00
|
|
|
|
_quickSettingsInitialized = true;
|
2021-02-23 15:53:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void dedupMode_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
dedupeSensLabel.Visible = dedupMode.SelectedIndex != 0;
|
2025-03-05 22:57:13 +01:00
|
|
|
|
mpDedupePanel.Visible = dedupMode.SelectedIndex == 1;
|
2025-03-10 11:57:43 +01:00
|
|
|
|
magickDedupePanel.Visible = dedupMode.SelectedIndex == 2; // Never true atm
|
2021-02-23 15:53:32 +01:00
|
|
|
|
SaveQuickSettings(null, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
|
{
|
2021-02-28 13:46:50 +01:00
|
|
|
|
if (Program.busy) return;
|
2021-02-23 15:53:32 +01:00
|
|
|
|
new SettingsForm().ShowDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2021-03-19 19:34:48 +01:00
|
|
|
|
|
2021-04-29 22:57:00 +02:00
|
|
|
|
private void pauseBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
AiProcessSuspend.SuspendResumeAi(!AiProcessSuspend.aiProcFrozen);
|
|
|
|
|
|
}
|
2021-05-04 00:20:31 +02:00
|
|
|
|
|
|
|
|
|
|
private void debugBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
new DebugForm().ShowDialog();
|
|
|
|
|
|
}
|
2021-07-14 10:58:07 +02:00
|
|
|
|
|
2022-04-20 05:37:22 +02:00
|
|
|
|
private void fpsOutTbox_Leave(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
float inFps = fpsInTbox.GetFloat();
|
|
|
|
|
|
float outFps = fpsOutTbox.GetFloat();
|
2024-08-21 20:46:28 +02:00
|
|
|
|
|
2024-09-28 21:33:36 +02:00
|
|
|
|
if (inFps == 0 || outFps == 0)
|
2024-08-21 20:46:28 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
2022-04-22 09:23:31 +02:00
|
|
|
|
var targetFactorRounded = Math.Round((Decimal)(outFps / inFps), 3, MidpointRounding.AwayFromZero);
|
2022-04-20 05:37:22 +02:00
|
|
|
|
interpFactorCombox.Text = $"{targetFactorRounded}";
|
|
|
|
|
|
ValidateFactor();
|
2022-04-22 09:23:31 +02:00
|
|
|
|
fpsOutTbox.Text = $"{inFps * interpFactorCombox.GetFloat()} FPS";
|
2022-04-20 05:37:22 +02:00
|
|
|
|
}
|
2022-07-23 14:43:57 +02:00
|
|
|
|
|
|
|
|
|
|
private void aiInfoBtn_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var ai = GetAi();
|
|
|
|
|
|
|
2023-01-15 17:23:49 +01:00
|
|
|
|
if (ai != null)
|
2022-07-23 14:43:57 +02:00
|
|
|
|
UiUtils.ShowMessageBox(ai.GetVerboseInfo(), UiUtils.MessageType.Message);
|
|
|
|
|
|
}
|
2023-01-15 17:23:49 +01:00
|
|
|
|
|
|
|
|
|
|
private void comboxOutputFormat_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateOutputUi();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void comboxOutputEncoder_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateOutputEncodingUi();
|
|
|
|
|
|
}
|
2023-02-05 02:38:48 +01:00
|
|
|
|
|
|
|
|
|
|
private void queueBtn_MouseDown(object sender, MouseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.Button == MouseButtons.Right)
|
|
|
|
|
|
menuStripQueue.Show(Cursor.Position);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void addCurrentConfigurationToQueueToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Program.batchQueue.Enqueue(Program.mainForm.GetCurrentSettings());
|
|
|
|
|
|
Application.OpenForms.Cast<Form>().Where(f => f is BatchForm).Select(f => (BatchForm)f).ToList().ForEach(f => f.RefreshGui());
|
|
|
|
|
|
}
|
2023-02-05 21:31:48 +01:00
|
|
|
|
|
|
|
|
|
|
private void comboxOutputQuality_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var qualityPreset = ParseUtils.GetEnum<Enums.Encoding.Quality.Common>(comboxOutputQuality.Text, true, Strings.VideoQuality);
|
|
|
|
|
|
bool cust = qualityPreset == Enums.Encoding.Quality.Common.Custom;
|
|
|
|
|
|
textboxOutputQualityCust.Visible = cust;
|
|
|
|
|
|
comboxOutputQuality.Margin = new System.Windows.Forms.Padding(0, 0, cust ? 0 : 6, 0);
|
|
|
|
|
|
comboxOutputQuality.Width = cust ? 70 : 100;
|
|
|
|
|
|
|
|
|
|
|
|
if (!cust)
|
|
|
|
|
|
textboxOutputQualityCust.Text = "";
|
2023-02-15 12:27:36 +01:00
|
|
|
|
else
|
|
|
|
|
|
textboxOutputQualityCust.Focus();
|
2023-02-05 21:31:48 +01:00
|
|
|
|
|
|
|
|
|
|
Refresh();
|
|
|
|
|
|
}
|
2020-11-23 16:51:05 +01:00
|
|
|
|
}
|
2021-02-28 16:26:46 +01:00
|
|
|
|
}
|