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 = GstIndex.html 27 * outPack = gstreamer 28 * outFile = Index 29 * strct = GstIndex 30 * realStrct= 31 * ctorStrct= 32 * clss = Index 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_index_ 41 * - gst_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gstreamer.ObjectGst 49 * structWrap: 50 * - GstIndex* -> Index 51 * - GstObject* -> ObjectGst 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gstreamer.Index; 58 59 public import gstreamerc.gstreamertypes; 60 61 private import gstreamerc.gstreamer; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 private import gobject.Signals; 66 public import gtkc.gdktypes; 67 68 private import glib.Str; 69 private import gstreamer.ObjectGst; 70 71 72 73 private import gstreamer.ObjectGst; 74 75 /** 76 * Description 77 * GstIndex is used to generate a stream index of one or more elements 78 * in a pipeline. 79 */ 80 public class Index : ObjectGst 81 { 82 83 /** the main Gtk struct */ 84 protected GstIndex* gstIndex; 85 86 87 public GstIndex* getIndexStruct() 88 { 89 return gstIndex; 90 } 91 92 93 /** the main Gtk struct as a void* */ 94 protected override void* getStruct() 95 { 96 return cast(void*)gstIndex; 97 } 98 99 /** 100 * Sets our main struct and passes it to the parent class 101 */ 102 public this (GstIndex* gstIndex) 103 { 104 super(cast(GstObject*)gstIndex); 105 this.gstIndex = gstIndex; 106 } 107 108 protected override void setStruct(GObject* obj) 109 { 110 super.setStruct(obj); 111 gstIndex = cast(GstIndex*)obj; 112 } 113 114 /** 115 */ 116 int[string] connectedSignals; 117 118 void delegate(GstIndexEntry*, Index)[] onEntryAddedListeners; 119 /** 120 * Is emitted when a new entry is added to the index. 121 * See Also 122 * GstIndexFactory 123 */ 124 void addOnEntryAdded(void delegate(GstIndexEntry*, Index) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 125 { 126 if ( !("entry-added" in connectedSignals) ) 127 { 128 Signals.connectData( 129 getStruct(), 130 "entry-added", 131 cast(GCallback)&callBackEntryAdded, 132 cast(void*)this, 133 null, 134 connectFlags); 135 connectedSignals["entry-added"] = 1; 136 } 137 onEntryAddedListeners ~= dlg; 138 } 139 extern(C) static void callBackEntryAdded(GstIndex* gstindexStruct, GstIndexEntry* arg1, Index _index) 140 { 141 foreach ( void delegate(GstIndexEntry*, Index) dlg ; _index.onEntryAddedListeners ) 142 { 143 dlg(arg1, _index); 144 } 145 } 146 147 148 /** 149 * Create a new tileindex object 150 * Throws: ConstructionException GTK+ fails to create the object. 151 */ 152 public this () 153 { 154 // GstIndex* gst_index_new (void); 155 auto p = gst_index_new(); 156 if(p is null) 157 { 158 throw new ConstructionException("null returned by gst_index_new()"); 159 } 160 this(cast(GstIndex*) p); 161 } 162 163 /** 164 * Tell the index that the writer with the given id is done 165 * with this index and is not going to write any more entries 166 * to it. 167 * Params: 168 * id = the writer that commited the index 169 */ 170 public void commit(int id) 171 { 172 // void gst_index_commit (GstIndex *index, gint id); 173 gst_index_commit(gstIndex, id); 174 } 175 176 /** 177 * Get the id of the current group. 178 * Returns: the id of the current group. 179 */ 180 public int getGroup() 181 { 182 // gint gst_index_get_group (GstIndex *index); 183 return gst_index_get_group(gstIndex); 184 } 185 186 /** 187 * Create a new group for the given index. It will be 188 * set as the current group. 189 * Returns: the id of the newly created group. 190 */ 191 public int newGroup() 192 { 193 // gint gst_index_new_group (GstIndex *index); 194 return gst_index_new_group(gstIndex); 195 } 196 197 /** 198 * Set the current groupnumber to the given argument. 199 * Params: 200 * groupnum = the groupnumber to set 201 * Returns: TRUE if the operation succeeded, FALSE if the group did not exist. 202 */ 203 public int setGroup(int groupnum) 204 { 205 // gboolean gst_index_set_group (GstIndex *index, gint groupnum); 206 return gst_index_set_group(gstIndex, groupnum); 207 } 208 209 /** 210 * Set the certainty of the given index. 211 * Params: 212 * certainty = the certainty to set 213 */ 214 public void setCertainty(GstIndexCertainty certainty) 215 { 216 // void gst_index_set_certainty (GstIndex *index, GstIndexCertainty certainty); 217 gst_index_set_certainty(gstIndex, certainty); 218 } 219 220 /** 221 * Get the certainty of the given index. 222 * Returns: the certainty of the index. 223 */ 224 public GstIndexCertainty getCertainty() 225 { 226 // GstIndexCertainty gst_index_get_certainty (GstIndex *index); 227 return gst_index_get_certainty(gstIndex); 228 } 229 230 /** 231 * Lets the app register a custom filter function so that 232 * it can select what entries should be stored in the index. 233 * Params: 234 * filter = the filter to register 235 * userData = data passed to the filter function 236 */ 237 public void setFilter(GstIndexFilter filter, void* userData) 238 { 239 // void gst_index_set_filter (GstIndex *index, GstIndexFilter filter, gpointer user_data); 240 gst_index_set_filter(gstIndex, filter, userData); 241 } 242 243 /** 244 * Lets the app register a custom filter function so that 245 * it can select what entries should be stored in the index. 246 * Params: 247 * filter = the filter to register 248 * userData = data passed to the filter function 249 * userDataDestroy = function to call when user_data is unset 250 */ 251 public void setFilterFull(GstIndexFilter filter, void* userData, GDestroyNotify userDataDestroy) 252 { 253 // void gst_index_set_filter_full (GstIndex *index, GstIndexFilter filter, gpointer user_data, GDestroyNotify user_data_destroy); 254 gst_index_set_filter_full(gstIndex, filter, userData, userDataDestroy); 255 } 256 257 /** 258 * Lets the app register a custom function to map index 259 * ids to writer descriptions. 260 * Params: 261 * resolver = the resolver to register 262 * userData = data passed to the resolver function 263 */ 264 public void setResolver(GstIndexResolver resolver, void* userData) 265 { 266 // void gst_index_set_resolver (GstIndex *index, GstIndexResolver resolver, gpointer user_data); 267 gst_index_set_resolver(gstIndex, resolver, userData); 268 } 269 270 /** 271 * Before entries can be added to the index, a writer 272 * should obtain a unique id. The methods to add new entries 273 * to the index require this id as an argument. 274 * The application can implement a custom function to map the writer object 275 * to a string. That string will be used to register or look up an id 276 * in the index. 277 * Params: 278 * writer = the GstObject to allocate an id for 279 * id = a pointer to a gint to hold the id 280 * Returns: TRUE if the writer would be mapped to an id. 281 */ 282 public int getWriterId(ObjectGst writer, ref int id) 283 { 284 // gboolean gst_index_get_writer_id (GstIndex *index, GstObject *writer, gint *id); 285 return gst_index_get_writer_id(gstIndex, (writer is null) ? null : writer.getObjectGstStruct(), &id); 286 } 287 288 /** 289 * Adds a format entry into the index. This function is 290 * used to map dynamic GstFormat ids to their original 291 * format key. 292 * Params: 293 * id = the id of the index writer 294 * format = the format to add to the index 295 * Returns: a pointer to the newly added entry in the index. 296 */ 297 public GstIndexEntry* addFormat(int id, GstFormat format) 298 { 299 // GstIndexEntry* gst_index_add_format (GstIndex *index, gint id, GstFormat format); 300 return gst_index_add_format(gstIndex, id, format); 301 } 302 303 /** 304 * Associate given format/value pairs with each other. 305 * Params: 306 * id = the id of the index writer 307 * flags = optinal flags for this entry 308 * n = number of associations 309 * list = list of associations 310 * Returns: a pointer to the newly added entry in the index. 311 */ 312 public GstIndexEntry* addAssociationv(int id, GstAssocFlags flags, int n, GstIndexAssociation* list) 313 { 314 // GstIndexEntry* gst_index_add_associationv (GstIndex *index, gint id, GstAssocFlags flags, gint n, const GstIndexAssociation *list); 315 return gst_index_add_associationv(gstIndex, id, flags, n, list); 316 } 317 318 /** 319 * Add the given object to the index with the given key. 320 * This function is not yet implemented. 321 * Params: 322 * id = the id of the index writer 323 * key = a key for the object 324 * type = the GType of the object 325 * object = a pointer to the object to add 326 * Returns: a pointer to the newly added entry in the index. 327 */ 328 public GstIndexEntry* addObject(int id, string key, GType type, void* object) 329 { 330 // GstIndexEntry* gst_index_add_object (GstIndex *index, gint id, gchar *key, GType type, gpointer object); 331 return gst_index_add_object(gstIndex, id, Str.toStringz(key), type, object); 332 } 333 334 /** 335 * Add an id entry into the index. 336 * Params: 337 * id = the id of the index writer 338 * description = the description of the index writer 339 * Returns: a pointer to the newly added entry in the index. 340 */ 341 public GstIndexEntry* addId(int id, string description) 342 { 343 // GstIndexEntry* gst_index_add_id (GstIndex *index, gint id, gchar *description); 344 return gst_index_add_id(gstIndex, id, Str.toStringz(description)); 345 } 346 347 /** 348 * Finds the given format/value in the index 349 * Params: 350 * id = the id of the index writer 351 * method = The lookup method to use 352 * flags = Flags for the entry 353 * format = the format of the value 354 * value = the value to find 355 * Returns: the entry associated with the value or NULL if the value was not found. 356 */ 357 public GstIndexEntry* getAssocEntry(int id, GstIndexLookupMethod method, GstAssocFlags flags, GstFormat format, long value) 358 { 359 // GstIndexEntry* gst_index_get_assoc_entry (GstIndex *index, gint id, GstIndexLookupMethod method, GstAssocFlags flags, GstFormat format, gint64 value); 360 return gst_index_get_assoc_entry(gstIndex, id, method, flags, format, value); 361 } 362 363 /** 364 * Finds the given format/value in the index with the given 365 * compare function and user_data. 366 * Params: 367 * id = the id of the index writer 368 * method = The lookup method to use 369 * flags = Flags for the entry 370 * format = the format of the value 371 * value = the value to find 372 * func = the function used to compare entries 373 * userData = user data passed to the compare function 374 * Returns: the entry associated with the value or NULL if the value was not found. 375 */ 376 public GstIndexEntry* getAssocEntryFull(int id, GstIndexLookupMethod method, GstAssocFlags flags, GstFormat format, long value, GCompareDataFunc func, void* userData) 377 { 378 // GstIndexEntry* gst_index_get_assoc_entry_full (GstIndex *index, gint id, GstIndexLookupMethod method, GstAssocFlags flags, GstFormat format, gint64 value, GCompareDataFunc func, gpointer user_data); 379 return gst_index_get_assoc_entry_full(gstIndex, id, method, flags, format, value, func, userData); 380 } 381 382 /** 383 * Copies an entry and returns the result. 384 * Params: 385 * entry = the entry to copy 386 * Returns: a newly allocated GstIndexEntry. 387 */ 388 public static GstIndexEntry* entryCopy(GstIndexEntry* entry) 389 { 390 // GstIndexEntry* gst_index_entry_copy (GstIndexEntry *entry); 391 return gst_index_entry_copy(entry); 392 } 393 394 /** 395 * Free the memory used by the given entry. 396 * Params: 397 * entry = the entry to free 398 */ 399 public static void entryFree(GstIndexEntry* entry) 400 { 401 // void gst_index_entry_free (GstIndexEntry *entry); 402 gst_index_entry_free(entry); 403 } 404 405 /** 406 * Gets alternative formats associated with the indexentry. 407 * Params: 408 * entry = the index to search 409 * format = the format of the value the find 410 * value = a pointer to store the value 411 * Returns: TRUE if there was a value associated with the given format. 412 */ 413 public static int entryAssocMap(GstIndexEntry* entry, GstFormat format, out long value) 414 { 415 // gboolean gst_index_entry_assoc_map (GstIndexEntry *entry, GstFormat format, gint64 *value); 416 return gst_index_entry_assoc_map(entry, format, &value); 417 } 418 }