/usr/include/d/gtkd-3/gstreamer/MiniObject.d is in libgstreamerd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gstreamer.MiniObject;
private import gobject.ObjectG;
private import gstreamer.c.functions;
public import gstreamer.c.types;
public import gstreamerc.gstreamertypes;
private import gtkd.Loader;
/**
* #GstMiniObject is a simple structure that can be used to implement refcounted
* types.
*
* Subclasses will include #GstMiniObject as the first member in their structure
* and then call gst_mini_object_init() to initialize the #GstMiniObject fields.
*
* gst_mini_object_ref() and gst_mini_object_unref() increment and decrement the
* refcount respectively. When the refcount of a mini-object reaches 0, the
* dispose function is called first and when this returns %TRUE, the free
* function of the miniobject is called.
*
* A copy can be made with gst_mini_object_copy().
*
* gst_mini_object_is_writable() will return %TRUE when the refcount of the
* object is exactly 1, meaning the current caller has the only reference to the
* object. gst_mini_object_make_writable() will return a writable version of the
* object, which might be a new copy when the refcount was not 1.
*
* Opaque data can be associated with a #GstMiniObject with
* gst_mini_object_set_qdata() and gst_mini_object_get_qdata(). The data is
* meant to be specific to the particular object and is not automatically copied
* with gst_mini_object_copy() or similar methods.
*
* A weak reference can be added and remove with gst_mini_object_weak_ref()
* and gst_mini_object_weak_unref() respectively.
*/
public class MiniObject
{
/** the main Gtk struct */
protected GstMiniObject* gstMiniObject;
protected bool ownedRef;
/** Get the main Gtk struct */
public GstMiniObject* getMiniObjectStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gstMiniObject;
}
/** the main Gtk struct as a void* */
protected void* getStruct()
{
return cast(void*)gstMiniObject;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GstMiniObject* gstMiniObject, bool ownedRef = false)
{
this.gstMiniObject = gstMiniObject;
this.ownedRef = ownedRef;
}
~this ()
{
if ( Linker.isLoaded(LIBRARY_GSTREAMER) && ownedRef )
gst_mini_object_unref(gstMiniObject);
}
/**
* Creates a copy of the mini-object.
*
* MT safe
*
* Returns: the new mini-object.
*/
public MiniObject copy()
{
auto p = gst_mini_object_copy(gstMiniObject);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p, true);
}
/**
* This function gets back user data pointers stored via
* gst_mini_object_set_qdata().
*
* Params:
* quark = A #GQuark, naming the user data pointer
*
* Returns: The user data pointer set, or
* %NULL
*/
public void* getQdata(GQuark quark)
{
return gst_mini_object_get_qdata(gstMiniObject, quark);
}
/**
* Initializes a mini-object with the desired type and copy/dispose/free
* functions.
*
* Params:
* flags = initial #GstMiniObjectFlags
* type = the #GType of the mini-object to create
* copyFunc = the copy function, or %NULL
* disposeFunc = the dispose function, or %NULL
* freeFunc = the free function or %NULL
*/
public void init(uint flags, GType type, GstMiniObjectCopyFunction copyFunc, GstMiniObjectDisposeFunction disposeFunc, GstMiniObjectFreeFunction freeFunc)
{
gst_mini_object_init(gstMiniObject, flags, type, copyFunc, disposeFunc, freeFunc);
}
/**
* If @mini_object has the LOCKABLE flag set, check if the current EXCLUSIVE
* lock on @object is the only one, this means that changes to the object will
* not be visible to any other object.
*
* If the LOCKABLE flag is not set, check if the refcount of @mini_object is
* exactly 1, meaning that no other reference exists to the object and that the
* object is therefore writable.
*
* Modification of a mini-object should only be done after verifying that it
* is writable.
*
* Returns: %TRUE if the object is writable.
*/
public bool isWritable()
{
return gst_mini_object_is_writable(gstMiniObject) != 0;
}
/**
* Lock the mini-object with the specified access mode in @flags.
*
* Params:
* flags = #GstLockFlags
*
* Returns: %TRUE if @object could be locked.
*/
public bool lock(GstLockFlags flags)
{
return gst_mini_object_lock(gstMiniObject, flags) != 0;
}
/**
* Checks if a mini-object is writable. If not, a writable copy is made and
* returned. This gives away the reference to the original mini object,
* and returns a reference to the new object.
*
* MT safe
*
* Returns: a mini-object (possibly the same pointer) that
* is writable.
*/
public MiniObject makeWritable()
{
auto p = gst_mini_object_make_writable(gstMiniObject);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p, true);
}
/**
* Increase the reference count of the mini-object.
*
* Note that the refcount affects the writability
* of @mini-object, see gst_mini_object_is_writable(). It is
* important to note that keeping additional references to
* GstMiniObject instances can potentially increase the number
* of memcpy operations in a pipeline, especially if the miniobject
* is a #GstBuffer.
*
* Returns: the mini-object.
*/
public MiniObject doref()
{
auto p = gst_mini_object_ref(gstMiniObject);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p, true);
}
/**
* This sets an opaque, named pointer on a miniobject.
* The name is specified through a #GQuark (retrieved e.g. via
* g_quark_from_static_string()), and the pointer
* can be gotten back from the @object with gst_mini_object_get_qdata()
* until the @object is disposed.
* Setting a previously set user data pointer, overrides (frees)
* the old pointer set, using %NULL as pointer essentially
* removes the data stored.
*
* @destroy may be specified which is called with @data as argument
* when the @object is disposed, or the data is being overwritten by
* a call to gst_mini_object_set_qdata() with the same @quark.
*
* Params:
* quark = A #GQuark, naming the user data pointer
* data = An opaque user data pointer
* destroy = Function to invoke with @data as argument, when @data
* needs to be freed
*/
public void setQdata(GQuark quark, void* data, GDestroyNotify destroy)
{
gst_mini_object_set_qdata(gstMiniObject, quark, data, destroy);
}
/**
* This function gets back user data pointers stored via gst_mini_object_set_qdata()
* and removes the data from @object without invoking its destroy() function (if
* any was set).
*
* Params:
* quark = A #GQuark, naming the user data pointer
*
* Returns: The user data pointer set, or
* %NULL
*/
public void* stealQdata(GQuark quark)
{
return gst_mini_object_steal_qdata(gstMiniObject, quark);
}
/**
* Unlock the mini-object with the specified access mode in @flags.
*
* Params:
* flags = #GstLockFlags
*/
public void unlock(GstLockFlags flags)
{
gst_mini_object_unlock(gstMiniObject, flags);
}
/**
* Decreases the reference count of the mini-object, possibly freeing
* the mini-object.
*/
public void unref()
{
gst_mini_object_unref(gstMiniObject);
}
/**
* Adds a weak reference callback to a mini object. Weak references are
* used for notification when a mini object is finalized. They are called
* "weak references" because they allow you to safely hold a pointer
* to the mini object without calling gst_mini_object_ref()
* (gst_mini_object_ref() adds a strong reference, that is, forces the object
* to stay alive).
*
* Params:
* notify = callback to invoke before the mini object is freed
* data = extra data to pass to notify
*/
public void weakRef(GstMiniObjectNotify notify, void* data)
{
gst_mini_object_weak_ref(gstMiniObject, notify, data);
}
/**
* Removes a weak reference callback from a mini object.
*
* Params:
* notify = callback to search for
* data = data to search for
*/
public void weakUnref(GstMiniObjectNotify notify, void* data)
{
gst_mini_object_weak_unref(gstMiniObject, notify, data);
}
/**
* Atomically modifies a pointer to point to a new mini-object.
* The reference count of @olddata is decreased and the reference count of
* @newdata is increased.
*
* Either @newdata and the value pointed to by @olddata may be %NULL.
*
* Params:
* olddata = pointer to a pointer to a
* mini-object to be replaced
* newdata = pointer to new mini-object
*
* Returns: %TRUE if @newdata was different from @olddata
*/
public static bool replace(ref MiniObject olddata, MiniObject newdata)
{
GstMiniObject* outolddata = olddata.getMiniObjectStruct();
auto p = gst_mini_object_replace(&outolddata, (newdata is null) ? null : newdata.getMiniObjectStruct()) != 0;
olddata = ObjectG.getDObject!(MiniObject)(outolddata);
return p;
}
/**
* Replace the current #GstMiniObject pointer to by @olddata with %NULL and
* return the old value.
*
* Params:
* olddata = pointer to a pointer to a mini-object to
* be stolen
*
* Returns: the #GstMiniObject at @oldata
*/
public static MiniObject steal(ref MiniObject olddata)
{
GstMiniObject* outolddata = olddata.getMiniObjectStruct();
auto p = gst_mini_object_steal(&outolddata);
olddata = ObjectG.getDObject!(MiniObject)(outolddata);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(MiniObject)(cast(GstMiniObject*) p);
}
/**
* Modifies a pointer to point to a new mini-object. The modification
* is done atomically. This version is similar to gst_mini_object_replace()
* except that it does not increase the refcount of @newdata and thus
* takes ownership of @newdata.
*
* Either @newdata and the value pointed to by @olddata may be %NULL.
*
* Params:
* olddata = pointer to a pointer to a mini-object to
* be replaced
* newdata = pointer to new mini-object
*
* Returns: %TRUE if @newdata was different from @olddata
*/
public static bool take(ref MiniObject olddata, MiniObject newdata)
{
GstMiniObject* outolddata = olddata.getMiniObjectStruct();
auto p = gst_mini_object_take(&outolddata, (newdata is null) ? null : newdata.getMiniObjectStruct()) != 0;
olddata = ObjectG.getDObject!(MiniObject)(outolddata);
return p;
}
}
|