Respect FFMpeg path passed via Environment Variable

This commit is contained in:
Neil Burrows 2020-06-29 17:08:20 +01:00
parent c39ad25e4c
commit 4389773508
4 changed files with 15 additions and 5 deletions

View File

@ -568,8 +568,7 @@ namespace Emby.Server.Implementations
// TODO: Refactor to eliminate the circular dependency here so that Lazy<T> isn't required // TODO: Refactor to eliminate the circular dependency here so that Lazy<T> isn't required
// TODO: Add StartupOptions.FFmpegPath to IConfiguration and remove this custom activation // TODO: Add StartupOptions.FFmpegPath to IConfiguration and remove this custom activation
serviceCollection.AddTransient(provider => new Lazy<EncodingHelper>(provider.GetRequiredService<EncodingHelper>)); serviceCollection.AddTransient(provider => new Lazy<EncodingHelper>(provider.GetRequiredService<EncodingHelper>));
serviceCollection.AddSingleton<IMediaEncoder>(provider => serviceCollection.AddSingleton<IMediaEncoder, MediaBrowser.MediaEncoding.Encoder.MediaEncoder>();
ActivatorUtilities.CreateInstance<MediaBrowser.MediaEncoding.Encoder.MediaEncoder>(provider, _startupOptions.FFmpegPath ?? string.Empty));
// TODO: Refactor to eliminate the circular dependencies here so that Lazy<T> isn't required // TODO: Refactor to eliminate the circular dependencies here so that Lazy<T> isn't required
serviceCollection.AddTransient(provider => new Lazy<ILibraryMonitor>(provider.GetRequiredService<ILibraryMonitor>)); serviceCollection.AddTransient(provider => new Lazy<ILibraryMonitor>(provider.GetRequiredService<ILibraryMonitor>));

View File

@ -101,6 +101,11 @@ namespace Jellyfin.Server
config.Add(UdpServer.AddressOverrideConfigKey, PublishedServerUrl.ToString()); config.Add(UdpServer.AddressOverrideConfigKey, PublishedServerUrl.ToString());
} }
if (FFmpegPath != null)
{
config.Add(ConfigurationExtensions.FfmpegPathKey, FFmpegPath);
}
return config; return config;
} }
} }

View File

@ -23,6 +23,11 @@ namespace MediaBrowser.Controller.Extensions
/// </summary> /// </summary>
public const string FfmpegAnalyzeDurationKey = "FFmpeg:analyzeduration"; public const string FfmpegAnalyzeDurationKey = "FFmpeg:analyzeduration";
/// <summary>
/// The key for the FFmpeg path option.
/// </summary>
public const string FfmpegPathKey = "ffmpeg";
/// <summary> /// <summary>
/// The key for a setting that indicates whether playlists should allow duplicate entries. /// The key for a setting that indicates whether playlists should allow duplicate entries.
/// </summary> /// </summary>

View File

@ -21,6 +21,7 @@ using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.System; using MediaBrowser.Model.System;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.Extensions.Configuration;
namespace MediaBrowser.MediaEncoding.Encoder namespace MediaBrowser.MediaEncoding.Encoder
{ {
@ -46,7 +47,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly object _runningProcessesLock = new object(); private readonly object _runningProcessesLock = new object();
private readonly List<ProcessWrapper> _runningProcesses = new List<ProcessWrapper>(); private readonly List<ProcessWrapper> _runningProcesses = new List<ProcessWrapper>();
private string _ffmpegPath; private string _ffmpegPath = string.Empty;
private string _ffprobePath; private string _ffprobePath;
public MediaEncoder( public MediaEncoder(
@ -55,14 +56,14 @@ namespace MediaBrowser.MediaEncoding.Encoder
IFileSystem fileSystem, IFileSystem fileSystem,
ILocalizationManager localization, ILocalizationManager localization,
Lazy<EncodingHelper> encodingHelperFactory, Lazy<EncodingHelper> encodingHelperFactory,
string startupOptionsFFmpegPath) IConfiguration config)
{ {
_logger = logger; _logger = logger;
_configurationManager = configurationManager; _configurationManager = configurationManager;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_localization = localization; _localization = localization;
_encodingHelperFactory = encodingHelperFactory; _encodingHelperFactory = encodingHelperFactory;
_startupOptionFFmpegPath = startupOptionsFFmpegPath; _startupOptionFFmpegPath = config.GetValue<string>(Controller.Extensions.ConfigurationExtensions.FfmpegPathKey) ?? "";
} }
private EncodingHelper EncodingHelper => _encodingHelperFactory.Value; private EncodingHelper EncodingHelper => _encodingHelperFactory.Value;