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.ElementClass; 26 27 private import glib.ListG; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gstreamer.PadTemplate; 31 private import gstreamerc.gstreamer; 32 public import gstreamerc.gstreamertypes; 33 34 35 /** 36 * GStreamer element class. Override the vmethods to implement the element 37 * functionality. 38 */ 39 public class ElementClass 40 { 41 /** the main Gtk struct */ 42 protected GstElementClass* gstElementClass; 43 44 /** Get the main Gtk struct */ 45 public GstElementClass* getElementClassStruct() 46 { 47 return gstElementClass; 48 } 49 50 /** the main Gtk struct as a void* */ 51 protected void* getStruct() 52 { 53 return cast(void*)gstElementClass; 54 } 55 56 /** 57 * Sets our main struct and passes it to the parent class. 58 */ 59 public this (GstElementClass* gstElementClass) 60 { 61 this.gstElementClass = gstElementClass; 62 } 63 64 /** 65 */ 66 67 /** 68 * Set @key with @value as metadata in @klass. 69 * 70 * Params: 71 * key = the key to set 72 * value = the value to set 73 */ 74 public void addMetadata(string key, string value) 75 { 76 gst_element_class_add_metadata(gstElementClass, Str.toStringz(key), Str.toStringz(value)); 77 } 78 79 /** 80 * Adds a padtemplate to an element class. This is mainly used in the _class_init 81 * functions of classes. If a pad template with the same name as an already 82 * existing one is added the old one is replaced by the new one. 83 * 84 * Params: 85 * templ = a #GstPadTemplate to add to the element class. 86 */ 87 public void addPadTemplate(PadTemplate templ) 88 { 89 gst_element_class_add_pad_template(gstElementClass, (templ is null) ? null : templ.getPadTemplateStruct()); 90 } 91 92 /** 93 * Set @key with @value as metadata in @klass. 94 * 95 * Same as gst_element_class_add_metadata(), but @value must be a static string 96 * or an inlined string, as it will not be copied. (GStreamer plugins will 97 * be made resident once loaded, so this function can be used even from 98 * dynamically loaded plugins.) 99 * 100 * Params: 101 * key = the key to set 102 * value = the value to set 103 */ 104 public void addStaticMetadata(string key, string value) 105 { 106 gst_element_class_add_static_metadata(gstElementClass, Str.toStringz(key), Str.toStringz(value)); 107 } 108 109 /** 110 * Get metadata with @key in @klass. 111 * 112 * Params: 113 * key = the key to get 114 * 115 * Return: the metadata for @key. 116 */ 117 public string getMetadata(string key) 118 { 119 return Str.toString(gst_element_class_get_metadata(gstElementClass, Str.toStringz(key))); 120 } 121 122 /** 123 * Retrieves a padtemplate from @element_class with the given name. 124 * <note>If you use this function in the #GInstanceInitFunc of an object class 125 * that has subclasses, make sure to pass the g_class parameter of the 126 * #GInstanceInitFunc here.</note> 127 * 128 * Params: 129 * name = the name of the #GstPadTemplate to get. 130 * 131 * Return: the #GstPadTemplate with the 132 * given name, or %NULL if none was found. No unreferencing is 133 * necessary. 134 */ 135 public PadTemplate getPadTemplate(string name) 136 { 137 auto p = gst_element_class_get_pad_template(gstElementClass, Str.toStringz(name)); 138 139 if(p is null) 140 { 141 return null; 142 } 143 144 return ObjectG.getDObject!(PadTemplate)(cast(GstPadTemplate*) p); 145 } 146 147 /** 148 * Retrieves a list of the pad templates associated with @element_class. The 149 * list must not be modified by the calling code. 150 * <note>If you use this function in the #GInstanceInitFunc of an object class 151 * that has subclasses, make sure to pass the g_class parameter of the 152 * #GInstanceInitFunc here.</note> 153 * 154 * Return: the #GList of 155 * pad templates. 156 */ 157 public ListG getPadTemplateList() 158 { 159 auto p = gst_element_class_get_pad_template_list(gstElementClass); 160 161 if(p is null) 162 { 163 return null; 164 } 165 166 return new ListG(cast(GList*) p); 167 } 168 169 /** 170 * Sets the detailed information for a #GstElementClass. 171 * <note>This function is for use in _class_init functions only.</note> 172 * 173 * Params: 174 * longname = The long English name of the element. E.g. "File Sink" 175 * classification = String describing the type of element, as an unordered list 176 * separated with slashes ('/'). See draft-klass.txt of the design docs 177 * for more details and common types. E.g: "Sink/File" 178 * description = Sentence describing the purpose of the element. 179 * E.g: "Write stream to a file" 180 * author = Name and contact details of the author(s). Use \n to separate 181 * multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>" 182 */ 183 public void setMetadata(string longname, string classification, string description, string author) 184 { 185 gst_element_class_set_metadata(gstElementClass, Str.toStringz(longname), Str.toStringz(classification), Str.toStringz(description), Str.toStringz(author)); 186 } 187 188 /** 189 * Sets the detailed information for a #GstElementClass. 190 * <note>This function is for use in _class_init functions only.</note> 191 * 192 * Same as gst_element_class_set_metadata(), but @longname, @classification, 193 * @description, and @author must be static strings or inlined strings, as 194 * they will not be copied. (GStreamer plugins will be made resident once 195 * loaded, so this function can be used even from dynamically loaded plugins.) 196 * 197 * Params: 198 * longname = The long English name of the element. E.g. "File Sink" 199 * classification = String describing the type of element, as an unordered list 200 * separated with slashes ('/'). See draft-klass.txt of the design docs 201 * for more details and common types. E.g: "Sink/File" 202 * description = Sentence describing the purpose of the element. 203 * E.g: "Write stream to a file" 204 * author = Name and contact details of the author(s). Use \n to separate 205 * multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>" 206 */ 207 public void setStaticMetadata(string longname, string classification, string description, string author) 208 { 209 gst_element_class_set_static_metadata(gstElementClass, Str.toStringz(longname), Str.toStringz(classification), Str.toStringz(description), Str.toStringz(author)); 210 } 211 }