mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
Add back warning message when Skia encoder cannot be used
This commit is contained in:
parent
9728aa8b0a
commit
ecf49caf0d
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Emby.Drawing;
|
using Emby.Drawing;
|
||||||
|
@ -42,11 +43,19 @@ namespace Jellyfin.Server
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected override void RegisterServices(IServiceCollection serviceCollection)
|
protected override void RegisterServices(IServiceCollection serviceCollection)
|
||||||
{
|
{
|
||||||
var imageEncoderType = SkiaEncoder.IsNativeLibAvailable()
|
// Register an image encoder
|
||||||
|
bool useSkiaEncoder = SkiaEncoder.IsNativeLibAvailable();
|
||||||
|
Type imageEncoderType = useSkiaEncoder
|
||||||
? typeof(SkiaEncoder)
|
? typeof(SkiaEncoder)
|
||||||
: typeof(NullImageEncoder);
|
: typeof(NullImageEncoder);
|
||||||
serviceCollection.AddSingleton(typeof(IImageEncoder), imageEncoderType);
|
serviceCollection.AddSingleton(typeof(IImageEncoder), imageEncoderType);
|
||||||
|
|
||||||
|
// Log a warning if the Skia encoder could not be used
|
||||||
|
if (!useSkiaEncoder)
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Skia not available. Will fallback to {nameof(NullImageEncoder)}.");
|
||||||
|
}
|
||||||
|
|
||||||
base.RegisterServices(serviceCollection);
|
base.RegisterServices(serviceCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue