[Xfce4-commits] <parole:master> Added gst-plugins-installer and some build fixes.

Sean Davis noreply at xfce.org
Thu Nov 15 00:26:01 CET 2012


Updating branch refs/heads/master
         to 6cda92561575c320a843427affcd17323a0cbd67 (commit)
       from 8f8b7754f934ea30898fa46eba09cdf12540ebf7 (commit)

commit 6cda92561575c320a843427affcd17323a0cbd67
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Wed Nov 14 13:59:48 2012 -0500

    Added gst-plugins-installer and some build fixes.

 configure.ac.in      |    1 +
 src/gst/Makefile.am  |    6 ++-
 src/gst/parole-gst.c |   89 +++++++++++++++++++++++++++++++++++++++++++++++++-
 src/main.c           |   16 ++++----
 src/parole-player.c  |    2 +
 src/parole-player.h  |    2 +
 6 files changed, 105 insertions(+), 11 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 76047ab..50eb9d3 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -101,6 +101,7 @@ XDT_CHECK_PACKAGE([GST], [gstreamer-0.10], [gstreamer_minimum_version])
 XDT_CHECK_PACKAGE([GST_BASE], [gstreamer-base-0.10], [gstreamer_minimum_version])
 XDT_CHECK_PACKAGE([GST_VIDEO], [gstreamer-video-0.10], [gstreamer_minimum_version])
 XDT_CHECK_PACKAGE([GST_INTERFACES], [gstreamer-interfaces-0.10], [gstreamer_minimum_version])
+XDT_CHECK_PACKAGE([GST_PBUTILS], [gstreamer-pbutils-0.10], [0.10.2])
 
 XDT_CHECK_PACKAGE([DBUS], [dbus-1], [dbus_minimum_version])
 XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [dbus_glib_minimum_version])
diff --git a/src/gst/Makefile.am b/src/gst/Makefile.am
index 30e7c08..5f2de02 100644
--- a/src/gst/Makefile.am
+++ b/src/gst/Makefile.am
@@ -25,11 +25,13 @@ libparolegst_la_CFLAGS =		\
 	$(GST_VIDEO_CFLAGS)             \
         $(GST_INTERFACES_CFLAGS)	\
 	$(GTHREAD_CFLAGS)               \
-	$(LIBXFCE4UI_CFLAGS)
+	$(LIBXFCE4UI_CFLAGS)            \
+	$(PBUTILS_CFLAGS)
 
 libparolegst_la_LIBADD =		\
 	$(top_builddir)/src/misc/libparole.la\
-	$(top_builddir)/src/common/libparolecommon.la
+	$(top_builddir)/src/common/libparolecommon.la\
+	$(GST_PBUTILS_LIBS)
 
 parole_glib_enum_headers =		\
 	parole-gst.h
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index ef1a3a8..bc8dee1 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -30,6 +30,8 @@
 
 #include <gst/interfaces/xoverlay.h>
 #include <gst/interfaces/navigation.h>
+#include <gst/pbutils/missing-plugins.h>
+#include <gst/pbutils/install-plugins.h>
 
 #include <gst/video/video.h>
 
@@ -1119,10 +1121,76 @@ parole_gst_application_message (ParoleGst *gst, GstMessage *msg)
     }
 }
 
