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 = gstreamer-GstBufferList.html 27 * outPack = gstreamer 28 * outFile = BufferList 29 * strct = GstBufferList 30 * realStrct= 31 * ctorStrct= 32 * clss = BufferList 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_buffer_list_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gstreamer.Buffer 47 * structWrap: 48 * - GstBuffer* -> Buffer 49 * - GstBufferList* -> BufferList 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gstreamer.BufferList; 56 57 public import gstreamerc.gstreamertypes; 58 59 private import gstreamerc.gstreamer; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 64 private import gstreamer.Buffer; 65 66 67 68 69 /** 70 * Buffer lists are an object containing a list of buffers. 71 * 72 * Buffer lists are created with gst_buffer_list_new() and filled with data 73 * using a gst_buffer_list_insert(). 74 * 75 * Buffer lists can be pushed on a srcpad with gst_pad_push_list(). This is 76 * interesting when multiple buffers need to be pushed in one go because it 77 * can reduce the amount of overhead for pushing each buffer individually. 78 * 79 * Last reviewed on 2012-03-28 (0.11.3) 80 */ 81 public class BufferList 82 { 83 84 /** the main Gtk struct */ 85 protected GstBufferList* gstBufferList; 86 87 88 public GstBufferList* getBufferListStruct() 89 { 90 return gstBufferList; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected void* getStruct() 96 { 97 return cast(void*)gstBufferList; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GstBufferList* gstBufferList) 104 { 105 this.gstBufferList = gstBufferList; 106 } 107 108 /** 109 */ 110 111 /** 112 * Creates a new, empty GstBufferList. The caller is responsible for unreffing 113 * the returned GstBufferList. 114 * Free-function: gst_buffer_list_unref 115 * Throws: ConstructionException GTK+ fails to create the object. 116 */ 117 public this () 118 { 119 // GstBufferList * gst_buffer_list_new (void); 120 auto p = gst_buffer_list_new(); 121 if(p is null) 122 { 123 throw new ConstructionException("null returned by gst_buffer_list_new()"); 124 } 125 this(cast(GstBufferList*) p); 126 } 127 128 /** 129 * Creates a new, empty GstBufferList. The caller is responsible for unreffing 130 * the returned GstBufferList. The list will have size space preallocated so 131 * that memory reallocations can be avoided. 132 * Free-function: gst_buffer_list_unref 133 * Params: 134 * size = an initial reserved size 135 * Throws: ConstructionException GTK+ fails to create the object. 136 */ 137 public this (uint size) 138 { 139 // GstBufferList * gst_buffer_list_new_sized (guint size); 140 auto p = gst_buffer_list_new_sized(size); 141 if(p is null) 142 { 143 throw new ConstructionException("null returned by gst_buffer_list_new_sized(size)"); 144 } 145 this(cast(GstBufferList*) p); 146 } 147 148 /** 149 * Returns the number of buffers in list. 150 * Returns: the number of buffers in the buffer list 151 */ 152 public uint length() 153 { 154 // guint gst_buffer_list_length (GstBufferList *list); 155 return gst_buffer_list_length(gstBufferList); 156 } 157 158 /** 159 * Insert buffer at idx in list. Other buffers are moved to make room for 160 * this new buffer. 161 * A -1 value for idx will append the buffer at the end. 162 * Params: 163 * idx = the index 164 * buffer = a GstBuffer. [transfer full] 165 */ 166 public void insert(int idx, Buffer buffer) 167 { 168 // void gst_buffer_list_insert (GstBufferList *list, gint idx, GstBuffer *buffer); 169 gst_buffer_list_insert(gstBufferList, idx, (buffer is null) ? null : buffer.getBufferStruct()); 170 } 171 172 /** 173 * Remove length buffers starting from idx in list. The following buffers are 174 * moved to close the gap. 175 * Params: 176 * idx = the index 177 * length = the amount to remove 178 */ 179 public void remove(uint idx, uint length) 180 { 181 // void gst_buffer_list_remove (GstBufferList *list, guint idx, guint length); 182 gst_buffer_list_remove(gstBufferList, idx, length); 183 } 184 185 /** 186 * Increases the refcount of the given buffer list by one. 187 * Note that the refcount affects the writeability of list and its data, see 188 * gst_buffer_list_make_writable(). It is important to note that keeping 189 * additional references to GstBufferList instances can potentially increase 190 * the number of memcpy operations in a pipeline. 191 * Returns: list. [transfer full] 192 */ 193 public BufferList doref() 194 { 195 // GstBufferList * gst_buffer_list_ref (GstBufferList *list); 196 auto p = gst_buffer_list_ref(gstBufferList); 197 198 if(p is null) 199 { 200 return null; 201 } 202 203 return ObjectG.getDObject!(BufferList)(cast(GstBufferList*) p); 204 } 205 206 /** 207 * Decreases the refcount of the buffer list. If the refcount reaches 0, the 208 * buffer list will be freed. 209 */ 210 public void unref() 211 { 212 // void gst_buffer_list_unref (GstBufferList *list); 213 gst_buffer_list_unref(gstBufferList); 214 } 215 216 /** 217 * Create a shallow copy of the given buffer list. This will make a newly 218 * allocated copy of the source list with copies of buffer pointers. The 219 * refcount of buffers pointed to will be increased by one. 220 * Returns: a new copy of list. [transfer full] 221 */ 222 public BufferList copy() 223 { 224 // GstBufferList * gst_buffer_list_copy (const GstBufferList *list); 225 auto p = gst_buffer_list_copy(gstBufferList); 226 227 if(p is null) 228 { 229 return null; 230 } 231 232 return ObjectG.getDObject!(BufferList)(cast(GstBufferList*) p); 233 } 234 235 /** 236 * Call func with data for each buffer in list. 237 * func can modify the passed buffer pointer or its contents. The return value 238 * of func define if this function returns or if the remaining buffers in 239 * the list should be skipped. 240 * Params: 241 * func = a GstBufferListFunc to call. [scope call] 242 * userData = user data passed to func. [closure] 243 * Returns: TRUE when func returned TRUE for each buffer in list or when list is empty. 244 */ 245 public int foreac(GstBufferListFunc func, void* userData) 246 { 247 // gboolean gst_buffer_list_foreach (GstBufferList *list, GstBufferListFunc func, gpointer user_data); 248 return gst_buffer_list_foreach(gstBufferList, func, userData); 249 } 250 251 /** 252 * Get the buffer at idx. 253 * Params: 254 * idx = the index 255 * Returns: the buffer at idx in group or NULL when there is no buffer. The buffer remains valid as long as list is valid. [transfer none] 256 */ 257 public Buffer get(uint idx) 258 { 259 // GstBuffer * gst_buffer_list_get (GstBufferList *list, guint idx); 260 auto p = gst_buffer_list_get(gstBufferList, idx); 261 262 if(p is null) 263 { 264 return null; 265 } 266 267 return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p); 268 } 269 }