1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| static GstBusSyncReply
create_window( GstBus *bus,
GstMessage *message,
GtkWidget *draw )
{
/* ignore anything but 'prepare-xwindow-id' element messages */
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 );
gst_x_overlay_set_xwindow_id(
GST_X_OVERLAY( GST_MESSAGE_SRC( message ) ),
GDK_WINDOW_XWINDOW( gtk_widget_get_window( draw ) ) );
gst_message_unref (message);
return( GST_BUS_DROP );
}
int
main( int argc,
char **argv)
{
/* Declarations here */
GtkWidget *draw_area;
GstBus *bus;
GstElement *pipeline;
/* ... */
gtk_init( &argc, &argv );
/* Create widget here */
/* Create pipeline here */
/* Embedding */
bus = gst_pipeline_get_bus( GST_PIPELINE( pipeline ) );
gst_bus_set_sync_handler( bus,
(GstBusSyncHandler)create_window,
draw_area );
/* More code here */
return( 0 );
} |