mediafoundation: Fix for UWP build
authorSeungha Yang <seungha@centricular.com>
Wed, 20 Oct 2021 16:47:07 +0000 (01:47 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 21 Oct 2021 05:11:40 +0000 (05:11 +0000)
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>

subprojects/gst-plugins-bad/sys/mediafoundation/gstmfplatloader.c
subprojects/gst-plugins-bad/sys/mediafoundation/meson.build

index d07fc29..8a7cecf 100644 (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);
index 1ee0b8c..1755587 100644 (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,
 )