1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GstGhostPad.html
27  * outPack = gstreamer
28  * outFile = GhostPad
29  * strct   = GstGhostPad
30  * realStrct=
31  * ctorStrct=GstPad
32  * clss    = GhostPad
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_ghost_pad_
41  * omit structs:
42  * omit prefixes:
43  * 	- gst_proxy_pad_
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gstreamer.ObjectGst
49  * 	- gstreamer.Pad
50  * 	- gstreamer.PadTemplate
51  * structWrap:
52  * 	- GstObject* -> ObjectGst
53  * 	- GstPad* -> Pad
54  * 	- GstPadTemplate* -> PadTemplate
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gstreamer.GhostPad;
61 
62 public  import gstreamerc.gstreamertypes;
63 
64 private import gstreamerc.gstreamer;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import glib.Str;
70 private import gstreamer.ObjectGst;
71 private import gstreamer.Pad;
72 private import gstreamer.PadTemplate;
73 
74 
75 
76 private import gstreamer.ProxyPad;
77 
78 /**
79  * GhostPads are useful when organizing pipelines with GstBin like elements.
80  * The idea here is to create hierarchical element graphs. The bin element
81  * contains a sub-graph. Now one would like to treat the bin-element like any
82  * other GstElement. This is where GhostPads come into play. A GhostPad acts as
83  * a proxy for another pad. Thus the bin can have sink and source ghost-pads
84  * that are associated with sink and source pads of the child elements.
85  *
86  * If the target pad is known at creation time, gst_ghost_pad_new() is the
87  * function to use to get a ghost-pad. Otherwise one can use gst_ghost_pad_new_no_target()
88  * to create the ghost-pad and use gst_ghost_pad_set_target() to establish the
89  * association later on.
90  *
91  * Note that GhostPads add overhead to the data processing of a pipeline.
92  *
93  * Last reviewed on 2005-11-18 (0.9.5)
94  */
95 public class GhostPad : ProxyPad
96 {
97 	
98 	/** the main Gtk struct */
99 	protected GstGhostPad* gstGhostPad;
100 	
101 	
102 	public GstGhostPad* getGhostPadStruct()
103 	{
104 		return gstGhostPad;
105 	}
106 	
107 	
108 	/** the main Gtk struct as a void* */
109 	protected override void* getStruct()
110 	{
111 		return cast(void*)gstGhostPad;
112 	}
113 	
114 	/**
115 	 * Sets our main struct and passes it to the parent class
116 	 */
117 	public this (GstGhostPad* gstGhostPad)
118 	{
119 		super(cast(GstProxyPad*)gstGhostPad);
120 		this.gstGhostPad = gstGhostPad;
121 	}
122 	
123 	protected override void setStruct(GObject* obj)
124 	{
125 		super.setStruct(obj);
126 		gstGhostPad = cast(GstGhostPad*)obj;
127 	}
128 	
129 	/**
130 	 */
131 	
132 	/**
133 	 * Create a new ghostpad with target as the target. The direction will be taken
134 	 * from the target pad. target must be unlinked.
135 	 * Will ref the target.
136 	 * Params:
137 	 * name = the name of the new pad, or NULL to assign a default name. [allow-none]
138 	 * target = the pad to ghost. [transfer none]
139 	 * Throws: ConstructionException GTK+ fails to create the object.
140 	 */
141 	public this (string name, Pad target)
142 	{
143 		// GstPad * gst_ghost_pad_new (const gchar *name,  GstPad *target);
144 		auto p = gst_ghost_pad_new(Str.toStringz(name), (target is null) ? null : target.getPadStruct());
145 		if(p is null)
146 		{
147 			throw new ConstructionException("null returned by gst_ghost_pad_new(Str.toStringz(name), (target is null) ? null : target.getPadStruct())");
148 		}
149 		this(cast(GstGhostPad*) p);
150 	}
151 	
152 	/**
153 	 * Create a new ghostpad without a target with the given direction.
154 	 * A target can be set on the ghostpad later with the
155 	 * gst_ghost_pad_set_target() function.
156 	 * The created ghostpad will not have a padtemplate.
157 	 * Params:
158 	 * name = the name of the new pad, or NULL to assign a default name. [allow-none]
159 	 * dir = the direction of the ghostpad
160 	 * Throws: ConstructionException GTK+ fails to create the object.
161 	 */
162 	public this (string name, GstPadDirection dir)
163 	{
164 		// GstPad * gst_ghost_pad_new_no_target (const gchar *name,  GstPadDirection dir);
165 		auto p = gst_ghost_pad_new_no_target(Str.toStringz(name), dir);
166 		if(p is null)
167 		{
168 			throw new ConstructionException("null returned by gst_ghost_pad_new_no_target(Str.toStringz(name), dir)");
169 		}
170 		this(cast(GstGhostPad*) p);
171 	}
172 	
173 	/**
174 	 * Create a new ghostpad with target as the target. The direction will be taken
175 	 * from the target pad. The template used on the ghostpad will be template.
176 	 * Will ref the target.
177 	 * Params:
178 	 * name = the name of the new pad, or NULL to assign a default name. [allow-none]
179 	 * target = the pad to ghost. [transfer none]
180 	 * templ = the GstPadTemplate to use on the ghostpad. [transfer none]
181 	 * Throws: ConstructionException GTK+ fails to create the object.
182 	 */
183 	public this (string name, Pad target, PadTemplate templ)
184 	{
185 		// GstPad * gst_ghost_pad_new_from_template (const gchar *name,  GstPad *target,  GstPadTemplate *templ);
186 		auto p = gst_ghost_pad_new_from_template(Str.toStringz(name), (target is null) ? null : target.getPadStruct(), (templ is null) ? null : templ.getPadTemplateStruct());
187 		if(p is null)
188 		{
189 			throw new ConstructionException("null returned by gst_ghost_pad_new_from_template(Str.toStringz(name), (target is null) ? null : target.getPadStruct(), (templ is null) ? null : templ.getPadTemplateStruct())");
190 		}
191 		this(cast(GstGhostPad*) p);
192 	}
193 	
194 	/**
195 	 * Create a new ghostpad based on templ, without setting a target. The
196 	 * direction will be taken from the templ.
197 	 * Params:
198 	 * name = the name of the new pad, or NULL to assign a default name. [allow-none]
199 	 * templ = the GstPadTemplate to create the ghostpad from. [transfer none]
200 	 * Throws: ConstructionException GTK+ fails to create the object.
201 	 */
202 	public this (string name, PadTemplate templ)
203 	{
204 		// GstPad * gst_ghost_pad_new_no_target_from_template  (const gchar *name,  GstPadTemplate *templ);
205 		auto p = gst_ghost_pad_new_no_target_from_template(Str.toStringz(name), (templ is null) ? null : templ.getPadTemplateStruct());
206 		if(p is null)
207 		{
208 			throw new ConstructionException("null returned by gst_ghost_pad_new_no_target_from_template(Str.toStringz(name), (templ is null) ? null : templ.getPadTemplateStruct())");
209 		}
210 		this(cast(GstGhostPad*) p);
211 	}
212 	
213 	/**
214 	 * Set the new target of the ghostpad gpad. Any existing target
215 	 * is unlinked and links to the new target are established. if newtarget is
216 	 * NULL the target will be cleared.
217 	 * Params:
218 	 * newtarget = the new pad target. [transfer none][allow-none]
219 	 * Returns: TRUE if the new target could be set. This function can return FALSE when the internal pads could not be linked. [transfer full]
220 	 */
221 	public int setTarget(Pad newtarget)
222 	{
223 		// gboolean gst_ghost_pad_set_target (GstGhostPad *gpad,  GstPad *newtarget);
224 		return gst_ghost_pad_set_target(gstGhostPad, (newtarget is null) ? null : newtarget.getPadStruct());
225 	}
226 	
227 	/**
228 	 * Get the target pad of gpad. Unref target pad after usage.
229 	 * Returns: the target GstPad, can be NULL if the ghostpad has no target set. Unref target pad after usage. [transfer full]
230 	 */
231 	public Pad getTarget()
232 	{
233 		// GstPad * gst_ghost_pad_get_target (GstGhostPad *gpad);
234 		auto p = gst_ghost_pad_get_target(gstGhostPad);
235 		
236 		if(p is null)
237 		{
238 			return null;
239 		}
240 		
241 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p);
242 	}
243 	
244 	/**
245 	 * Finish initialization of a newly allocated ghost pad.
246 	 * This function is most useful in language bindings and when subclassing
247 	 * GstGhostPad; plugin and application developers normally will not call this
248 	 * function. Call this function directly after a call to g_object_new
249 	 * (GST_TYPE_GHOST_PAD, "direction", dir, ..., NULL).
250 	 * Returns: TRUE if the construction succeeds, FALSE otherwise.
251 	 */
252 	public int construct()
253 	{
254 		// gboolean gst_ghost_pad_construct (GstGhostPad *gpad);
255 		return gst_ghost_pad_construct(gstGhostPad);
256 	}
257 	
258 	/**
259 	 * Invoke the default activate mode function of a ghost pad.
260 	 * Params:
261 	 * pad = the GstPad to activate or deactivate.
262 	 * parent = the parent of pad or NULL. [allow-none]
263 	 * mode = the requested activation mode
264 	 * active = whether the pad should be active or not.
265 	 * Returns: TRUE if the operation was successful.
266 	 */
267 	public static int activateModeDefault(Pad pad, ObjectGst parent, GstPadMode mode, int active)
268 	{
269 		// gboolean gst_ghost_pad_activate_mode_default (GstPad *pad,  GstObject *parent,  GstPadMode mode,  gboolean active);
270 		return gst_ghost_pad_activate_mode_default((pad is null) ? null : pad.getPadStruct(), (parent is null) ? null : parent.getObjectGstStruct(), mode, active);
271 	}
272 	
273 	/**
274 	 * Invoke the default activate mode function of a proxy pad that is
275 	 * owned by a ghost pad.
276 	 * Params:
277 	 * pad = the GstPad to activate or deactivate.
278 	 * parent = the parent of pad or NULL. [allow-none]
279 	 * mode = the requested activation mode
280 	 * active = whether the pad should be active or not.
281 	 * Returns: TRUE if the operation was successful.
282 	 */
283 	public static int internalActivateModeDefault(Pad pad, ObjectGst parent, GstPadMode mode, int active)
284 	{
285 		// gboolean gst_ghost_pad_internal_activate_mode_default  (GstPad *pad,  GstObject *parent,  GstPadMode mode,  gboolean active);
286 		return gst_ghost_pad_internal_activate_mode_default((pad is null) ? null : pad.getPadStruct(), (parent is null) ? null : parent.getObjectGstStruct(), mode, active);
287 	}
288 }