[gst-devel] Showing a video in c
Jakob Sloth
jakobsloth at hotmail.com
Thu Aug 9 08:56:11 CEST 2007
Hi,
thanks for the reply. I think I have made the changes that you suggested but
I can't really
get it to work. Here is the new main program:
///////////////////////////////////////////////////////////////////
int main(int argc, char *argv[]){
gst_init (&argc, &argv);
gtk_init(&argc, &argv);
create_gst_playbin ();
GtkWidget *window;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkWidget *da = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(da),640,480);
gtk_container_add(GTK_CONTAINER(window), da);
gtk_widget_show_all(window);
char* path = "Any.AVI";
g_object_set (playbin, "uri", path, NULL);
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(videosink),
GDK_WINDOW_XID(da->window));
gst_element_set_state (playbin, GST_STATE_PLAYING);
gtk_main();
return 0;
}
/////////////////////////////////////////////////////////////
I get the error message.
/////////////////////////////////////////////////////////////
The program 'simple_movie_player' received an X Window System error.This
probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 34 error_code 3 request_code 3 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
///////////////////////////////////////////////////////
what to do?
Cheers Jakob
>From: Stefan Kost <ensonic at hora-obscura.de>
>To: Jakob Sloth <jakobsloth at hotmail.com>
>Subject: Re: [gst-devel] Showing a video in c
>Date: Wed, 08 Aug 2007 16:33:04 +0300
>
>Hi,
>
>Jakob Sloth wrote:
> > Hi
> > im trying to write a simple media player i c.
> >
> > my problem is that the movie isn't shown in the gtk window that i
>create.
> > Instead it is shown in a new window that i havent created.
>
>make sure the GtkDrawingArea is realized. do the show_all() before and in
>the
>realized set the xid and set piepline to playing. There is also an example
>in
>the api docs.
>
>Stefan
>
> >
> > My program is as follows:
> >
>////////////////////////////////////////////////////////////////////////////////////////////////////////////
> >
> > #include <X11/Xlib.h>
> > #include <gst/gst.h>
> > #include <gst/interfaces/xoverlay.h>
> > #include <stdio.h>
> > #include <gtk/gtk.h>
> > #include <gdk/gdkx.h>
> >
> > GstElement *playbin, *videosink, *audiosink;
> >
> > void create_gst_playbin (void)
> > {
> > playbin = gst_element_factory_make ("playbin", "playbin");
> > videosink = gst_element_factory_make ("xvimagesink", "videosink");
> > audiosink = gst_element_factory_make ("alsasink", "audiosink");
> > g_object_set (videosink,
> > "force-aspect-ratio", false,
> > NULL);
> > g_object_set (playbin,
> > "audio-sink", audiosink,
> > "video-sink", videosink,
> > NULL);
> > }
> >
> > int main(int argc, char *argv[]){
> >
> > gst_init (&argc, &argv);
> > gtk_init(&argc, &argv);
> >
> > create_gst_playbin ();
> >
> > GtkWidget *window;
> > window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> >
> > GtkWidget *da = gtk_drawing_area_new();
> > gtk_drawing_area_size(GTK_DRAWING_AREA(da),640,480);
> >
> > char* path = "file:///SOME_URI";
> > g_object_set (playbin, "uri", path, NULL);
> >
> > gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(videosink),
> > GDK_WINDOW_XID(da->window));
> > gst_element_set_state (playbin, GST_STATE_PLAYING);
> >
> > gtk_widget_show_all(window);
> > gtk_main();
> >
> > return 0;
> > }
> >
>//////////////////////////////////////////////////////////////////////////////////////////
> >
> >
> > When i run the program i get the following error:
> >
> > (simple_gst:19947): Gdk-WARNING **: gdkdrawable-x11.c:878 drawable is
> > not a pixmap or window
> >
> > I guess the error has something to do with this line:
> >
> > gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(videosink),
> > GDK_WINDOW_XID(da->window));
> >
> > Any clues?
> > Jakob Sloth
> >
> > _________________________________________________________________
> > Download din yndlingsmusik på MSN Music: http://www.msn.dk/music - det
> > er nemt og billigt
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> >
>-------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
_________________________________________________________________
Opret en personlig blog og del dine billeder på MSN Spaces:
http://spaces.msn.com/
More information about the gstreamer-devel
mailing list