mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 22:05:58 +00:00
tests: refactor weird bus sync handler code in camerabin example
This commit is contained in:
parent
20fecc6874
commit
3eaa8c7673
1 changed files with 11 additions and 30 deletions
|
@ -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 */
|
/* Write raw image buffer to file if found from message */
|
||||||
static void
|
static void
|
||||||
handle_element_message (GstMessage * msg)
|
handle_element_message (GstMessage * msg)
|
||||||
|
@ -278,17 +258,18 @@ handle_element_message (GstMessage * msg)
|
||||||
static GstBusSyncReply
|
static GstBusSyncReply
|
||||||
my_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data)
|
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)) {
|
if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
|
||||||
case GST_MESSAGE_ELEMENT:
|
return GST_BUS_PASS;
|
||||||
ret = set_xwindow (&message, data);
|
|
||||||
break;
|
/* FIXME: make sure to get XID in main thread */
|
||||||
default:
|
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (message->src),
|
||||||
/* unhandled message */
|
GDK_WINDOW_XWINDOW (ui_drawing->window));
|
||||||
break;
|
|
||||||
}
|
gst_message_unref (message);
|
||||||
return ret;
|
return GST_BUS_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue