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.Meta; 26 27 private import glib.MemorySlice; 28 private import glib.Str; 29 private import gstreamer.c.functions; 30 public import gstreamer.c.types; 31 public import gstreamerc.gstreamertypes; 32 private import gtkd.Loader; 33 34 35 /** 36 * The #GstMeta structure should be included as the first member of a #GstBuffer 37 * metadata structure. The structure defines the API of the metadata and should 38 * be accessible to all elements using the metadata. 39 * 40 * A metadata API is registered with gst_meta_api_type_register() which takes a 41 * name for the metadata API and some tags associated with the metadata. 42 * With gst_meta_api_type_has_tag() one can check if a certain metadata API 43 * contains a given tag. 44 * 45 * Multiple implementations of a metadata API can be registered. 46 * To implement a metadata API, gst_meta_register() should be used. This 47 * function takes all parameters needed to create, free and transform metadata 48 * along with the size of the metadata. The function returns a #GstMetaInfo 49 * structure that contains the information for the implementation of the API. 50 * 51 * A specific implementation can be retrieved by name with gst_meta_get_info(). 52 * 53 * See #GstBuffer for how the metadata can be added, retrieved and removed from 54 * buffers. 55 */ 56 public final class Meta 57 { 58 /** the main Gtk struct */ 59 protected GstMeta* gstMeta; 60 protected bool ownedRef; 61 62 /** Get the main Gtk struct */ 63 public GstMeta* getMetaStruct(bool transferOwnership = false) 64 { 65 if (transferOwnership) 66 ownedRef = false; 67 return gstMeta; 68 } 69 70 /** the main Gtk struct as a void* */ 71 protected void* getStruct() 72 { 73 return cast(void*)gstMeta; 74 } 75 76 /** 77 * Sets our main struct and passes it to the parent class. 78 */ 79 public this (GstMeta* gstMeta, bool ownedRef = false) 80 { 81 this.gstMeta = gstMeta; 82 this.ownedRef = ownedRef; 83 } 84 85 ~this () 86 { 87 if ( Linker.isLoaded(LIBRARY_GSTREAMER) && ownedRef ) 88 sliceFree(gstMeta); 89 } 90 91 92 /** 93 * extra flags for the metadata 94 */ 95 public @property GstMetaFlags flags() 96 { 97 return gstMeta.flags; 98 } 99 100 /** Ditto */ 101 public @property void flags(GstMetaFlags value) 102 { 103 gstMeta.flags = value; 104 } 105 106 /** 107 * pointer to the #GstMetaInfo 108 */ 109 public @property GstMetaInfo* info() 110 { 111 return gstMeta.info; 112 } 113 114 /** Ditto */ 115 public @property void info(GstMetaInfo* value) 116 { 117 gstMeta.info = value; 118 } 119 120 /** 121 * Meta sequence number compare function. Can be used as #GCompareFunc 122 * or a #GCompareDataFunc. 123 * 124 * Params: 125 * meta2 = a #GstMeta 126 * 127 * Returns: a negative number if @meta1 comes before @meta2, 0 if both metas 128 * have an equal sequence number, or a positive integer if @meta1 comes 129 * after @meta2. 130 * 131 * Since: 1.16 132 */ 133 public int compareSeqnum(Meta meta2) 134 { 135 return gst_meta_compare_seqnum(gstMeta, (meta2 is null) ? null : meta2.getMetaStruct()); 136 } 137 138 /** 139 * Gets seqnum for this meta. 140 * 141 * Since: 1.16 142 */ 143 public ulong getSeqnum() 144 { 145 return gst_meta_get_seqnum(gstMeta); 146 } 147 148 /** 149 * 150 * Params: 151 * api = an API 152 * Returns: an array of tags as strings. 153 * 154 * Since: 1.2 155 */ 156 public static string[] apiTypeGetTags(GType api) 157 { 158 return Str.toStringArray(gst_meta_api_type_get_tags(api)); 159 } 160 161 /** 162 * Check if @api was registered with @tag. 163 * 164 * Params: 165 * api = an API 166 * tag = the tag to check 167 * 168 * Returns: %TRUE if @api was registered with @tag. 169 */ 170 public static bool apiTypeHasTag(GType api, GQuark tag) 171 { 172 return gst_meta_api_type_has_tag(api, tag) != 0; 173 } 174 175 /** 176 * Register and return a GType for the @api and associate it with 177 * @tags. 178 * 179 * Params: 180 * api = an API to register 181 * tags = tags for @api 182 * 183 * Returns: a unique GType for @api. 184 */ 185 public static GType apiTypeRegister(string api, string[] tags) 186 { 187 return gst_meta_api_type_register(Str.toStringz(api), Str.toStringzArray(tags)); 188 } 189 190 /** 191 * Lookup a previously registered meta info structure by its implementation name 192 * @impl. 193 * 194 * Params: 195 * impl = the name 196 * 197 * Returns: a #GstMetaInfo with @impl, or 198 * %NULL when no such metainfo exists. 199 */ 200 public static GstMetaInfo* getInfo(string impl) 201 { 202 return gst_meta_get_info(Str.toStringz(impl)); 203 } 204 205 /** 206 * Register a new #GstMeta implementation. 207 * 208 * The same @info can be retrieved later with gst_meta_get_info() by using 209 * @impl as the key. 210 * 211 * Params: 212 * api = the type of the #GstMeta API 213 * impl = the name of the #GstMeta implementation 214 * size = the size of the #GstMeta structure 215 * initFunc = a #GstMetaInitFunction 216 * freeFunc = a #GstMetaFreeFunction 217 * transformFunc = a #GstMetaTransformFunction 218 * 219 * Returns: a #GstMetaInfo that can be used to 220 * access metadata. 221 */ 222 public static GstMetaInfo* register(GType api, string impl, size_t size, GstMetaInitFunction initFunc, GstMetaFreeFunction freeFunc, GstMetaTransformFunction transformFunc) 223 { 224 return gst_meta_register(api, Str.toStringz(impl), size, initFunc, freeFunc, transformFunc); 225 } 226 }