mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
amfcodec: Add plugin status message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6167>
This commit is contained in:
parent
301e281777
commit
fa477a4a25
1 changed files with 23 additions and 5 deletions
|
@ -37,6 +37,8 @@
|
|||
#include "gstamfh265enc.h"
|
||||
#include "gstamfav1enc.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace amf;
|
||||
|
@ -48,20 +50,28 @@ plugin_init (GstPlugin * plugin)
|
|||
AMFFactory *amf_factory;
|
||||
ComPtr < IDXGIFactory1 > factory;
|
||||
HRESULT hr;
|
||||
bool have_amd_gpu = false;
|
||||
|
||||
if (!IsWindows8OrGreater ())
|
||||
if (!IsWindows8OrGreater ()) {
|
||||
gst_plugin_add_status_warning (plugin,
|
||||
N_("This plugin requires at least Windows 8 or newer."));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!gst_amf_init_once ())
|
||||
if (!gst_amf_init_once () || !gst_amf_get_factory ()) {
|
||||
gst_plugin_add_status_warning (plugin,
|
||||
"AMF runtime library \"" AMF_DLL_NAMEA "\" was not found.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
amf_factory = (AMFFactory *) gst_amf_get_factory ();
|
||||
if (!amf_factory)
|
||||
return TRUE;
|
||||
|
||||
hr = CreateDXGIFactory1 (IID_PPV_ARGS (&factory));
|
||||
if (FAILED (hr))
|
||||
if (FAILED (hr)) {
|
||||
/* Shouldn't happen, this means all DirectX bits would not be functional */
|
||||
gst_plugin_add_status_error (plugin, N_("Unable to enumerate GPUs."));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Enumerate AMD GPUs */
|
||||
for (guint idx = 0;; idx++) {
|
||||
|
@ -86,6 +96,7 @@ plugin_init (GstPlugin * plugin)
|
|||
if (desc.VendorId != 0x1002 && desc.VendorId != 0x1022)
|
||||
continue;
|
||||
|
||||
have_amd_gpu = true;
|
||||
luid = gst_d3d11_luid_to_int64 (&desc.AdapterLuid);
|
||||
device = gst_d3d11_device_new_for_adapter_luid (luid,
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT);
|
||||
|
@ -116,6 +127,13 @@ plugin_init (GstPlugin * plugin)
|
|||
gst_clear_object (&device);
|
||||
}
|
||||
|
||||
if (!have_amd_gpu) {
|
||||
/* A little unexpected case. AMF runtime (part of driver) is installed
|
||||
* but AMD GPU is not detected */
|
||||
gst_plugin_add_status_warning (plugin,
|
||||
N_("No AMD graphics cards detected!"));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue