Gstreamer inside Gtkmm window



Hi,
I'm trying to insert a gstreamer output inside a Gtk window. I managed to do that but I would to reserve to the gstreamer output just a portion of the entire window; in fact I associated the output with a Gtk::DrawingArea, but when the video plays the video frame acquires all the toplevel window area. How can I prevent that? I set the size of the Gtk::DrawingArea with the  function set_size_request(width,height). Here is my code:

    GstElement *pipeline;
    loop = g_main_loop_new (NULL, FALSE);
    pipeline = gst_pipeline_new ("gst-player");

    bin = gst_element_factory_make ("playbin", "bin");
    videosink = gst_element_factory_make ("directdrawsink", "videosink");

    g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);

    gst_bin_add (GST_BIN (pipeline), bin);
    {
        GstBus *bus;
        bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
        gst_bus_add_watch (bus, bus_call, NULL);
        gst_object_unref (bus);
    }

    if (g->getUri()) {
        g_object_set (G_OBJECT (bin), "uri", g->getUri(), NULL);
        printf("primo passo.....\n");
    }
   
    window=reinterpret_cast<unsigned long>GDK_WINDOW_HWND(g->getFrame()->get_window()->gobj());

    if (GST_IS_X_OVERLAY (videosink))
    {
        gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), window);
    }
   gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);


Thank you in advanced,

Mattia Donna Bianco


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]