[gst-devel] Pipeline problems

Stefan Kost ensonic at hora-obscura.de
Tue Jun 26 10:59:49 CEST 2007


Hi

please reply to the list.

Quoting omar.crea at jusan.it:

> - "I can't see what 'screen' is and what you are doing in
>   'expose'."
>
> Screen is a 'gtk_drawing_area' where the N800 camera input was shown. The
> 'expose' event permmits to show the camera input on the main window of the
> application, because the xvimagesink creates a new window by default.
> Here is the piece of code (I get it from maemo.org repository):
>
> static gboolean
> expose
>     ( GtkWidget * widget, GdkEventExpose * event, gpointer data )
> {
>     gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data),
>                                     GDK_WINDOW_XWINDOW(widget->window));
>     return FALSE;
> }
>
>
> - "Beside most of the code below can be written a bit more compact"
>
> I know, but using 'gst_bin_add_many' and 'gst_element_link_many' on   
> the N800 I
> obtained a broken pipeline (i.e. it not works), while using the   
> single calls it
> runs. Onestly, I don't know why...

My guess is you forgot to pass NULL as the last argument.

>
> - "Please also note that its not safe to draw to a gtk_window from   
> 'cb_handoff'
>  (it runs in the pipeline thread)."
>
> Why? I known nothing about this. Above all, it's the only   
> functioning method I found for what I have to do.

I think I misread your pipeline. Its
camera ! tee ! csp ! xvimagesink
            \ ! csp2 ! fakesink

you render to xvimagesink and grab from fakesink. That should work. I  
would try it on x86 using gdb to see where it terminates.

Stefan

