r3232 - in trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2: . src

abraxa at sita.openmoko.org abraxa at sita.openmoko.org
Mon Oct 22 02:09:01 CEST 2007


Author: abraxa
Date: 2007-10-22 02:08:59 +0200 (Mon, 22 Oct 2007)
New Revision: 3232

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/configure.ac
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c
Log:
Remove some unneeded (commented out) debugging messages
Add basic video playback support (requires gstreamer video plugins to work)



Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/configure.ac	2007-10-21 09:59:09 UTC (rev 3231)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/configure.ac	2007-10-22 00:08:59 UTC (rev 3232)
@@ -11,6 +11,7 @@
 AC_STDC_HEADERS
 AC_PROG_LIBTOOL
 AC_PROG_INTLTOOL([0.35.0])
+#AM_GCONF_SOURCE_2
 
 dnl i18n support
 GETTEXT_PACKAGE=AC_PACKAGE_NAME
@@ -34,6 +35,10 @@
 PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10 >= 0.10],,
 	AC_MSG_ERROR([*** Cannot find gstreamer ***]))
 
+# gstinterfaces-0.10 is contained in libgstximagesink - which in turn is
+# contained in gst-plugins-base. So if we have gstreamer we also have gstinterfaces-0.10
+LIBS="$GTK_LIBS $OPENMOKO_LIBS $GSTREAMER_LIBS $LIBS -lgstinterfaces-0.10"
+
 LIBS="-lexpat $LIBS"
 AC_CHECK_LIB(expat, XML_Parse, , [echo "Error: libexpat not found"; exit -1])
 
@@ -47,7 +52,6 @@
 AC_CHECK_LIB(mokoui2, moko_stock_register, , [echo "Error: libmokoui2 not found"; exit -1])
 
 
-LIBS="$GTK_LIBS $OPENMOKO_LIBS $GSTREAMER_LIBS $LIBS"
 CFLAGS="$OPENMOKO_CFLAGS $GSTREAMER_CFLAGS $CFLAGS"
 
 localedir=$datadir/locale

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c	2007-10-21 09:59:09 UTC (rev 3231)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c	2007-10-22 00:08:59 UTC (rev 3232)
@@ -31,7 +31,7 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 #include <glib/gi18n.h>
-
+#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
 #include "main_page.h"
