totem r5237 - in trunk: . src src/backend



Author: hadess
Date: Tue Mar  4 20:00:29 2008
New Revision: 5237
URL: http://svn.gnome.org/viewvc/totem?rev=5237&view=rev

Log:
2008-03-04  Bastien Nocera  <hadess hadess net>

	* src/totem-missing-plugins.[ch]: Move the missing plugins
	framework from here to ...
	* src/backend/bacon-video-widget-gst-missing-plugins.[ch]:
	... here and ...

	* src/backend/bacon-video-widget-gst-0.10.c:
	(bacon_video_widget_realize):
	* src/totem.c: ... adapt those files for the changes

	* configure.in:
	* src/Makefile.am:
	* src/backend/Makefile.am:
	Install a libbaconvideowidget.so.0 that the front-ends
	can link against, and make sure the front-ends don't link
	against any backend-specific libraries



Added:
   trunk/src/backend/bacon-video-widget-gst-missing-plugins.c
      - copied, changed from r5232, /trunk/src/totem-missing-plugins.c
   trunk/src/backend/bacon-video-widget-gst-missing-plugins.h
      - copied, changed from r5232, /trunk/src/totem-missing-plugins.h
Removed:
   trunk/src/totem-missing-plugins.c
   trunk/src/totem-missing-plugins.h
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/Makefile.am
   trunk/src/backend/Makefile.am
   trunk/src/backend/bacon-video-widget-gst-0.10.c
   trunk/src/totem.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Mar  4 20:00:29 2008
@@ -176,7 +176,7 @@
 fi
 
 if test x$HAVE_GSTREAMER = xno; then
-	MM="libxine >= $XINE_REQS gconf-2.0 gnome-keyring-1"
+	MM="libxine >= $XINE_REQS gconf-2.0 gnome-keyring-1 gnome-vfs-2.0"
 	PKG_CHECK_MODULES(XINE, $MM, HAVE_XINE=yes,
 		[
 			AC_MSG_RESULT(no)
@@ -234,23 +234,25 @@
 dnl Also check if we're going to be using GTK+ only
 if test x$ENABLE_GTK = "xno" ; then
 # FIXME: use gmodule-no-export instead!
-	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libgnomeui-2.0 >= $GNOMEUI_REQS gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS libgnome-2.0 >= $LIBGNOME_REQS  gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 totem-plparser >= $TOTEM_PLPARSER_REQS $ISO_CODES $MM)
+	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS libgnomeui-2.0 >= $GNOMEUI_REQS gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS libgnome-2.0 >= $LIBGNOME_REQS  gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 totem-plparser >= $TOTEM_PLPARSER_REQS $ISO_CODES)
 	HAVE_GNOME=yes
 else
 # FIXME: use gmodule-no-export instead!
