gst-plugin-scanner: Add support for Windows

Adding Win32 specific plugin loader implementation.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/11
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3512>
This commit is contained in:
Seungha Yang 2022-12-02 23:48:45 +09:00 committed by GStreamer Marge Bot
parent d071ea714d
commit 621feb32e9
6 changed files with 1205 additions and 13 deletions

View file

@ -154,7 +154,7 @@ gboolean _priv_gst_registry_remove_cache_plugins (GstRegistry *registry);
G_GNUC_INTERNAL void _priv_gst_registry_cleanup (void); G_GNUC_INTERNAL void _priv_gst_registry_cleanup (void);
GST_API GST_API
gboolean _gst_plugin_loader_client_run (void); gboolean _gst_plugin_loader_client_run (const gchar * pipe_name);
G_GNUC_INTERNAL GstPlugin * _priv_gst_plugin_load_file_for_registry (const gchar *filename, G_GNUC_INTERNAL GstPlugin * _priv_gst_plugin_load_file_for_registry (const gchar *filename,
GstRegistry * registry, GstRegistry * registry,

File diff suppressed because it is too large Load diff

View file

@ -644,7 +644,7 @@ plugin_loader_cleanup_child (GstPluginLoader * l)
} }
gboolean gboolean
_gst_plugin_loader_client_run (void) _gst_plugin_loader_client_run (const gchar * pipe_name)
{ {
gboolean res = TRUE; gboolean res = TRUE;
GstPluginLoader *l; GstPluginLoader *l;

View file

@ -1154,12 +1154,6 @@ gst_registry_scan_plugin_file (GstRegistryScanContext * context,
gboolean changed = FALSE; gboolean changed = FALSE;
GstPlugin *newplugin = NULL; GstPlugin *newplugin = NULL;
#ifdef G_OS_WIN32
/* Disable external plugin loader on Windows until it is ported properly. */
context->helper_state = REGISTRY_SCAN_HELPER_DISABLED;
#endif
/* Have a plugin to load - see if the scan-helper needs starting */ /* Have a plugin to load - see if the scan-helper needs starting */
if (context->helper_state == REGISTRY_SCAN_HELPER_NOT_STARTED) { if (context->helper_state == REGISTRY_SCAN_HELPER_NOT_STARTED) {
GST_DEBUG ("Starting plugin scanner for file %s", filename); GST_DEBUG ("Starting plugin scanner for file %s", filename);

View file

@ -40,7 +40,6 @@ gst_sources = files(
'gstpipeline.c', 'gstpipeline.c',
'gstplugin.c', 'gstplugin.c',
'gstpluginfeature.c', 'gstpluginfeature.c',
'gstpluginloader.c',
'gstpoll.c', 'gstpoll.c',
'gstpreset.c', 'gstpreset.c',
'gstprotection.c', 'gstprotection.c',
@ -155,6 +154,13 @@ endif
install_headers(gst_headers, subdir : 'gstreamer-1.0/gst') install_headers(gst_headers, subdir : 'gstreamer-1.0/gst')
# Some Win32 APIs are not allowed for UWP
if host_system == 'windows' and not building_for_uwp
gst_sources += files('gstpluginloader-win32.c')
else
gst_sources += files('gstpluginloader.c')
endif
extra_deps = [] extra_deps = []
if host_system == 'android' if host_system == 'android'
gst_sources += 'gstandroid.c' gst_sources += 'gstandroid.c'

View file

@ -37,11 +37,28 @@ main (int argc, char *argv[])
gboolean res; gboolean res;
char **my_argv; char **my_argv;
int my_argc; int my_argc;
char *pipe_name = NULL;
#ifdef G_OS_WIN32
/* On Windows, we need pipe name
* arg0: exe path
* arg1: -l
* arg2: parent process exe path
* arg3: pipe name */
if (argc != 4)
return 1;
_gst_executable_path = g_strdup (argv[2]);
pipe_name = argv[3];
#else
/* We may or may not have an executable path */ /* We may or may not have an executable path */
if (argc != 2 && argc != 3) if (argc != 2 && argc != 3)
return 1; return 1;
if (argc == 3)
_gst_executable_path = g_strdup (argv[2]);
#endif
if (strcmp (argv[1], "-l")) if (strcmp (argv[1], "-l"))
return 1; return 1;
@ -54,9 +71,6 @@ main (int argc, char *argv[])
_gst_disable_registry_cache = TRUE; _gst_disable_registry_cache = TRUE;
#endif #endif
if (argc == 3)
_gst_executable_path = g_strdup (argv[2]);
res = gst_init_check (&my_argc, &my_argv, NULL); res = gst_init_check (&my_argc, &my_argv, NULL);
g_free (my_argv); g_free (my_argv);
@ -64,7 +78,7 @@ main (int argc, char *argv[])
return 1; return 1;
/* Create registry scanner listener and run */ /* Create registry scanner listener and run */
if (!_gst_plugin_loader_client_run ()) if (!_gst_plugin_loader_client_run (pipe_name))
return 1; return 1;
return 0; return 0;