{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

'GI.Gst.Objects.Object.Object' provides a root for the object hierarchy tree filed in by the
GStreamer library.  It is currently a thin wrapper on top of
'GI.GObject.Objects.InitiallyUnowned.InitiallyUnowned'. It is an abstract class that is not very usable on its own.

'GI.Gst.Objects.Object.Object' gives us basic refcounting, parenting functionality and locking.
Most of the functions are just extended for special GStreamer needs and can be
found under the same name in the base class of 'GI.Gst.Objects.Object.Object' which is 'GI.GObject.Objects.Object.Object'
(e.g. 'GI.GObject.Objects.Object.objectRef' becomes 'GI.Gst.Objects.Object.objectRef').

Since 'GI.Gst.Objects.Object.Object' derives from 'GI.GObject.Objects.InitiallyUnowned.InitiallyUnowned', it also inherits the
floating reference. Be aware that functions such as 'GI.Gst.Objects.Bin.binAdd' and
'GI.Gst.Objects.Element.elementAddPad' take ownership of the floating reference.

In contrast to 'GI.GObject.Objects.Object.Object' instances, 'GI.Gst.Objects.Object.Object' adds a name property. The functions
'GI.Gst.Objects.Object.objectSetName' and 'GI.Gst.Objects.Object.objectGetName' are used to set\/get the name
of the object.

== controlled properties

Controlled properties offers a lightweight way to adjust gobject properties
over stream-time. It works by using time-stamped value pairs that are queued
for element-properties. At run-time the elements continuously pull value
changes for the current stream-time.

What needs to be changed in a 'GI.Gst.Objects.Element.Element'?
Very little - it is just two steps to make a plugin controllable!

  * mark gobject-properties paramspecs that make sense to be controlled,
    by GST_PARAM_CONTROLLABLE.

  * when processing data (get, chain, loop function) at the beginning call
    gst_object_sync_values(element,timestamp).
    This will make the controller update all GObject properties that are
    under its control with the current values based on the timestamp.

What needs to be done in applications? Again it\'s not a lot to change.

  * create a 'GI.Gst.Objects.ControlSource.ControlSource'.
    csource = gst_interpolation_control_source_new ();
    g_object_set (csource, \"mode\", GST_INTERPOLATION_MODE_LINEAR, NULL);

  * Attach the 'GI.Gst.Objects.ControlSource.ControlSource' on the controller to a property.
    gst_object_add_control_binding (object, gst_direct_control_binding_new (object, \"prop1\", csource));

  * Set the control values
    gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,0 * GST_SECOND, value1);
    gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,1 * GST_SECOND, value2);

  * start your pipeline
-}

module GI.Gst.Objects.Object
    ( 

-- * Exported types
    Object(..)                              ,
    IsObject                                ,
    toObject                                ,
    noObject                                ,


 -- * Methods
-- ** addControlBinding #method:addControlBinding#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectAddControlBindingMethodInfo       ,
#endif
    objectAddControlBinding                 ,


-- ** checkUniqueness #method:checkUniqueness#
    objectCheckUniqueness                   ,


-- ** defaultDeepNotify #method:defaultDeepNotify#
    objectDefaultDeepNotify                 ,


-- ** defaultError #method:defaultError#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectDefaultErrorMethodInfo            ,
#endif
    objectDefaultError                      ,


-- ** getControlBinding #method:getControlBinding#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectGetControlBindingMethodInfo       ,
#endif
    objectGetControlBinding                 ,


-- ** getControlRate #method:getControlRate#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectGetControlRateMethodInfo          ,
#endif
    objectGetControlRate                    ,


-- ** getGValueArray #method:getGValueArray#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectGetGValueArrayMethodInfo          ,
#endif
    objectGetGValueArray                    ,


-- ** getName #method:getName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectGetNameMethodInfo                 ,
#endif
    objectGetName                           ,


-- ** getParent #method:getParent#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectGetParentMethodInfo               ,
#endif
    objectGetParent                         ,


-- ** getPathString #method:getPathString#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectGetPathStringMethodInfo           ,
#endif
    objectGetPathString                     ,


-- ** getValue #method:getValue#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectGetValueMethodInfo                ,
#endif
    objectGetValue                          ,


-- ** hasActiveControlBindings #method:hasActiveControlBindings#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectHasActiveControlBindingsMethodInfo,
#endif
    objectHasActiveControlBindings          ,


-- ** hasAncestor #method:hasAncestor#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectHasAncestorMethodInfo             ,
#endif
    objectHasAncestor                       ,


-- ** hasAsAncestor #method:hasAsAncestor#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectHasAsAncestorMethodInfo           ,
#endif
    objectHasAsAncestor                     ,


-- ** hasAsParent #method:hasAsParent#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectHasAsParentMethodInfo             ,
#endif
    objectHasAsParent                       ,


-- ** ref #method:ref#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectRefMethodInfo                     ,
#endif
    objectRef                               ,


-- ** removeControlBinding #method:removeControlBinding#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectRemoveControlBindingMethodInfo    ,
#endif
    objectRemoveControlBinding              ,


-- ** replace #method:replace#
    objectReplace                           ,


-- ** setControlBindingDisabled #method:setControlBindingDisabled#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectSetControlBindingDisabledMethodInfo,
#endif
    objectSetControlBindingDisabled         ,


-- ** setControlBindingsDisabled #method:setControlBindingsDisabled#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectSetControlBindingsDisabledMethodInfo,
#endif
    objectSetControlBindingsDisabled        ,


-- ** setControlRate #method:setControlRate#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectSetControlRateMethodInfo          ,
#endif
    objectSetControlRate                    ,


-- ** setName #method:setName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectSetNameMethodInfo                 ,
#endif
    objectSetName                           ,


-- ** setParent #method:setParent#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectSetParentMethodInfo               ,
#endif
    objectSetParent                         ,


-- ** suggestNextSync #method:suggestNextSync#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectSuggestNextSyncMethodInfo         ,
#endif
    objectSuggestNextSync                   ,


-- ** syncValues #method:syncValues#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectSyncValuesMethodInfo              ,
#endif
    objectSyncValues                        ,


-- ** unparent #method:unparent#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectUnparentMethodInfo                ,
#endif
    objectUnparent                          ,


-- ** unref #method:unref#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectUnrefMethodInfo                   ,
#endif
    objectUnref                             ,




 -- * Properties
-- ** name #attr:name#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectNamePropertyInfo                  ,
#endif
    clearObjectName                         ,
    constructObjectName                     ,
    getObjectName                           ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    objectName                              ,
#endif
    setObjectName                           ,


-- ** parent #attr:parent#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectParentPropertyInfo                ,
#endif
    clearObjectParent                       ,
    constructObjectParent                   ,
    getObjectParent                         ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    objectParent                            ,
#endif
    setObjectParent                         ,




 -- * Signals
-- ** deepNotify #signal:deepNotify#
    C_ObjectDeepNotifyCallback              ,
    ObjectDeepNotifyCallback                ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ObjectDeepNotifySignalInfo              ,
#endif
    afterObjectDeepNotify                   ,
    genClosure_ObjectDeepNotify             ,
    mk_ObjectDeepNotifyCallback             ,
    noObjectDeepNotifyCallback              ,
    onObjectDeepNotify                      ,
    wrap_ObjectDeepNotifyCallback           ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.ControlBinding as Gst.ControlBinding

newtype Object = Object (ManagedPtr Object)
foreign import ccall "gst_object_get_type"
    c_gst_object_get_type :: IO GType

instance GObject Object where
    gobjectType _ = c_gst_object_get_type
    

class GObject o => IsObject o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Object a) =>
    IsObject a
#endif
instance IsObject Object
instance GObject.Object.IsObject Object

toObject :: (MonadIO m, IsObject o) => o -> m Object
toObject = liftIO . unsafeCastTo Object

noObject :: Maybe Object
noObject = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveObjectMethod (t :: Symbol) (o :: *) :: * where
    ResolveObjectMethod "addControlBinding" o = ObjectAddControlBindingMethodInfo
    ResolveObjectMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveObjectMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveObjectMethod "defaultError" o = ObjectDefaultErrorMethodInfo
    ResolveObjectMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveObjectMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveObjectMethod "hasActiveControlBindings" o = ObjectHasActiveControlBindingsMethodInfo
    ResolveObjectMethod "hasAncestor" o = ObjectHasAncestorMethodInfo
    ResolveObjectMethod "hasAsAncestor" o = ObjectHasAsAncestorMethodInfo
    ResolveObjectMethod "hasAsParent" o = ObjectHasAsParentMethodInfo
    ResolveObjectMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveObjectMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveObjectMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveObjectMethod "ref" o = ObjectRefMethodInfo
    ResolveObjectMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveObjectMethod "removeControlBinding" o = ObjectRemoveControlBindingMethodInfo
    ResolveObjectMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveObjectMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveObjectMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveObjectMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveObjectMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveObjectMethod "suggestNextSync" o = ObjectSuggestNextSyncMethodInfo
    ResolveObjectMethod "syncValues" o = ObjectSyncValuesMethodInfo
    ResolveObjectMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveObjectMethod "unparent" o = ObjectUnparentMethodInfo
    ResolveObjectMethod "unref" o = ObjectUnrefMethodInfo
    ResolveObjectMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveObjectMethod "getControlBinding" o = ObjectGetControlBindingMethodInfo
    ResolveObjectMethod "getControlRate" o = ObjectGetControlRateMethodInfo
    ResolveObjectMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveObjectMethod "getGValueArray" o = ObjectGetGValueArrayMethodInfo
    ResolveObjectMethod "getName" o = ObjectGetNameMethodInfo
    ResolveObjectMethod "getParent" o = ObjectGetParentMethodInfo
    ResolveObjectMethod "getPathString" o = ObjectGetPathStringMethodInfo
    ResolveObjectMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveObjectMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveObjectMethod "getValue" o = ObjectGetValueMethodInfo
    ResolveObjectMethod "setControlBindingDisabled" o = ObjectSetControlBindingDisabledMethodInfo
    ResolveObjectMethod "setControlBindingsDisabled" o = ObjectSetControlBindingsDisabledMethodInfo
    ResolveObjectMethod "setControlRate" o = ObjectSetControlRateMethodInfo
    ResolveObjectMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveObjectMethod "setName" o = ObjectSetNameMethodInfo
    ResolveObjectMethod "setParent" o = ObjectSetParentMethodInfo
    ResolveObjectMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveObjectMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveObjectMethod t Object, O.MethodInfo info Object p) => O.IsLabelProxy t (Object -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveObjectMethod t Object, O.MethodInfo info Object p) => O.IsLabel t (Object -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- signal Object::deep-notify
type ObjectDeepNotifyCallback =
    Object ->
    GParamSpec ->
    IO ()

noObjectDeepNotifyCallback :: Maybe ObjectDeepNotifyCallback
noObjectDeepNotifyCallback = Nothing

type C_ObjectDeepNotifyCallback =
    Ptr () ->                               -- object
    Ptr Object ->
    Ptr GParamSpec ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_ObjectDeepNotifyCallback :: C_ObjectDeepNotifyCallback -> IO (FunPtr C_ObjectDeepNotifyCallback)

genClosure_ObjectDeepNotify :: ObjectDeepNotifyCallback -> IO Closure
genClosure_ObjectDeepNotify cb = do
    let cb' = wrap_ObjectDeepNotifyCallback cb
    mk_ObjectDeepNotifyCallback cb' >>= newCClosure


wrap_ObjectDeepNotifyCallback ::
    ObjectDeepNotifyCallback ->
    Ptr () ->
    Ptr Object ->
    Ptr GParamSpec ->
    Ptr () ->
    IO ()
wrap_ObjectDeepNotifyCallback _cb _ propObject prop _ = do
    propObject' <- (newObject Object) propObject
    prop' <- newGParamSpecFromPtr prop
    _cb  propObject' prop'


onObjectDeepNotify :: (IsObject a, MonadIO m) => a -> ObjectDeepNotifyCallback -> m SignalHandlerId
onObjectDeepNotify obj cb = liftIO $ do
    let cb' = wrap_ObjectDeepNotifyCallback cb
    cb'' <- mk_ObjectDeepNotifyCallback cb'
    connectSignalFunPtr obj "deep-notify" cb'' SignalConnectBefore

afterObjectDeepNotify :: (IsObject a, MonadIO m) => a -> ObjectDeepNotifyCallback -> m SignalHandlerId
afterObjectDeepNotify obj cb = liftIO $ do
    let cb' = wrap_ObjectDeepNotifyCallback cb
    cb'' <- mk_ObjectDeepNotifyCallback cb'
    connectSignalFunPtr obj "deep-notify" cb'' SignalConnectAfter


-- VVV Prop "name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Nothing,Nothing)

getObjectName :: (MonadIO m, IsObject o) => o -> m (Maybe T.Text)
getObjectName obj = liftIO $ getObjectPropertyString obj "name"

setObjectName :: (MonadIO m, IsObject o) => o -> T.Text -> m ()
setObjectName obj val = liftIO $ setObjectPropertyString obj "name" (Just val)

constructObjectName :: (IsObject o) => T.Text -> IO (GValueConstruct o)
constructObjectName val = constructObjectPropertyString "name" (Just val)

clearObjectName :: (MonadIO m, IsObject o) => o -> m ()
clearObjectName obj = liftIO $ setObjectPropertyString obj "name" (Nothing :: Maybe T.Text)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectNamePropertyInfo
instance AttrInfo ObjectNamePropertyInfo where
    type AttrAllowedOps ObjectNamePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ObjectNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint ObjectNamePropertyInfo = IsObject
    type AttrGetType ObjectNamePropertyInfo = (Maybe T.Text)
    type AttrLabel ObjectNamePropertyInfo = "name"
    type AttrOrigin ObjectNamePropertyInfo = Object
    attrGet _ = getObjectName
    attrSet _ = setObjectName
    attrConstruct _ = constructObjectName
    attrClear _ = clearObjectName
#endif

-- VVV Prop "parent"
   -- Type: TInterface (Name {namespace = "Gst", name = "Object"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getObjectParent :: (MonadIO m, IsObject o) => o -> m (Maybe Object)
getObjectParent obj = liftIO $ getObjectPropertyObject obj "parent" Object

setObjectParent :: (MonadIO m, IsObject o, IsObject a) => o -> a -> m ()
setObjectParent obj val = liftIO $ setObjectPropertyObject obj "parent" (Just val)

constructObjectParent :: (IsObject o, IsObject a) => a -> IO (GValueConstruct o)
constructObjectParent val = constructObjectPropertyObject "parent" (Just val)

clearObjectParent :: (MonadIO m, IsObject o) => o -> m ()
clearObjectParent obj = liftIO $ setObjectPropertyObject obj "parent" (Nothing :: Maybe Object)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectParentPropertyInfo
instance AttrInfo ObjectParentPropertyInfo where
    type AttrAllowedOps ObjectParentPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ObjectParentPropertyInfo = IsObject
    type AttrBaseTypeConstraint ObjectParentPropertyInfo = IsObject
    type AttrGetType ObjectParentPropertyInfo = (Maybe Object)
    type AttrLabel ObjectParentPropertyInfo = "parent"
    type AttrOrigin ObjectParentPropertyInfo = Object
    attrGet _ = getObjectParent
    attrSet _ = setObjectParent
    attrConstruct _ = constructObjectParent
    attrClear _ = clearObjectParent
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Object
type instance O.AttributeList Object = ObjectAttributeList
type ObjectAttributeList = ('[ '("name", ObjectNamePropertyInfo), '("parent", ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
objectName :: AttrLabelProxy "name"
objectName = AttrLabelProxy

objectParent :: AttrLabelProxy "parent"
objectParent = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectDeepNotifySignalInfo
instance SignalInfo ObjectDeepNotifySignalInfo where
    type HaskellCallbackType ObjectDeepNotifySignalInfo = ObjectDeepNotifyCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ObjectDeepNotifyCallback cb
        cb'' <- mk_ObjectDeepNotifyCallback cb'
        connectSignalFunPtr obj "deep-notify" cb'' connectMode

type instance O.SignalList Object = ObjectSignalList
type ObjectSignalList = ('[ '("deepNotify", ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Object::add_control_binding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the controller object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "binding", argType = TInterface (Name {namespace = "Gst", name = "ControlBinding"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstControlBinding that should be used", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_add_control_binding" gst_object_add_control_binding :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.ControlBinding.ControlBinding -> -- binding : TInterface (Name {namespace = "Gst", name = "ControlBinding"})
    IO CInt

{- |
Attach the 'GI.Gst.Objects.ControlBinding.ControlBinding' to the object. If there already was a
'GI.Gst.Objects.ControlBinding.ControlBinding' for this property it will be replaced.

The /@object@/ will take ownership of the /@binding@/.
-}
objectAddControlBinding ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a, Gst.ControlBinding.IsControlBinding b) =>
    a
    {- ^ /@object@/: the controller object -}
    -> b
    {- ^ /@binding@/: the 'GI.Gst.Objects.ControlBinding.ControlBinding' that should be used -}
    -> m Bool
    {- ^ __Returns:__ 'False' if the given /@binding@/ has not been setup for this object or
has been setup for a non suitable property, 'True' otherwise. -}
objectAddControlBinding object binding = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    binding' <- B.ManagedPtr.disownObject binding
    result <- gst_object_add_control_binding object' binding'
    let result' = (/= 0) result
    touchManagedPtr object
    touchManagedPtr binding
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectAddControlBindingMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsObject a, Gst.ControlBinding.IsControlBinding b) => O.MethodInfo ObjectAddControlBindingMethodInfo a signature where
    overloadedMethod _ = objectAddControlBinding

#endif

-- method Object::default_error
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "source", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstObject that initiated the error.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the GError.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "an additional debug information string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_default_error" gst_object_default_error :: 
    Ptr Object ->                           -- source : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GError ->                           -- error : TError
    CString ->                              -- debug : TBasicType TUTF8
    IO ()

{- |
A default error function that uses @/g_printerr()/@ to display the error message
and the optional debug sting..

The default handler will simply print the error string using g_print.
-}
objectDefaultError ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@source@/: the 'GI.Gst.Objects.Object.Object' that initiated the error. -}
    -> GError
    {- ^ /@error@/: the GError. -}
    -> Maybe (T.Text)
    {- ^ /@debug@/: an additional debug information string, or 'Nothing' -}
    -> m ()
objectDefaultError source error_ debug = liftIO $ do
    source' <- unsafeManagedPtrCastPtr source
    error_' <- unsafeManagedPtrGetPtr error_
    maybeDebug <- case debug of
        Nothing -> return nullPtr
        Just jDebug -> do
            jDebug' <- textToCString jDebug
            return jDebug'
    gst_object_default_error source' error_' maybeDebug
    touchManagedPtr source
    touchManagedPtr error_
    freeMem maybeDebug
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectDefaultErrorMethodInfo
instance (signature ~ (GError -> Maybe (T.Text) -> m ()), MonadIO m, IsObject a) => O.MethodInfo ObjectDefaultErrorMethodInfo a signature where
    overloadedMethod _ = objectDefaultError

#endif

-- method Object::get_control_binding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of the property", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "ControlBinding"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_get_control_binding" gst_object_get_control_binding :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- property_name : TBasicType TUTF8
    IO (Ptr Gst.ControlBinding.ControlBinding)

{- |
Gets the corresponding 'GI.Gst.Objects.ControlBinding.ControlBinding' for the property. This should be
unreferenced again after use.
-}
objectGetControlBinding ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object -}
    -> T.Text
    {- ^ /@propertyName@/: name of the property -}
    -> m (Maybe Gst.ControlBinding.ControlBinding)
    {- ^ __Returns:__ the 'GI.Gst.Objects.ControlBinding.ControlBinding' for
/@propertyName@/ or 'Nothing' if the property is not controlled. -}
objectGetControlBinding object propertyName = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    propertyName' <- textToCString propertyName
    result <- gst_object_get_control_binding object' propertyName'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.ControlBinding.ControlBinding) result'
        return result''
    touchManagedPtr object
    freeMem propertyName'
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectGetControlBindingMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gst.ControlBinding.ControlBinding)), MonadIO m, IsObject a) => O.MethodInfo ObjectGetControlBindingMethodInfo a signature where
    overloadedMethod _ = objectGetControlBinding

