gstreamer1-plugins-base/gst-plugins-base-new-missing-plugins-API.patch
Kalev Lember 0f84b475d2 Backport new missing plugins API
It's unclear at this point if we're going to have a gstreamer 1.6
release in time for F22. This commit backports the new missing plugin
installation API from git master that gnome-software needs.
2015-02-21 17:55:03 +01:00

361 lines
13 KiB
Diff

From 538dc374c6899ae243831f134af2dbe9487bb48d Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember@gmail.com>
Date: Mon, 2 Feb 2015 16:16:46 +0100
Subject: [PATCH 1/4] install-plugins: Add API for passing desktop ID and
startup ID
The new gst_install_plugins_context_set_desktop_id() and
gst_install_plugins_context_set_startup_notification_id() API can be
used to pass extra details to the external installer process.
https://bugzilla.gnome.org/show_bug.cgi?id=744465
---
gst-libs/gst/pbutils/install-plugins.c | 85 +++++++++++++++++++++++++++++++---
gst-libs/gst/pbutils/install-plugins.h | 6 +++
2 files changed, 84 insertions(+), 7 deletions(-)
diff --git a/gst-libs/gst/pbutils/install-plugins.c b/gst-libs/gst/pbutils/install-plugins.c
index ebfa76a..28d15e0 100644
--- a/gst-libs/gst/pbutils/install-plugins.c
+++ b/gst-libs/gst/pbutils/install-plugins.c
@@ -381,10 +381,71 @@ static gboolean install_in_progress; /* FALSE */
/* private struct */
struct _GstInstallPluginsContext
{
+ gchar *desktop_id;
+ gchar *startup_notification_id;
guint xid;
};
/**
+ * gst_install_plugins_context_set_desktop_id:
+ * @ctx: a #GstInstallPluginsContext
+ * @desktop_id: the desktop file ID of the calling application
+ *
+ * This function is used to pass the calling application's desktop file ID to
+ * the external installer process.
+ *
+ * A desktop file ID is the basename of the desktop file, including the
+ * .desktop extension.
+ *
+ * If set, the desktop file ID will be passed to the installer via a
+ * --desktop-id= command line option.
+ *
+ * Since: 1.6
+ */
+void
+gst_install_plugins_context_set_desktop_id (GstInstallPluginsContext * ctx,
+ const gchar * desktop_id)
+{
+ g_return_if_fail (ctx != NULL);
+
+ ctx->desktop_id = g_strdup (desktop_id);
+}
+
+/**
+ * gst_install_plugins_context_set_startup_notification_id:
+ * @ctx: a #GstInstallPluginsContext
+ * @startup_id: the startup notification ID
+ *
+ * Sets the startup notification ID for the launched process.
+ *
+ * This is typically used to to pass the current X11 event timestamp to the
+ * external installer process.
+ *
+ * Startup notification IDs are defined in the
+ * [FreeDesktop.Org Startup Notifications standard](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
+ *
+ * If set, the ID will be passed to the installer via a
+ * --startup-notification-id= command line option.
+ *
+ * GTK+/GNOME applications should be able to create a startup notification ID
+ * like this:
+ * <programlisting>
+ * timestamp = gtk_get_current_event_time ();
+ * startup_id = g_strdup_printf ("_TIME%u", timestamp);
+ * ...
+ * </programlisting>
+ *
+ * Since: 1.6
+ */
+void gst_install_plugins_context_set_startup_notification_id
+ (GstInstallPluginsContext * ctx, const gchar * startup_id)
+{
+ g_return_if_fail (ctx != NULL);
+
+ ctx->startup_notification_id = g_strdup (startup_id);
+}
+
+/**
* gst_install_plugins_context_set_xid:
* @ctx: a #GstInstallPluginsContext
* @xid: the XWindow ID (XID) of the top-level application
@@ -445,6 +506,8 @@ gst_install_plugins_context_free (GstInstallPluginsContext * ctx)
{
g_return_if_fail (ctx != NULL);
+ g_free (ctx->desktop_id);
+ g_free (ctx->startup_notification_id);
g_free (ctx);
}
@@ -454,6 +517,8 @@ gst_install_plugins_context_copy (GstInstallPluginsContext * ctx)
GstInstallPluginsContext *ret;
ret = gst_install_plugins_context_new ();
+ ret->desktop_id = g_strdup (ctx->desktop_id);
+ ret->startup_notification_id = g_strdup (ctx->startup_notification_id);
ret->xid = ctx->xid;
return ret;
@@ -495,23 +560,29 @@ gst_install_plugins_spawn_child (const gchar * const *details,
GPtrArray *arr;
gboolean ret;
GError *err = NULL;
- gchar **argv, xid_str[64] = { 0, };
+ gchar **argv;
- arr = g_ptr_array_new ();
+ arr = g_ptr_array_new_with_free_func (g_free);
/* argv[0] = helper path */
- g_ptr_array_add (arr, (gchar *) gst_install_plugins_get_helper ());
+ g_ptr_array_add (arr, g_strdup (gst_install_plugins_get_helper ()));
/* add any additional command line args from the context */
+ if (ctx != NULL && ctx->desktop_id != NULL) {
+ g_ptr_array_add (arr, g_strdup_printf ("--desktop-id=%s", ctx->desktop_id));
+ }
+ if (ctx != NULL && ctx->startup_notification_id != NULL) {
+ g_ptr_array_add (arr, g_strdup_printf ("--startup-notification-id=%s",
+ ctx->startup_notification_id));
+ }
if (ctx != NULL && ctx->xid != 0) {
- g_snprintf (xid_str, sizeof (xid_str), "--transient-for=%u", ctx->xid);
- g_ptr_array_add (arr, xid_str);
+ g_ptr_array_add (arr, g_strdup_printf ("--transient-for=%u", ctx->xid));
}
/* finally, add the detail strings, but without duplicates */
while (details != NULL && details[0] != NULL) {
if (!ptr_array_contains_string (arr, details[0]))
- g_ptr_array_add (arr, (gpointer) details[0]);
+ g_ptr_array_add (arr, g_strdup (details[0]));
++details;
}
@@ -538,7 +609,7 @@ gst_install_plugins_spawn_child (const gchar * const *details,
g_error_free (err);
}
- g_ptr_array_free (arr, TRUE);
+ g_ptr_array_unref (arr);
return ret;
}
diff --git a/gst-libs/gst/pbutils/install-plugins.h b/gst-libs/gst/pbutils/install-plugins.h
index 4e0efc8..220b4f8 100644
--- a/gst-libs/gst/pbutils/install-plugins.h
+++ b/gst-libs/gst/pbutils/install-plugins.h
@@ -101,6 +101,12 @@ GstInstallPluginsContext * gst_install_plugins_context_new (void);
void gst_install_plugins_context_free (GstInstallPluginsContext * ctx);
+void gst_install_plugins_context_set_desktop_id (GstInstallPluginsContext * ctx,
+ const gchar * desktop_id);
+
+void gst_install_plugins_context_set_startup_notification_id (GstInstallPluginsContext * ctx,
+ const gchar * startup_id);
+
void gst_install_plugins_context_set_xid (GstInstallPluginsContext * ctx,
guint xid);
--
2.1.0
From 4d8f52eeef81a4b44af36d007dbeda157c5cec3f Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember@gmail.com>
Date: Tue, 3 Feb 2015 10:47:11 +0100
Subject: [PATCH 2/4] install-plugins: Add API to suppress confirmation before
searching
The new gst_install_plugins_context_set_confirm_search() API can be used
to pass a hint to modify the behaviour of the external installer
process.
https://bugzilla.gnome.org/show_bug.cgi?id=744465
---
gst-libs/gst/pbutils/install-plugins.c | 28 ++++++++++++++++++++++++++++
gst-libs/gst/pbutils/install-plugins.h | 3 +++
2 files changed, 31 insertions(+)
diff --git a/gst-libs/gst/pbutils/install-plugins.c b/gst-libs/gst/pbutils/install-plugins.c
index 28d15e0..bd17843 100644
--- a/gst-libs/gst/pbutils/install-plugins.c
+++ b/gst-libs/gst/pbutils/install-plugins.c
@@ -381,12 +381,35 @@ static gboolean install_in_progress; /* FALSE */
/* private struct */
struct _GstInstallPluginsContext
{
+ gchar *confirm_search;
gchar *desktop_id;
gchar *startup_notification_id;
guint xid;
};
/**
+ * gst_install_plugins_context_set_confirm_search:
+ * @ctx: a #GstInstallPluginsContext
+ * @confirm_search: whether to ask for confirmation before searching for plugins
+ *
+ * This function is used to tell the external installer process whether it
+ * should ask for confirmation or not before searching for missing plugins.
+ *
+ * If set, this option will be passed to the installer via a
+ * --interaction=[show-confirm-search|hide-confirm-search] command line option.
+ */
+void
+gst_install_plugins_context_set_confirm_search (GstInstallPluginsContext * ctx, gboolean confirm_search)
+{
+ g_return_if_fail (ctx != NULL);
+
+ if (confirm_search)
+ ctx->confirm_search = g_strdup ("show-confirm-search");
+ else
+ ctx->confirm_search = g_strdup ("hide-confirm-search");
+}
+
+/**
* gst_install_plugins_context_set_desktop_id:
* @ctx: a #GstInstallPluginsContext
* @desktop_id: the desktop file ID of the calling application
@@ -506,6 +529,7 @@ gst_install_plugins_context_free (GstInstallPluginsContext * ctx)
{
g_return_if_fail (ctx != NULL);
+ g_free (ctx->confirm_search);
g_free (ctx->desktop_id);
g_free (ctx->startup_notification_id);
g_free (ctx);
@@ -517,6 +541,7 @@ gst_install_plugins_context_copy (GstInstallPluginsContext * ctx)
GstInstallPluginsContext *ret;
ret = gst_install_plugins_context_new ();
+ ret->confirm_search = g_strdup (ctx->confirm_search);
ret->desktop_id = g_strdup (ctx->desktop_id);
ret->startup_notification_id = g_strdup (ctx->startup_notification_id);
ret->xid = ctx->xid;
@@ -568,6 +593,9 @@ gst_install_plugins_spawn_child (const gchar * const *details,
g_ptr_array_add (arr, g_strdup (gst_install_plugins_get_helper ()));
/* add any additional command line args from the context */
+ if (ctx != NULL && ctx->confirm_search) {
+ g_ptr_array_add (arr, g_strdup_printf ("--interaction=%s", ctx->confirm_search));
+ }
if (ctx != NULL && ctx->desktop_id != NULL) {
g_ptr_array_add (arr, g_strdup_printf ("--desktop-id=%s", ctx->desktop_id));
}
diff --git a/gst-libs/gst/pbutils/install-plugins.h b/gst-libs/gst/pbutils/install-plugins.h
index 220b4f8..cd3eb00 100644
--- a/gst-libs/gst/pbutils/install-plugins.h
+++ b/gst-libs/gst/pbutils/install-plugins.h
@@ -101,6 +101,9 @@ GstInstallPluginsContext * gst_install_plugins_context_new (void);
void gst_install_plugins_context_free (GstInstallPluginsContext * ctx);
+void gst_install_plugins_context_set_confirm_search (GstInstallPluginsContext * ctx,
+ gboolean confirm_search);
+
void gst_install_plugins_context_set_desktop_id (GstInstallPluginsContext * ctx,
const gchar * desktop_id);
--
2.1.0
From 25abb5fd4d31cf8568bb4c650971bbc566a63e24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Fri, 13 Feb 2015 22:49:04 +0000
Subject: [PATCH 3/4] install-plugins: add new API to exports .def and to docs
https://bugzilla.gnome.org/show_bug.cgi?id=744465
---
docs/libs/gst-plugins-base-libs-sections.txt | 3 +++
win32/common/libgstpbutils.def | 3 +++
2 files changed, 6 insertions(+)
diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt
index 231ff69..8b50589 100644
--- a/docs/libs/gst-plugins-base-libs-sections.txt
+++ b/docs/libs/gst-plugins-base-libs-sections.txt
@@ -2058,6 +2058,9 @@ GstInstallPluginsContext
gst_install_plugins_context_new
gst_install_plugins_context_free
gst_install_plugins_context_set_xid
+gst_install_plugins_context_set_confirm_search
+gst_install_plugins_context_set_desktop_id
+gst_install_plugins_context_set_startup_notification_id
<SUBSECTION Standard>
GST_TYPE_INSTALL_PLUGINS_CONTEXT
GST_TYPE_INSTALL_PLUGINS_RETURN
diff --git a/win32/common/libgstpbutils.def b/win32/common/libgstpbutils.def
index 81504cc..771371e 100644
--- a/win32/common/libgstpbutils.def
+++ b/win32/common/libgstpbutils.def
@@ -127,6 +127,9 @@ EXPORTS
gst_install_plugins_context_free
gst_install_plugins_context_get_type
gst_install_plugins_context_new
+ gst_install_plugins_context_set_confirm_search
+ gst_install_plugins_context_set_desktop_id
+ gst_install_plugins_context_set_startup_notification_id
gst_install_plugins_context_set_xid
gst_install_plugins_installation_in_progress
gst_install_plugins_return_get_name
--
2.1.0
From 0aa81614accf1c4f7f804418ce0243e72824be52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Fri, 13 Feb 2015 22:56:00 +0000
Subject: [PATCH 4/4] install-plugins: fix indentation and add Since marker
Forgot to squash this into the actual patch before pushing.
---
gst-libs/gst/pbutils/install-plugins.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gst-libs/gst/pbutils/install-plugins.c b/gst-libs/gst/pbutils/install-plugins.c
index bd17843..8ea1689 100644
--- a/gst-libs/gst/pbutils/install-plugins.c
+++ b/gst-libs/gst/pbutils/install-plugins.c
@@ -397,9 +397,12 @@ struct _GstInstallPluginsContext
*
* If set, this option will be passed to the installer via a
* --interaction=[show-confirm-search|hide-confirm-search] command line option.
+ *
+ * Since: 1.6
*/
void
-gst_install_plugins_context_set_confirm_search (GstInstallPluginsContext * ctx, gboolean confirm_search)
+gst_install_plugins_context_set_confirm_search (GstInstallPluginsContext * ctx,
+ gboolean confirm_search)
{
g_return_if_fail (ctx != NULL);
@@ -594,7 +597,8 @@ gst_install_plugins_spawn_child (const gchar * const *details,
/* add any additional command line args from the context */
if (ctx != NULL && ctx->confirm_search) {
- g_ptr_array_add (arr, g_strdup_printf ("--interaction=%s", ctx->confirm_search));
+ g_ptr_array_add (arr, g_strdup_printf ("--interaction=%s",
+ ctx->confirm_search));
}
if (ctx != NULL && ctx->desktop_id != NULL) {
g_ptr_array_add (arr, g_strdup_printf ("--desktop-id=%s", ctx->desktop_id));
--
2.1.0