[gst-devel] Pipeline problems

omar.crea at jusan.it omar.crea at jusan.it
Thu Jun 21 12:00:17 CEST 2007


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.




More information about the gstreamer-devel mailing list