#endif

-- method Object::get_control_rate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_get_control_rate" gst_object_get_control_rate :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO Word64

{- |
Obtain the control-rate for this /@object@/. Audio processing 'GI.Gst.Objects.Element.Element'
objects will use this rate to sub-divide their processing loop and call
'GI.Gst.Objects.Object.objectSyncValues' inbetween. The length of the processing segment
should be up to /@control@/-rate nanoseconds.

If the /@object@/ is not under property control, this will return
'GI.Gst.Constants.CLOCK_TIME_NONE'. This allows the element to avoid the sub-dividing.

The control-rate is not expected to change if the element is in
'GI.Gst.Enums.StatePaused' or 'GI.Gst.Enums.StatePlaying'.
-}
objectGetControlRate ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> m Word64
    {- ^ __Returns:__ the control rate in nanoseconds -}
objectGetControlRate object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_get_control_rate object'
    touchManagedPtr object
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectGetControlRateMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsObject a) => O.MethodInfo ObjectGetControlRateMethodInfo a signature where
    overloadedMethod _ = objectGetControlRate

#endif

-- method Object::get_g_value_array
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the property to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time that should be processed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time spacing between subsequent values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_values", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "values", argType = TCArray False (-1) 4 (TInterface (Name {namespace = "GObject", name = "Value"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "array to put control-values in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "n_values", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_get_g_value_array" gst_object_get_g_value_array :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- property_name : TBasicType TUTF8
    Word64 ->                               -- timestamp : TBasicType TUInt64
    Word64 ->                               -- interval : TBasicType TUInt64
    Word32 ->                               -- n_values : TBasicType TUInt
    Ptr GValue ->                           -- values : TCArray False (-1) 4 (TInterface (Name {namespace = "GObject", name = "Value"}))
    IO CInt

{- |
Gets a number of @/GValues/@ for the given controlled property starting at the
requested time. The array /@values@/ need to hold enough space for /@nValues@/ of
'GI.GObject.Structs.Value.Value'.

This function is useful if one wants to e.g. draw a graph of the control
curve or apply a control curve sample by sample.
-}
objectGetGValueArray ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> T.Text
    {- ^ /@propertyName@/: the name of the property to get -}
    -> Word64
    {- ^ /@timestamp@/: the time that should be processed -}
    -> Word64
    {- ^ /@interval@/: the time spacing between subsequent values -}
    -> [GValue]
    {- ^ /@values@/: array to put control-values in -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the given array could be filled, 'False' otherwise -}
objectGetGValueArray object propertyName timestamp interval values = liftIO $ do
    let nValues = fromIntegral $ length values
    object' <- unsafeManagedPtrCastPtr object
    propertyName' <- textToCString propertyName
    values' <- mapM unsafeManagedPtrGetPtr values
    values'' <- packBlockArray 24 values'
    result <- gst_object_get_g_value_array object' propertyName' timestamp interval nValues values''
    let result' = (/= 0) result
    touchManagedPtr object
    mapM_ touchManagedPtr values
    freeMem propertyName'
    freeMem values''
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectGetGValueArrayMethodInfo
instance (signature ~ (T.Text -> Word64 -> Word64 -> [GValue] -> m Bool), MonadIO m, IsObject a) => O.MethodInfo ObjectGetGValueArrayMethodInfo a signature where
    overloadedMethod _ = objectGetGValueArray

#endif

-- method Object::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_get_name" gst_object_get_name :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CString

{- |
Returns a copy of the name of /@object@/.
Caller should 'GI.GLib.Functions.free' the return value after usage.
For a nameless object, this returns 'Nothing', which you can safely 'GI.GLib.Functions.free'
as well.

Free-function: g_free
-}
objectGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the name of /@object@/. 'GI.GLib.Functions.free'
after usage.

MT safe. This function grabs and releases /@object@/\'s LOCK. -}
objectGetName object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_get_name object'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr object
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectGetNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsObject a) => O.MethodInfo ObjectGetNameMethodInfo a signature where
    overloadedMethod _ = objectGetName

#endif

-- method Object::get_parent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Object"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_get_parent" gst_object_get_parent :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Object)

{- |
Returns the parent of /@object@/. This function increases the refcount
of the parent object so you should 'GI.Gst.Objects.Object.objectUnref' it after usage.
-}
objectGetParent ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' -}
    -> m (Maybe Object)
    {- ^ __Returns:__ parent of /@object@/, this can be
  'Nothing' if /@object@/ has no parent. unref after usage.

MT safe. Grabs and releases /@object@/\'s LOCK. -}
objectGetParent object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_get_parent object'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Object) result'
        return result''
    touchManagedPtr object
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectGetParentMethodInfo
instance (signature ~ (m (Maybe Object)), MonadIO m, IsObject a) => O.MethodInfo ObjectGetParentMethodInfo a signature where
    overloadedMethod _ = objectGetParent

#endif

-- method Object::get_path_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_get_path_string" gst_object_get_path_string :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CString

{- |
Generates a string describing the path of /@object@/ in
the object hierarchy. Only useful (or used) for debugging.

Free-function: g_free
-}
objectGetPathString ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' -}
    -> m T.Text
    {- ^ __Returns:__ a string describing the path of /@object@/. You must
         'GI.GLib.Functions.free' the string after usage.

MT safe. Grabs and releases the 'GI.Gst.Objects.Object.Object'\'s LOCK for all objects
         in the hierarchy. -}
objectGetPathString object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_get_path_string object'
    checkUnexpectedReturnNULL "objectGetPathString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr object
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectGetPathStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsObject a) => O.MethodInfo ObjectGetPathStringMethodInfo a signature where
    overloadedMethod _ = objectGetPathString

