FFmpegOptionsForm improvements

This commit is contained in:
Jaex 2023-07-19 09:00:33 +03:00
parent 3f6fc79382
commit 6164f36e81
3 changed files with 606 additions and 228 deletions

View file

@ -51,7 +51,7 @@ private void InitializeComponent()
this.cbCustomCommands = new System.Windows.Forms.CheckBox(); this.cbCustomCommands = new System.Windows.Forms.CheckBox();
this.txtCommandLinePreview = new System.Windows.Forms.TextBox(); this.txtCommandLinePreview = new System.Windows.Forms.TextBox();
this.txtUserArgs = new System.Windows.Forms.TextBox(); this.txtUserArgs = new System.Windows.Forms.TextBox();
this.tcFFmpegVideoCodecs = new System.Windows.Forms.TabControl(); this.tcFFmpegVideoCodecs = new ShareX.HelpersLib.TablessControl();
this.tpX264 = new System.Windows.Forms.TabPage(); this.tpX264 = new System.Windows.Forms.TabPage();
this.lblx264BitrateK = new System.Windows.Forms.Label(); this.lblx264BitrateK = new System.Windows.Forms.Label();
this.cbx264UseBitrate = new System.Windows.Forms.CheckBox(); this.cbx264UseBitrate = new System.Windows.Forms.CheckBox();
@ -83,7 +83,7 @@ private void InitializeComponent()
this.lblQSVBitrate = new System.Windows.Forms.Label(); this.lblQSVBitrate = new System.Windows.Forms.Label();
this.btnTest = new System.Windows.Forms.Button(); this.btnTest = new System.Windows.Forms.Button();
this.btnCopyPreview = new System.Windows.Forms.Button(); this.btnCopyPreview = new System.Windows.Forms.Button();
this.tcFFmpegAudioCodecs = new System.Windows.Forms.TabControl(); this.tcFFmpegAudioCodecs = new ShareX.HelpersLib.TablessControl();
this.tpAAC = new System.Windows.Forms.TabPage(); this.tpAAC = new System.Windows.Forms.TabPage();
this.lblAACQuality = new System.Windows.Forms.Label(); this.lblAACQuality = new System.Windows.Forms.Label();
this.tpOpus = new System.Windows.Forms.TabPage(); this.tpOpus = new System.Windows.Forms.TabPage();
@ -198,36 +198,33 @@ private void InitializeComponent()
// //
// tbVorbis_qscale // tbVorbis_qscale
// //
this.tbVorbis_qscale.BackColor = System.Drawing.SystemColors.Window;
resources.ApplyResources(this.tbVorbis_qscale, "tbVorbis_qscale"); resources.ApplyResources(this.tbVorbis_qscale, "tbVorbis_qscale");
this.tbVorbis_qscale.BackColor = System.Drawing.SystemColors.Window;
this.tbVorbis_qscale.LargeChange = 1; this.tbVorbis_qscale.LargeChange = 1;
this.tbVorbis_qscale.Name = "tbVorbis_qscale"; this.tbVorbis_qscale.Name = "tbVorbis_qscale";
this.tbVorbis_qscale.TickStyle = System.Windows.Forms.TickStyle.Both;
this.ttHelpTip.SetToolTip(this.tbVorbis_qscale, resources.GetString("tbVorbis_qscale.ToolTip")); this.ttHelpTip.SetToolTip(this.tbVorbis_qscale, resources.GetString("tbVorbis_qscale.ToolTip"));
this.tbVorbis_qscale.Value = 3; this.tbVorbis_qscale.Value = 3;
this.tbVorbis_qscale.ValueChanged += new System.EventHandler(this.tbVorbis_qscale_ValueChanged); this.tbVorbis_qscale.ValueChanged += new System.EventHandler(this.tbVorbis_qscale_ValueChanged);
// //
// tbMP3_qscale // tbMP3_qscale
// //
this.tbMP3_qscale.BackColor = System.Drawing.SystemColors.Window;
resources.ApplyResources(this.tbMP3_qscale, "tbMP3_qscale"); resources.ApplyResources(this.tbMP3_qscale, "tbMP3_qscale");
this.tbMP3_qscale.BackColor = System.Drawing.SystemColors.Window;
this.tbMP3_qscale.LargeChange = 1; this.tbMP3_qscale.LargeChange = 1;
this.tbMP3_qscale.Maximum = 9; this.tbMP3_qscale.Maximum = 9;
this.tbMP3_qscale.Name = "tbMP3_qscale"; this.tbMP3_qscale.Name = "tbMP3_qscale";
this.tbMP3_qscale.TickStyle = System.Windows.Forms.TickStyle.Both;
this.ttHelpTip.SetToolTip(this.tbMP3_qscale, resources.GetString("tbMP3_qscale.ToolTip")); this.ttHelpTip.SetToolTip(this.tbMP3_qscale, resources.GetString("tbMP3_qscale.ToolTip"));
this.tbMP3_qscale.Value = 5; this.tbMP3_qscale.Value = 5;
this.tbMP3_qscale.ValueChanged += new System.EventHandler(this.tbMP3_qscale_ValueChanged); this.tbMP3_qscale.ValueChanged += new System.EventHandler(this.tbMP3_qscale_ValueChanged);
// //
// tbAACBitrate // tbAACBitrate
// //
this.tbAACBitrate.BackColor = System.Drawing.SystemColors.Window;
resources.ApplyResources(this.tbAACBitrate, "tbAACBitrate"); resources.ApplyResources(this.tbAACBitrate, "tbAACBitrate");
this.tbAACBitrate.BackColor = System.Drawing.SystemColors.Window;
this.tbAACBitrate.LargeChange = 1; this.tbAACBitrate.LargeChange = 1;
this.tbAACBitrate.Maximum = 16; this.tbAACBitrate.Maximum = 16;
this.tbAACBitrate.Minimum = 1; this.tbAACBitrate.Minimum = 1;
this.tbAACBitrate.Name = "tbAACBitrate"; this.tbAACBitrate.Name = "tbAACBitrate";
this.tbAACBitrate.TickStyle = System.Windows.Forms.TickStyle.Both;
this.ttHelpTip.SetToolTip(this.tbAACBitrate, resources.GetString("tbAACBitrate.ToolTip")); this.ttHelpTip.SetToolTip(this.tbAACBitrate, resources.GetString("tbAACBitrate.ToolTip"));
this.tbAACBitrate.Value = 4; this.tbAACBitrate.Value = 4;
this.tbAACBitrate.ValueChanged += new System.EventHandler(this.tbAACBitrate_ValueChanged); this.tbAACBitrate.ValueChanged += new System.EventHandler(this.tbAACBitrate_ValueChanged);
@ -260,13 +257,12 @@ private void InitializeComponent()
// //
// tbOpusBitrate // tbOpusBitrate
// //
this.tbOpusBitrate.BackColor = System.Drawing.SystemColors.Window;
resources.ApplyResources(this.tbOpusBitrate, "tbOpusBitrate"); resources.ApplyResources(this.tbOpusBitrate, "tbOpusBitrate");
this.tbOpusBitrate.BackColor = System.Drawing.SystemColors.Window;
this.tbOpusBitrate.LargeChange = 1; this.tbOpusBitrate.LargeChange = 1;
this.tbOpusBitrate.Maximum = 16; this.tbOpusBitrate.Maximum = 16;
this.tbOpusBitrate.Minimum = 1; this.tbOpusBitrate.Minimum = 1;
this.tbOpusBitrate.Name = "tbOpusBitrate"; this.tbOpusBitrate.Name = "tbOpusBitrate";
this.tbOpusBitrate.TickStyle = System.Windows.Forms.TickStyle.Both;
this.ttHelpTip.SetToolTip(this.tbOpusBitrate, resources.GetString("tbOpusBitrate.ToolTip")); this.ttHelpTip.SetToolTip(this.tbOpusBitrate, resources.GetString("tbOpusBitrate.ToolTip"));
this.tbOpusBitrate.Value = 4; this.tbOpusBitrate.Value = 4;
this.tbOpusBitrate.ValueChanged += new System.EventHandler(this.tbOpusBirate_ValueChanged); this.tbOpusBitrate.ValueChanged += new System.EventHandler(this.tbOpusBirate_ValueChanged);
@ -351,6 +347,7 @@ private void InitializeComponent()
this.tcFFmpegVideoCodecs.Controls.Add(this.tbAMF); this.tcFFmpegVideoCodecs.Controls.Add(this.tbAMF);
this.tcFFmpegVideoCodecs.Controls.Add(this.tbQSV); this.tcFFmpegVideoCodecs.Controls.Add(this.tbQSV);
resources.ApplyResources(this.tcFFmpegVideoCodecs, "tcFFmpegVideoCodecs"); resources.ApplyResources(this.tcFFmpegVideoCodecs, "tcFFmpegVideoCodecs");
this.tcFFmpegVideoCodecs.Multiline = true;
this.tcFFmpegVideoCodecs.Name = "tcFFmpegVideoCodecs"; this.tcFFmpegVideoCodecs.Name = "tcFFmpegVideoCodecs";
this.tcFFmpegVideoCodecs.SelectedIndex = 0; this.tcFFmpegVideoCodecs.SelectedIndex = 0;
// //
@ -642,6 +639,7 @@ private void InitializeComponent()
this.tcFFmpegAudioCodecs.Controls.Add(this.tpVorbis); this.tcFFmpegAudioCodecs.Controls.Add(this.tpVorbis);
this.tcFFmpegAudioCodecs.Controls.Add(this.tpMP3); this.tcFFmpegAudioCodecs.Controls.Add(this.tpMP3);
resources.ApplyResources(this.tcFFmpegAudioCodecs, "tcFFmpegAudioCodecs"); resources.ApplyResources(this.tcFFmpegAudioCodecs, "tcFFmpegAudioCodecs");
this.tcFFmpegAudioCodecs.Multiline = true;
this.tcFFmpegAudioCodecs.Name = "tcFFmpegAudioCodecs"; this.tcFFmpegAudioCodecs.Name = "tcFFmpegAudioCodecs";
this.tcFFmpegAudioCodecs.SelectedIndex = 0; this.tcFFmpegAudioCodecs.SelectedIndex = 0;
// //
@ -877,13 +875,13 @@ private void InitializeComponent()
private System.Windows.Forms.TextBox txtFFmpegPath; private System.Windows.Forms.TextBox txtFFmpegPath;
private System.Windows.Forms.TextBox txtCommandLinePreview; private System.Windows.Forms.TextBox txtCommandLinePreview;
private System.Windows.Forms.TextBox txtUserArgs; private System.Windows.Forms.TextBox txtUserArgs;
private System.Windows.Forms.TabControl tcFFmpegVideoCodecs; private HelpersLib.TablessControl tcFFmpegVideoCodecs;
private System.Windows.Forms.TabPage tpX264; private System.Windows.Forms.TabPage tpX264;
private System.Windows.Forms.TabPage tpVpx; private System.Windows.Forms.TabPage tpVpx;
private System.Windows.Forms.TabPage tpXvid; private System.Windows.Forms.TabPage tpXvid;
private System.Windows.Forms.Button btnTest; private System.Windows.Forms.Button btnTest;
private System.Windows.Forms.Button btnCopyPreview; private System.Windows.Forms.Button btnCopyPreview;
private System.Windows.Forms.TabControl tcFFmpegAudioCodecs; private HelpersLib.TablessControl tcFFmpegAudioCodecs;
private System.Windows.Forms.TabPage tpVorbis; private System.Windows.Forms.TabPage tpVorbis;
private System.Windows.Forms.TabPage tpMP3; private System.Windows.Forms.TabPage tpMP3;
private System.Windows.Forms.ComboBox cbVideoSource; private System.Windows.Forms.ComboBox cbVideoSource;

