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