mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
windows: Make GStreamer installation relocatable
Use the technique that is now done in GTK+ so that the plugins do not have to be installed in c:\gstreamer\lib\<debug>\gstreamer-$(GSTApiVersion), but can be installed in <parent_folder_of_gstreamer_main_dll>\lib\<debug>\gstreamer-$(GSTApiVersion), or as per g_win32_get_package_installation_directory_of_module() allows. https://bugzilla.gnome.org/show_bug.cgi?id=679115
This commit is contained in:
parent
f85c1c4648
commit
043c629e72
4 changed files with 65 additions and 5 deletions
19
gst/gst.c
19
gst/gst.c
|
@ -461,6 +461,7 @@ static gboolean
|
|||
init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
|
||||
GError ** error)
|
||||
{
|
||||
gchar *libdir;
|
||||
if (gst_initialized) {
|
||||
GST_DEBUG ("already initialized");
|
||||
return TRUE;
|
||||
|
@ -481,8 +482,24 @@ init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
|
|||
|
||||
/* This is the earliest we can make stuff show up in the logs.
|
||||
* So give some useful info about GStreamer here */
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
gchar *basedir = g_win32_get_package_installation_directory_of_module (_priv_gst_dll_handle);
|
||||
|
||||
libdir = g_build_filename (basedir,
|
||||
#ifdef _DEBUG
|
||||
"debug"
|
||||
#endif
|
||||
"lib",
|
||||
NULL);
|
||||
g_free (basedir);
|
||||
}
|
||||
#else
|
||||
libdir = g_strdup (LIBDIR);
|
||||
#endif
|
||||
GST_INFO ("Initializing GStreamer Core Library version %s", VERSION);
|
||||
GST_INFO ("Using library installed in %s", LIBDIR);
|
||||
GST_INFO ("Using library installed in %s", libdir);
|
||||
g_free (libdir);
|
||||
|
||||
/* Print some basic system details if possible (OS/architecture) */
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
|
|
|
@ -33,8 +33,13 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#define fsync(fd) _commit(fd)
|
||||
#include <io.h>
|
||||
|
||||
#include <windows.h>
|
||||
extern HMODULE _priv_gst_dll_handle;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
|
@ -470,7 +475,22 @@ gst_plugin_loader_spawn (GstPluginLoader * loader)
|
|||
|
||||
if (!res) {
|
||||
GST_LOG ("Trying installed plugin scanner");
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
gchar *basedir;
|
||||
|
||||
basedir = g_win32_get_package_installation_directory_of_module (_priv_gst_dll_handle);
|
||||
helper_bin = g_build_filename (basedir,
|
||||
"lib",
|
||||
"gstreamer-" GST_API_VERSION,
|
||||
"gst-plugin-scanner.exe",
|
||||
NULL);
|
||||
g_free (basedir);
|
||||
}
|
||||
#else
|
||||
helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED);
|
||||
#endif
|
||||
res = gst_plugin_loader_try_helper (loader, helper_bin);
|
||||
g_free (helper_bin);
|
||||
|
||||
|
|
|
@ -78,6 +78,13 @@
|
|||
#endif
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
extern HMODULE _priv_gst_dll_handle;
|
||||
#endif
|
||||
|
||||
#define GST_CAT_DEFAULT preset_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
|
@ -175,8 +182,18 @@ preset_get_paths (GstPreset * preset, const gchar ** preset_user_path,
|
|||
gchar *preset_dir;
|
||||
|
||||
/* system presets in '$GST_DATADIR/gstreamer-1.0/presets/GstAudioPanorama.prs' */
|
||||
#ifdef G_OS_WIN32
|
||||
gchar *basedir = g_win32_get_package_installation_directory_of_module (_priv_gst_dll_handle);
|
||||
preset_dir = g_build_filename (basedir,
|
||||
"share",
|
||||
"gstreamer-" GST_API_VERSION,
|
||||
"presets",
|
||||
NULL);
|
||||
g_free (basedir);
|
||||
#else
|
||||
preset_dir = g_build_filename (GST_DATADIR, "gstreamer-" GST_API_VERSION,
|
||||
"presets", NULL);
|
||||
#endif
|
||||
GST_INFO_OBJECT (preset, "system_preset_dir: '%s'", preset_dir);
|
||||
preset_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs",
|
||||
preset_dir, element_name);
|
||||
|
|
|
@ -1593,8 +1593,6 @@ scan_and_update_registry (GstRegistry * default_registry,
|
|||
g_free (home_plugins);
|
||||
|
||||
/* add the main (installed) library path */
|
||||
GST_DEBUG ("scanning main plugins %s", PLUGINDIR);
|
||||
changed |= gst_registry_scan_path_internal (&context, PLUGINDIR);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
|
@ -1606,8 +1604,13 @@ scan_and_update_registry (GstRegistry * default_registry,
|
|||
(_priv_gst_dll_handle);
|
||||
|
||||
dir =
|
||||
g_build_filename (base_dir, "lib", "gstreamer-" GST_API_VERSION,
|
||||
NULL);
|
||||
g_build_filename (base_dir,
|
||||
#ifdef _DEBUG
|
||||
"debug"
|
||||
#endif
|
||||
"lib",
|
||||
"gstreamer-" GST_API_VERSION,
|
||||
NULL);
|
||||
GST_DEBUG ("scanning DLL dir %s", dir);
|
||||
|
||||
changed |= gst_registry_scan_path_internal (&context, dir);
|
||||
|
@ -1615,6 +1618,9 @@ scan_and_update_registry (GstRegistry * default_registry,
|
|||
g_free (dir);
|
||||
g_free (base_dir);
|
||||
}
|
||||
#else
|
||||
GST_DEBUG ("scanning main plugins %s", PLUGINDIR);
|
||||
changed |= gst_registry_scan_path_internal (&context, PLUGINDIR);
|
||||
#endif
|
||||
} else {
|
||||
gchar **list;
|
||||
|
|
Loading…
Reference in a new issue