Mouse navigation don't work

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mouse navigation don't work

Yuri Brukov
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.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Mouse navigation don't work

Yuri Brukov
Hi.

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.

Best regards.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel