Skip to content

Commit 998e619

Browse files
committed
Merge branch 'dev'
2 parents 22a10b4 + 60af34d commit 998e619

29 files changed

+562
-86
lines changed

ScreenToGif.Model/Enums/EncoderTypes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ public enum EncoderTypes
55
ScreenToGif, //Gif, Apng
66
KGySoft, // Gif
77
System, //Gif, Video
8-
FFmpeg, //Gif, Webp, Apng, Video
8+
FFmpeg, //Gif, Webp, Apng, Avif, Video
99
Gifski //Gif
1010
}

ScreenToGif.Model/Enums/ExportFormats.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ public enum ExportFormats
2222
/// </summary>
2323
Bpg,
2424

25+
/// <summary>
26+
/// AV1 Still Image Format.
27+
/// </summary>
28+
Avif,
2529

2630
/// <summary>
2731
/// Audio Video Interleaved.

ScreenToGif.Model/ScreenToGif.Domain.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<DebugType>embedded</DebugType>
77
<UseWPF>True</UseWPF>
88
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
9-
<Version>2.41.1</Version>
9+
<Version>2.41.2</Version>
1010
</PropertyGroup>
1111
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1212
<UseVSHostingProcess>true</UseVSHostingProcess>

ScreenToGif.Native/ScreenToGif.Native.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<UseWindowsForms>True</UseWindowsForms>
77
<DebugType>embedded</DebugType>
88
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
9-
<Version>2.41.1</Version>
9+
<Version>2.41.2</Version>
1010
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
1111
</PropertyGroup>
1212
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

ScreenToGif.Util/Converters/ShortcutSelection.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Globalization;
32
using System.Windows;
43
using System.Windows.Data;
@@ -61,7 +60,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
6160
return Key.F2;
6261
case 2:
6362
return Key.F3;
64-
case 13:
63+
case 3:
6564
return Key.F4;
6665
case 4:
6766
return Key.F5;
@@ -78,7 +77,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
7877
case 10:
7978
return Key.F11;
8079
case 11:
81-
return Key.F11;
80+
return Key.F12;
8281
}
8382

8483
return Key.F1;