@@ -49,6 +49,7 @@
 struct
 {
 	GtkWidget *cover_image;
+	GtkWidget *cover_eventbox;
 	GtkWidget *cover_frame;
 	GtkWidget *label1;
 	GtkWidget *label2;
@@ -339,9 +340,6 @@
 	#define MAX_DELTA_LAST 3
 	gint delta_last_x, delta_last_y;
 
-//	g_printf("Pointer: X=%d /\t Y=%d /\t state=%d /\t is_hint=%d\n",
-//		(gint)event->x, (gint)event->y, event->state, event->is_hint);
-
 	if (main_gesture_data.pressed)
 	{
 		delta_last_x = abs((guint)event->x - main_gesture_data.last_x);
@@ -357,10 +355,8 @@
 
 			// Make sure we won't trigger anymore (if we were before, that is)
 			main_gesture_data.repeating = FALSE;
-//			g_printf("-- movement\n");
 
 		} else {
-//			g_printf("-- NO movement\n");
 
 			// Cursor is idle, so lets update the gesture data if it wasn't idle before
 			if (!main_gesture_data.cursor_idle)
@@ -381,9 +377,6 @@
 gboolean
 omp_main_pointer_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 {
-//	g_printf("- Pressed: X=%d /\t Y=%d /\t state=%d /\t button=%d\n",
-//		(gint)event->x, (gint)event->y, event->state, event->button);
-
 	main_gesture_data.pressed = TRUE;
 	g_get_current_time(&main_gesture_data.start_time);
 	main_gesture_data.x_origin = event->x;
@@ -403,9 +396,6 @@
 gboolean
 omp_main_pointer_released(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 {
-//	g_printf("- Released: X=%d /\t Y=%d /\t state=%d /\t button=%d\n",
-//		(gint)event->x, (gint)event->y, event->state, event->button);
-
 	// Stop repeat trigger if necessary - or trigger action
 	if (main_gesture_data.repeating)
 	{
@@ -428,7 +418,10 @@
 	gchar *caption;
 
 	if (omp_config_get_main_ui_show_cover())
+	{
 		gtk_image_set_from_stock(GTK_IMAGE(main_widgets.cover_image), "no_cover", -1);
+		gtk_widget_queue_draw(main_widgets.cover_image);	// Re-draw the default cover
+	}
 
 	// Determine which label we can use for showing the "No track information" line
 	// #2 is preferred, followed by #1 and #3
@@ -484,10 +477,14 @@
 	hbox = gtk_hbox_new(FALSE, 0);
 	gtk_container_add(GTK_CONTAINER(frame), hbox);
 
-	// Pack the image itself into another frame to give it a black border
+	// Pack the image into an eventbox (for video playback) and that into another frame to give it a black border
+	main_widgets.cover_eventbox = gtk_event_box_new();
+
 	main_widgets.cover_image = gtk_image_new();
 	gtk_widget_set_name(GTK_WIDGET(main_widgets.cover_image), "omp-main-top-cover");
-	main_widgets.cover_frame = widget_wrap(main_widgets.cover_image, NULL);
+	gtk_container_add(GTK_CONTAINER(main_widgets.cover_eventbox), main_widgets.cover_image);
+
+	main_widgets.cover_frame = widget_wrap(main_widgets.cover_eventbox, "omp-main-top-cover");
 	gtk_frame_set_shadow_type(GTK_FRAME(main_widgets.cover_frame), GTK_SHADOW_IN);
 	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(main_widgets.cover_frame), FALSE, FALSE, 0);
 
@@ -776,6 +773,18 @@
 }
 
 /**
+ * Helper function that returns the X window handle to use for video playback and prepares the UI for video playback
+ */
+gulong
+omp_main_get_video_window()
+{
+	if (GTK_WIDGET_NO_WINDOW(main_widgets.cover_eventbox))
+		g_error(_("Video display widget has no window!\n"));
+
+	return GDK_WINDOW_XWINDOW(main_widgets.cover_eventbox->window);
+}
+
+/**
  * Callback for the "playlist loaded" event
  */
 void
@@ -803,6 +812,13 @@
 	gchar *text;
 	gint track_id;
 
+	// Restore and invalidate default cover
+	if (omp_config_get_main_ui_show_cover())
+	{
+		gtk_image_set_from_stock(GTK_IMAGE(main_widgets.cover_image), "no_cover", -1);
+		gtk_widget_queue_draw(main_widgets.cover_image);	// Re-draw the default cover
+	}
+
 	// Set preliminary artist/title strings (updated on incoming metadata)
 	omp_playlist_get_track_info(omp_playlist_current_track_id, &artist, &title, &track_length);
 	omp_main_set_label(OMP_MAIN_LABEL_ARTIST, artist);

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h	2007-10-21 09:59:09 UTC (rev 3231)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h	2007-10-22 00:08:59 UTC (rev 3232)
@@ -50,4 +50,6 @@
 
 GtkWidget *omp_main_page_create();
 
+gulong omp_main_get_video_window();
+
 #endif

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c	2007-10-21 09:59:09 UTC (rev 3231)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c	2007-10-22 00:08:59 UTC (rev 3232)
@@ -26,11 +26,13 @@
 
 #include <glib/gi18n.h>
 #include <gst/gst.h>
+#include <gst/interfaces/xoverlay.h>
 #include <uriparser/Uri.h>
 
 #include "playback.h"
 #include "guitools.h"
 #include "main.h"
+#include "main_page.h"
 #include "persistent.h"
 
 /// Our ticket to the gstreamer world
@@ -61,6 +63,7 @@
 static gboolean omp_gst_message_error(GstBus *bus, GstMessage *message, gpointer data);
 static gboolean omp_gst_message_warning(GstBus *bus, GstMessage *message, gpointer data);
 static gboolean omp_gst_message_tag(GstBus *bus, GstMessage *message, gpointer data);
+static gboolean omp_gst_message_element(GstBus *bus, GstMessage *message, gpointer data);
 
 
 
@@ -141,6 +144,7 @@
 	g_signal_connect(bus, "message::warning", 			G_CALLBACK(omp_gst_message_warning), NULL);
 	g_signal_connect(bus, "message::state-changed",	G_CALLBACK(omp_gst_message_state_changed), NULL);
 	g_signal_connect(bus, "message::tag",						G_CALLBACK(omp_gst_message_tag), NULL);
+	g_signal_connect(bus, "message::element",				G_CALLBACK(omp_gst_message_element), NULL);
 
 	gst_object_unref(bus);
 
@@ -574,3 +578,18 @@
 
 	return TRUE;
 }
+
+/**
+ * Handles gstreamer's "we need a window for video playback" notification
+ */
+static gboolean
+omp_gst_message_element(GstBus *bus, GstMessage *message, gpointer data)
+{
+	if (gst_structure_has_name(message->structure, "prepare-xwindow-id"))
+	{
+		gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)), omp_main_get_video_window());
+	}
+
+	return TRUE;
+}
+





More information about the commitlog mailing list