gi-gst-1.0.30: GStreamer bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gst.Structs.MiniObject

Description

MiniObject is a simple structure that can be used to implement refcounted types.

Subclasses will include MiniObject as the first member in their structure and then call gst_mini_object_init() to initialize the MiniObject 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().

miniObjectIsWritable will return True when the refcount of the object is exactly 1 and there is no parent or a single parent exists and is writable itself, 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 MiniObject with miniObjectSetQdata and miniObjectGetQdata. 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.

Synopsis

Exported types

newtype MiniObject Source #

Memory-managed wrapper type.

Constructors

MiniObject (ManagedPtr MiniObject) 

Instances

Instances details
Eq MiniObject Source # 
Instance details

Defined in GI.Gst.Structs.MiniObject

GBoxed MiniObject Source # 
Instance details

Defined in GI.Gst.Structs.MiniObject

ManagedPtrNewtype MiniObject Source # 
Instance details

Defined in GI.Gst.Structs.MiniObject

Methods

toManagedPtr :: MiniObject -> ManagedPtr MiniObject

TypedObject MiniObject Source # 
Instance details

Defined in GI.Gst.Structs.MiniObject

Methods

glibType :: IO GType

HasParentTypes MiniObject Source # 
Instance details

Defined in GI.Gst.Structs.MiniObject

tag ~ 'AttrSet => Constructible MiniObject tag Source # 
Instance details

Defined in GI.Gst.Structs.MiniObject

Methods

new :: MonadIO m => (ManagedPtr MiniObject -> MiniObject) -> [AttrOp MiniObject tag] -> m MiniObject

IsGValue (Maybe MiniObject) Source #

Convert MiniObject to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gst.Structs.MiniObject

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe MiniObject -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe MiniObject)

type ParentTypes MiniObject Source # 
Instance details

Defined in GI.Gst.Structs.MiniObject

type ParentTypes MiniObject = '[] :: [Type]

newZeroMiniObject :: MonadIO m => m MiniObject Source #

Construct a MiniObject struct initialized to zero.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

addParent, isWritable, lock, removeParent, stealQdata, unlock.

Getters

getQdata.

Setters

setQdata.

addParent

miniObjectAddParent Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

object: a MiniObject

-> MiniObject

parent: a parent MiniObject

-> m () 

This adds parent as a parent for object. Having one ore more parents affects the writability of object: if a parent is not writable, object is also not writable, regardless of its refcount. object is only writable if all the parents are writable and its own refcount is exactly 1.

Note: This function does not take ownership of parent and also does not take an additional reference. It is the responsibility of the caller to remove the parent again at a later time.

Since: 1.16

getQdata

miniObjectGetQdata Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

object: The GstMiniObject to get a stored user data pointer from

-> Word32

quark: A GQuark, naming the user data pointer

-> m (Ptr ())

Returns: The user data pointer set, or Nothing

This function gets back user data pointers stored via miniObjectSetQdata.

isWritable

miniObjectIsWritable Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

miniObject: the mini-object to check

-> m Bool

Returns: True if the object is writable.

If miniObject 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 miniObject 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.

lock

miniObjectLock Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

object: the mini-object to lock

-> [LockFlags]

flags: LockFlags

-> m Bool

Returns: True if object could be locked.

Lock the mini-object with the specified access mode in flags.

removeParent

miniObjectRemoveParent Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

object: a MiniObject

-> MiniObject

parent: a parent MiniObject

-> m () 

This removes parent as a parent for object. See miniObjectAddParent.

Since: 1.16

setQdata

miniObjectSetQdata Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

object: a MiniObject

-> Word32

quark: A GQuark, naming the user data pointer

-> Ptr ()

data: An opaque user data pointer

-> DestroyNotify

destroy: Function to invoke with data as argument, when data needs to be freed

-> m () 

This sets an opaque, named pointer on a miniobject. The name is specified through a GQuark (retrieved e.g. via quarkFromStaticString), and the pointer can be gotten back from the object with miniObjectGetQdata until the object is disposed. Setting a previously set user data pointer, overrides (frees) the old pointer set, using Nothing 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 miniObjectSetQdata with the same quark.

stealQdata

miniObjectStealQdata Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

