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 gst.base.FlowCombiner; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gst.base.c.functions; 30 public import gst.base.c.types; 31 private import gstreamer.Pad; 32 private import gtkd.Loader; 33 34 35 /** 36 * Utility struct to help handling #GstFlowReturn combination. Useful for 37 * #GstElement<!-- -->s that have multiple source pads and need to combine 38 * the different #GstFlowReturn for those pads. 39 * 40 * #GstFlowCombiner works by using the last #GstFlowReturn for all #GstPad 41 * it has in its list and computes the combined return value and provides 42 * it to the caller. 43 * 44 * To add a new pad to the #GstFlowCombiner use gst_flow_combiner_add_pad(). 45 * The new #GstPad is stored with a default value of %GST_FLOW_OK. 46 * 47 * In case you want a #GstPad to be removed, use gst_flow_combiner_remove_pad(). 48 * 49 * Please be aware that this struct isn't thread safe as its designed to be 50 * used by demuxers, those usually will have a single thread operating it. 51 * 52 * These functions will take refs on the passed #GstPad<!-- -->s. 53 * 54 * Aside from reducing the user's code size, the main advantage of using this 55 * helper struct is to follow the standard rules for #GstFlowReturn combination. 56 * These rules are: 57 * 58 * * %GST_FLOW_EOS: only if all returns are EOS too 59 * * %GST_FLOW_NOT_LINKED: only if all returns are NOT_LINKED too 60 * * %GST_FLOW_ERROR or below: if at least one returns an error return 61 * * %GST_FLOW_NOT_NEGOTIATED: if at least one returns a not-negotiated return 62 * * %GST_FLOW_FLUSHING: if at least one returns flushing 63 * * %GST_FLOW_OK: otherwise 64 * 65 * %GST_FLOW_ERROR or below, GST_FLOW_NOT_NEGOTIATED and GST_FLOW_FLUSHING are 66 * returned immediately from the gst_flow_combiner_update_flow() function. 67 * 68 * Since: 1.4 69 */ 70 public class FlowCombiner 71 { 72 /** the main Gtk struct */ 73 protected GstFlowCombiner* gstFlowCombiner; 74 protected bool ownedRef; 75 76 /** Get the main Gtk struct */ 77 public GstFlowCombiner* getFlowCombinerStruct(bool transferOwnership = false) 78 { 79 if (transferOwnership) 80 ownedRef = false; 81 return gstFlowCombiner; 82 } 83 84 /** the main Gtk struct as a void* */ 85 protected void* getStruct() 86 { 87 return cast(void*)gstFlowCombiner; 88 } 89 90 /** 91 * Sets our main struct and passes it to the parent class. 92 */ 93 public this (GstFlowCombiner* gstFlowCombiner, bool ownedRef = false) 94 { 95 this.gstFlowCombiner = gstFlowCombiner; 96 this.ownedRef = ownedRef; 97 } 98 99 ~this () 100 { 101 if ( Linker.isLoaded(LIBRARY_GSTBASE) && ownedRef ) 102 gst_flow_combiner_unref(gstFlowCombiner); 103 } 104 105 106 /** */ 107 public static GType getType() 108 { 109 return gst_flow_combiner_get_type(); 110 } 111 112 /** 113 * Creates a new #GstFlowCombiner, use gst_flow_combiner_free() to free it. 114 * 115 * Returns: A new #GstFlowCombiner 116 * 117 * Since: 1.4 118 * 119 * Throws: ConstructionException GTK+ fails to create the object. 120 */ 121 public this() 122 { 123 auto __p = gst_flow_combiner_new(); 124 125 if(__p is null) 126 { 127 throw new ConstructionException("null returned by new"); 128 } 129 130 this(cast(GstFlowCombiner*) __p); 131 } 132 133 /** 134 * Adds a new #GstPad to the #GstFlowCombiner. 135 * 136 * Params: 137 * pad = the #GstPad that is being added 138 * 139 * Since: 1.4 140 */ 141 public void addPad(Pad pad) 142 { 143 gst_flow_combiner_add_pad(gstFlowCombiner, (pad is null) ? null : pad.getPadStruct()); 144 } 145 146 /** 147 * Removes all pads from a #GstFlowCombiner and resets it to its initial state. 148 * 149 * Since: 1.6 150 */ 151 public void clear() 152 { 153 gst_flow_combiner_clear(gstFlowCombiner); 154 } 155 156 /** 157 * Frees a #GstFlowCombiner struct and all its internal data. 158 * 159 * Since: 1.4 160 */ 161 public void free() 162 { 163 gst_flow_combiner_free(gstFlowCombiner); 164 ownedRef = false; 165 } 166 167 alias doref = ref_; 168 /** 169 * Increments the reference count on the #GstFlowCombiner. 170 * 171 * Returns: the #GstFlowCombiner. 172 * 173 * Since: 1.12.1 174 */ 175 public FlowCombiner ref_() 176 { 177 auto __p = gst_flow_combiner_ref(gstFlowCombiner); 178 179 if(__p is null) 180 { 181 return null; 182 } 183 184 return ObjectG.getDObject!(FlowCombiner)(cast(GstFlowCombiner*) __p, true); 185 } 186 187 /** 188 * Removes a #GstPad from the #GstFlowCombiner. 189 * 190 * Params: 191 * pad = the #GstPad to remove 192 * 193 * Since: 1.4 194 */ 195 public void removePad(Pad pad) 196 { 197 gst_flow_combiner_remove_pad(gstFlowCombiner, (pad is null) ? null : pad.getPadStruct()); 198 } 199 200 /** 201 * Reset flow combiner and all pads to their initial state without removing pads. 202 * 203 * Since: 1.6 204 */ 205 public void reset() 206 { 207 gst_flow_combiner_reset(gstFlowCombiner); 208 } 209 210 /** 211 * Decrements the reference count on the #GstFlowCombiner. 212 * 213 * Since: 1.12.1 214 */ 215 public void unref() 216 { 217 gst_flow_combiner_unref(gstFlowCombiner); 218 } 219 220 /** 221 * Computes the combined flow return for the pads in it. 222 * 223 * The #GstFlowReturn parameter should be the last flow return update for a pad 224 * in this #GstFlowCombiner. It will use this value to be able to shortcut some 225 * combinations and avoid looking over all pads again. e.g. The last combined 226 * return is the same as the latest obtained #GstFlowReturn. 227 * 228 * Params: 229 * fret = the latest #GstFlowReturn received for a pad in this #GstFlowCombiner 230 * 231 * Returns: The combined #GstFlowReturn 232 * 233 * Since: 1.4 234 */ 235 public GstFlowReturn updateFlow(GstFlowReturn fret) 236 { 237 return gst_flow_combiner_update_flow(gstFlowCombiner, fret); 238 } 239 240 /** 241 * Sets the provided pad's last flow return to provided value and computes 242 * the combined flow return for the pads in it. 243 * 244 * The #GstFlowReturn parameter should be the last flow return update for a pad 245 * in this #GstFlowCombiner. It will use this value to be able to shortcut some 246 * combinations and avoid looking over all pads again. e.g. The last combined 247 * return is the same as the latest obtained #GstFlowReturn. 248 * 249 * Params: 250 * pad = the #GstPad whose #GstFlowReturn to update 251 * fret = the latest #GstFlowReturn received for a pad in this #GstFlowCombiner 252 * 253 * Returns: The combined #GstFlowReturn 254 * 255 * Since: 1.6 256 */ 257 public GstFlowReturn updatePadFlow(Pad pad, GstFlowReturn fret) 258 { 259 return gst_flow_combiner_update_pad_flow(gstFlowCombiner, (pad is null) ? null : pad.getPadStruct(), fret); 260 } 261 }