summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-01-11 01:18:16 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-01-22 02:25:44 +0000
commit3eaa8c7673c1352422c8e1d57ed3630fd4bc0f96 (patch)
treeb13b42c6ef4398b8e25d2e47977a1db59356390b /tests
parent20fecc68743de398c255f26e1fa3950d1a6c59a6 (diff)
downloadgstreamer-plugins-bad-3eaa8c7673c1352422c8e1d57ed3630fd4bc0f96.tar.gz
tests: refactor weird bus sync handler code in camerabin example
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/camerabin/gst-camera.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/tests/examples/camerabin/gst-camera.c b/tests/examples/camerabin/gst-camera.c
index 45b77fb29..68815b4db 100644
--- a/tests/examples/camerabin/gst-camera.c
+++ b/tests/examples/camerabin/gst-camera.c
@@ -202,26 +202,6 @@ set_filename (GString * name)
}
}
-static GstBusSyncReply
-set_xwindow (GstMessage ** message, gpointer data)
-{
- GstBusSyncReply ret = GST_BUS_PASS;
- const GstStructure *s = gst_message_get_structure (*message);
-
- if (!s || !gst_structure_has_name (s, "prepare-xwindow-id")) {
- goto done;
- }
-
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (*message)),
- GDK_WINDOW_XWINDOW (ui_drawing->window));
-
- gst_message_unref (*message);
- *message = NULL;
- ret = GST_BUS_DROP;
-done:
- return ret;
-}
-
/* Write raw image buffer to file if found from message */
static void
handle_element_message (GstMessage * msg)
@@ -278,17 +258,18 @@ handle_element_message (GstMessage * msg)
static GstBusSyncReply
my_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data)
{
- GstBusSyncReply ret = GST_BUS_PASS;
+ if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
+ return GST_BUS_PASS;
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ELEMENT:
- ret = set_xwindow (&message, data);
- break;
- default:
- /* unhandled message */
- break;
- }
- return ret;
+ if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
+ return GST_BUS_PASS;
+
+ /* FIXME: make sure to get XID in main thread */
+ gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (message->src),
+ GDK_WINDOW_XWINDOW (ui_drawing->window));
+
+ gst_message_unref (message);
+ return GST_BUS_DROP;
}
static void