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  = GstPad
38  * implements:
39  * prefixes:
40  * 	- gst_ghost_pad_
41  * 	- gst_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gstreamer.Pad
49  * 	- gstreamer.PadTemplate
50  * structWrap:
51  * 	- GstGhostPad* -> GhostPad
52  * 	- GstPad* -> Pad
53  * 	- GstPadTemplate* -> PadTemplate
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gstreamer.GhostPad;
60 
61 public  import gstreamerc.gstreamertypes;
62 
63 private import gstreamerc.gstreamer;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import glib.Str;
69 private import gstreamer.Pad;
70 private import gstreamer.PadTemplate;
71 
72 
73 
74 private import gstreamer.Pad;
75 
76 /**
77  * Description
78  * GhostPads are useful when organizing pipelines with GstBin like elements.
79  * The idea here is to create hierarchical element graphs. The bin element
80  * contains a sub-graph. Now one would like to treat the bin-element like other
81  * GstElements. This is where GhostPads come into play. A GhostPad acts as a
82  * proxy for another pad. Thus the bin can have sink and source ghost-pads that
83  * are associated with sink and source pads of the child elements.
84  * If the target pad is known at creation time, gst_ghost_pad_new() is the
85  * function to use to get a ghost-pad. Otherwise one can use gst_ghost_pad_new_no_target()
86  * to create the ghost-pad and use gst_ghost_pad_set_target() to establish the
87  * association later on.
88  * Note that GhostPads add overhead to the data processing of a pipeline.
89  * Last reviewed on 2005-11-18 (0.9.5)
90  */
91 public class GhostPad : Pad
92 {
93 	
94 	/** the main Gtk struct */
95 	protected GstGhostPad* gstGhostPad;
96 	
97 	
98 	public GstGhostPad* getGhostPadStruct()
99 	{
100 		return gstGhostPad;
101 	}
102 	
103 	
104 	/** the main Gtk struct as a void* */
105 	protected override void* getStruct()
106 	{
107 		return cast(void*)gstGhostPad;
108 	}
109 	
110 	/**
111 	 * Sets our main struct and passes it to the parent class
112 	 */
113 	public this (GstGhostPad* gstGhostPad)
114 	{
115 		super(cast(GstPad*)gstGhostPad);
116 		this.gstGhostPad = gstGhostPad;
117 	}
118 	
119 	protected override void setStruct(GObject* obj)
120 	{
121 		super.setStruct(obj);
122 		gstGhostPad = cast(GstGhostPad*)obj;
123 	}
124 	
125 	/**
126 	 */
127 	
128 	/**
129 	 * Create a new ghostpad with target as the target. The direction will be taken
130 	 * from the target pad. target must be unlinked.
131 	 * Will ref the target.
132 	 * Params:
133 	 * name = the name of the new pad, or NULL to assign a default name.
134 	 * target = the pad to ghost.
135 	 * Throws: ConstructionException GTK+ fails to create the object.
136 	 */
137 	public this (string name, Pad target)
138 	{
139 		// GstPad* gst_ghost_pad_new (const gchar *name,  GstPad *target);
140 		auto p = gst_ghost_pad_new(Str.toStringz(name), (target is null) ? null : target.getPadStruct());
141 		if(p is null)
142 		{
143 			throw new ConstructionException("null returned by gst_ghost_pad_new(Str.toStringz(name), (target is null) ? null : target.getPadStruct())");
144 		}
145 		this(cast(GstGhostPad*) p);
146 	}
147 	
148 	/**
149 	 * Create a new ghostpad without a target with the given direction.
150 	 * A target can be set on the ghostpad later with the
151 	 * gst_ghost_pad_set_target() function.
152 	 * The created ghostpad will not have a padtemplate.
153 	 * Params:
154 	 * name = the name of the new pad, or NULL to assign a default name.
155 	 * dir = the direction of the ghostpad
156 	 * Throws: ConstructionException GTK+ fails to create the object.
157 	 */
158 	public this (string name, GstPadDirection dir)
159 	{
160 		// GstPad* gst_ghost_pad_new_no_target (const gchar *name,  GstPadDirection dir);
161 		auto p = gst_ghost_pad_new_no_target(Str.toStringz(name), dir);
162 		if(p is null)
163 		{
164 			throw new ConstructionException("null returned by gst_ghost_pad_new_no_target(Str.toStringz(name), dir)");
165 		}
166 		this(cast(GstGhostPad*) p);
167 	}
168 	
169 	/**
170 	 * Create a new ghostpad with target as the target. The direction will be taken
171 	 * from the target pad. The template used on the ghostpad will be template.
172 	 * Will ref the target.
173 	 * Params:
174 	 * name = the name of the new pad, or NULL to assign a default name.
175 	 * target = the pad to ghost.
176 	 * templ = the GstPadTemplate to use on the ghostpad.
177 	 * Throws: ConstructionException GTK+ fails to create the object.
178 	 */
179 	public this (string name, Pad target, PadTemplate templ)
180 	{
181 		// GstPad* gst_ghost_pad_new_from_template (const gchar *name,  GstPad *target,  GstPadTemplate *templ);
182 		auto p = gst_ghost_pad_new_from_template(Str.toStringz(name), (target is null) ? null : target.getPadStruct(), (templ is null) ? null : templ.getPadTemplateStruct());
183 		if(p is null)
184 		{
185 			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())");
186 		}
187 		this(cast(GstGhostPad*) p);
188 	}
189 	
190 	/**
191 	 * Create a new ghostpad based on templ, without setting a target. The
192 	 * direction will be taken from the templ.
193 	 * Params:
194 	 * name = the name of the new pad, or NULL to assign a default name.
195 	 * templ = the GstPadTemplate to create the ghostpad from.
196 	 * Throws: ConstructionException GTK+ fails to create the object.
197 	 */
198 	public this (string name, PadTemplate templ)
199 	{
200 		// GstPad* gst_ghost_pad_new_no_target_from_template  (const gchar *name,  GstPadTemplate *templ);
201 		auto p = gst_ghost_pad_new_no_target_from_template(Str.toStringz(name), (templ is null) ? null : templ.getPadTemplateStruct());
202 		if(p is null)
203 		{
204 			throw new ConstructionException("null returned by gst_ghost_pad_new_no_target_from_template(Str.toStringz(name), (templ is null) ? null : templ.getPadTemplateStruct())");
205 		}
206 		this(cast(GstGhostPad*) p);
207 	}
208 	
209 	/**
210 	 * Set the new target of the ghostpad gpad. Any existing target
211 	 * is unlinked and links to the new target are established.
212 	 * Params:
213 	 * newtarget = the new pad target
214 	 * Returns: TRUE if the new target could be set. This function can return FALSE when the internal pads could not be linked.
215 	 */
216 	public int setTarget(Pad newtarget)
217 	{
218 		// gboolean gst_ghost_pad_set_target (GstGhostPad *gpad,  GstPad *newtarget);
219 		return gst_ghost_pad_set_target(gstGhostPad, (newtarget is null) ? null : newtarget.getPadStruct());
220 	}
221 	
222 	/**
223 	 * Get the target pad of gpad. Unref target pad after usage.
224 	 * Returns: the target GstPad, can be NULL if the ghostpad has no target set. Unref target pad after usage.
225 	 */
226 	public Pad getTarget()
227 	{
228 		// GstPad* gst_ghost_pad_get_target (GstGhostPad *gpad);
229 		auto p = gst_ghost_pad_get_target(gstGhostPad);
230 		
231 		if(p is null)
232 		{
233 			return null;
234 		}
235 		
236 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p);
237 	}
238 }