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