[gst-devel] Pipeline problems
Stefan Kost
ensonic at hora-obscura.de
Mon Jun 25 18:28:51 CEST 2007
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
More information about the gstreamer-devel
mailing list