+/**
+ * parole_gst_install_plugins_result_func:
+ * @result    : %GST_INSTALL_PLUGINS_SUCCESS (0) if successful.
+ * @user_data : gst instance passed as user_data for callback function.
+ *
+ * Callback function for when asynchronous codec installation finishes.  Update
+ * the gstreamer plugin registry and restart playback.
+ **/
+static void
+parole_gst_install_plugins_result_func(GstInstallPluginsReturn result, gpointer user_data)
+{
+    switch (result)
+    {
+        case GST_INSTALL_PLUGINS_SUCCESS:
+            g_debug ("Finished plugin install.\n");
+            gst_update_registry();
+            parole_gst_resume(PAROLE_GST(user_data));
+            break;
+        case GST_INSTALL_PLUGINS_NOT_FOUND:
+            g_debug ("An appropriate installation candidate could not be found.\n");
+            break;
+        case GST_INSTALL_PLUGINS_USER_ABORT:
+            g_debug ("User aborted plugin install.\n");
+            break;
+        default:
+            g_debug ("Plugin installation failed with code %i\n", result);
+            break;
+    }
+}
+
+static GtkDialog*
+parole_gst_missing_codec_dialog(ParoleGst *gst, GstMessage *msg)
+{
+    GtkMessageDialog *dialog;
+    gchar*     desc;
+                                                    
+    desc = gst_missing_plugin_message_get_description(msg);
+    
+    dialog = GTK_MESSAGE_DIALOG(gtk_message_dialog_new_with_markup(
+                            NULL,
+                            GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                            GTK_MESSAGE_QUESTION,
+                            GTK_BUTTONS_NONE,
+                            "<b><big>%s</big></b>", 
+                            _("Additional software is required.")
+                            ));
+                            
+    gtk_dialog_add_buttons( GTK_DIALOG(dialog), 
+                            _("Don't Install"),
+                            GTK_RESPONSE_REJECT,
+                            _("Install"), 
+                            GTK_RESPONSE_ACCEPT,
+                            NULL );
+    
+    gtk_message_dialog_format_secondary_markup(dialog,
+                                             "Parole needs <b>%s</b> to play this file.\n"
+                                             "It can be installed automatically.",
+                                             desc);
+    
+    return GTK_DIALOG(dialog);
+}
+
 static gboolean
 parole_gst_bus_event (GstBus *bus, GstMessage *msg, gpointer data)
 {
-    ParoleGst *gst;
+    ParoleGst                *gst;
+    GtkDialog                *dialog;
+    gchar*                    details[2];
+    GstInstallPluginsContext *ctx;
+    gint response;
     
     gst = PAROLE_GST (data);
 
@@ -1220,6 +1288,25 @@ parole_gst_bus_event (GstBus *bus, GstMessage *msg, gpointer data)
 	    }
 	    break;
 	case GST_MESSAGE_ELEMENT:
+	    if (gst_is_missing_plugin_message(msg))
+	    {
+	        g_debug("Missing plugin\n");
+	        parole_gst_stop(gst);
+	        dialog = parole_gst_missing_codec_dialog(gst, msg);
+	        response = gtk_dialog_run(dialog);
+	        if ( response == GTK_RESPONSE_ACCEPT )
+	        {
+	             gtk_widget_destroy(GTK_WIDGET(dialog));
+	             details[0] = gst_missing_plugin_message_get_installer_detail(msg);
+	             details[1] = NULL;
+	             ctx = gst_install_plugins_context_new();
+	             gst_install_plugins_async(details, ctx, parole_gst_install_plugins_result_func, gst);
+	             
+	             gst_install_plugins_context_free(ctx);
+	        }
+	        else if ( response == GTK_RESPONSE_REJECT )
+	            gtk_widget_destroy(GTK_WIDGET(dialog));
+        }
 	    break;
 	case GST_MESSAGE_WARNING:
 	    break;
diff --git a/src/main.c b/src/main.c
index 769d50a..2195dff 100644
--- a/src/main.c
+++ b/src/main.c
@@ -264,14 +264,6 @@ int main (int argc, char **argv)
 	gboolean enqueue = FALSE;
     gchar    *client_id = NULL;
     
-    /* initialize xfconf */
-    if (!xfconf_init (&error))
-    {
-        g_critical ("Failed to initialize Xfconf: %s", error->message);
-        g_error_free (error);
-        return EXIT_FAILURE;
-    }
-    
     /* Command-line options */
     GOptionEntry option_entries[] = 
     {
@@ -297,6 +289,14 @@ int main (int argc, char **argv)
         { NULL, },
     };
     
+        /* initialize xfconf */
+    if (!xfconf_init (&error))
+    {
+        g_critical ("Failed to initialize Xfconf: %s", error->message);
+        g_error_free (error);
+        return EXIT_FAILURE;
+    }
+    
 	XInitThreads();
 
     xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
diff --git a/src/parole-player.c b/src/parole-player.c
index 7ed6156..9afba68 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -158,6 +158,8 @@ gboolean	parole_player_delete_event_cb		(GtkWidget *widget,
 
 void		parole_player_show_hide_playlist	(GtkWidget *widget,
 							 ParolePlayer *player);
+							 
+void        parole_player_reset_controls (ParolePlayer *player, gboolean fullscreen);
 
 /*Menu items callbacks*/
 void            parole_player_menu_open_location_cb     (GtkWidget *widget, 
diff --git a/src/parole-player.h b/src/parole-player.h
index a663e01..54125b2 100644
--- a/src/parole-player.h
+++ b/src/parole-player.h
@@ -63,6 +63,8 @@ void				 parole_player_play_uri_disc   (ParolePlayer *player,
 
 void				 parole_player_terminate       (ParolePlayer *player);
 
+void                parole_player_embedded (ParolePlayer *player);
+
 void				 parole_player_full_screen     (ParolePlayer *player, 
 								gboolean fullscreen);
 


More information about the Xfce4-commits mailing list