1 | /* GStreamer |
---|
2 | * Copyright (C) 2004 Andy Wingo <wingo at pobox.com> |
---|
3 | * |
---|
4 | * This library is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU Library 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. |
---|
8 | * |
---|
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 | * Library General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU Library General Public |
---|
15 | * License along with this library; if not, write to the |
---|
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
17 | * Boston, MA 02111-1307, USA. |
---|
18 | */ |
---|
19 | |
---|
20 | #include <gst/gst.h> |
---|
21 | |
---|
22 | gint |
---|
23 | main (gint argc, gchar * argv[]) |
---|
24 | { |
---|
25 | GstElement *pipeline, *bin; |
---|
26 | GstElement *fakesrc, *fakesink, *identity; |
---|
27 | GstPad *sink, *src, *real = (GstPad *) 0xdeadbeef; |
---|
28 | |
---|
29 | gst_init (&argc, &argv); |
---|
30 | |
---|
31 | pipeline = gst_element_factory_make ("pipeline", NULL); |
---|
32 | bin = gst_element_factory_make ("bin", NULL); |
---|
33 | fakesrc = gst_element_factory_make ("fakesrc", NULL); |
---|
34 | fakesink = gst_element_factory_make ("fakesink", NULL); |
---|
35 | identity = gst_element_factory_make ("identity", NULL); |
---|
36 | |
---|
37 | gst_bin_add_many (GST_BIN (pipeline), fakesrc, bin, fakesink, NULL); |
---|
38 | gst_bin_add (GST_BIN (bin), identity); |
---|
39 | |
---|
40 | sink = gst_element_add_ghost_pad (bin, |
---|
41 | gst_element_get_pad (identity, "sink"), "sink"); |
---|
42 | src = gst_element_add_ghost_pad (bin, |
---|
43 | gst_element_get_pad (identity, "src"), "src"); |
---|
44 | |
---|
45 | gst_element_link_many (fakesrc, bin, fakesink, NULL); |
---|
46 | gst_element_set_state (pipeline, GST_STATE_PLAYING); |
---|
47 | |
---|
48 | if (!gst_bin_iterate (GST_BIN (pipeline))) |
---|
49 | g_assert_not_reached (); |
---|
50 | |
---|
51 | gst_element_set_state (pipeline, GST_STATE_NULL); |
---|
52 | |
---|
53 | /* test the cleanup */ |
---|
54 | gst_object_ref (GST_OBJECT (sink)); |
---|
55 | gst_object_unref ((GstObject *) pipeline); |
---|
56 | g_object_get (sink, "real-pad", &real, NULL); |
---|
57 | g_assert (real == NULL); |
---|
58 | g_assert (G_OBJECT (sink)->ref_count == 1); |
---|
59 | gst_object_unref (GST_OBJECT (sink)); |
---|
60 | |
---|
61 | return 0; |
---|
62 | } |
---|