update ffmpeg path customization
This commit is contained in:
parent
6cb5b2cd72
commit
fb07b4640c
|
@ -19,12 +19,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
/// <value>The encoder path.</value>
|
/// <value>The encoder path.</value>
|
||||||
string EncoderPath { get; }
|
string EncoderPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the version.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The version.</value>
|
|
||||||
string Version { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Supportses the decoder.
|
/// Supportses the decoder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -66,8 +66,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
|
|
||||||
public string FFProbePath { get; private set; }
|
public string FFProbePath { get; private set; }
|
||||||
|
|
||||||
public string Version { get; private set; }
|
|
||||||
|
|
||||||
protected readonly IServerConfigurationManager ConfigurationManager;
|
protected readonly IServerConfigurationManager ConfigurationManager;
|
||||||
protected readonly IFileSystem FileSystem;
|
protected readonly IFileSystem FileSystem;
|
||||||
protected readonly ILiveTvManager LiveTvManager;
|
protected readonly ILiveTvManager LiveTvManager;
|
||||||
|
@ -81,11 +79,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
private readonly List<ProcessWrapper> _runningProcesses = new List<ProcessWrapper>();
|
private readonly List<ProcessWrapper> _runningProcesses = new List<ProcessWrapper>();
|
||||||
private readonly bool _hasExternalEncoder;
|
private readonly bool _hasExternalEncoder;
|
||||||
|
|
||||||
public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, string version, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILiveTvManager liveTvManager, IIsoManager isoManager, ILibraryManager libraryManager, IChannelManager channelManager, ISessionManager sessionManager, Func<ISubtitleEncoder> subtitleEncoder, Func<IMediaSourceManager> mediaSourceManager)
|
public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, bool hasExternalEncoder, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILiveTvManager liveTvManager, IIsoManager isoManager, ILibraryManager libraryManager, IChannelManager channelManager, ISessionManager sessionManager, Func<ISubtitleEncoder> subtitleEncoder, Func<IMediaSourceManager> mediaSourceManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
Version = version;
|
|
||||||
ConfigurationManager = configurationManager;
|
ConfigurationManager = configurationManager;
|
||||||
FileSystem = fileSystem;
|
FileSystem = fileSystem;
|
||||||
LiveTvManager = liveTvManager;
|
LiveTvManager = liveTvManager;
|
||||||
|
@ -98,34 +95,51 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
FFProbePath = ffProbePath;
|
FFProbePath = ffProbePath;
|
||||||
FFMpegPath = ffMpegPath;
|
FFMpegPath = ffMpegPath;
|
||||||
|
|
||||||
_hasExternalEncoder = !string.IsNullOrWhiteSpace(ffMpegPath);
|
_hasExternalEncoder = hasExternalEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
ConfigureEncoderPaths();
|
ConfigureEncoderPaths();
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureEncoderPaths()
|
|
||||||
{
|
|
||||||
if (_hasExternalEncoder)
|
if (_hasExternalEncoder)
|
||||||
{
|
{
|
||||||
LogPaths();
|
LogPaths();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var appPath = GetEncodingOptions().EncoderAppPath;
|
// If the path was passed in, save it into config now.
|
||||||
|
var encodingOptions = GetEncodingOptions();
|
||||||
if (Directory.Exists(appPath))
|
var appPath = encodingOptions.EncoderAppPath;
|
||||||
|
if (!string.IsNullOrWhiteSpace(FFMpegPath) && !string.Equals(FFMpegPath, appPath, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
SetPathsFromDirectory(appPath);
|
encodingOptions.EncoderAppPath = FFMpegPath;
|
||||||
|
ConfigurationManager.SaveConfiguration("encoding", encodingOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigureEncoderPaths()
|
||||||
|
{
|
||||||
|
if (_hasExternalEncoder)
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (File.Exists(appPath))
|
var appPath = GetEncodingOptions().EncoderAppPath;
|
||||||
{
|
|
||||||
FFMpegPath = appPath;
|
|
||||||
|
|
||||||
SetProbePathFromEncoderPath(appPath);
|
if (!string.IsNullOrWhiteSpace(appPath))
|
||||||
|
{
|
||||||
|
if (Directory.Exists(appPath))
|
||||||
|
{
|
||||||
|
SetPathsFromDirectory(appPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (File.Exists(appPath))
|
||||||
|
{
|
||||||
|
FFMpegPath = appPath;
|
||||||
|
|
||||||
|
SetProbePathFromEncoderPath(appPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPaths();
|
LogPaths();
|
||||||
|
|
|
@ -650,13 +650,13 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetType().Assembly, NativeApp.GetFfmpegInstallInfo())
|
var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetType().Assembly, NativeApp.GetFfmpegInstallInfo())
|
||||||
.GetFFMpegInfo(NativeApp.Environment, _startupOptions, progress).ConfigureAwait(false);
|
.GetFFMpegInfo(NativeApp.Environment, _startupOptions, progress).ConfigureAwait(false);
|
||||||
|
|
||||||
_hasExternalEncoder = !string.IsNullOrWhiteSpace(info.EncoderPath);
|
_hasExternalEncoder = string.Equals(info.Version, "custom", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var mediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"),
|
var mediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"),
|
||||||
JsonSerializer,
|
JsonSerializer,
|
||||||
info.EncoderPath,
|
info.EncoderPath,
|
||||||
info.ProbePath,
|
info.ProbePath,
|
||||||
info.Version,
|
_hasExternalEncoder,
|
||||||
ServerConfigurationManager,
|
ServerConfigurationManager,
|
||||||
FileSystemManager,
|
FileSystemManager,
|
||||||
LiveTvManager,
|
LiveTvManager,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user