mirror of https://github.com/ShareX/ShareX.git
Automatically fix video/audio sources
This commit is contained in:
parent
a8809da5e2
commit
7407df1f34
|
@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyProduct("ShareX")]
|
||||
[assembly: AssemblyCopyright("Copyright (c) 2007-2024 ShareX Team")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("15.0.1")]
|
||||
[assembly: AssemblyFileVersion("15.0.1")]
|
||||
[assembly: AssemblyVersion("15.0.2")]
|
||||
[assembly: AssemblyFileVersion("15.0.2")]
|
|
@ -24,6 +24,7 @@
|
|||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
using System;
|
||||
|
||||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
|
@ -136,5 +137,23 @@ namespace ShareX.ScreenCaptureLib
|
|||
public bool IsAnimatedImage => VideoCodec == FFmpegVideoCodec.gif || VideoCodec == FFmpegVideoCodec.libwebp || VideoCodec == FFmpegVideoCodec.apng;
|
||||
|
||||
public bool IsEvenSizeRequired => !IsAnimatedImage;
|
||||
|
||||
// TEMP: For backward compatibility
|
||||
public void FixSources()
|
||||
{
|
||||
if (VideoSource.Equals("None", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
VideoSource = FFmpegCaptureDevice.None.Value;
|
||||
}
|
||||
else if (VideoSource.Equals("GDI grab", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
VideoSource = FFmpegCaptureDevice.GDIGrab.Value;
|
||||
}
|
||||
|
||||
if (AudioSource.Equals("None", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AudioSource = FFmpegCaptureDevice.None.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -179,6 +179,7 @@ namespace ShareX
|
|||
HotkeysConfig = HotkeysConfig.Load(HotkeysConfigFilePath, BackupFolder, fallbackSupport);
|
||||
HotkeysConfig.CreateBackup = true;
|
||||
HotkeysConfig.CreateWeeklyBackup = true;
|
||||
HotkeysConfigBackwardCompatibilityTasks();
|
||||
}
|
||||
|
||||
public static void LoadAllSettings()
|
||||
|
@ -229,9 +230,10 @@ namespace ShareX
|
|||
}
|
||||
}
|
||||
|
||||
if (Settings.IsUpgradeFrom("15.0.0"))
|
||||
if (Settings.IsUpgradeFrom("15.0.1"))
|
||||
{
|
||||
DefaultTaskSettings.CaptureSettings.ScrollingCaptureOptions = new ScrollingCaptureOptions();
|
||||
DefaultTaskSettings.CaptureSettings.FFmpegOptions.FixSources();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,6 +270,21 @@ namespace ShareX
|
|||
}
|
||||
}
|
||||
|
||||
private static void HotkeysConfigBackwardCompatibilityTasks()
|
||||
{
|
||||
if (Settings.IsUpgradeFrom("15.0.1"))
|
||||
{
|
||||
foreach (TaskSettings taskSettings in HotkeysConfig.Hotkeys.Select(x => x.TaskSettings))
|
||||
{
|
||||
if (taskSettings != null && taskSettings.CaptureSettings != null)
|
||||
{
|
||||
taskSettings.CaptureSettings.ScrollingCaptureOptions = new ScrollingCaptureOptions();
|
||||
taskSettings.CaptureSettings.FFmpegOptions.FixSources();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CleanupHotkeysConfig()
|
||||
{
|
||||
foreach (TaskSettings taskSettings in HotkeysConfig.Hotkeys.Select(x => x.TaskSettings))
|
||||
|
|
Loading…
Reference in New Issue