mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 20:59:44 +00:00
docs/manual/: Don't leak bus reference in sample code.
Original commit message from CVS: * docs/manual/advanced-autoplugging.xml: * docs/manual/basics-helloworld.xml: * docs/manual/highlevel-components.xml: Don't leak bus reference in sample code.
This commit is contained in:
parent
fa5953d31c
commit
49c923d8f6
4 changed files with 42 additions and 11 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
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>
|
2006-06-15 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* autogen.sh:
|
* autogen.sh:
|
||||||
|
|
|
@ -185,6 +185,7 @@ main (gint argc,
|
||||||
{
|
{
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GstElement *pipeline, *filesrc, *typefind;
|
GstElement *pipeline, *filesrc, *typefind;
|
||||||
|
GstBus *bus;
|
||||||
|
|
||||||
/* init GStreamer */
|
/* init GStreamer */
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
@ -198,8 +199,10 @@ main (gint argc,
|
||||||
|
|
||||||
/* create a new pipeline to hold the elements */
|
/* create a new pipeline to hold the elements */
|
||||||
pipeline = gst_pipeline_new ("pipe");
|
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 */
|
/* create file source and typefind element */
|
||||||
filesrc = gst_element_factory_make ("filesrc", "source");
|
filesrc = gst_element_factory_make ("filesrc", "source");
|
||||||
|
@ -544,6 +547,7 @@ main (gint argc,
|
||||||
{
|
{
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GstElement *typefind, *realsink;
|
GstElement *typefind, *realsink;
|
||||||
|
GError *err = NULL;
|
||||||
gchar *p;
|
gchar *p;
|
||||||
|
|
||||||
/* init GStreamer and ourselves */
|
/* init GStreamer and ourselves */
|
||||||
|
@ -559,10 +563,19 @@ main (gint argc,
|
||||||
|
|
||||||
/* pipeline */
|
/* pipeline */
|
||||||
p = g_strdup_printf ("filesrc location=\"%s\" ! typefind name=tf", argv[1]);
|
p = g_strdup_printf ("filesrc location=\"%s\" ! typefind name=tf", argv[1]);
|
||||||
pipeline = gst_parse_launch (p, NULL);
|
pipeline = gst_parse_launch (p, &err);
|
||||||
gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
|
|
||||||
my_bus_callback, NULL);
|
|
||||||
g_free (p);
|
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");
|
typefind = gst_bin_get_by_name (GST_BIN (pipeline), "tf");
|
||||||
g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), NULL);
|
g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), NULL);
|
||||||
gst_object_unref (GST_OBJECT (typefind));
|
gst_object_unref (GST_OBJECT (typefind));
|
||||||
|
|
|
@ -119,6 +119,7 @@ main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
|
GstBus *bus;
|
||||||
|
|
||||||
/* initialize GStreamer */
|
/* initialize GStreamer */
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
@ -145,8 +146,10 @@ main (int argc,
|
||||||
/* set filename property on the file source. Also add a message
|
/* set filename property on the file source. Also add a message
|
||||||
* handler. */
|
* handler. */
|
||||||
g_object_set (G_OBJECT (source), "location", argv[1], NULL);
|
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 */
|
/* put all elements in a bin */
|
||||||
gst_bin_add_many (GST_BIN (pipeline),
|
gst_bin_add_many (GST_BIN (pipeline),
|
||||||
|
|
|
@ -89,6 +89,7 @@ main (gint argc,
|
||||||
{
|
{
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GstElement *play;
|
GstElement *play;
|
||||||
|
GstBus *bus;
|
||||||
|
|
||||||
/* init GStreamer */
|
/* init GStreamer */
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
@ -103,8 +104,11 @@ main (gint argc,
|
||||||
/* set up */
|
/* set up */
|
||||||
play = gst_element_factory_make ("playbin", "play");
|
play = gst_element_factory_make ("playbin", "play");
|
||||||
g_object_set (G_OBJECT (play), "uri", argv[1], NULL);
|
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);
|
gst_element_set_state (play, GST_STATE_PLAYING);
|
||||||
|
|
||||||
/* now run */
|
/* now run */
|
||||||
|
@ -266,6 +270,7 @@ main (gint argc,
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GstElement *src, *dec, *conv, *sink;
|
GstElement *src, *dec, *conv, *sink;
|
||||||
GstPad *audiopad;
|
GstPad *audiopad;
|
||||||
|
GstBus *bus;
|
||||||
|
|
||||||
/* init GStreamer */
|
/* init GStreamer */
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
@ -279,8 +284,11 @@ main (gint argc,
|
||||||
|
|
||||||
/* setup */
|
/* setup */
|
||||||
pipeline = gst_pipeline_new ("pipeline");
|
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");
|
src = gst_element_factory_make ("filesrc", "source");
|
||||||
g_object_set (G_OBJECT (src), "location", argv[1], NULL);
|
g_object_set (G_OBJECT (src), "location", argv[1], NULL);
|
||||||
dec = gst_element_factory_make ("decodebin", "decoder");
|
dec = gst_element_factory_make ("decodebin", "decoder");
|
||||||
|
|
Loading…
Reference in a new issue