[totem/wip/kalev/codecs: 1/2] missing plugins: Break out a function
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/kalev/codecs: 1/2] missing plugins: Break out a function
- Date: Sun, 15 Feb 2015 18:44:13 +0000 (UTC)
commit 55bec16e32f1538affa38329043c3c705b151df1
Author: Kalev Lember <kalevlember gmail com>
Date: Fri Feb 13 15:54:39 2015 +0100
missing plugins: Break out a function
.../bacon-video-widget-gst-missing-plugins.c | 94 +++++++++++---------
1 files changed, 52 insertions(+), 42 deletions(-)
---
diff --git a/src/backend/bacon-video-widget-gst-missing-plugins.c
b/src/backend/bacon-video-widget-gst-missing-plugins.c
index 3d99cd6..d0d44b7 100644
--- a/src/backend/bacon-video-widget-gst-missing-plugins.c
+++ b/src/backend/bacon-video-widget-gst-missing-plugins.c
@@ -237,52 +237,14 @@ on_plugin_installation_done (GstInstallPluginsReturn res, gpointer user_data)
}
static gboolean
-bacon_video_widget_gst_on_missing_plugins_event (BaconVideoWidget *bvw, char **details,
- char **descriptions, gboolean playing,
- gpointer user_data)
+bacon_video_widget_start_plugin_installation (TotemCodecInstallContext *ctx)
{
GstInstallPluginsContext *install_ctx;
- TotemCodecInstallContext *ctx;
GstInstallPluginsReturn status;
- guint i, num;
#ifdef GDK_WINDOWING_X11
GdkDisplay *display;
#endif
- num = g_strv_length (details);
- g_return_val_if_fail (num > 0 && g_strv_length (descriptions) == num, FALSE);
-
- ctx = g_new0 (TotemCodecInstallContext, 1);
- ctx->descriptions = g_strdupv (descriptions);
- ctx->details = g_strdupv (details);
- ctx->playing = playing;
- ctx->bvw = bvw;
-
- for (i = 0; i < num; ++i)
- {
- if (bacon_video_widget_gst_codec_install_plugin_is_blacklisted (ctx->details[i]))
- {
- g_message ("Missing plugin: %s (ignoring)", ctx->details[i]);
- g_free (ctx->details[i]);
- g_free (ctx->descriptions[i]);
- ctx->details[i] = ctx->details[num-1];
- ctx->descriptions[i] = ctx->descriptions[num-1];
- ctx->details[num-1] = NULL;
- ctx->descriptions[num-1] = NULL;
- --num;
- --i;
- } else {
- g_message ("Missing plugin: %s (%s)", ctx->details[i], ctx->descriptions[i]);
- }
- }
-
- if (num == 0)
- {
- g_message ("All missing plugins are blacklisted, doing nothing");
- bacon_video_widget_gst_codec_install_context_free (ctx);
- return FALSE;
- }
-
install_ctx = gst_install_plugins_context_new ();
gst_install_plugins_context_set_desktop_id (install_ctx, "org.gnome.Totem.desktop");
@@ -290,12 +252,12 @@ bacon_video_widget_gst_on_missing_plugins_event (BaconVideoWidget *bvw, char **d
display = gdk_display_get_default ();
if (GDK_IS_X11_DISPLAY (display) &&
- gtk_widget_get_window (GTK_WIDGET (bvw)) != NULL &&
- gtk_widget_get_realized (GTK_WIDGET (bvw)))
+ gtk_widget_get_window (GTK_WIDGET (ctx->bvw)) != NULL &&
+ gtk_widget_get_realized (GTK_WIDGET (ctx->bvw)))
{
gulong xid = 0;
- xid = bacon_video_widget_gst_get_toplevel (GTK_WIDGET (bvw));
+ xid = bacon_video_widget_gst_get_toplevel (GTK_WIDGET (ctx->bvw));
gst_install_plugins_context_set_xid (install_ctx, xid);
}
#endif /* GDK_WINDOWING_X11 */
@@ -322,6 +284,54 @@ bacon_video_widget_gst_on_missing_plugins_event (BaconVideoWidget *bvw, char **d
return FALSE;
}
+ return TRUE;
+}
+
+static gboolean
+bacon_video_widget_gst_on_missing_plugins_event (BaconVideoWidget *bvw, char **details,
+ char **descriptions, gboolean playing,
+ gpointer user_data)
+{
+ TotemCodecInstallContext *ctx;
+ guint i, num;
+
+ num = g_strv_length (details);
+ g_return_val_if_fail (num > 0 && g_strv_length (descriptions) == num, FALSE);
+
+ ctx = g_new0 (TotemCodecInstallContext, 1);
+ ctx->descriptions = g_strdupv (descriptions);
+ ctx->details = g_strdupv (details);
+ ctx->playing = playing;
+ ctx->bvw = bvw;
+
+ for (i = 0; i < num; ++i)
+ {
+ if (bacon_video_widget_gst_codec_install_plugin_is_blacklisted (ctx->details[i]))
+ {
+ g_message ("Missing plugin: %s (ignoring)", ctx->details[i]);
+ g_free (ctx->details[i]);
+ g_free (ctx->descriptions[i]);
+ ctx->details[i] = ctx->details[num-1];
+ ctx->descriptions[i] = ctx->descriptions[num-1];
+ ctx->details[num-1] = NULL;
+ ctx->descriptions[num-1] = NULL;
+ --num;
+ --i;
+ } else {
+ g_message ("Missing plugin: %s (%s)", ctx->details[i], ctx->descriptions[i]);
+ }
+ }
+
+ if (num == 0)
+ {
+ g_message ("All missing plugins are blacklisted, doing nothing");
+ bacon_video_widget_gst_codec_install_context_free (ctx);
+ return FALSE;
+ }
+
+ if (!bacon_video_widget_start_plugin_installation (ctx))
+ return FALSE;
+
/* if we managed to start playing, pause playback, since some install
* wizard should now take over in a second anyway and the user might not
* be able to use totem's controls while the wizard is running */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]