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 private import glib.Str; 69 private import gstreamer.ObjectGst; 70 private import gstreamer.Pad; 71 private import gstreamer.PadTemplate; 72 73 74 private import gstreamer.ProxyPad; 75 76 /** 77 * GhostPads are useful when organizing pipelines with GstBin like elements. 78 * The idea here is to create hierarchical element graphs. The bin element 79 * contains a sub-graph. Now one would like to treat the bin-element like any 80 * other GstElement. This is where GhostPads come into play. A GhostPad acts as 81 * a proxy for another pad. Thus the bin can have sink and source ghost-pads 82 * that are associated with sink and source pads of the child elements. 83 * 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 * 89 * Note that GhostPads add overhead to the data processing of a pipeline. 90 * 91 * Last reviewed on 2005-11-18 (0.9.5) 92 */ 93 public class GhostPad : ProxyPad 94 { 95 96 /** the main Gtk struct */ 97 protected GstGhostPad* gstGhostPad; 98 99 100 /** Get the main Gtk struct */ 101 public GstGhostPad* getGhostPadStruct() 102 { 103 return gstGhostPad; 104 } 105 106 107 /** the main Gtk struct as a void* */ 108 protected override void* getStruct() 109 { 110 return cast(void*)gstGhostPad; 111 } 112 113 /** 114 * Sets our main struct and passes it to the parent class 115 */ 116 public this (GstGhostPad* gstGhostPad) 117 { 118 super(cast(GstProxyPad*)gstGhostPad); 119 this.gstGhostPad = gstGhostPad; 120 } 121 122 protected override void setStruct(GObject* obj) 123 { 124 super.setStruct(obj); 125 gstGhostPad = cast(GstGhostPad*)obj; 126 } 127 128 /** 129 */ 130 131 /** 132 * Create a new ghostpad with target as the target. The direction will be taken 133 * from the target pad. target must be unlinked. 134 * Will ref the target. 135 * Params: 136 * name = the name of the new pad, or NULL to assign a default name. [allow-none] 137 * target = the pad to ghost. [transfer none] 138 * Throws: ConstructionException GTK+ fails to create the object. 139 */ 140 public this (string name, Pad target) 141 { 142 // GstPad * gst_ghost_pad_new (const gchar *name, GstPad *target); 143 auto p = gst_ghost_pad_new(Str.toStringz(name), (target is null) ? null : target.getPadStruct()); 144 if(p is null) 145 { 146 throw new ConstructionException("null returned by gst_ghost_pad_new(Str.toStringz(name), (target is null) ? null : target.getPadStruct())"); 147 } 148 this(cast(GstGhostPad*) p); 149 } 150 151 /** 152 * Create a new ghostpad without a target with the given direction. 153 * A target can be set on the ghostpad later with the 154 * gst_ghost_pad_set_target() function. 155 * The created ghostpad will not have a padtemplate. 156 * Params: 157 * name = the name of the new pad, or NULL to assign a default name. [allow-none] 158 * dir = the direction of the ghostpad 159 * Throws: ConstructionException GTK+ fails to create the object. 160 */ 161 public this (string name, GstPadDirection dir) 162 { 163 // GstPad * gst_ghost_pad_new_no_target (const gchar *name, GstPadDirection dir); 164 auto p = gst_ghost_pad_new_no_target(Str.toStringz(name), dir); 165 if(p is null) 166 { 167 throw new ConstructionException("null returned by gst_ghost_pad_new_no_target(Str.toStringz(name), dir)"); 168 } 169 this(cast(GstGhostPad*) p); 170 } 171 172 /** 173 * Create a new ghostpad with target as the target. The direction will be taken 174 * from the target pad. The template used on the ghostpad will be template. 175 * Will ref the target. 176 * Params: 177 * name = the name of the new pad, or NULL to assign a default name. [allow-none] 178 * target = the pad to ghost. [transfer none] 179 * templ = the GstPadTemplate to use on the ghostpad. [transfer none] 180 * Throws: ConstructionException GTK+ fails to create the object. 181 */ 182 public this (string name, Pad target, PadTemplate templ) 183 { 184 // GstPad * gst_ghost_pad_new_from_template (const gchar *name, GstPad *target, GstPadTemplate *templ); 185 auto p = gst_ghost_pad_new_from_template(Str.toStringz(name), (target is null) ? null : target.getPadStruct(), (templ is null) ? null : templ.getPadTemplateStruct()); 186 if(p is null) 187 { 188 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())"); 189 } 190 this(cast(GstGhostPad*) p); 191 } 192 193 /** 194 * Create a new ghostpad based on templ, without setting a target. The 195 * direction will be taken from the templ. 196 * Params: 197 * name = the name of the new pad, or NULL to assign a default name. [allow-none] 198 * templ = the GstPadTemplate to create the ghostpad from. [transfer none] 199 * Throws: ConstructionException GTK+ fails to create the object. 200 */ 201 public this (string name, PadTemplate templ) 202 { 203 // GstPad * gst_ghost_pad_new_no_target_from_template (const gchar *name, GstPadTemplate *templ); 204 auto p = gst_ghost_pad_new_no_target_from_template(Str.toStringz(name), (templ is null) ? null : templ.getPadTemplateStruct()); 205 if(p is null) 206 { 207 throw new ConstructionException("null returned by gst_ghost_pad_new_no_target_from_template(Str.toStringz(name), (templ is null) ? null : templ.getPadTemplateStruct())"); 208 } 209 this(cast(GstGhostPad*) p); 210 } 211 212 /** 213 * Set the new target of the ghostpad gpad. Any existing target 214 * is unlinked and links to the new target are established. if newtarget is 215 * NULL the target will be cleared. 216 * Params: 217 * newtarget = the new pad target. [transfer none][allow-none] 218 * Returns: TRUE if the new target could be set. This function can return FALSE when the internal pads could not be linked. [transfer full] 219 */ 220 public int setTarget(Pad newtarget) 221 { 222 // gboolean gst_ghost_pad_set_target (GstGhostPad *gpad, GstPad *newtarget); 223 return gst_ghost_pad_set_target(gstGhostPad, (newtarget is null) ? null : newtarget.getPadStruct()); 224 } 225 226 /** 227 * Get the target pad of gpad. Unref target pad after usage. 228 * Returns: the target GstPad, can be NULL if the ghostpad has no target set. Unref target pad after usage. [transfer full] 229 */ 230 public Pad getTarget() 231 { 232 // GstPad * gst_ghost_pad_get_target (GstGhostPad *gpad); 233 auto p = gst_ghost_pad_get_target(gstGhostPad); 234 235 if(p is null) 236 { 237 return null; 238 } 239 240 return ObjectG.getDObject!(Pad)(cast(GstPad*) p); 241 } 242 243 /** 244 * Finish initialization of a newly allocated ghost pad. 245 * This function is most useful in language bindings and when subclassing 246 * GstGhostPad; plugin and application developers normally will not call this 247 * function. Call this function directly after a call to g_object_new 248 * (GST_TYPE_GHOST_PAD, "direction", dir, ..., NULL). 249 * Returns: TRUE if the construction succeeds, FALSE otherwise. 250 */ 251 public int construct() 252 { 253 // gboolean gst_ghost_pad_construct (GstGhostPad *gpad); 254 return gst_ghost_pad_construct(gstGhostPad); 255 } 256 257 /** 258 * Invoke the default activate mode function of a ghost pad. 259 * Params: 260 * pad = the GstPad to activate or deactivate. 261 * parent = the parent of pad or NULL. [allow-none] 262 * mode = the requested activation mode 263 * active = whether the pad should be active or not. 264 * Returns: TRUE if the operation was successful. 265 */ 266 public static int activateModeDefault(Pad pad, ObjectGst parent, GstPadMode mode, int active) 267 { 268 // gboolean gst_ghost_pad_activate_mode_default (GstPad *pad, GstObject *parent, GstPadMode mode, gboolean active); 269 return gst_ghost_pad_activate_mode_default((pad is null) ? null : pad.getPadStruct(), (parent is null) ? null : parent.getObjectGstStruct(), mode, active); 270 } 271 272 /** 273 * Invoke the default activate mode function of a proxy pad that is 274 * owned by a ghost pad. 275 * Params: 276 * pad = the GstPad to activate or deactivate. 277 * parent = the parent of pad or NULL. [allow-none] 278 * mode = the requested activation mode 279 * active = whether the pad should be active or not. 280 * Returns: TRUE if the operation was successful. 281 */ 282 public static int internalActivateModeDefault(Pad pad, ObjectGst parent, GstPadMode mode, int active) 283 { 284 // gboolean gst_ghost_pad_internal_activate_mode_default (GstPad *pad, GstObject *parent, GstPadMode mode, gboolean active); 285 return gst_ghost_pad_internal_activate_mode_default((pad is null) ? null : pad.getPadStruct(), (parent is null) ? null : parent.getObjectGstStruct(), mode, active); 286 } 287 }