[gst-devel] output a video in a drawing area (XWINDOW)

bounce bounce bouncebounce at caramail.com
Tue Jun 5 17:42:36 CEST 2007


Hi
 
I'm trying to play a video in my application with GStreamer in a DrawingArea of XWindow.
I'm working on a Windows application.
 
First, I make a "playbin" decoder and I make a "directdrawsink" sink.
Here, you can see the source code :
 
 --------------------------------------------------------------------------------------------------------------------------
 
 /* initialisation de GStreamer */
 if ( ! gst_init_check(argc, argv, 0) )
         return VIDEO_ERROR;

 loop = g_main_loop_new (NULL, FALSE);
 status = 0;
 status_mutex = g_mutex_new();
 video_width = video_height = 0;

 /* Pipeline principal */
 pipeline = gst_pipeline_new("pipeline");
 gst_bus_add_watch(gst_pipeline_get_bus(GST_PIPELINE(pipeline)), cb_bus, NULL);
 playbin = gst_element_factory_make("playbin", "dec");
 gst_bin_add(GST_BIN(pipeline), playbin);
 
 #ifndef WIN32
 vsink = gst_element_factory_make("ximagesink", "vsink");
 #else
 vsink = gst_element_factory_make("directdrawsink", "vsink");
 # endif

 #ifndef WIN32
 asink = gst_element_factory_make ("alsasink", "asink");
 #else
 asink = gst_element_factory_make ("directsoundsink", "asink");
 #endif
 
 g_object_set (G_OBJECT (playbin), "audio_sink", asink, "video_sink", vsink, NULL);

 if ( ! pipeline || ! playbin || ! vsink || ! asink )
        return VIDEO_ERROR;
 
return VIDEO_OK;
 
 --------------------------------------------------------------------------------------------------------------------------

Next, to specify the window (in my case DrawingArea) within which output the video, I use this function :

 --------------------------------------------------------------------------------------------------------------------------

     g_object_set(G_OBJECT(vsink), "window", winid, NULL);

 --------------------------------------------------------------------------------------------------------------------------

My problem is that when I play the video, it is not displayed in my widget but in a window which is open from GStreamer. But I want to play it in my drawing area widget.
I'm not sure about the second parameter of the function used. I've tried "window", "video_window" and "PROP_WINDOW", but they don't succeed.

I've also tryed to specify the widget within output the video thanks to the function :

 --------------------------------------------------------------------------------------------------------------------------

      gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(vsink), winid);

 --------------------------------------------------------------------------------------------------------------------------

but it doesn't work. My application goes frozen when I play the video and there is nothing in my widget.
and  no window is opened from gstreamer.


Have you an idea about my problem ? How can I succed to display the video in my DrawingArea?

Thanks.



More information about the gstreamer-devel mailing list