refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
1 parent
c99842cc86
commit
f2b58522b9
1801 files changed
+11804
-10676
No files matched your search
@@ -0,0 +1,116 @@
|
||||
using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Windows.Wic;
|
||||
|
||||
namespace Chronos.Core.Windows.Codecs;
|
||||
|
||||
/// <summary>How one image format decodes through WIC on this machine.</summary>
|
||||
/// <param name="Format">The format.</param>
|
||||
/// <param name="Decoder">The WIC decoder that handles its extensions, if any (it may only reach previews, e.g. the in-box DNG decoder).</param>
|
||||
/// <param name="IsNative">True when WIC delivers a full native decode (<see cref="DecodeTier.Native"/>).</param>
|
||||
/// <param name="MissingExtensions">Store extensions whose installation would make the format native.</param>
|
||||
public sealed record FormatSupport(ImageFileFormat Format, WicDecoderInfo? Decoder, bool IsNative, IReadOnlyList<StoreExtension> MissingExtensions);
|
||||
|
||||
/// <summary>
|
||||
/// Which WIC decoders exist on this machine and what they mean per <see cref="ImageFileFormat"/> (BRIEF §8.1):
|
||||
/// JPEG/PNG/TIFF/BMP/GIF/JPEG XR are built in; DNG and camera RAW count only through the Raw Image Extension
|
||||
/// (the in-box DNG decoder reads just the embedded preview); HEIF needs the HEIF decoder plus an HEVC decoder,
|
||||
/// AVIF an AVIF-capable decoder plus an AV1 decoder; WebP the WebP extension. Immutable snapshot; call
|
||||
/// <see cref="Detect"/> again (with refresh) after the user installs an extension.
|
||||
/// </summary>
|
||||
public sealed class CodecInventory
|
||||
{
|
||||
/// <summary>The Raw Image Extension reuses the CLSID of the older in-box RAW codec, so its package identifies it.</summary>
|
||||
internal const string RawImageExtensionPackageFamily = "Microsoft.RawImageExtension_8wekyb3d8bbwe";
|
||||
|
||||
private readonly Dictionary<ImageFileFormat, FormatSupport> _formats;
|
||||
|
||||
internal CodecInventory(IReadOnlyList<WicDecoderInfo> decoders, bool hasHevcDecoder, bool hasAv1Decoder)
|
||||
{
|
||||
Decoders = decoders;
|
||||
HasHevcDecoder = hasHevcDecoder;
|
||||
HasAv1Decoder = hasAv1Decoder;
|
||||
_formats = ImageFormatInfo.Known.ToDictionary(i => i.Format, Evaluate);
|
||||
Formats = [.. _formats.Values];
|
||||
MissingExtensions = StoreExtension.All.Where(e => Formats.Any(f => f.MissingExtensions.Contains(e))).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>Installed WIC decoders, in WIC's enumeration order.</summary>
|
||||
public IReadOnlyList<WicDecoderInfo> Decoders { get; }
|
||||
|
||||
/// <summary>An HEVC decoder MFT is present (HEVC Video Extensions or a vendor hardware decoder).</summary>
|
||||
public bool HasHevcDecoder { get; }
|
||||
|
||||
/// <summary>An AV1 decoder MFT is present (AV1 Video Extension or a vendor hardware decoder).</summary>
|
||||
public bool HasAv1Decoder { get; }
|
||||
|
||||
/// <summary>One entry per known format, in <see cref="ImageFormatInfo.Known"/> order.</summary>
|
||||
public IReadOnlyList<FormatSupport> Formats { get; }
|
||||
|
||||
/// <summary>Distinct Store extensions that would unlock at least one format, for the "Install" notice.</summary>
|
||||
public IReadOnlyList<StoreExtension> MissingExtensions { get; }
|
||||
|
||||
/// <summary>Enumerates WIC decoders and probes the HEVC/AV1 decoders. Call from any thread.</summary>
|
||||
/// <param name="refresh">Make WIC re-read codec registrations (after an extension was installed).</param>
|
||||
public static CodecInventory Detect(bool refresh = false)
|
||||
{
|
||||
var rawExtensionInstalled = PackageProbe.IsInstalled(RawImageExtensionPackageFamily);
|
||||
var decoders = WicComponents.EnumerateDecoders(refresh)
|
||||
.Select(d => d with { Extension = Classify(d, rawExtensionInstalled) })
|
||||
.ToArray();
|
||||
return new CodecInventory(decoders, VideoDecoderProbe.HasDecoder(VideoDecoderProbe.Hevc), VideoDecoderProbe.HasDecoder(VideoDecoderProbe.Av1));
|
||||
}
|
||||
|
||||
public FormatSupport For(ImageFileFormat format) =>
|
||||
_formats.TryGetValue(format, out var support) ? support : new FormatSupport(format, null, false, []);
|
||||
|
||||
public bool IsNative(ImageFileFormat format) => For(format).IsNative;
|
||||
|
||||
/// <summary>Which Microsoft Store extension installed a decoder, judged by its CLSID (and vendor for AVIF).</summary>
|
||||
internal static StoreExtensionKind? Classify(WicDecoderInfo decoder, bool rawExtensionInstalled)
|
||||
{
|
||||
if (decoder.Clsid == WicGuids.RawDecoder) return rawExtensionInstalled ? StoreExtensionKind.RawImage : null;
|
||||
if (decoder.Clsid == WicGuids.HeifDecoder) return StoreExtensionKind.HeifImage;
|
||||
if (decoder.Clsid == WicGuids.WebpDecoder) return StoreExtensionKind.WebpImage;
|
||||
var microsoft = decoder.Vendor == WicGuids.VendorMicrosoft || decoder.Vendor == WicGuids.VendorMicrosoftBuiltIn;
|
||||
return microsoft && decoder.Handles("avif") ? StoreExtensionKind.Av1Video : null;
|
||||
}
|
||||
|
||||
private FormatSupport Evaluate(ImageFormatInfo info)
|
||||
{
|
||||
var handler = Decoders.FirstOrDefault(d => info.Extensions.Any(d.Handles));
|
||||
switch (info.Format)
|
||||
{
|
||||
case ImageFileFormat.Heif:
|
||||
return new(info.Format, handler, handler is not null && HasHevcDecoder,
|
||||
Missing((handler is null, StoreExtensionKind.HeifImage), (!HasHevcDecoder, StoreExtensionKind.HevcVideo)));
|
||||
|
||||
case ImageFileFormat.Avif:
|
||||
// AVIF is HEIF with AV1 payloads: the HEIF decoder reads it when no dedicated AVIF decoder is registered.
|
||||
var avif = handler ?? Decoders.FirstOrDefault(d => d.Extension == StoreExtensionKind.HeifImage);
|
||||
return new(info.Format, avif, avif is not null && HasAv1Decoder,
|
||||
Missing((avif is null, StoreExtensionKind.HeifImage), (!HasAv1Decoder, StoreExtensionKind.Av1Video)));
|
||||
|
||||
case ImageFileFormat.WebP:
|
||||
return new(info.Format, handler, handler is not null, Missing((handler is null, StoreExtensionKind.WebpImage)));
|
||||
}
|
||||
|
||||
if (info.IsRaw)
|
||||
{
|
||||
var raw = Decoders.FirstOrDefault(d => d.Extension == StoreExtensionKind.RawImage && info.Extensions.Any(d.Handles));
|
||||
var extensionInstalled = Decoders.Any(d => d.Extension == StoreExtensionKind.RawImage);
|
||||
return new(info.Format, raw ?? handler, raw is not null, Missing((!extensionInstalled, StoreExtensionKind.RawImage)));
|
||||
}
|
||||
|
||||
return new(info.Format, handler, handler is not null, []);
|
||||
}
|
||||
|
||||
private static StoreExtension[] Missing(params ReadOnlySpan<(bool IsMissing, StoreExtensionKind Kind)> requirements)
|
||||
{
|
||||
var missing = new List<StoreExtension>(requirements.Length);
|
||||
foreach (var (isMissing, kind) in requirements)
|
||||
{
|
||||
if (isMissing) missing.Add(StoreExtension.Get(kind));
|
||||
}
|
||||
return [.. missing];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Chronos.Core.Windows.Codecs;
|
||||
|
||||
/// <summary>Checks whether a packaged (Store) app is registered for the current user.</summary>
|
||||
internal static partial class PackageProbe
|
||||
{
|
||||
private const int ERROR_SUCCESS = 0;
|
||||
private const int ERROR_INSUFFICIENT_BUFFER = 122;
|
||||
|
||||
/// <summary>True when at least one package of <paramref name="packageFamilyName"/> is installed for this user.</summary>
|
||||
public static bool IsInstalled(string packageFamilyName)
|
||||
{
|
||||
uint count = 0, bufferLength = 0;
|
||||
// With empty buffers the call reports how many packages exist (ERROR_INSUFFICIENT_BUFFER when any do).
|
||||
var result = GetPackagesByPackageFamily(packageFamilyName, ref count, 0, ref bufferLength, 0);
|
||||
return (result is ERROR_SUCCESS or ERROR_INSUFFICIENT_BUFFER) && count > 0;
|
||||
}
|
||||
|
||||
[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
|
||||
private static partial int GetPackagesByPackageFamily(string packageFamilyName, ref uint count, nint packageFullNames, ref uint bufferLength, nint buffer);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Chronos.Core.Windows.Shell;
|
||||
|
||||
namespace Chronos.Core.Windows.Codecs;
|
||||
|
||||
/// <summary>Free or paid Microsoft Store codec extensions that widen what WIC can decode (BRIEF §8.1).</summary>
|
||||
public enum StoreExtensionKind
|
||||
{
|
||||
RawImage,
|
||||
HeifImage,
|
||||
HevcVideo,
|
||||
Av1Video,
|
||||
WebpImage,
|
||||
}
|
||||
|
||||
/// <summary>A Microsoft Store codec extension: product id and the URIs that open its Store page.</summary>
|
||||
public sealed record StoreExtension(StoreExtensionKind Kind, string ProductName, string ProductId)
|
||||
{
|
||||
/// <summary>Catalogue in the order the UI lists missing extensions.</summary>
|
||||
public static IReadOnlyList<StoreExtension> All { get; } =
|
||||
[
|
||||
new(StoreExtensionKind.RawImage, "Raw Image Extension", "9NCTDW2W1BH8"),
|
||||
new(StoreExtensionKind.HeifImage, "HEIF Image Extensions", "9PMMSR1CGPWG"),
|
||||
new(StoreExtensionKind.HevcVideo, "HEVC Video Extensions", "9NMZLZ57R3T7"),
|
||||
new(StoreExtensionKind.Av1Video, "AV1 Video Extension", "9MVZQVXJBQ9V"),
|
||||
new(StoreExtensionKind.WebpImage, "WebP Image Extensions", "9PG2DK419DRG"),
|
||||
];
|
||||
|
||||
/// <summary>Store app deep link (<c>ms-windows-store://pdp/?ProductId=…</c>).</summary>
|
||||
public Uri StoreUri => new($"ms-windows-store://pdp/?ProductId={ProductId}");
|
||||
|
||||
/// <summary>Web page of the same product, for systems without the Store app.</summary>
|
||||
public Uri WebUri => new($"https://apps.microsoft.com/detail/{ProductId.ToLowerInvariant()}");
|
||||
|
||||
public static StoreExtension Get(StoreExtensionKind kind) => All.First(e => e.Kind == kind);
|
||||
|
||||
/// <summary>Opens the Store page through the shell; false when the shell could not open it.</summary>
|
||||
public bool OpenInStore() => ShellLauncher.OpenUrl(StoreUri.AbsoluteUri);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Chronos.Core.Windows.Codecs;
|
||||
|
||||
/// <summary>
|
||||
/// Detects HEVC and AV1 decoders with <c>MFTEnumEx</c>, the check Microsoft documents for the codecs that HEIC and
|
||||
/// AVIF decoding through WIC depend on (HEVC / AV1 Video Extensions or a vendor hardware decoder).
|
||||
/// </summary>
|
||||
internal static unsafe partial class VideoDecoderProbe
|
||||
{
|
||||
/// <summary>MFVideoFormat_HEVC (FOURCC 'HEVC').</summary>
|
||||
public static readonly Guid Hevc = new("43564548-0000-0010-8000-00aa00389b71");
|
||||
|
||||
/// <summary>MFVideoFormat_AV1 (FOURCC 'AV01').</summary>
|
||||
public static readonly Guid Av1 = new("31305641-0000-0010-8000-00aa00389b71");
|
||||
|
||||
private static readonly Guid VideoDecoderCategory = new("d6c02d4b-6833-45b4-971a-05a4b04bab91");
|
||||
private static readonly Guid MediaTypeVideo = new("73646976-0000-0010-8000-00aa00389b71");
|
||||
|
||||
private const uint MF_VERSION = 0x00020070;
|
||||
private const uint MFSTARTUP_LITE = 0x1;
|
||||
private const uint MFT_ENUM_FLAG_SYNCMFT = 0x1, MFT_ENUM_FLAG_ASYNCMFT = 0x2, MFT_ENUM_FLAG_HARDWARE = 0x4, MFT_ENUM_FLAG_SORTANDFILTER = 0x40;
|
||||
|
||||
/// <summary>True when at least one decoder MFT accepts the video <paramref name="subtype"/>.</summary>
|
||||
public static bool HasDecoder(Guid subtype)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MFStartup(MF_VERSION, MFSTARTUP_LITE) < 0) return false;
|
||||
try
|
||||
{
|
||||
var input = new MftRegisterTypeInfo { MajorType = MediaTypeVideo, Subtype = subtype };
|
||||
const uint flags = MFT_ENUM_FLAG_SYNCMFT | MFT_ENUM_FLAG_ASYNCMFT | MFT_ENUM_FLAG_HARDWARE | MFT_ENUM_FLAG_SORTANDFILTER;
|
||||
if (MFTEnumEx(VideoDecoderCategory, flags, &input, null, out var activates, out var count) < 0) return false;
|
||||
for (var i = 0; i < count; i++) Marshal.Release(((nint*)activates)[i]);
|
||||
Marshal.FreeCoTaskMem(activates);
|
||||
return count > 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MFShutdown();
|
||||
}
|
||||
}
|
||||
catch (DllNotFoundException)
|
||||
{
|
||||
// Windows "N" editions ship without Media Foundation unless the Media Feature Pack is installed.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct MftRegisterTypeInfo
|
||||
{
|
||||
public Guid MajorType;
|
||||
public Guid Subtype;
|
||||
}
|
||||
|
||||
[LibraryImport("mfplat.dll")]
|
||||
private static partial int MFStartup(uint version, uint flags);
|
||||
|
||||
[LibraryImport("mfplat.dll")]
|
||||
private static partial int MFShutdown();
|
||||
|
||||
[LibraryImport("mfplat.dll")]
|
||||
private static partial int MFTEnumEx(Guid category, uint flags, MftRegisterTypeInfo* inputType, MftRegisterTypeInfo* outputType, out nint activates, out uint count);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
namespace Chronos.Core.Windows.Codecs;
|
||||
|
||||
/// <summary>One installed WIC decoder as registered on this machine.</summary>
|
||||
/// <param name="FriendlyName">Registered display name, e.g. "JPEG Decoder".</param>
|
||||
/// <param name="Clsid">Decoder class id.</param>
|
||||
/// <param name="ContainerFormat">WIC container format GUID.</param>
|
||||
/// <param name="Vendor">Vendor GUID (Microsoft built-in, Microsoft, or a third party).</param>
|
||||
/// <param name="Version">Registered version string.</param>
|
||||
/// <param name="FileExtensions">Lower-case extensions without the dot.</param>
|
||||
/// <param name="Extension">The Microsoft Store extension that installed it, if any.</param>
|
||||
public sealed record WicDecoderInfo(
|
||||
string FriendlyName,
|
||||
Guid Clsid,
|
||||
Guid ContainerFormat,
|
||||
Guid Vendor,
|
||||
string Version,
|
||||
IReadOnlyList<string> FileExtensions,
|
||||
StoreExtensionKind? Extension)
|
||||
{
|
||||
/// <summary>True when the decoder registers <paramref name="extension"/> (with or without the dot).</summary>
|
||||
public bool Handles(string extension)
|
||||
{
|
||||
var bare = extension.TrimStart('.');
|
||||
foreach (var e in FileExtensions)
|
||||
{
|
||||
if (string.Equals(e, bare, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Parses WIC's comma-separated extension list (".jpg,.jpeg") into bare lower-case names.</summary>
|
||||
internal static IReadOnlyList<string> ParseExtensions(string list) =>
|
||||
list.Split([',', ';', ' '], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
|
||||
.Select(e => e.TrimStart('.').ToLowerInvariant())
|
||||
.Where(e => e.Length > 0)
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
}
|
||||
Reference in new issue
Block a user