object: The GstMiniObject to get a stored user data pointer from

-> Word32

quark: A GQuark, naming the user data pointer

-> m (Ptr ())

Returns: The user data pointer set, or Nothing

This function gets back user data pointers stored via miniObjectSetQdata and removes the data from object without invoking its destroy() function (if any was set).

unlock

miniObjectUnlock Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> MiniObject

object: the mini-object to unlock

-> [LockFlags]

flags: LockFlags

-> m () 

Unlock the mini-object with the specified access mode in flags.

Properties

copy

a copy function

clearMiniObjectCopy :: MonadIO m => MiniObject -> m () Source #

Set the value of the “copy” field to Nothing. When overloading is enabled, this is equivalent to

clear #copy

getMiniObjectCopy :: MonadIO m => MiniObject -> m (Maybe MiniObjectCopyFunction) Source #

Get the value of the “copy” field. When overloading is enabled, this is equivalent to

get miniObject #copy

setMiniObjectCopy :: MonadIO m => MiniObject -> FunPtr C_MiniObjectCopyFunction -> m () Source #

Set the value of the “copy” field. When overloading is enabled, this is equivalent to

set miniObject [ #copy := value ]

dispose

a dispose function

clearMiniObjectDispose :: MonadIO m => MiniObject -> m () Source #

Set the value of the “dispose” field to Nothing. When overloading is enabled, this is equivalent to

clear #dispose

getMiniObjectDispose :: MonadIO m => MiniObject -> m (Maybe MiniObjectDisposeFunction) Source #

Get the value of the “dispose” field. When overloading is enabled, this is equivalent to

get miniObject #dispose

setMiniObjectDispose :: MonadIO m => MiniObject -> FunPtr C_MiniObjectDisposeFunction -> m () Source #

Set the value of the “dispose” field. When overloading is enabled, this is equivalent to

set miniObject [ #dispose := value ]

flags

extra flags.

getMiniObjectFlags :: MonadIO m => MiniObject -> m Word32 Source #

Get the value of the “flags” field. When overloading is enabled, this is equivalent to

get miniObject #flags

setMiniObjectFlags :: MonadIO m => MiniObject -> Word32 -> m () Source #

Set the value of the “flags” field. When overloading is enabled, this is equivalent to

set miniObject [ #flags := value ]

free

the free function

clearMiniObjectFree :: MonadIO m => MiniObject -> m () Source #

Set the value of the “free” field to Nothing. When overloading is enabled, this is equivalent to

clear #free

getMiniObjectFree :: MonadIO m => MiniObject -> m (Maybe MiniObjectFreeFunction) Source #

Get the value of the “free” field. When overloading is enabled, this is equivalent to

get miniObject #free

setMiniObjectFree :: MonadIO m => MiniObject -> FunPtr C_MiniObjectFreeFunction -> m () Source #

Set the value of the “free” field. When overloading is enabled, this is equivalent to

set miniObject [ #free := value ]

lockstate

atomic state of the locks

getMiniObjectLockstate :: MonadIO m => MiniObject -> m Int32 Source #

Get the value of the “lockstate” field. When overloading is enabled, this is equivalent to

get miniObject #lockstate

setMiniObjectLockstate :: MonadIO m => MiniObject -> Int32 -> m () Source #

Set the value of the “lockstate” field. When overloading is enabled, this is equivalent to

set miniObject [ #lockstate := value ]

refcount

atomic refcount

getMiniObjectRefcount :: MonadIO m => MiniObject -> m Int32 Source #

Get the value of the “refcount” field. When overloading is enabled, this is equivalent to

get miniObject #refcount

setMiniObjectRefcount :: MonadIO m => MiniObject -> Int32 -> m () Source #

Set the value of the “refcount” field. When overloading is enabled, this is equivalent to

set miniObject [ #refcount := value ]

type

the GType of the object

getMiniObjectType :: MonadIO m => MiniObject -> m GType Source #

Get the value of the “type” field. When overloading is enabled, this is equivalent to

get miniObject #type

setMiniObjectType :: MonadIO m => MiniObject -> GType -> m () Source #

Set the value of the “type” field. When overloading is enabled, this is equivalent to

set miniObject [ #type := value ]