Debian Codegraph @

gstreamer/src/ghostpad.hg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gstreamermm/pad.h>
21
22 _DEFS(gstreamermm,gst)
23
24 namespace Gst
25 {
26
27 /** A class that represents pseudo link pads.
28 * Gst::GhostPad are useful when organizing pipelines with Gst::Bin like
29 * elements.
30 * The idea here is to create hierarchical element graphs. The bin element
31 * contains a sub-graph. Now one would like to treat the bin-element like
32 * another Gst::Element. This is where Gst::GhostPad come into play. A
33 * Gst::GhostPad acts as a proxy for another pad. Thus the bin can have sink
34 * and source ghost-pads that are associated with sink and source pads of the
35 * child elements.
36 *
37 * If the target pad is known at creation time, create() with a Gst::Pad
38 * argument is the method to use to get a ghost-pad. Otherwise one can use
39 * create() with a Gst::PadDirection argument to create the ghost-pad and use
40 * set_target() to establish the association later on.
41 *
42 * Note that Gst::GhostPad add overhead to the data processing of a pipeline.
43 *
44 * Last reviewed on 2016-06-05 (1.8.0)
45 */
46 class GhostPad : public Pad
47 {
48 _CLASS_GOBJECT(GhostPad, GstGhostPad, GST_GHOST_PAD, Pad, GstPad)
49
50 protected:
51 /** Creates a Gst::GhostPad from a target pad.
52 * @param target The target pad.
53 * @param name The name of the Gst::GhostPad.
54 *
55 * @throw std::runtime_error if Gst::GhostPad construction fails.
56 */
57 GhostPad(const Glib::RefPtr<Gst::Pad>& target, const Glib::ustring& name);
58
59 /** Creates a Gst::GhostPad with a specified name and direction.
60 * @param direction The direction of the Gst::GhostPad.
61 * @param name The name of the Gst::GhostPad.
62 *
63 * @throw std::runtime_error if Gst::GhostPad construction fails.
64 */
65 GhostPad(PadDirection direction, const Glib::ustring& name);
66
67 /** Creates a Gst::GhostPad from a target pad and a pad template.
68 * @param target The target pad.
69 * @param templ The pad template.
70 * @param name The name of the Gst::GhostPad.
71 *
72 * @throw std::runtime_error if Gst::GhostPad construction fails.
73 */
74 GhostPad(const Glib::RefPtr<Gst::Pad>& target,
75 const Glib::RefPtr<Gst::PadTemplate>& templ, const Glib::ustring& name);
76
77 /** Creates a Gst::GhostPad from a pad template.
78 * @param templ The pad template.
79 * @param name The name of the Gst::GhostPad.
80 *
81 * @throw std::runtime_error if Gst::GhostPad construction fails.
82 */
83 GhostPad(const Glib::RefPtr<Gst::PadTemplate>& templ,
84 const Glib::ustring& name);
85 _IGNORE(gst_ghost_pad_construct)
86
87 public:
88 /** Create a new Gst::GhostPad with @a target as the target. The direction
89 * will be taken from the target pad. @a target must be unlinked.
90 *
91 * @param target The pad to ghost.
92 * @param name The (optional) name of the new pad.
93 * @return A new Gst::GhostPad, or an empty RefPtr in case of an error.
94 * @throw std::runtime_error if Gst::GhostPad construction fails.
95 */
96 _WRAP_CREATE(const Glib::RefPtr<Gst::Pad>& target,
97 const Glib::ustring& name = Glib::ustring())
98
99 /** Create a new Gst::GhostPad without a target with the given direction. A
100 * target can be set on the Gst::GhostPad later with the set_target()
101 * function.
102 *
103 * The created Gst::GhostPad will not have a padtemplate.
104 *
105 * @param dir The direction of the Gst::GhostPad.
106 * @param name The (optional) name of the new Gst::GhostPad.
107 * @return A new Gst::GhostPad, or an empty RefPtr in case of an error.
108 * @throw std::runtime_error if Gst::GhostPad construction fails.
109 */
110 _WRAP_CREATE(PadDirection dir,
111 const Glib::ustring& name = Glib::ustring())
112
113 /** Create a new Gst::GhostPad with @a target as the target. The direction
114 * will be taken from the target pad. The template used on the Gst::GhostPad
115 * will be template.
116 *
117 * @param target The pad to ghost.
118 * @param templ The Gst::PadTemplate to use on the Gst::GhostPad.
119 * @param name The (optional) name of the new Gst::GhostPad.
120 * @return A new Gst::GhostPad, or an empty RefPtr in case of an error.
121 * @throw std::runtime_error if Gst::GhostPad construction fails.
122 */
123 _WRAP_CREATE(const Glib::RefPtr<Gst::Pad>& target,
124 const Glib::RefPtr<Gst::PadTemplate>& templ,
125 const Glib::ustring& name = Glib::ustring())
126
127 /** Create a new Gst::GhostPad based on @a templ, without setting a target.
128 * The direction will be taken from @a templ.
129 *
130 * @param templ The Gst::PadTemplate to create the Gst::GhostPad from.
131 * @param name The (optional) name of the new Gst::GhostPad.
132 * @return A new Gst::GhostPad, or an empty RefPtr in case of an error.
133 * @throw std::runtime_error if Gst::GhostPad construction fails.
134 */
135 _WRAP_CREATE(const Glib::RefPtr<Gst::PadTemplate>& templ,
136 const Glib::ustring& name = Glib::ustring())
137
138 _WRAP_METHOD(bool set_target(const Glib::RefPtr<Gst::Pad>& newtarget), gst_ghost_pad_set_target)
139
140 _WRAP_METHOD(Glib::RefPtr<Gst::Pad> get_target(), gst_ghost_pad_get_target)
141 _WRAP_METHOD(Glib::RefPtr<const Gst::Pad> get_target() const, gst_ghost_pad_get_target, constversion)
142
143 };
144
145 } // namespace Gst