tpm gstreamer: gstreamer/ gstreamer/gst/ gstreamer/tests/check/gst/
[email protected] Sat, 17 Jan 2009 13:04:55 -0800 (PST)
| Newsgroups | gmane.comp.video.gstreamer.cvs |
|---|---|
| Message-ID | <[email protected]> |
--===============0383511869970779074==
CVS Root: /cvs/gstreamer
Module: gstreamer
Changes by: tpm
Date: Sat Jan 17 2009 21:04:55 UTC
Log message:
* gst/gstbus.c: (gst_bus_set_main_context), (gst_bus_create_watch):
Fix order of members in GstBusSource structure - the first member
must be the parent structure ie. GSource. Should make bus sources
attached to non-default main contexts work in all cases now (ie.
primarily in cases where the callback has a non-NULL user data
argument). Fixes #562170.
* tests/check/gst/gstbus.c: (test_custom_main_context):
Add unit test for the above, based on code by
Justin Karneges <justin at affinix com>.
Modified files:
. : ChangeLog
gst : gstbus.c
tests/check/gst : gstbus.c
Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4222&r2=1.4223
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstbus.c.diff?r1=1.70&r2=1.71
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/tests/check/gst/gstbus.c.diff?r1=1.17&r2=1.18
====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v
retrieving revision 1.4222
retrieving revision 1.4223
diff -u -d -r1.4222 -r1.4223
--- ChangeLog 15 Jan 2009 10:04:35 -0000 1.4222
+++ ChangeLog 17 Jan 2009 21:04:37 -0000 1.4223
@@ -1,3 +1,16 @@
+2009-01-17 Tim-Philipp Müller <tim.muller at collabora co uk>
+
+ * gst/gstbus.c: (gst_bus_set_main_context), (gst_bus_create_watch):
+ Fix order of members in GstBusSource structure - the first member
+ must be the parent structure ie. GSource. Should make bus sources
+ attached to non-default main contexts work in all cases now (ie.
+ primarily in cases where the callback has a non-NULL user data
+ argument). Fixes #562170.
+ * tests/check/gst/gstbus.c: (test_custom_main_context):
+ Add unit test for the above, based on code by
+ Justin Karneges <justin at affinix com>.
2009-01-15 Wim Taymans <[email protected]>
Patch by: Jonas Holmberg <jonas dot holmberg at axis dot com>
Index: gstbus.c
RCS file: /cvs/gstreamer/gstreamer/gst/gstbus.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- gstbus.c 5 Jan 2009 15:41:00 -0000 1.70
+++ gstbus.c 17 Jan 2009 21:04:40 -0000 1.71
@@ -325,6 +325,9 @@
bus->priv->main_context = g_main_context_ref (ctx);
}
+ GST_DEBUG_OBJECT (bus, "setting main context to %p, GLib default context: %p",
+ ctx, g_main_context_default ());
GST_OBJECT_UNLOCK (bus);
}
@@ -767,9 +770,9 @@
*/
typedef struct
{
- gboolean inited;
GSource source;
GstBus *bus;
+ gboolean inited;
} GstBusSource;
static gboolean
@@ -888,6 +891,7 @@
source = (GstBusSource *) g_source_new (&gst_bus_source_funcs,
sizeof (GstBusSource));
source->bus = gst_object_ref (bus);
+ source->inited = FALSE;
return (GSource *) source;
RCS file: /cvs/gstreamer/gstreamer/tests/check/gst/gstbus.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- gstbus.c 27 Dec 2008 17:41:11 -0000 1.17
+++ gstbus.c 17 Jan 2009 21:04:41 -0000 1.18
@@ -487,6 +487,84 @@
GST_END_TEST;
+static gboolean
+cb_bus_call (GstBus * bus, GstMessage * msg, gpointer data)
+{
+ GMainLoop *loop = data;
+ switch (GST_MESSAGE_TYPE (msg)) {
+ case GST_MESSAGE_EOS:
+ {
+ GST_INFO ("End-of-stream");
+ g_main_loop_quit (loop);
+ break;
+ }
+ case GST_MESSAGE_ERROR:
+ GError *err = NULL;
+ gst_message_parse_error (msg, &err, NULL);
+ g_error ("Error: %s", err->message);
+ g_error_free (err);
+ default:
+ GST_LOG ("BUS MESSAGE: type=%s", GST_MESSAGE_TYPE_NAME (msg));
+ }
+ return TRUE;
+}
+GST_START_TEST (test_custom_main_context)
+ GMainContext *ctx;
+ GMainLoop *loop;
+ GstElement *pipeline;
+ GstElement *src;
+ GstElement *sink;
+ GSource *source;
+ GstBus *bus;
+ ctx = g_main_context_new ();
+ loop = g_main_loop_new (ctx, FALSE);
+ pipeline = gst_pipeline_new (NULL);
+ src = gst_element_factory_make ("fakesrc", NULL);
+ g_object_set (src, "num-buffers", 2000, NULL);
+ sink = gst_element_factory_make ("fakesink", NULL);
+ fail_unless (gst_bin_add (GST_BIN (pipeline), src));
+ fail_unless (gst_bin_add (GST_BIN (pipeline), sink));
+ fail_unless (gst_element_link (src, sink));
+ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ source = gst_bus_create_watch (bus);
+ g_source_attach (source, ctx);
+ g_source_set_callback (source, (GSourceFunc) cb_bus_call, loop, NULL);
+ gst_object_unref (bus);
+ GST_INFO ("starting pipeline");
+ gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
+ GST_INFO ("running event loop, ctx=%p", ctx);
+ g_main_loop_run (loop);
+ /* clean up */
+ if (ctx)
+ g_main_context_unref (ctx);
+ g_main_loop_unref (loop);
+GST_END_TEST;
static Suite *
gst_bus_suite (void)
@@ -504,6 +582,7 @@
tcase_add_test (tc_chain, test_timed_pop_thread);
tcase_add_test (tc_chain, test_timed_pop_filtered);
tcase_add_test (tc_chain, test_timed_pop_filtered_with_timeout);
+ tcase_add_test (tc_chain, test_custom_main_context);
return s;
--===============0383511869970779074==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--===============0383511869970779074==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose
--===============0383511869970779074==--