#endif

-- method Object::get_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the property to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time the control-change should be read from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GObject", name = "Value"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_get_value" gst_object_get_value :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- property_name : TBasicType TUTF8
    Word64 ->                               -- timestamp : TBasicType TUInt64
    IO (Ptr GValue)

{- |
Gets the value for the given controlled property at the requested time.
-}
objectGetValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> T.Text
    {- ^ /@propertyName@/: the name of the property to get -}
    -> Word64
    {- ^ /@timestamp@/: the time the control-change should be read from -}
    -> m (Maybe GValue)
    {- ^ __Returns:__ the GValue of the property at the given time,
or 'Nothing' if the property isn\'t controlled. -}
objectGetValue object propertyName timestamp = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    propertyName' <- textToCString propertyName
    result <- gst_object_get_value object' propertyName' timestamp
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed GValue) result'
        return result''
    touchManagedPtr object
    freeMem propertyName'
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectGetValueMethodInfo
instance (signature ~ (T.Text -> Word64 -> m (Maybe GValue)), MonadIO m, IsObject a) => O.MethodInfo ObjectGetValueMethodInfo a signature where
    overloadedMethod _ = objectGetValue

#endif

-- method Object::has_active_control_bindings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_has_active_control_bindings" gst_object_has_active_control_bindings :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CInt

{- |
Check if the /@object@/ has active controlled properties.
-}
objectHasActiveControlBindings ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the object has active controlled properties -}
objectHasActiveControlBindings object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_has_active_control_bindings object'
    let result' = (/= 0) result
    touchManagedPtr object
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectHasActiveControlBindingsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsObject a) => O.MethodInfo ObjectHasActiveControlBindingsMethodInfo a signature where
    overloadedMethod _ = objectHasActiveControlBindings

#endif

-- method Object::has_ancestor
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ancestor", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to check as ancestor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_has_ancestor" gst_object_has_ancestor :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Object ->                           -- ancestor : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CInt

{-# DEPRECATED objectHasAncestor ["Use 'GI.Gst.Objects.Object.objectHasAsAncestor' instead.","","MT safe. Grabs and releases /@object@/\\'s locks."] #-}
{- |
Check if /@object@/ has an ancestor /@ancestor@/ somewhere up in
the hierarchy. One can e.g. check if a 'GI.Gst.Objects.Element.Element' is inside a 'GI.Gst.Objects.Pipeline.Pipeline'.
-}
objectHasAncestor ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a, IsObject b) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' to check -}
    -> b
    {- ^ /@ancestor@/: a 'GI.Gst.Objects.Object.Object' to check as ancestor -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@ancestor@/ is an ancestor of /@object@/. -}
objectHasAncestor object ancestor = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    ancestor' <- unsafeManagedPtrCastPtr ancestor
    result <- gst_object_has_ancestor object' ancestor'
    let result' = (/= 0) result
    touchManagedPtr object
    touchManagedPtr ancestor
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectHasAncestorMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsObject a, IsObject b) => O.MethodInfo ObjectHasAncestorMethodInfo a signature where
    overloadedMethod _ = objectHasAncestor

#endif

-- method Object::has_as_ancestor
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ancestor", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to check as ancestor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_has_as_ancestor" gst_object_has_as_ancestor :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Object ->                           -- ancestor : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CInt

{- |
Check if /@object@/ has an ancestor /@ancestor@/ somewhere up in
the hierarchy. One can e.g. check if a 'GI.Gst.Objects.Element.Element' is inside a 'GI.Gst.Objects.Pipeline.Pipeline'.
-}
objectHasAsAncestor ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a, IsObject b) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' to check -}
    -> b
    {- ^ /@ancestor@/: a 'GI.Gst.Objects.Object.Object' to check as ancestor -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@ancestor@/ is an ancestor of /@object@/.

MT safe. Grabs and releases /@object@/\'s locks. -}
objectHasAsAncestor object ancestor = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    ancestor' <- unsafeManagedPtrCastPtr ancestor
    result <- gst_object_has_as_ancestor object' ancestor'
    let result' = (/= 0) result
    touchManagedPtr object
    touchManagedPtr ancestor
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectHasAsAncestorMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsObject a, IsObject b) => O.MethodInfo ObjectHasAsAncestorMethodInfo a signature where
    overloadedMethod _ = objectHasAsAncestor

