<div dir="ltr"><div class="gmail_quote">Hi.<br><br><div dir="ltr">I wrote small example for testing gstreamer features. It based on examples from gstreamer tutorials:<br>
<i><br>#include <gst/gst.h><br>#include <gst/interfaces/xoverlay.h><br>#include <X11/X.h><br>
#include <X11/Xlib.h><br><br>static GstBusSyncReply create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)<br>{<br> if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)<br> return GST_BUS_PASS;<br>
<br> if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))<br> return GST_BUS_PASS;<br><br> Display *disp = XOpenDisplay(NULL);<br> int snum = DefaultScreen(disp);<br><br> XID win = XCreateSimpleWindow (disp, RootWindow(disp, snum), 0, 0, 640, 480, 0, 0, 0);<br>
XSetWindowBackgroundPixmap (disp, win, None);<br> XMapRaised (disp, win);<br> XSync (disp, FALSE);<br><br> gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), win);<br><br> gst_message_unref (message);<br>
<br> return GST_BUS_DROP;<br>}<br><br>int<br>main (int argc,<br> char *argv[])<br>{<br> GMainLoop *loop;<br><br> GstElement *pipeline;<br> GstBus *bus;<br><br> gst_init (&argc, &argv);<br><br>
loop = g_main_loop_new (NULL, FALSE);<br><br> GstXML *xml;<br> xml = gst_xml_new();<br> unsigned char path[] = "pipeline.xml";<br> gboolean ret = gst_xml_parse_file(xml, path, NULL);<br> g_assert(ret == TRUE);<br>
<br> unsigned char element[] = "pipeline0";<br> pipeline = gst_xml_get_element (xml, element);<br> g_assert(pipeline != NULL);<br><br> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br> gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, pipeline);<br>
<br> gst_element_set_state (pipeline, GST_STATE_PLAYING);<br><br> g_main_loop_run (loop);<br><br> gst_element_set_state (pipeline, GST_STATE_NULL);<br> gst_object_unref (GST_OBJECT (pipeline));<br><br> return 0;<br>
}<br></i><br>Where file "pipeline.xml" was generated by executing next command:<br> gst-launch-0.10 videotestsrc ! navigationtest ! xvimagesink -o pipeline.xml<br><br>It seems that this code not work because mouse clicks not handled but mouse moving and key pressing handled. Have you any suggestions?<br>
<br>P.S. I use Ubuntu 8.04 and gstreamer packages from it repository.<br><br>Best regards.<br></div>
</div><br></div>