+2006-06-16 Tim-Philipp Müller <tim at centricular dot net>
+
+ * docs/manual/advanced-autoplugging.xml:
+ * docs/manual/basics-helloworld.xml:
+ * docs/manual/highlevel-components.xml:
+ Don't leak bus reference in sample code.
+
2006-06-15 Tim-Philipp Müller <tim at centricular dot net>
* autogen.sh:
{
GMainLoop *loop;
GstElement *pipeline, *filesrc, *typefind;
+ GstBus *bus;
/* init GStreamer */
gst_init (&argc, &argv);
/* create a new pipeline to hold the elements */
pipeline = gst_pipeline_new ("pipe");
- gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
- my_bus_callback, NULL);
+
+ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ gst_bus_add_watch (bus, my_bus_callback, NULL);
+ gst_object_unref (bus);
/* create file source and typefind element */
filesrc = gst_element_factory_make ("filesrc", "source");
{
GMainLoop *loop;
GstElement *typefind, *realsink;
+ GError *err = NULL;
gchar *p;
/* init GStreamer and ourselves */
/* pipeline */
p = g_strdup_printf ("filesrc location=\"%s\" ! typefind name=tf", argv[1]);
- pipeline = gst_parse_launch (p, NULL);
- gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
- my_bus_callback, NULL);
+ pipeline = gst_parse_launch (p, &err);
g_free (p);
+
+ if (err) {
+ g_error ("Could not construct pipeline: %s", err->message);
+ g_error_free (err);
+ return -1;
+ }
+
+ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ gst_bus_add_watch (bus, my_bus_callback, NULL);
+ gst_object_unref (bus);
+
typefind = gst_bin_get_by_name (GST_BIN (pipeline), "tf");
g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), NULL);
gst_object_unref (GST_OBJECT (typefind));
char *argv[])
{
GMainLoop *loop;
+ GstBus *bus;
/* initialize GStreamer */
gst_init (&argc, &argv);
/* set filename property on the file source. Also add a message
* handler. */
g_object_set (G_OBJECT (source), "location", argv[1], NULL);
- gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
- bus_call, loop);
+
+ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ gst_bus_add_watch (bus, bus_call, loop);
+ gst_object_unref (bus);
/* put all elements in a bin */
gst_bin_add_many (GST_BIN (pipeline),
{
GMainLoop *loop;
GstElement *play;
+ GstBus *bus;
/* init GStreamer */
gst_init (&argc, &argv);
/* set up */
play = gst_element_factory_make ("playbin", "play");
g_object_set (G_OBJECT (play), "uri", argv[1], NULL);
- gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (play)),
- my_bus_callback, loop);
+
+ bus = gst_pipeline_get_bus (GST_PIPELINE (play));
+ gst_bus_add_watch (bus, my_bus_callback, loop);
+ gst_object_unref (bus);
+
gst_element_set_state (play, GST_STATE_PLAYING);
/* now run */
GMainLoop *loop;
GstElement *src, *dec, *conv, *sink;
GstPad *audiopad;
+ GstBus *bus;
/* init GStreamer */
gst_init (&argc, &argv);
/* setup */
pipeline = gst_pipeline_new ("pipeline");
- gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
- my_bus_callback, loop);
+
+ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ gst_bus_add_watch (bus, my_bus_callback, loop);
+ gst_object_unref (bus);
+
src = gst_element_factory_make ("filesrc", "source");
g_object_set (G_OBJECT (src), "location", argv[1], NULL);
dec = gst_element_factory_make ("decodebin", "decoder");