#endif

-- method Object::has_as_parent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to check as parent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_has_as_parent" gst_object_has_as_parent :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Object ->                           -- parent : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CInt

{- |
Check if /@parent@/ is the parent of /@object@/.
E.g. a 'GI.Gst.Objects.Element.Element' can check if it owns a given 'GI.Gst.Objects.Pad.Pad'.

@since 1.6
-}
objectHasAsParent ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a, IsObject b) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' to check -}
    -> b
    {- ^ /@parent@/: a 'GI.Gst.Objects.Object.Object' to check as parent -}
    -> m Bool
    {- ^ __Returns:__ 'False' if either /@object@/ or /@parent@/ is 'Nothing'. 'True' if /@parent@/ is
         the parent of /@object@/. Otherwise 'False'.

MT safe. Grabs and releases /@object@/\'s locks. -}
objectHasAsParent object parent = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    parent' <- unsafeManagedPtrCastPtr parent
    result <- gst_object_has_as_parent object' parent'
    let result' = (/= 0) result
    touchManagedPtr object
    touchManagedPtr parent
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectHasAsParentMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsObject a, IsObject b) => O.MethodInfo ObjectHasAsParentMethodInfo a signature where
    overloadedMethod _ = objectHasAsParent

#endif

-- method Object::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to reference", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Object"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_ref" gst_object_ref :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Object)

{- |
Increments the reference count on /@object@/. This function
does not take the lock on /@object@/ because it relies on
atomic refcounting.

This object returns the input parameter to ease writing
constructs like :
 result = gst_object_ref (object->parent);
-}
objectRef ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' to reference -}
    -> m Object
    {- ^ __Returns:__ A pointer to /@object@/ -}
objectRef object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_ref object'
    checkUnexpectedReturnNULL "objectRef" result
    result' <- (wrapObject Object) result
    touchManagedPtr object
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectRefMethodInfo
instance (signature ~ (m Object), MonadIO m, IsObject a) => O.MethodInfo ObjectRefMethodInfo a signature where
    overloadedMethod _ = objectRef

#endif

-- method Object::remove_control_binding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "binding", argType = TInterface (Name {namespace = "Gst", name = "ControlBinding"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the binding", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_remove_control_binding" gst_object_remove_control_binding :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.ControlBinding.ControlBinding -> -- binding : TInterface (Name {namespace = "Gst", name = "ControlBinding"})
    IO CInt

{- |
Removes the corresponding 'GI.Gst.Objects.ControlBinding.ControlBinding'. If it was the
last ref of the binding, it will be disposed.
-}
objectRemoveControlBinding ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a, Gst.ControlBinding.IsControlBinding b) =>
    a
    {- ^ /@object@/: the object -}
    -> b
    {- ^ /@binding@/: the binding -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the binding could be removed. -}
objectRemoveControlBinding object binding = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    binding' <- unsafeManagedPtrCastPtr binding
    result <- gst_object_remove_control_binding object' binding'
    let result' = (/= 0) result
    touchManagedPtr object
    touchManagedPtr binding
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectRemoveControlBindingMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsObject a, Gst.ControlBinding.IsControlBinding b) => O.MethodInfo ObjectRemoveControlBindingMethodInfo a signature where
    overloadedMethod _ = objectRemoveControlBinding

#endif

-- method Object::set_control_binding_disabled
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "property to disable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "disabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "boolean that specifies whether to disable the controller\nor not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_set_control_binding_disabled" gst_object_set_control_binding_disabled :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- property_name : TBasicType TUTF8
    CInt ->                                 -- disabled : TBasicType TBoolean
    IO ()

{- |
This function is used to disable the control bindings on a property for
some time, i.e. 'GI.Gst.Objects.Object.objectSyncValues' will do nothing for the
property.
-}
objectSetControlBindingDisabled ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> T.Text
    {- ^ /@propertyName@/: property to disable -}
    -> Bool
    {- ^ /@disabled@/: boolean that specifies whether to disable the controller
or not. -}
    -> m ()
objectSetControlBindingDisabled object propertyName disabled = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    propertyName' <- textToCString propertyName
    let disabled' = (fromIntegral . fromEnum) disabled
    gst_object_set_control_binding_disabled object' propertyName' disabled'
    touchManagedPtr object
    freeMem propertyName'
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectSetControlBindingDisabledMethodInfo
instance (signature ~ (T.Text -> Bool -> m ()), MonadIO m, IsObject a) => O.MethodInfo ObjectSetControlBindingDisabledMethodInfo a signature where
    overloadedMethod _ = objectSetControlBindingDisabled

#endif

-- method Object::set_control_bindings_disabled
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "disabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "boolean that specifies whether to disable the controller\nor not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_set_control_bindings_disabled" gst_object_set_control_bindings_disabled :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    CInt ->                                 -- disabled : TBasicType TBoolean
    IO ()

{- |
This function is used to disable all controlled properties of the /@object@/ for
some time, i.e. 'GI.Gst.Objects.Object.objectSyncValues' will do nothing.
-}
objectSetControlBindingsDisabled ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> Bool
    {- ^ /@disabled@/: boolean that specifies whether to disable the controller
or not. -}
    -> m ()
objectSetControlBindingsDisabled object disabled = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    let disabled' = (fromIntegral . fromEnum) disabled
    gst_object_set_control_bindings_disabled object' disabled'
    touchManagedPtr object
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectSetControlBindingsDisabledMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsObject a) => O.MethodInfo ObjectSetControlBindingsDisabledMethodInfo a signature where
    overloadedMethod _ = objectSetControlBindingsDisabled

