[gst-devel] Mouse navigation don't work

Брюков Юрий y.brukov at gmail.com
Wed Aug 6 16:11:16 CEST 2008


I  wrote small example for testing gstreamer features. It based on examples
from gstreamer tutorials:
*
#include <gst/gst.h>
#include <gst/interfaces/xoverlay.h>
#include <X11/X.h>
#include <X11/Xlib.h>

static GstBusSyncReply create_window (GstBus * bus, GstMessage * message,
GstPipeline * pipeline)
{
    if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
        return GST_BUS_PASS;

    if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
        return GST_BUS_PASS;

    Display *disp = XOpenDisplay(NULL);
    int snum = DefaultScreen(disp);

    XID win = XCreateSimpleWindow (disp, RootWindow(disp, snum), 0, 0, 640,
480, 0, 0, 0);
    XSetWindowBackgroundPixmap (disp, win, None);
    XMapRaised (disp, win);
    XSync (disp, FALSE);

    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
win);

    gst_message_unref (message);

    return GST_BUS_DROP;
}

int
main (int   argc,
      char *argv[])
{
    GMainLoop *loop;

    GstElement *pipeline;
    GstBus *bus;

    gst_init (&argc, &argv);

    loop = g_main_loop_new (NULL, FALSE);

    GstXML *xml;
    xml = gst_xml_new();
    unsigned char path[] = "pipeline.xml";
    gboolean ret = gst_xml_parse_file(xml, path, NULL);
    g_assert(ret == TRUE);

    unsigned char element[] = "pipeline0";
    pipeline = gst_xml_get_element (xml, element);
    g_assert(pipeline != NULL);

    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
    gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window,
pipeline);

    gst_element_set_state (pipeline, GST_STATE_PLAYING);

    g_main_loop_run (loop);

    gst_element_set_state (pipeline, GST_STATE_NULL);
    gst_object_unref (GST_OBJECT (pipeline));

    return 0;
}
*
Where file "pipeline.xml" was generated by executing next command:
    gst-launch-0.10 videotestsrc ! navigationtest ! xvimagesink -o
pipeline.xml

It seems that this code not work because mouse clicks not handled but mouse
moving and key pressing handled. Have you any suggestions?

P.S. I use Ubuntu 8.04 and gstreamer packages from it repository.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080806/52490a2b/attachment.htm>


More information about the gstreamer-devel mailing list