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  = gstreamer-GstMiniObject.html
27  * outPack = gstreamer
28  * outFile = MiniObject
29  * strct   = GstMiniObject
30  * realStrct=
31  * ctorStrct=
32  * clss    = MiniObject
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_mini_object_
41  * omit structs:
42  * 	- GstMiniObject
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gobject.ParamSpec
49  * 	- gobject.Value
50  * structWrap:
51  * 	- GParamSpec* -> ParamSpec
52  * 	- GValue* -> Value
53  * 	- GstMiniObject* -> MiniObject
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gstreamer.MiniObject;
60 
61 public  import gstreamerc.gstreamertypes;
62 
63 private import gstreamerc.gstreamer;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import glib.Str;
69 private import gobject.ParamSpec;
70 private import gobject.Value;
71 
72 
73 
74 
75 /**
76  * Description
77  * GstMiniObject is a baseclass like GObject, but has been stripped down of
78  * features to be fast and small.
79  * It offers sub-classing and ref-counting in the same way as GObject does.
80  * It has no properties and no signal-support though.
81  * Last reviewed on 2005-11-23 (0.9.5)
82  */
83 public class MiniObject
84 {
85 	
86 	/** the main Gtk struct */
87 	protected GstMiniObject* gstMiniObject;
88 	
89 	
90 	public GstMiniObject* getMiniObjectStruct()
91 	{
92 		return gstMiniObject;
93 	}
94 	
95 	
96 	/** the main Gtk struct as a void* */
97 	protected void* getStruct()
98 	{
99 		return cast(void*)gstMiniObject;
100 	}
101 	
102 	/**
103 	 * Sets our main struct and passes it to the parent class
104 	 */
105 	public this (GstMiniObject* gstMiniObject)
106 	{
107 		this.gstMiniObject = gstMiniObject;
108 	}
109 	
110 	/**
111 	 */
112 	
113 	/**
114 	 * Creates a new mini-object of the desired type.
115 	 * MT safe
116 	 * Params:
117 	 * type = the GType of the mini-object to create
118 	 * Throws: ConstructionException GTK+ fails to create the object.
119 	 */
120 	public this (GType type)
121 	{
122 		// GstMiniObject* gst_mini_object_new (GType type);
123 		auto p = gst_mini_object_new(type);
124 		if(p is null)
125 		{
126 			throw new ConstructionException("null returned by gst_mini_object_new(type)");
127 		}
128 		this(cast(GstMiniObject*) p);
129 	}
130 	
131 	/**
132 	 * Creates a copy of the mini-object.
133 	 * MT safe
134 	 * Returns: the new mini-object.
135 	 */
136 	public MiniObject copy()
137 	{
138 		// GstMiniObject* gst_mini_object_copy (const GstMiniObject *mini_object);
139 		auto p = gst_mini_object_copy(gstMiniObject);
140 		
141 		if(p is null)
142 		{
143 			return null;
144 		}
145 		
146 		return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p);
147 	}
148 	
149 	/**
150 	 * Checks if a mini-object is writable. A mini-object is writable
151 	 * if the reference count is one and the GST_MINI_OBJECT_FLAG_READONLY
152 	 * flag is not set. Modification of a mini-object should only be
153 	 * done after verifying that it is writable.
154 	 * MT safe
155 	 * Returns: TRUE if the object is writable.
156 	 */
157 	public int isWritable()
158 	{
159 		// gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
160 		return gst_mini_object_is_writable(gstMiniObject);
161 	}
162 	
163 	/**
164 	 * Checks if a mini-object is writable. If not, a writeable copy is made and
165 	 * returned. This gives away the reference to the original mini object,
166 	 * and returns a reference to the new object.
167 	 * MT safe
168 	 * Returns: a mini-object (possibly the same pointer) that is writable.
169 	 */
170 	public MiniObject makeWritable()
171 	{
172 		// GstMiniObject* gst_mini_object_make_writable (GstMiniObject *mini_object);
173 		auto p = gst_mini_object_make_writable(gstMiniObject);
174 		
175 		if(p is null)
176 		{
177 			return null;
178 		}
179 		
180 		return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p);
181 	}
182 	
183 	/**
184 	 * Increase the reference count of the mini-object.
185 	 * Note that the refcount affects the writeability
186 	 * of mini-object, see gst_mini_object_is_writable(). It is
187 	 * important to note that keeping additional references to
188 	 * GstMiniObject instances can potentially increase the number
189 	 * of memcpy operations in a pipeline, especially if the minibject
190 	 * is a GstBuffer.
191 	 * Returns: the mini-object.
192 	 */
193 	public MiniObject doref()
194 	{
195 		// GstMiniObject* gst_mini_object_ref (GstMiniObject *mini_object);
196 		auto p = gst_mini_object_ref(gstMiniObject);
197 		
198 		if(p is null)
199 		{
200 			return null;
201 		}
202 		
203 		return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p);
204 	}
205 	
206 	/**
207 	 * Decreases the reference count of the mini-object, possibly freeing
208 	 * the mini-object.
209 	 */
210 	public void unref()
211 	{
212 		// void gst_mini_object_unref (GstMiniObject *mini_object);
213 		gst_mini_object_unref(gstMiniObject);
214 	}
215 	
216 	/**
217 	 * Modifies a pointer to point to a new mini-object. The modification
218 	 * is done atomically, and the reference counts are updated correctly.
219 	 * Either newdata and the value pointed to by olddata may be NULL.
220 	 * Params:
221 	 * olddata = pointer to a pointer to a mini-object to be replaced
222 	 * newdata = pointer to new mini-object
223 	 */
224 	public static void replace(ref MiniObject olddata, MiniObject newdata)
225 	{
226 		// void gst_mini_object_replace (GstMiniObject **olddata,  GstMiniObject *newdata);
227 		GstMiniObject* outolddata = (olddata is null) ? null : olddata.getMiniObjectStruct();
228 		
229 		gst_mini_object_replace(&outolddata, (newdata is null) ? null : newdata.getMiniObjectStruct());
230 		
231 		olddata = ObjectG.getDObject!(MiniObject)(outolddata);
232 	}
233 	
234 	/**
235 	 * Creates a new GParamSpec instance that hold GstMiniObject references.
236 	 * Params:
237 	 * name = the canonical name of the property
238 	 * nick = the nickname of the property
239 	 * blurb = a short description of the property
240 	 * objectType = the GstMiniObjectType for the property
241 	 * flags = a combination of GParamFlags
242 	 * Returns: a newly allocated GParamSpec instance
243 	 */
244 	public static ParamSpec gstParamSpecMiniObject(string name, string nick, string blurb, GType objectType, GParamFlags flags)
245 	{
246 		// GParamSpec* gst_param_spec_mini_object (const char *name,  const char *nick,  const char *blurb,  GType object_type,  GParamFlags flags);
247 		auto p = gst_param_spec_mini_object(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), objectType, flags);
248 		
249 		if(p is null)
250 		{
251 			return null;
252 		}
253 		
254 		return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p);
255 	}
256 	
257 	/**
258 	 * Set the contents of a GST_TYPE_MINI_OBJECT derived GValue to
259 	 * mini_object.
260 	 * The caller retains ownership of the reference.
261 	 * Params:
262 	 * value = a valid GValue of GST_TYPE_MINI_OBJECT derived type
263 	 * miniObject = mini object value to set
264 	 */
265 	public static void gstValueSetMiniObject(Value value, MiniObject miniObject)
266 	{
267 		// void gst_value_set_mini_object (GValue *value,  GstMiniObject *mini_object);
268 		gst_value_set_mini_object((value is null) ? null : value.getValueStruct(), (miniObject is null) ? null : miniObject.getMiniObjectStruct());
269 	}
270 	
271 	/**
272 	 * Set the contents of a GST_TYPE_MINI_OBJECT derived GValue to
273 	 * mini_object.
274 	 * Takes over the ownership of the caller's reference to mini_object;
275 	 * the caller doesn't have to unref it any more.
276 	 * Params:
277 	 * value = a valid GValue of GST_TYPE_MINI_OBJECT derived type
278 	 * miniObject = mini object value to take
279 	 */
280 	public static void gstValueTakeMiniObject(Value value, MiniObject miniObject)
281 	{
282 		// void gst_value_take_mini_object (GValue *value,  GstMiniObject *mini_object);
283 		gst_value_take_mini_object((value is null) ? null : value.getValueStruct(), (miniObject is null) ? null : miniObject.getMiniObjectStruct());
284 	}
285 	
286 	/**
287 	 * Get the contents of a GST_TYPE_MINI_OBJECT derived GValue.
288 	 * Does not increase the refcount of the returned object.
289 	 * Params:
290 	 * value = a valid GValue of GST_TYPE_MINI_OBJECT derived type
291 	 * Returns: mini object contents of value
292 	 */
293 	public static MiniObject gstValueGetMiniObject(Value value)
294 	{
295 		// GstMiniObject* gst_value_get_mini_object (const GValue *value);
296 		auto p = gst_value_get_mini_object((value is null) ? null : value.getValueStruct());
297 		
298 		if(p is null)
299 		{
300 			return null;
301 		}
302 		
303 		return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p);
304 	}
305 }