#endif

-- method Object::set_control_rate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "control_rate", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new control-rate in nanoseconds.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_set_control_rate" gst_object_set_control_rate :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Word64 ->                               -- control_rate : TBasicType TUInt64
    IO ()

{- |
Change the control-rate for this /@object@/. Audio processing 'GI.Gst.Objects.Element.Element'
objects will use this rate to sub-divide their processing loop and call
'GI.Gst.Objects.Object.objectSyncValues' inbetween. The length of the processing segment
should be up to /@control@/-rate nanoseconds.

The control-rate should not change if the element is in 'GI.Gst.Enums.StatePaused' or
'GI.Gst.Enums.StatePlaying'.
-}
objectSetControlRate ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> Word64
    {- ^ /@controlRate@/: the new control-rate in nanoseconds. -}
    -> m ()
objectSetControlRate object controlRate = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    gst_object_set_control_rate object' controlRate
    touchManagedPtr object
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectSetControlRateMethodInfo
instance (signature ~ (Word64 -> m ()), MonadIO m, IsObject a) => O.MethodInfo ObjectSetControlRateMethodInfo a signature where
    overloadedMethod _ = objectSetControlRate

#endif

-- method Object::set_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "new name of object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_set_name" gst_object_set_name :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

{- |
Sets the name of /@object@/, or gives /@object@/ a guaranteed unique
name (if /@name@/ is 'Nothing').
This function makes a copy of the provided name, so the caller
retains ownership of the name it sent.
-}
objectSetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' -}
    -> Maybe (T.Text)
    {- ^ /@name@/: new name of object -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the name could be set. Since Objects that have
a parent cannot be renamed, this function returns 'False' in those
cases.

MT safe.  This function grabs and releases /@object@/\'s LOCK. -}
objectSetName object name = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    result <- gst_object_set_name object' maybeName
    let result' = (/= 0) result
    touchManagedPtr object
    freeMem maybeName
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectSetNameMethodInfo
instance (signature ~ (Maybe (T.Text) -> m Bool), MonadIO m, IsObject a) => O.MethodInfo ObjectSetNameMethodInfo a signature where
    overloadedMethod _ = objectSetName

#endif

-- method Object::set_parent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "new parent of object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_set_parent" gst_object_set_parent :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Object ->                           -- parent : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CInt

{- |
Sets the parent of /@object@/ to /@parent@/. The object\'s reference count will
be incremented, and any floating reference will be removed (see @/gst_object_ref_sink()/@).
-}
objectSetParent ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a, IsObject b) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' -}
    -> b
    {- ^ /@parent@/: new parent of object -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@parent@/ could be set or 'False' when /@object@/
already had a parent or /@object@/ and /@parent@/ are the same.

MT safe. Grabs and releases /@object@/\'s LOCK. -}
objectSetParent object parent = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    parent' <- unsafeManagedPtrCastPtr parent
    result <- gst_object_set_parent object' parent'
    let result' = (/= 0) result
    touchManagedPtr object
    touchManagedPtr parent
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectSetParentMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsObject a, IsObject b) => O.MethodInfo ObjectSetParentMethodInfo a signature where
    overloadedMethod _ = objectSetParent

#endif

-- method Object::suggest_next_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_suggest_next_sync" gst_object_suggest_next_sync :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO Word64

{- |
Returns a suggestion for timestamps where buffers should be split
to get best controller results.
-}
objectSuggestNextSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> m Word64
    {- ^ __Returns:__ Returns the suggested timestamp or 'GI.Gst.Constants.CLOCK_TIME_NONE'
if no control-rate was set. -}
objectSuggestNextSync object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_suggest_next_sync object'
    touchManagedPtr object
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectSuggestNextSyncMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsObject a) => O.MethodInfo ObjectSuggestNextSyncMethodInfo a signature where
    overloadedMethod _ = objectSuggestNextSync

#endif

-- method Object::sync_values
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object that has controlled properties", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time that should be processed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_sync_values" gst_object_sync_values :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Word64 ->                               -- timestamp : TBasicType TUInt64
    IO CInt

{- |
Sets the properties of the object, according to the @/GstControlSources/@ that
(maybe) handle them and for the given timestamp.

If this function fails, it is most likely the application developers fault.
Most probably the control sources are not setup correctly.
-}
objectSyncValues ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: the object that has controlled properties -}
    -> Word64
    {- ^ /@timestamp@/: the time that should be processed -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the controller values could be applied to the object
properties, 'False' otherwise -}
objectSyncValues object timestamp = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    result <- gst_object_sync_values object' timestamp
    let result' = (/= 0) result
    touchManagedPtr object
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectSyncValuesMethodInfo
instance (signature ~ (Word64 -> m Bool), MonadIO m, IsObject a) => O.MethodInfo ObjectSyncValuesMethodInfo a signature where
    overloadedMethod _ = objectSyncValues

#endif

-- method Object::unparent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to unparent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_unparent" gst_object_unparent :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO ()

{- |
Clear the parent of /@object@/, removing the associated reference.
This function decreases the refcount of /@object@/.

MT safe. Grabs and releases /@object@/\'s lock.
-}
objectUnparent ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' to unparent -}
    -> m ()
objectUnparent object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    gst_object_unparent object'
    touchManagedPtr object
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectUnparentMethodInfo
instance (signature ~ (m ()), MonadIO m, IsObject a) => O.MethodInfo ObjectUnparentMethodInfo a signature where
    overloadedMethod _ = objectUnparent

#endif

-- method Object::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject to unreference", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_unref" gst_object_unref :: 
    Ptr Object ->                           -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    IO ()

{- |
Decrements the reference count on /@object@/.  If reference count hits
zero, destroy /@object@/. This function does not take the lock
on /@object@/ as it relies on atomic refcounting.

The unref method should never be called with the LOCK held since
this might deadlock the dispose function.
-}
objectUnref ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    a
    {- ^ /@object@/: a 'GI.Gst.Objects.Object.Object' to unreference -}
    -> m ()
