mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
update ffmpeg info
This commit is contained in:
parent
132766ff15
commit
d91c63c553
|
@ -9,6 +9,8 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using MediaBrowser.Controller.Power;
|
||||
using MediaBrowser.Server.Startup.Common.FFMpeg;
|
||||
using OperatingSystem = MediaBrowser.Server.Startup.Common.OperatingSystem;
|
||||
|
||||
namespace MediaBrowser.Server.Mono.Native
|
||||
{
|
||||
|
@ -209,6 +211,99 @@ namespace MediaBrowser.Server.Mono.Native
|
|||
{
|
||||
return new NullPowerManagement();
|
||||
}
|
||||
|
||||
public FFMpegInstallInfo GetFfmpegInstallInfo()
|
||||
{
|
||||
return GetInfo(Environment);
|
||||
}
|
||||
|
||||
public static FFMpegInstallInfo GetInfo(NativeEnvironment environment)
|
||||
{
|
||||
var info = new FFMpegInstallInfo();
|
||||
|
||||
// Windows builds: http://ffmpeg.zeranoe.com/builds/
|
||||
// Linux builds: http://johnvansickle.com/ffmpeg/
|
||||
// OS X builds: http://ffmpegmac.net/
|
||||
// OS X x64: http://www.evermeet.cx/ffmpeg/
|
||||
|
||||
switch (environment.OperatingSystem)
|
||||
{
|
||||
case OperatingSystem.Bsd:
|
||||
break;
|
||||
case OperatingSystem.Linux:
|
||||
|
||||
info.ArchiveType = "7z";
|
||||
info.Version = "20160215";
|
||||
break;
|
||||
case OperatingSystem.Osx:
|
||||
|
||||
info.ArchiveType = "7z";
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
info.Version = "20160124";
|
||||
break;
|
||||
case Architecture.X86:
|
||||
info.Version = "20150110";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
info.DownloadUrls = GetDownloadUrls(environment);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
private static string[] GetDownloadUrls(NativeEnvironment environment)
|
||||
{
|
||||
switch (environment.OperatingSystem)
|
||||
{
|
||||
case OperatingSystem.Osx:
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
|
||||
};
|
||||
case Architecture.X86:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z"
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case OperatingSystem.Linux:
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"
|
||||
};
|
||||
case Architecture.X86:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
|
||||
};
|
||||
case Architecture.Arm:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-arm.7z"
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// No version available
|
||||
return new string[] { };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class NullPowerManagement : IPowerManagement
|
||||
|
|
|
@ -618,7 +618,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
/// <returns>Task.</returns>
|
||||
private async Task RegisterMediaEncoder(IProgress<double> progress)
|
||||
{
|
||||
var info = await new FFMpegDownloader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetType().Assembly)
|
||||
var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetType().Assembly, NativeApp.GetFfmpegInstallInfo())
|
||||
.GetFFMpegInfo(NativeApp.Environment, _startupOptions, progress).ConfigureAwait(false);
|
||||
|
||||
var mediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"),
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
|
||||
namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
||||
{
|
||||
public class FFMpegDownloadInfo
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public string FFMpegFilename { get; set; }
|
||||
public string FFProbeFilename { get; set; }
|
||||
public string ArchiveType { get; set; }
|
||||
public string[] DownloadUrls { get; set; }
|
||||
public bool IsEmbedded { get; set; }
|
||||
|
||||
public FFMpegDownloadInfo()
|
||||
{
|
||||
DownloadUrls = new string[] { };
|
||||
Version = "Path";
|
||||
FFMpegFilename = "ffmpeg";
|
||||
FFProbeFilename = "ffprobe";
|
||||
}
|
||||
|
||||
public static FFMpegDownloadInfo GetInfo(NativeEnvironment environment)
|
||||
{
|
||||
var info = new FFMpegDownloadInfo();
|
||||
|
||||
// Windows builds: http://ffmpeg.zeranoe.com/builds/
|
||||
// Linux builds: http://johnvansickle.com/ffmpeg/
|
||||
// OS X builds: http://ffmpegmac.net/
|
||||
// OS X x64: http://www.evermeet.cx/ffmpeg/
|
||||
|
||||
switch (environment.OperatingSystem)
|
||||
{
|
||||
case OperatingSystem.Bsd:
|
||||
break;
|
||||
case OperatingSystem.Linux:
|
||||
|
||||
info.ArchiveType = "7z";
|
||||
info.Version = "20160215";
|
||||
break;
|
||||
case OperatingSystem.Osx:
|
||||
|
||||
info.ArchiveType = "7z";
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
info.Version = "20160124";
|
||||
break;
|
||||
case Architecture.X86:
|
||||
info.Version = "20150110";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case OperatingSystem.Windows:
|
||||
|
||||
info.FFMpegFilename = "ffmpeg.exe";
|
||||
info.FFProbeFilename = "ffprobe.exe";
|
||||
info.Version = "20160401";
|
||||
info.ArchiveType = "7z";
|
||||
info.IsEmbedded = true;
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
break;
|
||||
case Architecture.X86:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
info.DownloadUrls = GetDownloadUrls(environment);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
private static string[] GetDownloadUrls(NativeEnvironment environment)
|
||||
{
|
||||
switch (environment.OperatingSystem)
|
||||
{
|
||||
case OperatingSystem.Windows:
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
return new string[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx64.7z" };
|
||||
case Architecture.X86:
|
||||
return new string[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx86.7z" };
|
||||
}
|
||||
break;
|
||||
|
||||
case OperatingSystem.Osx:
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
|
||||
};
|
||||
case Architecture.X86:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z"
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case OperatingSystem.Linux:
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"
|
||||
};
|
||||
case Architecture.X86:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
|
||||
};
|
||||
case Architecture.Arm:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-arm.7z"
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// No version available
|
||||
return new string[] { };
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
||||
{
|
||||
public class FFMpegInstallInfo
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public string FFMpegFilename { get; set; }
|
||||
public string FFProbeFilename { get; set; }
|
||||
public string ArchiveType { get; set; }
|
||||
public string[] DownloadUrls { get; set; }
|
||||
public bool IsEmbedded { get; set; }
|
||||
|
||||
public FFMpegInstallInfo()
|
||||
{
|
||||
DownloadUrls = new string[] { };
|
||||
Version = "Path";
|
||||
FFMpegFilename = "ffmpeg";
|
||||
FFProbeFilename = "ffprobe";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ using CommonIO;
|
|||
|
||||
namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
||||
{
|
||||
public class FFMpegDownloader
|
||||
public class FFMpegLoader
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
|
@ -24,14 +24,15 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
private readonly IZipClient _zipClient;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly NativeEnvironment _environment;
|
||||
private Assembly _ownerAssembly;
|
||||
private readonly Assembly _ownerAssembly;
|
||||
private readonly FFMpegInstallInfo _ffmpegInstallInfo;
|
||||
|
||||
private readonly string[] _fontUrls =
|
||||
{
|
||||
"https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/ARIALUNI.7z"
|
||||
};
|
||||
|
||||
public FFMpegDownloader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment, Assembly ownerAssembly)
|
||||
public FFMpegLoader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment, Assembly ownerAssembly, FFMpegInstallInfo ffmpegInstallInfo)
|
||||
{
|
||||
_logger = logger;
|
||||
_appPaths = appPaths;
|
||||
|
@ -40,6 +41,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
_fileSystem = fileSystem;
|
||||
_environment = environment;
|
||||
_ownerAssembly = ownerAssembly;
|
||||
_ffmpegInstallInfo = ffmpegInstallInfo;
|
||||
}
|
||||
|
||||
public async Task<FFMpegInfo> GetFFMpegInfo(NativeEnvironment environment, StartupOptions options, IProgress<double> progress)
|
||||
|
@ -57,7 +59,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
};
|
||||
}
|
||||
|
||||
var downloadInfo = FFMpegDownloadInfo.GetInfo(environment);
|
||||
var downloadInfo = _ffmpegInstallInfo;
|
||||
|
||||
var version = downloadInfo.Version;
|
||||
|
||||
|
@ -181,7 +183,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
return null;
|
||||
}
|
||||
|
||||
private async void DownloadFFMpegInBackground(FFMpegDownloadInfo downloadinfo, string directory)
|
||||
private async void DownloadFFMpegInBackground(FFMpegInstallInfo downloadinfo, string directory)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -193,7 +195,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
}
|
||||
}
|
||||
|
||||
private async Task DownloadFFMpeg(FFMpegDownloadInfo downloadinfo, string directory, IProgress<double> progress)
|
||||
private async Task DownloadFFMpeg(FFMpegInstallInfo downloadinfo, string directory, IProgress<double> progress)
|
||||
{
|
||||
if (downloadinfo.IsEmbedded)
|
||||
{
|
||||
|
@ -241,7 +243,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
throw new ApplicationException("Unable to download required components. Please try again later.");
|
||||
}
|
||||
|
||||
private void ExtractFFMpeg(FFMpegDownloadInfo downloadinfo, string tempFile, string targetFolder)
|
||||
private void ExtractFFMpeg(FFMpegInstallInfo downloadinfo, string tempFile, string targetFolder)
|
||||
{
|
||||
_logger.Info("Extracting ffmpeg from {0}", tempFile);
|
||||
|
||||
|
@ -287,7 +289,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
|
|||
}
|
||||
}
|
||||
|
||||
private void ExtractArchive(FFMpegDownloadInfo downloadinfo, string archivePath, string targetPath)
|
||||
private void ExtractArchive(FFMpegInstallInfo downloadinfo, string archivePath, string targetPath)
|
||||
{
|
||||
_logger.Info("Extracting {0} to {1}", archivePath, targetPath);
|
||||
|
|
@ -3,6 +3,7 @@ using MediaBrowser.Model.Logging;
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using MediaBrowser.Controller.Power;
|
||||
using MediaBrowser.Server.Startup.Common.FFMpeg;
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common
|
||||
{
|
||||
|
@ -97,5 +98,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
/// </summary>
|
||||
/// <returns>IPowerManagement.</returns>
|
||||
IPowerManagement GetPowerManagement();
|
||||
|
||||
FFMpegInstallInfo GetFfmpegInstallInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@
|
|||
<Compile Include="Browser\BrowserLauncher.cs" />
|
||||
<Compile Include="EntryPoints\KeepServerAwake.cs" />
|
||||
<Compile Include="EntryPoints\StartupWizard.cs" />
|
||||
<Compile Include="FFMpeg\FFMpegDownloader.cs" />
|
||||
<Compile Include="FFMpeg\FFMpegDownloadInfo.cs" />
|
||||
<Compile Include="FFMpeg\FFMpegLoader.cs" />
|
||||
<Compile Include="FFMpeg\FFMpegInstallInfo.cs" />
|
||||
<Compile Include="FFMpeg\FFMpegInfo.cs" />
|
||||
<Compile Include="FFMpeg\FFmpegValidator.cs" />
|
||||
<Compile Include="INativeApp.cs" />
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Controller.Power;
|
||||
using MediaBrowser.Server.Startup.Common.FFMpeg;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.Native
|
||||
{
|
||||
|
@ -124,5 +125,32 @@ namespace MediaBrowser.ServerApplication.Native
|
|||
{
|
||||
return new WindowsPowerManagement(_logger);
|
||||
}
|
||||
|
||||
public FFMpegInstallInfo GetFfmpegInstallInfo()
|
||||
{
|
||||
var info = new FFMpegInstallInfo();
|
||||
|
||||
info.FFMpegFilename = "ffmpeg.exe";
|
||||
info.FFProbeFilename = "ffprobe.exe";
|
||||
info.Version = "20160401";
|
||||
info.ArchiveType = "7z";
|
||||
info.IsEmbedded = true;
|
||||
info.DownloadUrls = GetDownloadUrls();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
private string[] GetDownloadUrls()
|
||||
{
|
||||
switch (Environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
return new[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx64.7z" };
|
||||
case Architecture.X86:
|
||||
return new[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx86.7z" };
|
||||
}
|
||||
|
||||
return new string[] { };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue