mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	Merge pull request #3480 from neilsb/ffmpeg-env-var
Respect FFMpeg path passed via Environment Variable
This commit is contained in:
		
						commit
						72aa0bb1ad
					
				@ -566,10 +566,8 @@ namespace Emby.Server.Implementations
 | 
				
			|||||||
            serviceCollection.AddTransient(provider => new Lazy<IDtoService>(provider.GetRequiredService<IDtoService>));
 | 
					            serviceCollection.AddTransient(provider => new Lazy<IDtoService>(provider.GetRequiredService<IDtoService>));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 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
 | 
					 | 
				
			||||||
            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>));
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -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>
 | 
				
			||||||
 | 
				
			|||||||
@ -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) ?? string.Empty;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private EncodingHelper EncodingHelper => _encodingHelperFactory.Value;
 | 
					        private EncodingHelper EncodingHelper => _encodingHelperFactory.Value;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user