diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-04-22 20:39:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-22 20:39:03 +0200 |
| commit | 07c4dfd8fe7331b80389ae5002397ae134b14f9e (patch) | |
| tree | 3730a47d01e54416fa4461a6e28eebaef4c8f7d2 /MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | |
| parent | a85b1dcba663fe3bbb2441380cd8da382c92f2bd (diff) | |
| parent | 8f02fb9a4f062e2b6d980b6645a85e2681298dfa (diff) | |
Merge pull request #2765 from mark-monteiro/register-services-correctly
Register And Construct Services Correctly Using DI Framework
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 359330449..992ad146d 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -19,7 +19,6 @@ using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.System; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using System.Diagnostics; @@ -39,8 +38,7 @@ namespace MediaBrowser.MediaEncoding.Encoder private readonly IServerConfigurationManager _configurationManager; private readonly IFileSystem _fileSystem; private readonly ILocalizationManager _localization; - private readonly Func<ISubtitleEncoder> _subtitleEncoder; - private readonly IConfiguration _configuration; + private readonly Lazy<EncodingHelper> _encodingHelperFactory; private readonly string _startupOptionFFmpegPath; private readonly SemaphoreSlim _thumbnailResourcePool = new SemaphoreSlim(2, 2); @@ -48,8 +46,6 @@ namespace MediaBrowser.MediaEncoding.Encoder private readonly object _runningProcessesLock = new object(); private readonly List<ProcessWrapper> _runningProcesses = new List<ProcessWrapper>(); - private EncodingHelper _encodingHelper; - private string _ffmpegPath; private string _ffprobePath; @@ -58,23 +54,18 @@ namespace MediaBrowser.MediaEncoding.Encoder IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILocalizationManager localization, - Func<ISubtitleEncoder> subtitleEncoder, - IConfiguration configuration, + Lazy<EncodingHelper> encodingHelperFactory, string startupOptionsFFmpegPath) { _logger = logger; _configurationManager = configurationManager; _fileSystem = fileSystem; _localization = localization; + _encodingHelperFactory = encodingHelperFactory; _startupOptionFFmpegPath = startupOptionsFFmpegPath; - _subtitleEncoder = subtitleEncoder; - _configuration = configuration; } - private EncodingHelper EncodingHelper - => LazyInitializer.EnsureInitialized( - ref _encodingHelper, - () => new EncodingHelper(this, _fileSystem, _subtitleEncoder(), _configuration)); + private EncodingHelper EncodingHelper => _encodingHelperFactory.Value; /// <inheritdoc /> public string EncoderPath => _ffmpegPath; |
