aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2022-11-27 08:49:52 -0700
committerCody Robibero <cody@robibe.ro>2022-11-27 08:49:52 -0700
commit4e34c428d8ed8753af0fa81a8833ac92a7d2f5ac (patch)
tree29fbe5f7355bc7dfe96a7787df34dec8fe75597d /MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
parent5787ab15dc297da6d2e1ec984ccf19751ed85db6 (diff)
parentd4bd72049b4609582fb57f63134bee58327bc0cc (diff)
Merge branch 'master' into fix-fmp4-flac-opus
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs')
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs42
1 files changed, 40 insertions, 2 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
index 9b4b1db94..8c8fc6b0f 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
@@ -102,7 +102,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
"tonemap_vaapi",
"procamp_vaapi",
"overlay_vaapi",
- "hwupload_vaapi"
+ "hwupload_vaapi",
+ // vulkan
+ "libplacebo",
+ "scale_vulkan",
+ "overlay_vulkan"
};
private static readonly IReadOnlyDictionary<int, string[]> _filterOptionsDict = new Dictionary<int, string[]>
@@ -111,7 +115,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
{ 1, new string[] { "tonemap_cuda", "GPU accelerated HDR to SDR tonemapping" } },
{ 2, new string[] { "tonemap_opencl", "bt2390" } },
{ 3, new string[] { "overlay_opencl", "Action to take when encountering EOF from secondary input" } },
- { 4, new string[] { "overlay_vaapi", "Action to take when encountering EOF from secondary input" } }
+ { 4, new string[] { "overlay_vaapi", "Action to take when encountering EOF from secondary input" } },
+ { 5, new string[] { "overlay_vulkan", "Action to take when encountering EOF from secondary input" } }
};
// These are the library versions that corresponds to our minimum ffmpeg version 4.x according to the version table below
@@ -351,6 +356,39 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
}
+ public bool CheckVulkanDrmDeviceByExtensionName(string renderNodePath, string[] vulkanExtensions)
+ {
+ if (!OperatingSystem.IsLinux())
+ {
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(renderNodePath))
+ {
+ return false;
+ }
+
+ try
+ {
+ var command = "-v verbose -hide_banner -init_hw_device drm=dr:" + renderNodePath + " -init_hw_device vulkan=vk@dr";
+ var output = GetProcessOutput(_encoderPath, command, true, null);
+ foreach (string ext in vulkanExtensions)
+ {
+ if (!output.Contains(ext, StringComparison.Ordinal))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Error detecting the given drm render node path");
+ return false;
+ }
+ }
+
private IEnumerable<string> GetHwaccelTypes()
{
string? output = null;