aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
blob: c86e85785bf084c349e426e658364932fae58997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using Emby.Drawing;
using Emby.Drawing.Skia;
using Emby.Server.Implementations;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;

namespace MediaBrowser.Server.Startup.Common
{
    public class ImageEncoderHelper
    {
        public static IImageEncoder GetImageEncoder(ILogger logger,
            ILogManager logManager,
            IFileSystem fileSystem,
            StartupOptions startupOptions,
            Func<IHttpClient> httpClient,
            IApplicationPaths appPaths)
        {
            try
            {
                return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem);
            }
            catch
            {
                logger.Error("Skia not available. Will try next image processor.");
            }

            return new NullImageEncoder();
        }
    }
}