Hi all,<br><br>I'm trying to make a small video player with Gstreamer and Gtk. I've seen the blog post on <a href="http://tristanswork.blogspot.com/2008/09/fullscreen-video-in-gstreamer-with-gtk.html">http://tristanswork.blogspot.com/2008/09/fullscreen-video-in-gstreamer-with-gtk.html</a> and it helped me a lot. But I need to show real videos, and after I did read the Gstreamer documentation, I figured out that I should use Playbin to display the videos the simpler way. I modified the example I found on the blog to use <br>
Playbin instead of a handmade pipeline. When I run the application I have made, it only displays the Gtk window, without the video that should be on it. No output, no error.<br><br>The code is as below:<br><br>#include <stdio.h><br>
#include <stdlib.h><br><br>#include <gst/gst.h><br>#include <gtk/gtk.h><br>#include <gst/interfaces/xoverlay.h><br>#include <gdk/gdk.h><br>#include <gdk/gdkx.h><br><br>static gboolean expose_callback(GtkWidget *widget, GdkEventExpose *event, gpointer data){<br>
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data), GDK_WINDOW_XWINDOW(widget->window));<br> return TRUE;<br>}<br><br>int main(int argc, char** argv) {<br> GstStateChangeReturn ret;<br> GMainLoop *loop;<br> GstElement *play, *sink;<br>
GtkWidget *window;<br><br> /* init GStreamer */<br> gst_init (&argc, &argv);<br> gtk_init (&argc, &argv);<br> loop = g_main_loop_new (NULL, FALSE);<br><br> /* set up */<br> play = gst_element_factory_make ("playbin", "play");<br>
<br> sink = gst_element_factory_make("xvimagesink", "videosink");<br> if (!sink)<br> g_print ("output could not be found - check your install\n");<br><br> g_object_set (G_OBJECT (play), "video-sink", sink, NULL);<br>
g_object_set (G_OBJECT (play), "uri", "file:///home/jp/SpiritOfUbuntu.ogv", NULL);<br><br> window = gtk_window_new(GTK_WINDOW_TOPLEVEL);<br> g_signal_connect(G_OBJECT(window), "expose-event", G_CALLBACK(expose_callback), sink);<br>
<br> gtk_widget_show_all(window);<br><br> gst_element_set_state (play, GST_STATE_PLAYING);<br> if (ret == GST_STATE_CHANGE_FAILURE) {<br> g_print ("Failed to start up pipeline!\n");<br> }<br><br>
/* now run */<br> g_main_loop_run (loop);<br><br> /* also clean up */<br> gst_element_set_state (play, GST_STATE_NULL);<br> gst_object_unref (GST_OBJECT (play));<br><br> return (EXIT_SUCCESS);<br>}<br><br>
<br>Any help will be very apreciated.<br><br><br>Thanks a lot,<br><br>Joao Paulo<br>