2 * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 handoff_identity (GstElement * element)
26 parent = GST_BIN (gst_element_get_parent (element));
27 g_print ("identity handoff\n");
28 /* element is unreffed and destroyed here, which will cause
30 gst_bin_remove (parent, element);
34 main (gint argc, gchar ** argv)
36 GstElement *pipeline, *src, *sink, *id;
38 gst_init (&argc, &argv);
40 g_print ("setting up...\n");
42 pipeline = gst_element_factory_make ("pipeline", NULL);
44 src = gst_element_factory_make ("fakesrc", NULL);
46 id = gst_element_factory_make ("identity", NULL);
48 g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity,
50 g_object_set (G_OBJECT (id), "loop-based", TRUE, NULL);
52 sink = gst_element_factory_make ("fakesink", NULL);
55 gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
56 gst_element_link_pads (src, "src", id, "sink");
57 gst_element_link_pads (id, "src", sink, "sink");
59 if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS)
60 g_assert_not_reached ();
62 gst_bin_iterate (GST_BIN (pipeline));
63 gst_bin_iterate (GST_BIN (pipeline));
64 g_print ("got past iteration, scheduler refs elements correctly\n");
66 g_print ("cleaning up...\n");
67 gst_object_unref (GST_OBJECT (pipeline));
68 src = id = sink = pipeline = NULL;