mediafoundation: Fix for UWP build

We don't support D3D11 interop for UWP because some APIs
(specifically MFTEnum2) are desktop application only.
However, the code for symbol loading is commonly used by both UWP and WIN32.
Just link GModule unconditionally which is UWP compatible, and simply don't
try to load any library/symbol dynamically when D3D11 interop is unavailable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1216>
This commit is contained in:
Seungha Yang 2021-10-21 01:47:07 +09:00 committed by GStreamer Marge Bot
parent ba34f6a113
commit 8b6c3e030b
2 changed files with 5 additions and 2 deletions

View file

@ -22,6 +22,7 @@
#endif
#include "gstmfplatloader.h"
#include "gstmfconfig.h"
#include <gmodule.h>
/* *INDENT-OFF* */
@ -66,6 +67,7 @@ load_library_once (void)
{
static gsize load_once = 0;
if (g_once_init_enter (&load_once)) {
#if GST_MF_HAVE_D3D11
GModule *module;
GstMFPlatVTable *vtable = &gst_mf_plat_vtable;
@ -79,6 +81,7 @@ load_library_once (void)
GstMFCreateVideoSampleAllocatorEx);
vtable->loaded = TRUE;
#endif
out:
g_once_init_leave (&load_once, 1);

View file

@ -139,7 +139,7 @@ if winapi_desktop
# by using g_module_open() so that keep supporting old OS versions
if gstd3d11_dep.found() and cc.has_header('d3d11_4.h') and cc.has_header('d3d10.h')
have_mf_d3d11 = true
mf_lib_deps += [gstd3d11_dep, gmodule_dep]
mf_lib_deps += [gstd3d11_dep]
extra_c_args += ['-DGST_USE_UNSTABLE_API']
extra_cpp_args += ['-DGST_USE_UNSTABLE_API']
message ('Enable D3D11 interop for MediaFoundation plugin')
@ -164,7 +164,7 @@ gstmediafoundation = library('gstmediafoundation',
c_args : gst_plugins_bad_args + extra_c_args,
cpp_args : gst_plugins_bad_args + extra_cpp_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstpbutils_dep] + mf_lib_deps,
dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, gstpbutils_dep, gmodule_dep] + mf_lib_deps,
install : true,
install_dir : plugins_install_dir,
)