mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
FFMpegCore: remove binaries from repository (use choco)
- improve binary path detection
Former-commit-id: 4d75640a16
This commit is contained in:
parent
77849ecf5b
commit
214d68d369
11 changed files with 52 additions and 64 deletions
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"RootDirectory": "./FFMPEG/bin"
|
"RootDirectory": "C:\\ProgramData\\chocolatey\\lib\\ffmpeg\\tools\\ffmpeg\\bin\\"
|
||||||
}
|
}
|
|
@ -30,16 +30,7 @@ public FFMpeg(): base()
|
||||||
{
|
{
|
||||||
FFMpegHelper.RootExceptionCheck(FFMpegOptions.Options.RootDirectory);
|
FFMpegHelper.RootExceptionCheck(FFMpegOptions.Options.RootDirectory);
|
||||||
|
|
||||||
var progName = "ffmpeg";
|
_ffmpegPath = FFMpegOptions.Options.FFmpegBinary;
|
||||||
if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) {
|
|
||||||
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
|
||||||
|
|
||||||
progName = $"{target}{Path.DirectorySeparatorChar}{progName}.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = $"{Path.DirectorySeparatorChar}{progName}";
|
|
||||||
|
|
||||||
_ffmpegPath = $"{FFMpegOptions.Options.RootDirectory}{path}";
|
|
||||||
|
|
||||||
ArgumentBuilder = new FFArgumentBuilder();
|
ArgumentBuilder = new FFArgumentBuilder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
using Newtonsoft.Json;
|
using FFMpegCore.FFMPEG.Exceptions;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace FFMpegCore.FFMPEG
|
namespace FFMpegCore.FFMPEG
|
||||||
{
|
{
|
||||||
|
@ -24,5 +27,49 @@ static FFMpegOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RootDirectory { get; set; } = _DefaultRoot;
|
public string RootDirectory { get; set; } = _DefaultRoot;
|
||||||
|
|
||||||
|
public string FFmpegBinary
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
||||||
|
var progName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ffmpeg.exe" : "ffmpeg";
|
||||||
|
|
||||||
|
if (Directory.Exists($"{Options.RootDirectory}{target}"))
|
||||||
|
{
|
||||||
|
progName = $"{target}{Path.DirectorySeparatorChar}{progName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = $"{Options.RootDirectory}{Path.DirectorySeparatorChar}{progName}";
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
||||||
|
$"FFMpeg cannot be found @ {path}");
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string FFProbeBinary
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
||||||
|
var progName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ffprobe.exe" : "ffprobe";
|
||||||
|
|
||||||
|
if (Directory.Exists($"{Options.RootDirectory}{target}"))
|
||||||
|
{
|
||||||
|
progName = $"{target}{Path.DirectorySeparatorChar}{progName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = $"{Options.RootDirectory}{Path.DirectorySeparatorChar}{progName}";
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
||||||
|
$"FFProbe cannot be found @ {path}");
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,7 @@ public FFProbe(): base()
|
||||||
{
|
{
|
||||||
FFProbeHelper.RootExceptionCheck(FFMpegOptions.Options.RootDirectory);
|
FFProbeHelper.RootExceptionCheck(FFMpegOptions.Options.RootDirectory);
|
||||||
|
|
||||||
var progName = "ffprobe";
|
_ffprobePath = FFMpegOptions.Options.FFProbeBinary;
|
||||||
if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) {
|
|
||||||
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
|
||||||
|
|
||||||
progName = $"{target}{Path.DirectorySeparatorChar}{progName}.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = $"{Path.DirectorySeparatorChar}{progName}";
|
|
||||||
|
|
||||||
_ffprobePath = $"{FFMpegOptions.Options.RootDirectory}{path}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
cbeb93b3e549b119eb93ac5d5a120aa71ae8fd0c
|
|
|
@ -1 +0,0 @@
|
||||||
adf675e8cc71563575d18d103be11fcf9efd31cd
|
|
|
@ -1 +0,0 @@
|
||||||
958219856504251bf1bb68ff08490fcee2448975
|
|
|
@ -1 +0,0 @@
|
||||||
5a70926400475c3a0efd0ef30a60a89c49b41f2a
|
|
|
@ -127,18 +127,6 @@
|
||||||
<Content Include="FFMPEG\bin\presets\libx264-veryslow_firstpass.ffpreset">
|
<Content Include="FFMPEG\bin\presets\libx264-veryslow_firstpass.ffpreset">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="FFMPEG\bin\x64\ffmpeg.exe">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="FFMPEG\bin\x64\ffprobe.exe">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="FFMPEG\bin\x86\ffmpeg.exe">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="FFMPEG\bin\x86\ffprobe.exe">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -73,19 +73,6 @@ public static void RootExceptionCheck(string root)
|
||||||
if (root == null)
|
if (root == null)
|
||||||
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
||||||
"FFMpeg root is not configured in app config. Missing key 'ffmpegRoot'.");
|
"FFMpeg root is not configured in app config. Missing key 'ffmpegRoot'.");
|
||||||
|
|
||||||
var progName = "ffmpeg";
|
|
||||||
if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) {
|
|
||||||
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
|
||||||
|
|
||||||
progName = $"{target}{Path.DirectorySeparatorChar}{progName}.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = root + $"{Path.DirectorySeparatorChar}{progName}";
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
|
||||||
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
|
||||||
"FFMpeg cannot be found in the root directory!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,18 +24,6 @@ public static void RootExceptionCheck(string root)
|
||||||
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
||||||
"FFProbe root is not configured in app config. Missing key 'ffmpegRoot'.");
|
"FFProbe root is not configured in app config. Missing key 'ffmpegRoot'.");
|
||||||
|
|
||||||
var progName = "ffprobe";
|
|
||||||
if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) {
|
|
||||||
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
|
||||||
|
|
||||||
progName = $"{target}{Path.DirectorySeparatorChar}{progName}.exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = root + $"{Path.DirectorySeparatorChar}{progName}";
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
|
||||||
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
|
||||||
$"FFProbe cannot be found in the in {path}...");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue