Register IImageEncoder in Jellyfin.Server instead of Emby.Server.Implementations

pull/2765/head
Mark Monteiro 4 years ago
parent 735d6c8ad5
commit f2760cb055

@ -48,7 +48,6 @@ using Emby.Server.Implementations.Session;
using Emby.Server.Implementations.SocketSharp; using Emby.Server.Implementations.SocketSharp;
using Emby.Server.Implementations.TV; using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates; using Emby.Server.Implementations.Updates;
using Jellyfin.Drawing.Skia;
using MediaBrowser.Api; using MediaBrowser.Api;
using MediaBrowser.Common; using MediaBrowser.Common;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
@ -540,13 +539,8 @@ namespace Emby.Server.Implementations
/// <summary> /// <summary>
/// Registers services/resources with the service collection that will be available via DI. /// Registers services/resources with the service collection that will be available via DI.
/// </summary> /// </summary>
protected void RegisterServices(IServiceCollection serviceCollection) protected virtual void RegisterServices(IServiceCollection serviceCollection)
{ {
var imageEncoderType = SkiaEncoder.IsNativeLibAvailable()
? typeof(SkiaEncoder)
: typeof(NullImageEncoder);
serviceCollection.AddSingleton(typeof(IImageEncoder), imageEncoderType);
serviceCollection.AddSingleton(_startupOptions); serviceCollection.AddSingleton(_startupOptions);
serviceCollection.AddMemoryCache(); serviceCollection.AddMemoryCache();

@ -4,7 +4,6 @@
<ProjectReference Include="..\Emby.Naming\Emby.Naming.csproj" /> <ProjectReference Include="..\Emby.Naming\Emby.Naming.csproj" />
<ProjectReference Include="..\Emby.Notifications\Emby.Notifications.csproj" /> <ProjectReference Include="..\Emby.Notifications\Emby.Notifications.csproj" />
<ProjectReference Include="..\Jellyfin.Api\Jellyfin.Api.csproj" /> <ProjectReference Include="..\Jellyfin.Api\Jellyfin.Api.csproj" />
<ProjectReference Include="..\Jellyfin.Drawing.Skia\Jellyfin.Drawing.Skia.csproj" />
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" /> <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" /> <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />

@ -1,9 +1,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using Emby.Drawing;
using Emby.Server.Implementations; using Emby.Server.Implementations;
using Jellyfin.Drawing.Skia;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Jellyfin.Server namespace Jellyfin.Server
@ -36,6 +39,17 @@ namespace Jellyfin.Server
{ {
} }
/// <inheritdoc/>
protected override void RegisterServices(IServiceCollection serviceCollection)
{
var imageEncoderType = SkiaEncoder.IsNativeLibAvailable()
? typeof(SkiaEncoder)
: typeof(NullImageEncoder);
serviceCollection.AddSingleton(typeof(IImageEncoder), imageEncoderType);
base.RegisterServices(serviceCollection);
}
/// <inheritdoc /> /// <inheritdoc />
protected override void RestartInternal() => Program.Restart(); protected override void RestartInternal() => Program.Restart();

Loading…
Cancel
Save