wpe: Install WebExtension in pkglibdir
authorPhilippe Normand <philn@igalia.com>
Sat, 29 Jan 2022 10:24:36 +0000 (10:24 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 31 Jan 2022 00:54:10 +0000 (00:54 +0000)
The uninstalled WebExtension takes precedence over the installed one, so that
audio support works in local developer builds as well.

Fixes #975

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1602>

subprojects/gst-plugins-bad/ext/wpe/WPEThreadedView.cpp
subprojects/gst-plugins-bad/ext/wpe/gstwpe.cpp
subprojects/gst-plugins-bad/ext/wpe/gstwpe.h
subprojects/gst-plugins-bad/ext/wpe/meson.build
subprojects/gst-plugins-bad/ext/wpe/wpe-extension/meson.build

index d3c85b5..d3fefc0 100644 (file)
@@ -183,7 +183,10 @@ gpointer WPEContextThread::s_viewThread(gpointer data)
 static void
 initialize_web_extensions (WebKitWebContext *context)
 {
-    webkit_web_context_set_web_extensions_directory (context, gst_wpe_get_extension_path ());
+    const gchar *local_path = gst_wpe_get_uninstalled_extension_path ();
+    const gchar *path = g_file_test (local_path, G_FILE_TEST_IS_DIR) ? local_path : G_STRINGIFY (WPE_EXTENSION_INSTALL_DIR);
+    GST_INFO ("Loading WebExtension from %s", path);
+    webkit_web_context_set_web_extensions_directory (context, path);
 }
 
 static void
index ceca61e..1872811 100644 (file)
@@ -33,7 +33,7 @@ GST_DEBUG_CATEGORY (wpe_video_src_debug);
 GST_DEBUG_CATEGORY (wpe_view_debug);
 GST_DEBUG_CATEGORY (wpe_src_debug);
 
-const gchar *gst_wpe_get_extension_path (void)
+const gchar *gst_wpe_get_uninstalled_extension_path (void)
 {
   return extension_path;
 }
index da0d2c9..6d628da 100644 (file)
@@ -21,4 +21,4 @@
 
 #include <gst/gst.h>
 
-const gchar *gst_wpe_get_extension_path (void);
+const gchar *gst_wpe_get_uninstalled_extension_path (void);
index 580b8f4..fb6048e 100644 (file)
@@ -16,11 +16,13 @@ if not wpe_dep.found() or not wpe_fdo_dep.found() or not egl_dep.found() or not
   subdir_done()
 endif
 
+wpe_extension_install_dir = get_option('prefix') / get_option('libdir') / meson.project_name() / 'wpe-extension'
+
 giounix_dep = dependency('gio-unix-2.0', required: false)
 gstwpe = library('gstwpe',
   ['WPEThreadedView.cpp', 'gstwpe.cpp', 'gstwpevideosrc.cpp', 'gstwpesrcbin.cpp'],
   dependencies : [egl_dep, wpe_dep, wpe_fdo_dep, gstallocators_dep, gstaudio_dep, gstvideo_dep, gstbase_dep, gstgl_dep, xkbcommon_dep, wl_server_dep, giounix_dep],
-  cpp_args : gst_plugins_bad_args + ['-DHAVE_CONFIG_H=1'],
+  cpp_args : gst_plugins_bad_args + ['-DHAVE_CONFIG_H=1', '-DWPE_EXTENSION_INSTALL_DIR=' + wpe_extension_install_dir],
   include_directories : [configinc],
   install : true,
   install_dir : plugins_install_dir)
index 7bf98d6..e1ef972 100644 (file)
@@ -4,5 +4,4 @@ library('gstwpeextension',
   c_args : ['-DHAVE_CONFIG_H=1'],
   include_directories : [configinc],
   install : true,
-  install_dir : plugins_install_dir / 'wpe-extension')
-
+  install_dir : wpe_extension_install_dir)