objectUnref object = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    gst_object_unref object'
    touchManagedPtr object
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ObjectUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m, IsObject a) => O.MethodInfo ObjectUnrefMethodInfo a signature where
    overloadedMethod _ = objectUnref

#endif

-- method Object::check_uniqueness
-- method type : MemberFunction
-- Args : [Arg {argCName = "list", argType = TGList (TInterface (Name {namespace = "Gst", name = "Object"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a list of #GstObject to\n     check through", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name to search for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_check_uniqueness" gst_object_check_uniqueness :: 
    Ptr (GList (Ptr Object)) ->             -- list : TGList (TInterface (Name {namespace = "Gst", name = "Object"}))
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

{- |
Checks to see if there is any object named /@name@/ in /@list@/. This function
does not do any locking of any kind. You might want to protect the
provided list with the lock of the owner of the list. This function
will lock each 'GI.Gst.Objects.Object.Object' in the list to compare the name, so be
careful when passing a list with a locked object.
-}
objectCheckUniqueness ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a) =>
    [a]
    {- ^ /@list@/: a list of 'GI.Gst.Objects.Object.Object' to
     check through -}
    -> T.Text
    {- ^ /@name@/: the name to search for -}
    -> m Bool
    {- ^ __Returns:__ 'True' if a 'GI.Gst.Objects.Object.Object' named /@name@/ does not appear in /@list@/,
'False' if it does.

MT safe. Grabs and releases the LOCK of each object in the list. -}
objectCheckUniqueness list name = liftIO $ do
    list' <- mapM unsafeManagedPtrCastPtr list
    list'' <- packGList list'
    name' <- textToCString name
    result <- gst_object_check_uniqueness list'' name'
    let result' = (/= 0) result
    mapM_ touchManagedPtr list
    g_list_free list''
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Object::default_deep_notify
-- method type : MemberFunction
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GObject that signalled the notify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "orig", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject that initiated the notify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GParamSpec of the property.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "excluded_props", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "\n    a set of user-specified properties to exclude or %NULL to show\n    all changes.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_default_deep_notify" gst_object_default_deep_notify :: 
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr Object ->                           -- orig : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    Ptr CString ->                          -- excluded_props : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO ()

{- |
A default deep_notify signal callback for an object. The user data
should contain a pointer to an array of strings that should be excluded
from the notify. The default handler will print the new value of the property
using g_print.

MT safe. This function grabs and releases /@object@/\'s LOCK for getting its
         path string.
-}
objectDefaultDeepNotify ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a, IsObject b) =>
    a
    {- ^ /@object@/: the 'GI.GObject.Objects.Object.Object' that signalled the notify. -}
    -> b
    {- ^ /@orig@/: a 'GI.Gst.Objects.Object.Object' that initiated the notify. -}
    -> GParamSpec
    {- ^ /@pspec@/: a 'GI.GObject.Objects.ParamSpec.ParamSpec' of the property. -}
    -> Maybe ([T.Text])
    {- ^ /@excludedProps@/: 
    a set of user-specified properties to exclude or 'Nothing' to show
    all changes. -}
    -> m ()
objectDefaultDeepNotify object orig pspec excludedProps = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    orig' <- unsafeManagedPtrCastPtr orig
    pspec' <- unsafeManagedPtrGetPtr pspec
    maybeExcludedProps <- case excludedProps of
        Nothing -> return nullPtr
        Just jExcludedProps -> do
            jExcludedProps' <- packZeroTerminatedUTF8CArray jExcludedProps
            return jExcludedProps'
    gst_object_default_deep_notify object' orig' pspec' maybeExcludedProps
    touchManagedPtr object
    touchManagedPtr orig
    touchManagedPtr pspec
    mapZeroTerminatedCArray freeMem maybeExcludedProps
    freeMem maybeExcludedProps
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Object::replace
-- method type : MemberFunction
-- Args : [Arg {argCName = "oldobj", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionInout, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer to a place of\n    a #GstObject to replace", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "newobj", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a new #GstObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_object_replace" gst_object_replace :: 
    Ptr (Ptr Object) ->                     -- oldobj : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Object ->                           -- newobj : TInterface (Name {namespace = "Gst", name = "Object"})
    IO CInt

{- |
Atomically modifies a pointer to point to a new object.
The reference count of /@oldobj@/ is decreased and the reference count of
/@newobj@/ is increased.

Either /@newobj@/ and the value pointed to by /@oldobj@/ may be 'Nothing'.
-}
objectReplace ::
    (B.CallStack.HasCallStack, MonadIO m, IsObject a, IsObject b) =>
    Maybe (a)
    {- ^ /@oldobj@/: pointer to a place of
    a 'GI.Gst.Objects.Object.Object' to replace -}
    -> Maybe (b)
    {- ^ /@newobj@/: a new 'GI.Gst.Objects.Object.Object' -}
    -> m ((Bool, Maybe Object))
    {- ^ __Returns:__ 'True' if /@newobj@/ was different from /@oldobj@/ -}
objectReplace oldobj newobj = liftIO $ do
    maybeOldobj <- case oldobj of
        Nothing -> return nullPtr
        Just jOldobj -> do
            jOldobj' <- B.ManagedPtr.disownObject jOldobj
            return jOldobj'
    maybeOldobj' <- allocMem :: IO (Ptr (Ptr Object))
    poke maybeOldobj' maybeOldobj
    maybeNewobj <- case newobj of
        Nothing -> return nullPtr
        Just jNewobj -> do
            jNewobj' <- unsafeManagedPtrCastPtr jNewobj
            return jNewobj'
    result <- gst_object_replace maybeOldobj' maybeNewobj
    let result' = (/= 0) result
    maybeOldobj'' <- peek maybeOldobj'
    maybeMaybeOldobj'' <- convertIfNonNull maybeOldobj'' $ \maybeOldobj''' -> do
        maybeOldobj'''' <- (wrapObject Object) maybeOldobj'''
        return maybeOldobj''''
    whenJust oldobj touchManagedPtr
    whenJust newobj touchManagedPtr
    freeMem maybeOldobj'
    return (result', maybeMaybeOldobj'')

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif