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 module gstreamer.GhostPad; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gstreamer.ObjectGst; 31 private import gstreamer.Pad; 32 private import gstreamer.PadTemplate; 33 private import gstreamer.ProxyPad; 34 private import gstreamer.c.functions; 35 public import gstreamer.c.types; 36 37 38 /** 39 * GhostPads are useful when organizing pipelines with #GstBin like elements. 40 * The idea here is to create hierarchical element graphs. The bin element 41 * contains a sub-graph. Now one would like to treat the bin-element like any 42 * other #GstElement. This is where GhostPads come into play. A GhostPad acts as 43 * a proxy for another pad. Thus the bin can have sink and source ghost-pads 44 * that are associated with sink and source pads of the child elements. 45 * 46 * If the target pad is known at creation time, gst_ghost_pad_new() is the 47 * function to use to get a ghost-pad. Otherwise one can use gst_ghost_pad_new_no_target() 48 * to create the ghost-pad and use gst_ghost_pad_set_target() to establish the 49 * association later on. 50 * 51 * Note that GhostPads add overhead to the data processing of a pipeline. 52 */ 53 public class GhostPad : ProxyPad 54 { 55 /** the main Gtk struct */ 56 protected GstGhostPad* gstGhostPad; 57 58 /** Get the main Gtk struct */ 59 public GstGhostPad* getGhostPadStruct(bool transferOwnership = false) 60 { 61 if (transferOwnership) 62 ownedRef = false; 63 return gstGhostPad; 64 } 65 66 /** the main Gtk struct as a void* */ 67 protected override void* getStruct() 68 { 69 return cast(void*)gstGhostPad; 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GstGhostPad* gstGhostPad, bool ownedRef = false) 76 { 77 this.gstGhostPad = gstGhostPad; 78 super(cast(GstProxyPad*)gstGhostPad, ownedRef); 79 } 80 81 82 /** */ 83 public static GType getType() 84 { 85 return gst_ghost_pad_get_type(); 86 } 87 88 /** 89 * Create a new ghostpad with @target as the target. The direction will be taken 90 * from the target pad. @target must be unlinked. 91 * 92 * Will ref the target. 93 * 94 * Params: 95 * name = the name of the new pad, or %NULL to assign a default name 96 * target = the pad to ghost. 97 * 98 * Returns: a new #GstPad, or %NULL in 99 * case of an error. 100 * 101 * Throws: ConstructionException GTK+ fails to create the object. 102 */ 103 public this(string name, Pad target) 104 { 105 auto __p = gst_ghost_pad_new(Str.toStringz(name), (target is null) ? null : target.getPadStruct()); 106 107 if(__p is null) 108 { 109 throw new ConstructionException("null returned by new"); 110 } 111 112 this(cast(GstGhostPad*) __p); 113 } 114 115 /** 116 * Create a new ghostpad with @target as the target. The direction will be taken 117 * from the target pad. The template used on the ghostpad will be @template. 118 * 119 * Will ref the target. 120 * 121 * Params: 122 * name = the name of the new pad, or %NULL to assign a default name. 123 * target = the pad to ghost. 124 * templ = the #GstPadTemplate to use on the ghostpad. 125 * 126 * Returns: a new #GstPad, or %NULL in 127 * case of an error. 128 * 129 * Throws: ConstructionException GTK+ fails to create the object. 130 */ 131 public this(string name, Pad target, PadTemplate templ) 132 { 133 auto __p = gst_ghost_pad_new_from_template(Str.toStringz(name), (target is null) ? null : target.getPadStruct(), (templ is null) ? null : templ.getPadTemplateStruct()); 134 135 if(__p is null) 136 { 137 throw new ConstructionException("null returned by new_from_template"); 138 } 139 140 this(cast(GstGhostPad*) __p); 141 } 142 143 /** 144 * Create a new ghostpad without a target with the given direction. 145 * A target can be set on the ghostpad later with the 146 * gst_ghost_pad_set_target() function. 147 * 148 * The created ghostpad will not have a padtemplate. 149 * 150 * Params: 151 * name = the name of the new pad, or %NULL to assign a default name. 152 * dir = the direction of the ghostpad 153 * 154 * Returns: a new #GstPad, or %NULL in 155 * case of an error. 156 * 157 * Throws: ConstructionException GTK+ fails to create the object. 158 */ 159 public this(string name, GstPadDirection dir) 160 { 161 auto __p = gst_ghost_pad_new_no_target(Str.toStringz(name), dir); 162 163 if(__p is null) 164 { 165 throw new ConstructionException("null returned by new_no_target"); 166 } 167 168 this(cast(GstGhostPad*) __p); 169 } 170 171 /** 172 * Create a new ghostpad based on @templ, without setting a target. The 173 * direction will be taken from the @templ. 174 * 175 * Params: 176 * name = the name of the new pad, or %NULL to assign a default name 177 * templ = the #GstPadTemplate to create the ghostpad from. 178 * 179 * Returns: a new #GstPad, or %NULL in 180 * case of an error. 181 * 182 * Throws: ConstructionException GTK+ fails to create the object. 183 */ 184 public this(string name, PadTemplate templ) 185 { 186 auto __p = gst_ghost_pad_new_no_target_from_template(Str.toStringz(name), (templ is null) ? null : templ.getPadTemplateStruct()); 187 188 if(__p is null) 189 { 190 throw new ConstructionException("null returned by new_no_target_from_template"); 191 } 192 193 this(cast(GstGhostPad*) __p); 194 } 195 196 /** 197 * Invoke the default activate mode function of a ghost pad. 198 * 199 * Params: 200 * pad = the #GstPad to activate or deactivate. 201 * parent = the parent of @pad or %NULL 202 * mode = the requested activation mode 203 * active = whether the pad should be active or not. 204 * 205 * Returns: %TRUE if the operation was successful. 206 */ 207 public static bool activateModeDefault(Pad pad, ObjectGst parent, GstPadMode mode, bool active) 208 { 209 return gst_ghost_pad_activate_mode_default((pad is null) ? null : pad.getPadStruct(), (parent is null) ? null : parent.getObjectGstStruct(), mode, active) != 0; 210 } 211 212 /** 213 * Invoke the default activate mode function of a proxy pad that is 214 * owned by a ghost pad. 215 * 216 * Params: 217 * pad = the #GstPad to activate or deactivate. 218 * parent = the parent of @pad or %NULL 219 * mode = the requested activation mode 220 * active = whether the pad should be active or not. 221 * 222 * Returns: %TRUE if the operation was successful. 223 */ 224 public static bool internalActivateModeDefault(Pad pad, ObjectGst parent, GstPadMode mode, bool active) 225 { 226 return gst_ghost_pad_internal_activate_mode_default((pad is null) ? null : pad.getPadStruct(), (parent is null) ? null : parent.getObjectGstStruct(), mode, active) != 0; 227 } 228 229 /** 230 * Finish initialization of a newly allocated ghost pad. 231 * 232 * This function is most useful in language bindings and when subclassing 233 * #GstGhostPad; plugin and application developers normally will not call this 234 * function. Call this function directly after a call to g_object_new 235 * (GST_TYPE_GHOST_PAD, "direction", @dir, ..., NULL). 236 * 237 * Deprecated: This function is deprecated since 1.18 and does nothing 238 * anymore. 239 * 240 * Returns: %TRUE if the construction succeeds, %FALSE otherwise. 241 */ 242 public bool construct() 243 { 244 return gst_ghost_pad_construct(gstGhostPad) != 0; 245 } 246 247 /** 248 * Get the target pad of @gpad. Unref target pad after usage. 249 * 250 * Returns: the target #GstPad, can be 251 * %NULL if the ghostpad has no target set. Unref target pad after 252 * usage. 253 */ 254 public Pad getTarget() 255 { 256 auto __p = gst_ghost_pad_get_target(gstGhostPad); 257 258 if(__p is null) 259 { 260 return null; 261 } 262 263 return ObjectG.getDObject!(Pad)(cast(GstPad*) __p, true); 264 } 265 266 /** 267 * Set the new target of the ghostpad @gpad. Any existing target 268 * is unlinked and links to the new target are established. if @newtarget is 269 * %NULL the target will be cleared. 270 * 271 * Params: 272 * newtarget = the new pad target 273 * 274 * Returns: %TRUE if the new target could be set. This function 275 * can return %FALSE when the internal pads could not be linked. 276 */ 277 public bool setTarget(Pad newtarget) 278 { 279 return gst_ghost_pad_set_target(gstGhostPad, (newtarget is null) ? null : newtarget.getPadStruct()) != 0; 280 } 281 }