> Do you know other methods to send the pipeline
> input to a fakesink and use it when you want (to take a photo after a button
> was clicked, for example...)? If yes, please tell me.
>
> Best regards,
> Omar
>
>
> ===============================================================================
>
> Quoting Stefan Kost <ensonic at hora-obscura.de>:
>
>> hi,
>>
>> the snippet is incomplete. It would be good if you could provide a   
>> compilable
>> test case. E.g. I can't see what 'screen' is and what you are doing in
>> 'expose'.
>> Please also note that its not safe to draw to a gtk_window from 'cb_handoff'
>> (it
>> runs in the pipeline thread).
>> Beside most of the code below can be written a bit more compact:
>> - 	gst_bin_add(GST_BIN(pipeline), src);
>> - 	gst_bin_add(GST_BIN(pipeline), csp);
>> - 	gst_bin_add(GST_BIN(pipeline), csp2);
>> - 	gst_bin_add(GST_BIN(pipeline), tee);
>> - 	gst_bin_add(GST_BIN(pipeline), sink);
>> - 	gst_bin_add(GST_BIN(pipeline), fakesink);
>> - 	gst_bin_add(GST_BIN(pipeline), queue);
>> +       gst_bin_add_many(GST_BIN(pipeline), src, ..., queue, NULL);
>>
>> Instead of using gst_element_link_filtered() you can create a capsfilter
>> element, set the caps and then in the end link the whole pipeline via:
>> gst_element_link_many(src, ..., filter, NULL);
>>
>> Stefan
>>
>> omar.crea at jusan.it wrote:
>> > I wrote a little application for my Nokia N800 that uses a gstreamer
>> > pipeline into a gtk window: the app show the camera input and permits
>> > to take a photo when a button is clicked.
>> > I implemented the pipeline as showed below, but I have a few problems:
>> >
>> > - after a random amount of time (100-150 seconds) the pipeline crashes
>> >   and the app screen remains blocked.
>> > - I receive the following messages when I quit the application:
>> >   barcode_ui[1615]: GLIB WARNING ** default - Unable to get the window id
>> >   barcode_ui[1615]: GLIB CRITICAL ** GStreamer - gst_element_set_state:
>> >   assertion `GST_IS_ELEMENT (element)' failed
>> >   barcode_ui[1615]: GLIB CRITICAL ** GStreamer - gst_object_unref:
>> >   assertion `((GObject *) object)->ref_count > 0' failed
>> >
>> >
>> >
>> >   
>> ===========================================================================
>> >
>> > Here is the code:
>> >
>> >   
>> ===========================================================================
>> >
>> > To init the application:
>> >
>> > 	g_thread_init( NULL );
>> > 	gtk_init (&argc, &argv);
>> > 	gst_init(&argc, &argv);
>> > 	init_dbus();
>> >
>> >   
>> ===========================================================================
>> >
>> > GStreamer code:
>> >
>> > 	pipeline = gst_pipeline_new("camera");
>> >
>> > 	src = gst_element_factory_make("gconfv4l2src", "src");
>> > 	csp = gst_element_factory_make("ffmpegcolorspace", "csp");
>> > 	csp2 = gst_element_factory_make("ffmpegcolorspace", "csp2");
>> > 	tee = gst_element_factory_make("tee", "tee");
>> > 	sink = gst_element_factory_make("xvimagesink", "sink");
>> > 	fakesink = gst_element_factory_make("fakesink", "fakesink");
>> > 	queue = gst_element_factory_make("queue", "queue");
>> >
>> > /* Adding objects to pipeline */
>> > 	gst_bin_add(GST_BIN(pipeline), src);
>> > 	gst_bin_add(GST_BIN(pipeline), csp);
>> > 	gst_bin_add(GST_BIN(pipeline), csp2);
>> > 	gst_bin_add(GST_BIN(pipeline), tee);
>> > 	gst_bin_add(GST_BIN(pipeline), sink);
>> > 	gst_bin_add(GST_BIN(pipeline), fakesink);
>> > 	gst_bin_add(GST_BIN(pipeline), queue);
>> >
>> >
>> > 	filter = gst_caps_new_simple(
>> > 			"video/x-raw-yuv",
>> > 			"width", G_TYPE_INT, YUV_FILTER_WIDTH,
>> > 			"height",  G_TYPE_INT, YUV_FILTER_HEIGHT,
>> > 			"framerate", GST_TYPE_FRACTION, 11, 1,
>> > 			NULL);
>> >
>> > 	link_ok = gst_element_link_filtered(src, tee, filter);
>> > 	if (!link_ok) {
>> > 		printf("Failed to link YUV filter for the video sink\n");
>> > 		return FALSE;
>> > 		}
>> > 	gst_caps_unref(filter);
>> >
>> > 	gst_element_link(tee, csp);
>> > 	gst_element_link(csp, sink);
>> >
>> >
>> > 	filter = gst_caps_new_simple(
>> > 			"video/x-raw-rgb",
>> > 			"width", G_TYPE_INT, RGB_FILTER_WIDTH,
>> > 			"height",  G_TYPE_INT, RGB_FILTER_HEIGHT,
>> > 			"bpp", G_TYPE_INT, 24,
>> > 			"depth", G_TYPE_INT, 24,
>> > 			"framerate", GST_TYPE_FRACTION, FRAMERATE, 1,
>> > //			"endianess", G_TYPE_INT, G_BYTE_ORDER,
>> > 			NULL);
>> >
>> > 	gst_element_link(tee, queue);
>> > 	gst_element_link(queue, csp2);
>> > 	link_ok = gst_element_link_filtered(csp2, fakesink, filter);
>> > 	if (!link_ok)
>> > 		printf("Failed to link RGB filter for the fake sink\n");
>> > 		return FALSE;
>> > 		}
>> > 	gst_caps_unref(filter);
>> >
>> >
>> > /* Connect signals */
>> > 	g_signal_connect(screen, "expose-event", G_CALLBACK(expose), sink);
>> > 	g_object_set (G_OBJECT (fakesink), "signal-handoffs", TRUE, NULL);
>> >         g_signal_connect(fakesink, "handoff", G_CALLBACK(cb_handoff),
>> NULL);
>> >
>> >       	gst_element_set_state(pipeline, GST_STATE_PLAYING);
>> >
>> > /* Entering main program */
>> > 	gtk_widget_show(window);
>> > 	gtk_main ();
>> >
>> >
>> >   
>> ===========================================================================
>> >
>> > To quit the application:
>> >
>> > void
>> > destroy ( GtkWidget *widget, gpointer data )
>> > {
>> > 	gst_element_set_state(pipeline, GST_STATE_NULL);
>> > 	gst_object_unref(pipeline);
>> > 	remove_dbus_connection();
>> > 	gtk_main_quit();
>> > }
>> >
>> > ----------------------------------------------------------------
>> > This message was sent using IMP, the Internet Messaging Program.
>> >
>> > -------------------------------------------------------------------------
>> > This SF.net email is sponsored by DB2 Express
>> > Download DB2 Express C - the FREE version of DB2 express and take
>> > control of your XML. No limits. Just data. Click to get it now.
>> > http://sourceforge.net/powerbar/db2/
>> > _______________________________________________
>> > gstreamer-devel mailing list
>> > gstreamer-devel at lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>






More information about the gstreamer-devel mailing list