totem r5322 - in branches/gnome-2-20: . src/backend
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5322 - in branches/gnome-2-20: . src/backend
- Date: Fri, 28 Mar 2008 12:12:22 +0000 (GMT)
Author: hadess
Date: Fri Mar 28 12:12:21 2008
New Revision: 5322
URL: http://svn.gnome.org/viewvc/totem?rev=5322&view=rev
Log:
2008-03-28 Bastien Nocera <hadess hadess net>
* src/backend/bacon-video-widget-gst-0.10.c
(bacon_video_widget_finalize),
(bvw_update_brightness_and_contrast_from_gconf),
(bvw_update_colorbalance_from_gconf_delayed),
(bvw_update_interface_implementations), (bacon_video_widget_new):
Backport fix for #471159
Modified:
branches/gnome-2-20/ChangeLog
branches/gnome-2-20/src/backend/bacon-video-widget-gst-0.10.c
Modified: branches/gnome-2-20/src/backend/bacon-video-widget-gst-0.10.c
==============================================================================
--- branches/gnome-2-20/src/backend/bacon-video-widget-gst-0.10.c (original)
+++ branches/gnome-2-20/src/backend/bacon-video-widget-gst-0.10.c Fri Mar 28 12:12:21 2008
@@ -2,7 +2,7 @@
* Copyright (C) 2003-2007 the GStreamer project
* Julien Moutte <julien moutte net>
* Ronald Bultje <rbultje ronald bitfreak net>
- * Tim-Philipp MÃller <tim centricular net>
+ * Copyright (C) 2005-2008 Tim-Philipp MÃller <tim centricular net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -118,8 +118,9 @@
BaconVideoWidgetAspectRatio ratio_type;
GstElement *play;
- GstXOverlay *xoverlay; /* protect with lock */
- GstColorBalance *balance; /* protect with lock */
+ GstXOverlay *xoverlay; /* protect with lock */
+ GstColorBalance *balance; /* protect with lock */
+ guint col_update_id; /* protect with lock */
GMutex *lock;
guint update_id;
@@ -226,6 +227,8 @@
static int bvw_signals[LAST_SIGNAL] = { 0 };
+static GThread *gui_thread;
+
GST_DEBUG_CATEGORY (_totem_gst_debug_cat);
#define GST_CAT_DEFAULT _totem_gst_debug_cat
@@ -1857,6 +1860,11 @@
bvw->priv->update_id = 0;
}
+ if (bvw->priv->col_update_id) {
+ g_source_remove (bvw->priv->col_update_id);
+ bvw->priv->col_update_id = 0;
+ }
+
if (bvw->priv->tagcache) {
gst_tag_list_free (bvw->priv->tagcache);
bvw->priv->tagcache = NULL;
@@ -4617,16 +4625,46 @@
}
static void
+bvw_update_brightness_and_contrast_from_gconf (BaconVideoWidget * bvw)
+{
+ GConfValue *confvalue;
+ guint i;
+
+ g_return_if_fail (g_thread_self() == gui_thread);
+
+ /* Setup brightness and contrast */
+ GST_LOG ("updating brightness and contrast from GConf settings");
+ for (i = 0; i < G_N_ELEMENTS (video_props_str); i++) {
+ confvalue = gconf_client_get_without_default (bvw->priv->gc,
+ video_props_str[i], NULL);
+ if (confvalue != NULL) {
+ bacon_video_widget_set_video_property (bvw, i,
+ gconf_value_get_int (confvalue));
+ gconf_value_free (confvalue);
+ }
+ }
+}
+
+static gboolean
+bvw_update_colorbalance_from_gconf_delayed (BaconVideoWidget * bvw)
+{
+ GST_LOG ("delayed updating of colorbalance");
+ g_mutex_lock (bvw->priv->lock);
+ bvw_update_interface_implementations (bvw);
+ bvw->priv->col_update_id = 0;
+ g_mutex_unlock (bvw->priv->lock);
+ return FALSE;
+}
+
+static void
bvw_update_interface_implementations (BaconVideoWidget *bvw)
{
GstColorBalance *old_balance = bvw->priv->balance;
GstXOverlay *old_xoverlay = bvw->priv->xoverlay;
- GConfValue *confvalue;
GstElement *video_sink = NULL;
GstElement *element = NULL;
GstIteratorResult ires;
GstIterator *iter;
- guint i;
g_object_get (bvw->priv->play, "video-sink", &video_sink, NULL);
g_assert (video_sink != NULL);
@@ -4676,15 +4714,18 @@
bvw->priv->balance = NULL;
}
- /* Setup brightness and contrast */
- for (i = 0; i < G_N_ELEMENTS (video_props_str); i++) {
- confvalue = gconf_client_get_without_default (bvw->priv->gc,
- video_props_str[i], NULL);
- if (confvalue != NULL) {
- bacon_video_widget_set_video_property (bvw, i,
- gconf_value_get_int (confvalue));
- gconf_value_free (confvalue);
- }
+ /* Setup brightness and contrast from configured values (do it delayed if
+ * we're within a streaming thread, otherwise gconf/orbit/whatever may
+ * iterate or otherwise mess with the default main context and cause all
+ * kinds of nasty issues) */
+ if (g_thread_self() == gui_thread) {
+ bvw_update_brightness_and_contrast_from_gconf (bvw);
+ } else {
+ /* caller will have acquired bvw->priv->lock already */
+ if (bvw->priv->col_update_id)
+ g_source_remove (bvw->priv->col_update_id);
+ bvw->priv->col_update_id =
+ g_idle_add ((GSourceFunc) bvw_update_colorbalance_from_gconf_delayed, bvw);
}
if (old_xoverlay)
@@ -5110,6 +5151,9 @@
gconf_value_free (confvalue);
}
+ /* assume we're always called from the main Gtk+ GUI thread */
+ gui_thread = g_thread_self();
+
return GTK_WIDGET (bvw);
/* errors */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]