View file

@ -171,11 +171,12 @@ await Task.Run(() =>
cbAudioSource.Items.AddRange(devices.AudioDevices.Select(x => new FFmpegCaptureDevice(x, $"dshow ({x})")).ToArray()); cbAudioSource.Items.AddRange(devices.AudioDevices.Select(x => new FFmpegCaptureDevice(x, $"dshow ({x})")).ToArray());
} }
if (selectDevices && cbVideoSource.Items.Contains(FFmpegCaptureDevice.ScreenCaptureRecorder)) if (selectDevices && cbVideoSource.Items.Cast<FFmpegCaptureDevice>().
Any(x => x.Value.Equals(FFmpegCaptureDevice.ScreenCaptureRecorder.Value, StringComparison.OrdinalIgnoreCase)))
{ {
Options.FFmpeg.VideoSource = FFmpegCaptureDevice.ScreenCaptureRecorder.Value; Options.FFmpeg.VideoSource = FFmpegCaptureDevice.ScreenCaptureRecorder.Value;
} }
else if (cbVideoSource.Items.Cast<FFmpegCaptureDevice>().All(x => !x.Value.Equals(Options.FFmpeg.VideoSource, StringComparison.OrdinalIgnoreCase))) else if (!cbVideoSource.Items.Cast<FFmpegCaptureDevice>().Any(x => x.Value.Equals(Options.FFmpeg.VideoSource, StringComparison.OrdinalIgnoreCase)))
{ {
Options.FFmpeg.VideoSource = FFmpegCaptureDevice.GDIGrab.Value; Options.FFmpeg.VideoSource = FFmpegCaptureDevice.GDIGrab.Value;
} }
@ -189,11 +190,12 @@ await Task.Run(() =>
} }
} }
if (selectDevices && cbAudioSource.Items.Contains(FFmpegCaptureDevice.VirtualAudioCapturer)) if (selectDevices && cbAudioSource.Items.Cast<FFmpegCaptureDevice>().
Any(x => x.Value.Equals(FFmpegCaptureDevice.VirtualAudioCapturer.Value, StringComparison.OrdinalIgnoreCase)))
{ {
Options.FFmpeg.AudioSource = FFmpegCaptureDevice.VirtualAudioCapturer.Value; Options.FFmpeg.AudioSource = FFmpegCaptureDevice.VirtualAudioCapturer.Value;
} }
else if (cbAudioSource.Items.Cast<FFmpegCaptureDevice>().All(x => !x.Value.Equals(Options.FFmpeg.AudioSource, StringComparison.OrdinalIgnoreCase))) else if (!cbAudioSource.Items.Cast<FFmpegCaptureDevice>().Any(x => x.Value.Equals(Options.FFmpeg.AudioSource, StringComparison.OrdinalIgnoreCase)))
{ {
Options.FFmpeg.AudioSource = FFmpegCaptureDevice.None.Value; Options.FFmpeg.AudioSource = FFmpegCaptureDevice.None.Value;
} }
@ -258,13 +260,15 @@ private async void buttonFFmpegBrowse_Click(object sender, EventArgs e)
private void cbVideoSource_SelectedIndexChanged(object sender, EventArgs e) private void cbVideoSource_SelectedIndexChanged(object sender, EventArgs e)
{ {
Options.FFmpeg.VideoSource = cbVideoSource.Text; FFmpegCaptureDevice device = cbVideoSource.SelectedItem as FFmpegCaptureDevice;
Options.FFmpeg.VideoSource = device?.Value;
UpdateUI(); UpdateUI();
} }
private void cbAudioSource_SelectedIndexChanged(object sender, EventArgs e) private void cbAudioSource_SelectedIndexChanged(object sender, EventArgs e)
{ {
Options.FFmpeg.AudioSource = cbAudioSource.Text; FFmpegCaptureDevice device = cbAudioSource.SelectedItem as FFmpegCaptureDevice;
Options.FFmpeg.AudioSource = device?.Value;
UpdateUI(); UpdateUI();
} }
@ -347,6 +351,11 @@ private void cbVideoCodec_SelectedIndexChanged(object sender, EventArgs e)
tcFFmpegVideoCodecs.SelectedIndex = 6; tcFFmpegVideoCodecs.SelectedIndex = 6;
break; break;
} }
if (settingsLoaded)
{
cbVideoCodec.Focus();
}
} }
UpdateUI(); UpdateUI();
@ -374,6 +383,11 @@ private void cbAudioCodec_SelectedIndexChanged(object sender, EventArgs e)
tcFFmpegAudioCodecs.SelectedIndex = 3; tcFFmpegAudioCodecs.SelectedIndex = 3;
break; break;
} }
if (settingsLoaded)
{
cbAudioCodec.Focus();
}
} }
UpdateUI(); UpdateUI();

File diff suppressed because it is too large Load diff