<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Take a look at the example code here:<br>http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html<br><br>Basically you need to listen for 'prepare-xwindow-id' signal and handle it synchronoysly.<br><hr id="stopSpelling">Date: Wed, 29 Apr 2009 11:14:57 +0200<br>From: guitarboy000@gmail.com<br>To: gstreamer-devel@lists.sourceforge.net<br>Subject: [gst-devel] Gtk xoverlay problem<br><br>Hi,<br><br>I'm developing an application, it's called Gloobus and it wants to be a very fast previewer for any kind of file, you can see some screenhots and download it from here:<br><br><a>http://gloobus.launchpad.net</a><br>
<br>Now, I can reproduce audio files with gstreamer without any problem, but when I try to do it for movies, they play in his own window.<br>I've been trying a lot of thing with the xoverlay function that its supposed to be the one to make the video play in a gtk widget but I get an error<br>
<br>If I add the gtk_drawing_area into the GTK_FIXED before I call the xoverlay function, I get a BAD WINDOW error and the application stops.<br>If I add the gtk_drawing_area into the GTK_FIXED after I call the xoverlay function, I get that the gtk drawin has no window or pixmap and it plays in its own window.<br>
<br>Here you have the code, I hope you can see what fails here:<br><br>container is a gtk_fixed added into the main window!<br><br><br><br><br>void iMovie::play(GtkWidget * container)<br>{<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;m_drawable = gtk_drawing_area_new();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gtk_widget_set_size_request (m_drawable, 600, 500);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gtk_fixed_put(GTK_FIXED(container),m_drawable,SHADOW_WIDTH,SHADOW_WIDTH+HEADER_HEIGHT);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;g_print("Start Playing (%s)...\n",g_file_get_uri ( m_gfile));<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gst_init (NULL, NULL);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;m_pipeline&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;= gst_pipeline_new &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ("gst-player");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;m_bin &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;= gst_element_factory_make ("playbin", &nbsp;&nbsp;&nbsp; &nbsp; "m_bin");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;m_sink &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;= gst_element_factory_make ("xvimagesink",&nbsp; "m_sink");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;g_object_set ( G_OBJECT (m_bin), "video-sink", m_sink, NULL );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gst_bin_add&nbsp; ( GST_BIN (m_pipeline), m_bin );<br>
<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;GstBus *bus;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;bus = gst_pipeline_get_bus (GST_PIPELINE (m_pipeline));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gst_object_unref (bus);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;g_object_set (G_OBJECT (m_bin), "uri", g_file_get_uri( m_gfile), NULL );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;g_object_set (G_OBJECT (m_sink), "force-aspect-ratio", TRUE, NULL&nbsp; );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (GST_IS_X_OVERLAY (m_sink))<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;printf("Is Overlay (Win ID: %i)!!\n",GPOINTER_TO_INT(GDK_WINDOW_XWINDOW(m_drawable-&gt;window)));<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (m_sink), GPOINTER_TO_INT(GDK_WINDOW_XWINDOW(m_drawable-&gt;window)));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gst_x_overlay_handle_events&nbsp; (GST_X_OVERLAY (m_sink), FALSE);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gst_element_set_state (m_pipeline, GST_STATE_PLAYING);<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gtk_widget_show_all(container); <br>}<br clear="all"><br>-- <br>Jordi Hernández Puigdellívol<br><br /><hr />Δείξτε το στιλ σας με μια εικόνα στο Messenger. Δείτε τις όλες. <a href='http://download.live.com/messenger ' target='_new'>Κάντε κλικ εδώ!</a></body>
</html>