ScreenToGif.Util/PathHelper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ public static class PathHelper
1414
/// <returns>The name with the date and time.</returns>
1515
public static string ReplaceRegexInName(string name)
1616
{
17-
const string dateTimeFileNameRegEx = @"[?]([ymdhsfzgkt]+[-_ ]*)+[?]";
17+
//Less than 2 question marks? Then it's not valid.
18+
if (name.Split('?').Length - 1 < 2)
19+
return name;
20+
21+
const string dateTimeFileNameRegEx = "[?]([ymdhsfzgkt]{1,6}[-_ ]{0,2}){1,10}[?]";
1822

1923
if (!Regex.IsMatch(name, dateTimeFileNameRegEx, RegexOptions.IgnoreCase))
2024
return name;

ScreenToGif.Util/ScreenToGif.Util.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<UseWPF>True</UseWPF>
66
<DebugType>embedded</DebugType>
77
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
8-
<Version>2.41.1</Version>
8+
<Version>2.41.2</Version>
99
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
1010
<!--<UseWindowsForms>True</UseWindowsForms>-->
1111
</PropertyGroup>

ScreenToGif.Util/Settings/UserSettings.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,15 @@ private static ResourceDictionary Load(string path)
102102
#region Load settings from disk
103103

104104
var doc = XDocument.Parse(File.ReadAllText(path));
105-
var properties = doc.Root?.Elements().Select(GetProperty).ToList();
105+
var properties = doc.Root?.Elements().Select(GetProperty).ToList() ?? [];
106106

107107
#endregion
108108

109-
#region Migrate
110-
111-
var version = properties?.FirstOrDefault(f => f.Key == "Version")?.Value ?? "0.0";
109+
//Migrate
110+
var version = properties.FirstOrDefault(f => f.Key == "Version")?.Value ?? "0.0";
112111

113112
Migration.Migrate(properties, version);
114113

115-
#endregion
116-
117114
#region Parse settings
118115

119116
//Since the settings were migrated, add the current version.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using ScreenToGif.Domain.Enums;
2+
using ScreenToGif.ViewModel.ExportPresets.Video;
3+
4+
namespace ScreenToGif.ViewModel.ExportPresets.AnimatedImage.Avif;
5+
6+
public class AvifPreset : AnimatedImagePreset
7+
{
8+
public AvifPreset()
9+
{
10+
Type = ExportFormats.Avif;
11+
DefaultExtension = ".avif";
12+
Extension = ".avif";
13+
}
14+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using ScreenToGif.Domain.Enums;
2+
using ScreenToGif.Domain.Interfaces;
3+
using ScreenToGif.ViewModel.ExportPresets.AnimatedImage.Webp;
4+
using System.Runtime.Serialization;
5+
6+
namespace ScreenToGif.ViewModel.ExportPresets.AnimatedImage.Avif;
7+
8+
public class FfmpegAvifPreset : AvifPreset, IFfmpegPreset
9+
{
10+
private VideoSettingsModes _settingsMode = VideoSettingsModes.Normal;
11+
private string _parameters = "-vsync passthrough \n{I} \n-c:v libaom-av1 \n-quality 75 \n-loop 0 \n-f avif \n{O}";
12+
private VideoCodecPresets _codecPreset = VideoCodecPresets.Default;
13+
private int _quality = 75; // A lower value may be better for the default
14+
private VideoCodecs _videoCodec = VideoCodecs.LibAom;
15+
private HardwareAccelerationModes _hardwareAcceleration = HardwareAccelerationModes.Auto;
16+
private VideoPixelFormats _pixelFormat = VideoPixelFormats.Auto;
17+
private Framerates _framerate = Framerates.Auto;
18+
private double _customFramerate = 25d;
19+
private Vsyncs _vsync = Vsyncs.Passthrough;
20+
21+
public VideoSettingsModes SettingsMode
22+
{
23+
get => _settingsMode;
24+
set => SetProperty(ref _settingsMode, value);
25+
}
26+
27+
[DataMember(EmitDefaultValue = false)]
28+
public string Parameters
29+
{
30+
get => _parameters;
31+
set => SetProperty(ref _parameters, value);
32+
}
33+
34+
public VideoCodecPresets CodecPreset
35+
{
36+
get => _codecPreset;
37+
set => SetProperty(ref _codecPreset, value);
38+
}
39+
40+
public int Quality
41+
{
42+
get => _quality;
43+
set => SetProperty(ref _quality, value);
44+
}
45+
46+
public VideoCodecs VideoCodec
47+
{
48+
get => _videoCodec;
49+
set => SetProperty(ref _videoCodec, value);
50+
}
51+
52+
public HardwareAccelerationModes HardwareAcceleration
53+
{
54+
get => _hardwareAcceleration;
55+
set => SetProperty(ref _hardwareAcceleration, value);
56+
}
57+
58+
public VideoPixelFormats PixelFormat
59+
{
60+
get => _pixelFormat;
61+
set => SetProperty(ref _pixelFormat, value);
62+
}
63+
64+
public Framerates Framerate
65+
{
66+
get => _framerate;
67+
set => SetProperty(ref _framerate, value);
68+
}
69+
70+
public double CustomFramerate
71+
{
72+
get => _customFramerate;
73+
set => SetProperty(ref _customFramerate, value);
74+
}
75+
76+
public Vsyncs Vsync
77+
{
78+
get => _vsync;
79+
set => SetProperty(ref _vsync, value);
80+
}
81+
82+
83+
public FfmpegAvifPreset()
84+
{
85+
Encoder = EncoderTypes.FFmpeg;
86+
ImageId = "Vector.Ffmpeg";
87+
IsEncoderExpanded = false;
88+
RequiresFfmpeg = true;
89+
}
90+
91+
public static List<FfmpegAvifPreset> Defaults => new()
92+
{
93+
new FfmpegAvifPreset
94+
{
95+
TitleKey = "S.Preset.Default.Title",
96+
DescriptionKey = "S.Preset.Default.Description",
97+
HasAutoSave = true,
98+
IsSelectedForEncoder = true,
99+
IsDefault = true,
100+
CreationDate = new DateTime(2024, 09, 18)
101+
},
102+
};
103+
}

0 commit comments

Comments
 (0)