-	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 totem-plparser >= $TOTEM_PLPARSER_REQS $ISO_CODES $MM)
+	PKG_CHECK_MODULES(EXTRA_GNOME, glib-2.0 >= $GLIB_REQS gtk+-2.0 >= $GTK_REQS gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 >= $GNOMEVFS_REQS gnome-icon-theme >= $GNOMEICON_REQS gmodule-2.0 totem-plparser >= $TOTEM_PLPARSER_REQS $ISO_CODES)
 	AC_DEFINE(USE_STABLE_LIBGNOMEUI, 1, [defined if we don't have GNOME])
 	AC_DEFINE(HAVE_GTK_ONLY, 1, [defined if GNOME isn't used])
 	HAVE_GNOME=no
 fi
 
+PKG_CHECK_MODULES(MM, $MM)
+
 AM_CONDITIONAL(HAVE_GNOME, test x$HAVE_GNOME = "xyes")
 EXTRA_GNOME_CFLAGS="$EXTRA_GNOME_CFLAGS"
 EXTRA_GNOME_LIBS="$EXTRA_GNOME_LIBS $EXTRA_BACKEND_LIBS"
 AC_SUBST(EXTRA_GNOME_CFLAGS)
 AC_SUBST(EXTRA_GNOME_LIBS)
 
-PKG_CHECK_MODULES(GTK, gtk+-2.0 $MM gthread-2.0)
+PKG_CHECK_MODULES(GTK, gtk+-2.0 gthread-2.0)
 AC_SUBST(GTK_CFLAGS)
 GTK_LIBS="$GTK_LIBS $EXTRA_BACKEND_LIBS"
 AC_SUBST(GTK_LIBS)
@@ -880,7 +882,7 @@
 	[ENABLE_NAUTILUS=yes]) dnl Default value
 
 if test x$ENABLE_NAUTILUS = "xyes" ; then
-	PKG_CHECK_MODULES(NAUTILUS, gtk+-2.0 $MM gthread-2.0 libnautilus-extension,
+	PKG_CHECK_MODULES(NAUTILUS, gtk+-2.0 gthread-2.0 libnautilus-extension,
 			[HAVE_NAUTILUS=yes], [HAVE_NAUTILUS=no])
 fi
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Mar  4 20:00:29 2008
@@ -109,7 +109,6 @@
 	totem-sidebar.c totem-sidebar.h \
 	totem-open-location.c totem-open-location.h \
 	totem-menu.c totem-menu.h	\
-	totem-missing-plugins.c totem-missing-plugins.h \
 	totem-uri.c totem-uri.h		\
 	ev-sidebar.c ev-sidebar.h	\
 	totem-subtitle-encoding.c	\
@@ -148,8 +147,7 @@
 	$(NVTV_LIBS)					\
 	$(DBUS_LIBS)					\
 	$(XTEST_LIBS)					\
-	$(X_LIBS)					\
-	$(MISSING_PLUGINS_LIBS)
+	$(X_LIBS)
 
 if ENABLE_PYTHON
 totem_LDADD += \

Modified: trunk/src/backend/Makefile.am
==============================================================================
--- trunk/src/backend/Makefile.am	(original)
+++ trunk/src/backend/Makefile.am	Tue Mar  4 20:00:29 2008
@@ -1,6 +1,6 @@
 noinst_PROGRAMS = bvw-test
 
-noinst_LTLIBRARIES = libbaconvideowidget.la
+lib_LTLIBRARIES = libbaconvideowidget.la
 
 bvw_test_SOURCES = bvw-test.c
 
@@ -38,9 +38,11 @@
 	debug.h
 
 if TOTEM_GST
-libbaconvideowidget_la_SOURCES += \
-	bacon-video-widget-gst-0.10.c \
-	gstscreenshot.c \
+libbaconvideowidget_la_SOURCES +=			\
+	bacon-video-widget-gst-0.10.c			\
+	bacon-video-widget-gst-missing-plugins.c	\
+	bacon-video-widget-gst-missing-plugins.h	\
+	gstscreenshot.c					\
 	gstscreenshot.h
 else
 libbaconvideowidget_la_SOURCES += \
@@ -53,15 +55,23 @@
 	$(DISABLE_DEPRECATED)			\
 	$(AM_CPPFLAGS)
 
-libbaconvideowidget_la_CFLAGS = \
-	$(EXTRA_GNOME_CFLAGS)	\
-	$(NVTV_CFLAGS) 		\
-	$(AM_CFLAGS)		\
+libbaconvideowidget_la_CFLAGS =		\
+	$(EXTRA_GNOME_CFLAGS)		\
+	$(MM_CFLAGS)			\
+	$(MISSING_PLUGINS_CFLAGS)	\
+	$(NVTV_CFLAGS) 			\
+	$(AM_CFLAGS)			\
 	-I$(top_srcdir)/
 
 
-libbaconvideowidget_la_LIBADD = \
-	$(XVIDMODE_LIBS)
+libbaconvideowidget_la_LIBADD =	\
+	$(XVIDMODE_LIBS)	\
+	$(MM_LIBS)		\
+	$(GST_LIBS)		\
+	$(MISSING_PLUGINS_LIBS)
+
+libbaconvideowidget_la_LDFLAGS=	\
+	-no-undefined
 
 CLEANFILES = $(BUILT_SOURCES)
 

Modified: trunk/src/backend/bacon-video-widget-gst-0.10.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-gst-0.10.c	(original)
+++ trunk/src/backend/bacon-video-widget-gst-0.10.c	Tue Mar  4 20:00:29 2008
@@ -64,6 +64,7 @@
 
 #include "bacon-video-widget.h"
 #include "bacon-video-widget-common.h"
+#include "bacon-video-widget-gst-missing-plugins.h"
 #include "baconvideowidget-marshal.h"
 #include "video-utils.h"
 #include "gstscreenshot.h"
@@ -552,6 +553,8 @@
   get_media_size (BACON_VIDEO_WIDGET (widget), &w, &h);
   totem_widget_set_preferred_size (widget, w, h);
 
+  bacon_video_widget_gst_missing_plugins_setup (bvw);
+
 #ifdef HAVE_NVTV
   if (!(nvtv_simple_init() && nvtv_enable_autoresize(TRUE))) {
     nvtv_simple_enable(FALSE);

Copied: trunk/src/backend/bacon-video-widget-gst-missing-plugins.c (from r5232, /trunk/src/totem-missing-plugins.c)
==============================================================================
--- /trunk/src/totem-missing-plugins.c	(original)
+++ trunk/src/backend/bacon-video-widget-gst-missing-plugins.c	Tue Mar  4 20:00:29 2008
@@ -22,11 +22,10 @@
 
 #include "config.h"
 
-#include "totem-missing-plugins.h"
+#include "bacon-video-widget-gst-missing-plugins.h"
 
 #ifdef ENABLE_MISSING_PLUGIN_INSTALLATION
 
-#include "totem-private.h"
 #include "bacon-video-widget.h"
 
 #include <gst/pbutils/pbutils.h>
@@ -53,12 +52,59 @@
 	gboolean   playing;
 	gchar    **descriptions;
 	gchar    **details;
-	Totem     *totem;
+	BaconVideoWidget *bvw;
 }
 TotemCodecInstallContext;
 
+#ifdef GDK_WINDOWING_X11
+/* Adapted from totem-interface.c */
+static GdkNativeWindow
+bacon_video_widget_gtk_plug_get_toplevel (GtkPlug *plug)
+{
+	Window root, parent, *children;
+	guint nchildren;
+	GdkNativeWindow xid;
+
+	g_return_val_if_fail (GTK_IS_PLUG (plug), 0);
+
+	xid = gtk_plug_get_id (plug);
+
+	do
+	{
+		/* FIXME: multi-head */
+		if (XQueryTree (GDK_DISPLAY (), xid, &root,
+					&parent, &children, &nchildren) == 0)
+		{
+			g_warning ("Couldn't find window manager window");
+			return 0;
+		}
+
+		if (root == parent)
+			return xid;
+
+		xid = parent;
+	}
+	while (TRUE);
+}
+
+static GdkNativeWindow
+bacon_video_widget_gst_get_toplevel (GtkWidget *widget)
+{
+	GtkWidget *parent;
+
+	parent = gtk_widget_get_toplevel (GTK_WIDGET (widget));
+	if (parent == NULL)
+		return 0;
+
+	if (GTK_IS_PLUG (parent))
+		return bacon_video_widget_gtk_plug_get_toplevel (GTK_PLUG (parent));
+	else
+		return GDK_WINDOW_XID(widget->window);
+}
+#endif
+
 static gboolean
-totem_codec_install_plugin_is_blacklisted (const gchar * detail)
+bacon_video_widget_gst_codec_install_plugin_is_blacklisted (const gchar * detail)
 {
 	GList *res;
 
@@ -70,9 +116,9 @@
 }
 
 static void
-totem_codec_install_blacklist_plugin (const gchar * detail)
+bacon_video_widget_gst_codec_install_blacklist_plugin (const gchar * detail)
 {
-	if (!totem_codec_install_plugin_is_blacklisted (detail))
+	if (!bacon_video_widget_gst_codec_install_plugin_is_blacklisted (detail))
 	{
 		blacklisted_plugins = g_list_prepend (blacklisted_plugins,
 		                                      g_strdup (detail));
@@ -80,7 +126,7 @@
 }
 
 static void
-totem_codec_install_context_free (TotemCodecInstallContext *ctx)
+bacon_video_widget_gst_codec_install_context_free (TotemCodecInstallContext *ctx)
 {
 	g_strfreev (ctx->descriptions);
 	g_strfreev (ctx->details);
@@ -105,16 +151,16 @@
 				/* blacklist installed plugins too, so that we don't get
 				 * into endless installer loops in case of inconsistencies */
 				for (p = ctx->details; p != NULL && *p != NULL; ++p)
-					totem_codec_install_blacklist_plugin (*p);
+					bacon_video_widget_gst_codec_install_blacklist_plugin (*p);
 
-				bacon_video_widget_stop (ctx->totem->bvw);
+				bacon_video_widget_stop (ctx->bvw);
 				g_message ("Missing plugins installed. Updating plugin registry ...");
 
 				/* force GStreamer to re-read its plugin registry */
 				if (gst_update_registry ())
 				{
 					g_message ("Plugin registry updated, trying again.");
-					bacon_video_widget_play (ctx->totem->bvw, NULL);
+					bacon_video_widget_play (ctx->bvw, NULL);
 				} else {
 					g_warning ("GStreamer registry update failed");
 					/* FIXME: should we show an error message here? */
@@ -132,16 +178,16 @@
 				 * could not play anything we should blacklist them as well,
 				 * so the install wizard isn't called again for nothing */
 				for (p = ctx->details; p != NULL && *p != NULL; ++p)
-					totem_codec_install_blacklist_plugin (*p);
+					bacon_video_widget_gst_codec_install_blacklist_plugin (*p);
 
 				if (ctx->playing)
 				{
-					bacon_video_widget_play (ctx->totem->bvw, NULL);
+					bacon_video_widget_play (ctx->bvw, NULL);
 				} else {
 					/* wizard has not shown error, do stop/play again,
 					 * so that an error message gets shown */
-					bacon_video_widget_stop (ctx->totem->bvw);
-					bacon_video_widget_play (ctx->totem->bvw, NULL);
+					bacon_video_widget_stop (ctx->bvw);
+					bacon_video_widget_play (ctx->bvw, NULL);
 				}
 			}
 			break;
@@ -150,15 +196,15 @@
 				/* blacklist on user abort, so we show an error next time (or
 				 * just play what we can) instead of calling the installer */
 				for (p = ctx->details; p != NULL && *p != NULL; ++p)
-					totem_codec_install_blacklist_plugin (*p);
+					bacon_video_widget_gst_codec_install_blacklist_plugin (*p);
 
 				if (ctx->playing) {
-					bacon_video_widget_play (ctx->totem->bvw, NULL);
+					bacon_video_widget_play (ctx->bvw, NULL);
 				} else {
 					/* if we couldn't play anything, do stop/play again,
 					 * so that an error message gets shown */
-					bacon_video_widget_stop (ctx->totem->bvw);
-					bacon_video_widget_play (ctx->totem->bvw, NULL);
+					bacon_video_widget_stop (ctx->bvw);
+					bacon_video_widget_play (ctx->bvw, NULL);
 				}
 			}
 			break;
@@ -170,20 +216,20 @@
 				           gst_install_plugins_return_get_name (res));
 
 				if (ctx->playing)
-					bacon_video_widget_play (ctx->totem->bvw, NULL);
+					bacon_video_widget_play (ctx->bvw, NULL);
 				else
-					bacon_video_widget_stop (ctx->totem->bvw);
+					bacon_video_widget_stop (ctx->bvw);
 				break;
 			}
 	}
 
-	totem_codec_install_context_free (ctx);
+	bacon_video_widget_gst_codec_install_context_free (ctx);
 }
 
 static gboolean
-totem_on_missing_plugins_event (BaconVideoWidget *bvw, char **details,
-                                char **descriptions, gboolean playing,
-                                Totem *totem)
+bacon_video_widget_gst_on_missing_plugins_event (BaconVideoWidget *bvw, char **details,
+						 char **descriptions, gboolean playing,
+						 gpointer user_data)
 {
 	GstInstallPluginsContext *install_ctx;
 	TotemCodecInstallContext *ctx;
@@ -197,11 +243,11 @@
 	ctx->descriptions = g_strdupv (descriptions);
 	ctx->details = g_strdupv (details);
 	ctx->playing = playing;
-	ctx->totem = totem;
+	ctx->bvw = bvw;
 
 	for (i = 0; i < num; ++i)
 	{
-		if (totem_codec_install_plugin_is_blacklisted (ctx->details[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]);
@@ -220,18 +266,18 @@
 	if (num == 0)
 	{
 		g_message ("All missing plugins are blacklisted, doing nothing");
-		totem_codec_install_context_free (ctx);
+		bacon_video_widget_gst_codec_install_context_free (ctx);
 		return FALSE;
 	}
 
 	install_ctx = gst_install_plugins_context_new ();
 
 #ifdef GDK_WINDOWING_X11
-	if (totem->win != NULL && GTK_WIDGET_REALIZED (totem->win))
+	if (GTK_WIDGET (bvw)->window != NULL && GTK_WIDGET_REALIZED (bvw))
 	{
 		gulong xid = 0;
 
-		xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (totem->win)->window);
+		xid = bacon_video_widget_gst_get_toplevel (GTK_WIDGET (bvw));
 		gst_install_plugins_context_set_xid (install_ctx, xid);
 	}
 #endif
@@ -254,7 +300,7 @@
 			g_warning ("Failed to start codec installation: %s",
 			           gst_install_plugins_return_get_name (status));
 		}
-		totem_codec_install_context_free (ctx);
+		bacon_video_widget_gst_codec_install_context_free (ctx);
 		return FALSE;
 	}
 
@@ -270,13 +316,13 @@
 #endif /* ENABLE_MISSING_PLUGIN_INSTALLATION */
 
 void
-totem_missing_plugins_setup (Totem *totem)
+bacon_video_widget_gst_missing_plugins_setup (BaconVideoWidget *bvw)
 {
 #ifdef ENABLE_MISSING_PLUGIN_INSTALLATION
-	g_signal_connect (G_OBJECT (totem->bvw),
+	g_signal_connect (G_OBJECT (bvw),
 			"missing-plugins",
-			G_CALLBACK (totem_on_missing_plugins_event),
-			totem);
+			G_CALLBACK (bacon_video_widget_gst_on_missing_plugins_event),
+			bvw);
 
 	gst_pb_utils_init ();
 

Copied: trunk/src/backend/bacon-video-widget-gst-missing-plugins.h (from r5232, /trunk/src/totem-missing-plugins.h)
==============================================================================
--- /trunk/src/totem-missing-plugins.h	(original)
+++ trunk/src/backend/bacon-video-widget-gst-missing-plugins.h	Tue Mar  4 20:00:29 2008
@@ -1,4 +1,4 @@
-/* totem-missing-plugins.h
+/* bacon-video-widget-gst-missing-plugins.h
 
    Copyright (C) 2007 Tim-Philipp MÃller <tim centricular net>
 
@@ -20,15 +20,15 @@
    Author: Tim-Philipp MÃller <tim centricular net>
  */
 
-#ifndef TOTEM_MISSING_PLUGINS_H
-#define TOTEM_MISSING_PLUGINS_H
+#ifndef BACON_VIDEO_WIDGET_GST_MISSING_PLUGINS_H
+#define BACON_VIDEO_WIDGET_GST_MISSING_PLUGINS_H
 
-#include "totem.h"
+#include "bacon-video-widget.h"
 
 G_BEGIN_DECLS
 
-void totem_missing_plugins_setup (Totem *totem);
+void bacon_video_widget_gst_missing_plugins_setup (BaconVideoWidget *bvw);
 
 G_END_DECLS
 
-#endif /* TOTEM_MISSING_PLUGINS_H */
+#endif /* BACON_VIDEO_WIDGET_GST_MISSING_PLUGINS_H */

Modified: trunk/src/totem.c
==============================================================================
--- trunk/src/totem.c	(original)
+++ trunk/src/totem.c	Tue Mar  4 20:00:29 2008
@@ -57,7 +57,6 @@
 #include "totem-screenshot.h"
 #include "totem-sidebar.h"
 #include "totem-menu.h"
-#include "totem-missing-plugins.h"
 #include "totem-options.h"
 #include "totem-uri.h"
 #include "totem-interface.h"
@@ -3007,8 +3006,6 @@
 			G_CALLBACK (on_error_event),
 			totem);
 
-	totem_missing_plugins_setup (totem);
-
 	container = GTK_CONTAINER (gtk_builder_get_object (totem->xml, "tmw_bvw_box"));
 	gtk_container_add (container,
 			GTK_WIDGET (totem->bvw));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]