1 | /* GStreamer |
---|
2 | * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> |
---|
3 | * |
---|
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. |
---|
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 | * General Public License for more details. |
---|
13 | * |
---|
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. |
---|
17 | */ |
---|
18 | |
---|
19 | #include <unistd.h> |
---|
20 | |
---|
21 | #include <gst/gst.h> |
---|
22 | |
---|
23 | gint |
---|
24 | main (gint argc, gchar ** argv) |
---|
25 | { |
---|
26 | GstElement *pipeline, *thread, *bin, *src, *queue, *id1, *sink; |
---|
27 | |
---|
28 | gst_init (&argc, &argv); |
---|
29 | |
---|
30 | g_print ("setting up...\n"); |
---|
31 | /* setup pipeline */ |
---|
32 | pipeline = gst_element_factory_make ("pipeline", NULL); |
---|
33 | g_assert (pipeline); |
---|
34 | src = gst_element_factory_make ("fakesrc", NULL); |
---|
35 | g_assert (src); |
---|
36 | queue = gst_element_factory_make ("queue", NULL); |
---|
37 | g_assert (queue); |
---|
38 | |
---|
39 | thread = gst_element_factory_make ("thread", NULL); |
---|
40 | g_assert (thread); |
---|
41 | bin = gst_element_factory_make ("bin", NULL); |
---|
42 | g_assert (bin); |
---|
43 | id1 = gst_element_factory_make ("identity", NULL); |
---|
44 | g_assert (id1); |
---|
45 | sink = gst_element_factory_make ("fakesink", NULL); |
---|
46 | g_assert (sink); |
---|
47 | |
---|
48 | gst_bin_add_many (GST_BIN (bin), id1, sink, NULL); |
---|
49 | gst_bin_add_many (GST_BIN (thread), bin, NULL); |
---|
50 | gst_bin_add_many (GST_BIN (pipeline), src, queue, thread, NULL); |
---|
51 | |
---|
52 | gst_element_link_pads (src, "src", queue, "sink"); |
---|
53 | gst_element_link_pads (queue, "src", id1, "sink"); |
---|
54 | gst_element_link_pads (id1, "src", sink, "sink"); |
---|
55 | |
---|
56 | if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) |
---|
57 | g_assert_not_reached (); |
---|
58 | |
---|
59 | g_print ("unlinking...\n"); |
---|
60 | |
---|
61 | gst_object_ref (GST_OBJECT (queue)); |
---|
62 | gst_bin_remove (GST_BIN (pipeline), queue); |
---|
63 | gst_object_ref (GST_OBJECT (bin)); |
---|
64 | gst_bin_remove (GST_BIN (thread), bin); |
---|
65 | |
---|
66 | g_print ("done.\n"); |
---|
67 | return 0; |
---|
68 | } |
---|