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

A 'GI.Gst.Objects.Element.Element' is linked to other elements via \"pads\", which are extremely
light-weight generic link points.

Pads have a 'GI.Gst.Enums.PadDirection', source pads produce data, sink pads consume
data.

Pads are typically created from a 'GI.Gst.Objects.PadTemplate.PadTemplate' with
'GI.Gst.Objects.Pad.padNewFromTemplate' and are then added to a 'GI.Gst.Objects.Element.Element'. This usually
happens when the element is created but it can also happen dynamically based
on the data that the element is processing or based on the pads that the
application requests.

Pads without pad templates can be created with 'GI.Gst.Objects.Pad.padNew',
which takes a direction and a name as an argument.  If the name is 'Nothing',
then a guaranteed unique name will be assigned to it.

A 'GI.Gst.Objects.Element.Element' creating a pad will typically use the various
gst_pad_set_*@/_function()/@ calls to register callbacks for events, queries or
dataflow on the pads.

@/gst_pad_get_parent()/@ will retrieve the 'GI.Gst.Objects.Element.Element' that owns the pad.

After two pads are retrieved from an element by 'GI.Gst.Objects.Element.elementGetStaticPad',
the pads can be linked with 'GI.Gst.Objects.Pad.padLink'. (For quick links,
you can also use 'GI.Gst.Objects.Element.elementLink', which will make the obvious
link for you if it\'s straightforward.). Pads can be unlinked again with
'GI.Gst.Objects.Pad.padUnlink'. 'GI.Gst.Objects.Pad.padGetPeer' can be used to check what the pad is
linked to.

Before dataflow is possible on the pads, they need to be activated with
'GI.Gst.Objects.Pad.padSetActive'.

'GI.Gst.Objects.Pad.padQuery' and 'GI.Gst.Objects.Pad.padPeerQuery' can be used to query various
properties of the pad and the stream.

To send a 'GI.Gst.Structs.Event.Event' on a pad, use 'GI.Gst.Objects.Pad.padSendEvent' and
'GI.Gst.Objects.Pad.padPushEvent'. Some events will be sticky on the pad, meaning that
after they pass on the pad they can be queried later with
'GI.Gst.Objects.Pad.padGetStickyEvent' and 'GI.Gst.Objects.Pad.padStickyEventsForeach'.
'GI.Gst.Objects.Pad.padGetCurrentCaps' and 'GI.Gst.Objects.Pad.padHasCurrentCaps' are convenience
functions to query the current sticky CAPS event on a pad.

GstElements will use 'GI.Gst.Objects.Pad.padPush' and 'GI.Gst.Objects.Pad.padPullRange' to push out
or pull in a buffer.

The dataflow, events and queries that happen on a pad can be monitored with
probes that can be installed with 'GI.Gst.Objects.Pad.padAddProbe'. 'GI.Gst.Objects.Pad.padIsBlocked'
can be used to check if a block probe is installed on the pad.
'GI.Gst.Objects.Pad.padIsBlocking' checks if the blocking probe is currently blocking the
pad. 'GI.Gst.Objects.Pad.padRemoveProbe' is used to remove a previously installed probe
and unblock blocking probes if any.

Pad have an offset that can be retrieved with 'GI.Gst.Objects.Pad.padGetOffset'. This
offset will be applied to the running_time of all data passing over the pad.
'GI.Gst.Objects.Pad.padSetOffset' can be used to change the offset.

Convenience functions exist to start, pause and stop the task on a pad with
'GI.Gst.Objects.Pad.padStartTask', 'GI.Gst.Objects.Pad.padPauseTask' and 'GI.Gst.Objects.Pad.padStopTask'
respectively.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gst.Objects.Pad
    (

-- * Exported types
    Pad(..)                                 ,
    IsPad                                   ,
    toPad                                   ,
    noPad                                   ,


 -- * Methods
-- ** activateMode #method:activateMode#

#if ENABLE_OVERLOADING
    PadActivateModeMethodInfo               ,
#endif
    padActivateMode                         ,


-- ** addProbe #method:addProbe#

#if ENABLE_OVERLOADING
    PadAddProbeMethodInfo                   ,
#endif
    padAddProbe                             ,


-- ** canLink #method:canLink#

#if ENABLE_OVERLOADING
    PadCanLinkMethodInfo                    ,
#endif
    padCanLink                              ,


-- ** chain #method:chain#

#if ENABLE_OVERLOADING
    PadChainMethodInfo                      ,
#endif
    padChain                                ,


-- ** chainList #method:chainList#

#if ENABLE_OVERLOADING
    PadChainListMethodInfo                  ,
#endif
    padChainList                            ,


-- ** checkReconfigure #method:checkReconfigure#

#if ENABLE_OVERLOADING
    PadCheckReconfigureMethodInfo           ,
#endif
    padCheckReconfigure                     ,


-- ** createStreamId #method:createStreamId#

#if ENABLE_OVERLOADING
    PadCreateStreamIdMethodInfo             ,
#endif
    padCreateStreamId                       ,


-- ** eventDefault #method:eventDefault#

#if ENABLE_OVERLOADING
    PadEventDefaultMethodInfo               ,
#endif
    padEventDefault                         ,


-- ** forward #method:forward#

#if ENABLE_OVERLOADING
    PadForwardMethodInfo                    ,
#endif
    padForward                              ,


-- ** getAllowedCaps #method:getAllowedCaps#

#if ENABLE_OVERLOADING
    PadGetAllowedCapsMethodInfo             ,
#endif
    padGetAllowedCaps                       ,


-- ** getCurrentCaps #method:getCurrentCaps#

#if ENABLE_OVERLOADING
    PadGetCurrentCapsMethodInfo             ,
#endif
    padGetCurrentCaps                       ,


-- ** getDirection #method:getDirection#

#if ENABLE_OVERLOADING
    PadGetDirectionMethodInfo               ,
#endif
    padGetDirection                         ,


-- ** getElementPrivate #method:getElementPrivate#

#if ENABLE_OVERLOADING
    PadGetElementPrivateMethodInfo          ,
#endif
    padGetElementPrivate                    ,


-- ** getLastFlowReturn #method:getLastFlowReturn#

#if ENABLE_OVERLOADING
    PadGetLastFlowReturnMethodInfo          ,
#endif
    padGetLastFlowReturn                    ,


-- ** getOffset #method:getOffset#

#if ENABLE_OVERLOADING
    PadGetOffsetMethodInfo                  ,
#endif
    padGetOffset                            ,


-- ** getPadTemplate #method:getPadTemplate#

#if ENABLE_OVERLOADING
    PadGetPadTemplateMethodInfo             ,
#endif
    padGetPadTemplate                       ,


-- ** getPadTemplateCaps #method:getPadTemplateCaps#

#if ENABLE_OVERLOADING
    PadGetPadTemplateCapsMethodInfo         ,
#endif
    padGetPadTemplateCaps                   ,


-- ** getParentElement #method:getParentElement#

#if ENABLE_OVERLOADING
    PadGetParentElementMethodInfo           ,
#endif
    padGetParentElement                     ,


-- ** getPeer #method:getPeer#

#if ENABLE_OVERLOADING
    PadGetPeerMethodInfo                    ,
#endif
    padGetPeer                              ,


-- ** getRange #method:getRange#

#if ENABLE_OVERLOADING
    PadGetRangeMethodInfo                   ,
#endif
    padGetRange                             ,


-- ** getStickyEvent #method:getStickyEvent#

#if ENABLE_OVERLOADING
    PadGetStickyEventMethodInfo             ,
#endif
    padGetStickyEvent                       ,


-- ** getStream #method:getStream#

#if ENABLE_OVERLOADING
    PadGetStreamMethodInfo                  ,
#endif
    padGetStream                            ,


-- ** getStreamId #method:getStreamId#

#if ENABLE_OVERLOADING
    PadGetStreamIdMethodInfo                ,
#endif
    padGetStreamId                          ,


-- ** getTaskState #method:getTaskState#

#if ENABLE_OVERLOADING
    PadGetTaskStateMethodInfo               ,
#endif
    padGetTaskState                         ,


-- ** hasCurrentCaps #method:hasCurrentCaps#

#if ENABLE_OVERLOADING
    PadHasCurrentCapsMethodInfo             ,
#endif
    padHasCurrentCaps                       ,


-- ** isActive #method:isActive#

#if ENABLE_OVERLOADING
    PadIsActiveMethodInfo                   ,
#endif
    padIsActive                             ,


-- ** isBlocked #method:isBlocked#

#if ENABLE_OVERLOADING
    PadIsBlockedMethodInfo                  ,
#endif
    padIsBlocked                            ,


-- ** isBlocking #method:isBlocking#

#if ENABLE_OVERLOADING
    PadIsBlockingMethodInfo                 ,
#endif
    padIsBlocking                           ,


-- ** isLinked #method:isLinked#

#if ENABLE_OVERLOADING
    PadIsLinkedMethodInfo                   ,
#endif
    padIsLinked                             ,


-- ** iterateInternalLinks #method:iterateInternalLinks#

#if ENABLE_OVERLOADING
    PadIterateInternalLinksMethodInfo       ,
#endif
    padIterateInternalLinks                 ,


-- ** iterateInternalLinksDefault #method:iterateInternalLinksDefault#

#if ENABLE_OVERLOADING
    PadIterateInternalLinksDefaultMethodInfo,
#endif
    padIterateInternalLinksDefault          ,


-- ** link #method:link#

#if ENABLE_OVERLOADING
    PadLinkMethodInfo                       ,
#endif
    padLink                                 ,


-- ** linkFull #method:linkFull#

#if ENABLE_OVERLOADING
    PadLinkFullMethodInfo                   ,
#endif
    padLinkFull                             ,


-- ** linkGetName #method:linkGetName#

    padLinkGetName                          ,


-- ** linkMaybeGhosting #method:linkMaybeGhosting#

#if ENABLE_OVERLOADING
    PadLinkMaybeGhostingMethodInfo          ,
#endif
    padLinkMaybeGhosting                    ,


-- ** linkMaybeGhostingFull #method:linkMaybeGhostingFull#

#if ENABLE_OVERLOADING
    PadLinkMaybeGhostingFullMethodInfo      ,
#endif
    padLinkMaybeGhostingFull                ,


-- ** markReconfigure #method:markReconfigure#

#if ENABLE_OVERLOADING
    PadMarkReconfigureMethodInfo            ,
#endif
    padMarkReconfigure                      ,


-- ** needsReconfigure #method:needsReconfigure#

#if ENABLE_OVERLOADING
    PadNeedsReconfigureMethodInfo           ,
#endif
    padNeedsReconfigure                     ,


-- ** new #method:new#

    padNew                                  ,


-- ** newFromStaticTemplate #method:newFromStaticTemplate#

    padNewFromStaticTemplate                ,


-- ** newFromTemplate #method:newFromTemplate#

    padNewFromTemplate                      ,


-- ** pauseTask #method:pauseTask#

#if ENABLE_OVERLOADING
    PadPauseTaskMethodInfo                  ,
#endif
    padPauseTask                            ,


-- ** peerQuery #method:peerQuery#

#if ENABLE_OVERLOADING
    PadPeerQueryMethodInfo                  ,
#endif
    padPeerQuery                            ,


-- ** peerQueryAcceptCaps #method:peerQueryAcceptCaps#

#if ENABLE_OVERLOADING
    PadPeerQueryAcceptCapsMethodInfo        ,
#endif
    padPeerQueryAcceptCaps                  ,


-- ** peerQueryCaps #method:peerQueryCaps#

#if ENABLE_OVERLOADING
    PadPeerQueryCapsMethodInfo              ,
#endif
    padPeerQueryCaps                        ,


-- ** peerQueryConvert #method:peerQueryConvert#

#if ENABLE_OVERLOADING
    PadPeerQueryConvertMethodInfo           ,
#endif
    padPeerQueryConvert                     ,


-- ** peerQueryDuration #method:peerQueryDuration#

#if ENABLE_OVERLOADING
    PadPeerQueryDurationMethodInfo          ,
#endif
    padPeerQueryDuration                    ,


-- ** peerQueryPosition #method:peerQueryPosition#

#if ENABLE_OVERLOADING
    PadPeerQueryPositionMethodInfo          ,
#endif
    padPeerQueryPosition                    ,


-- ** proxyQueryAcceptCaps #method:proxyQueryAcceptCaps#

#if ENABLE_OVERLOADING
    PadProxyQueryAcceptCapsMethodInfo       ,
#endif
    padProxyQueryAcceptCaps                 ,


-- ** proxyQueryCaps #method:proxyQueryCaps#

#if ENABLE_OVERLOADING
    PadProxyQueryCapsMethodInfo             ,
#endif
    padProxyQueryCaps                       ,


-- ** pullRange #method:pullRange#

#if ENABLE_OVERLOADING
    PadPullRangeMethodInfo                  ,
#endif
    padPullRange                            ,


-- ** push #method:push#

#if ENABLE_OVERLOADING
    PadPushMethodInfo                       ,
#endif
    padPush                                 ,


-- ** pushEvent #method:pushEvent#

#if ENABLE_OVERLOADING
    PadPushEventMethodInfo                  ,
#endif
    padPushEvent                            ,


-- ** pushList #method:pushList#

#if ENABLE_OVERLOADING
    PadPushListMethodInfo                   ,
#endif
    padPushList                             ,


-- ** query #method:query#

#if ENABLE_OVERLOADING
    PadQueryMethodInfo                      ,
#endif
    padQuery                                ,


-- ** queryAcceptCaps #method:queryAcceptCaps#

#if ENABLE_OVERLOADING
    PadQueryAcceptCapsMethodInfo            ,
#endif
    padQueryAcceptCaps                      ,


-- ** queryCaps #method:queryCaps#

#if ENABLE_OVERLOADING
    PadQueryCapsMethodInfo                  ,
#endif
    padQueryCaps                            ,


-- ** queryConvert #method:queryConvert#

#if ENABLE_OVERLOADING
    PadQueryConvertMethodInfo               ,
#endif
    padQueryConvert                         ,


-- ** queryDefault #method:queryDefault#

#if ENABLE_OVERLOADING
    PadQueryDefaultMethodInfo               ,
#endif
    padQueryDefault                         ,


-- ** queryDuration #method:queryDuration#

#if ENABLE_OVERLOADING
    PadQueryDurationMethodInfo              ,
#endif
    padQueryDuration                        ,


-- ** queryPosition #method:queryPosition#

#if ENABLE_OVERLOADING
    PadQueryPositionMethodInfo              ,
#endif
    padQueryPosition                        ,


-- ** removeProbe #method:removeProbe#

#if ENABLE_OVERLOADING
    PadRemoveProbeMethodInfo                ,
#endif
    padRemoveProbe                          ,


-- ** sendEvent #method:sendEvent#

#if ENABLE_OVERLOADING
    PadSendEventMethodInfo                  ,
#endif
    padSendEvent                            ,


-- ** setActivateFunctionFull #method:setActivateFunctionFull#

#if ENABLE_OVERLOADING
    PadSetActivateFunctionFullMethodInfo    ,
#endif
    padSetActivateFunctionFull              ,


-- ** setActivatemodeFunctionFull #method:setActivatemodeFunctionFull#

#if ENABLE_OVERLOADING
    PadSetActivatemodeFunctionFullMethodInfo,
#endif
    padSetActivatemodeFunctionFull          ,


-- ** setActive #method:setActive#

#if ENABLE_OVERLOADING
    PadSetActiveMethodInfo                  ,
#endif
    padSetActive                            ,


-- ** setChainFunctionFull #method:setChainFunctionFull#

#if ENABLE_OVERLOADING
    PadSetChainFunctionFullMethodInfo       ,
#endif
    padSetChainFunctionFull                 ,


-- ** setChainListFunctionFull #method:setChainListFunctionFull#

#if ENABLE_OVERLOADING
    PadSetChainListFunctionFullMethodInfo   ,
#endif
    padSetChainListFunctionFull             ,


-- ** setElementPrivate #method:setElementPrivate#

#if ENABLE_OVERLOADING
    PadSetElementPrivateMethodInfo          ,
#endif
    padSetElementPrivate                    ,


-- ** setEventFullFunctionFull #method:setEventFullFunctionFull#

#if ENABLE_OVERLOADING
    PadSetEventFullFunctionFullMethodInfo   ,
#endif
    padSetEventFullFunctionFull             ,


-- ** setEventFunctionFull #method:setEventFunctionFull#

#if ENABLE_OVERLOADING
    PadSetEventFunctionFullMethodInfo       ,
#endif
    padSetEventFunctionFull                 ,


-- ** setGetrangeFunctionFull #method:setGetrangeFunctionFull#

#if ENABLE_OVERLOADING
    PadSetGetrangeFunctionFullMethodInfo    ,
#endif
    padSetGetrangeFunctionFull              ,


-- ** setIterateInternalLinksFunctionFull #method:setIterateInternalLinksFunctionFull#

#if ENABLE_OVERLOADING
    PadSetIterateInternalLinksFunctionFullMethodInfo,
#endif
    padSetIterateInternalLinksFunctionFull  ,


-- ** setLinkFunctionFull #method:setLinkFunctionFull#

#if ENABLE_OVERLOADING
    PadSetLinkFunctionFullMethodInfo        ,
#endif
    padSetLinkFunctionFull                  ,


-- ** setOffset #method:setOffset#

#if ENABLE_OVERLOADING
    PadSetOffsetMethodInfo                  ,
#endif
    padSetOffset                            ,


-- ** setQueryFunctionFull #method:setQueryFunctionFull#

#if ENABLE_OVERLOADING
    PadSetQueryFunctionFullMethodInfo       ,
#endif
    padSetQueryFunctionFull                 ,


-- ** setUnlinkFunctionFull #method:setUnlinkFunctionFull#

#if ENABLE_OVERLOADING
    PadSetUnlinkFunctionFullMethodInfo      ,
#endif
    padSetUnlinkFunctionFull                ,


-- ** startTask #method:startTask#

#if ENABLE_OVERLOADING
    PadStartTaskMethodInfo                  ,
#endif
    padStartTask                            ,


-- ** stickyEventsForeach #method:stickyEventsForeach#

#if ENABLE_OVERLOADING
    PadStickyEventsForeachMethodInfo        ,
#endif
    padStickyEventsForeach                  ,


-- ** stopTask #method:stopTask#

#if ENABLE_OVERLOADING
    PadStopTaskMethodInfo                   ,
#endif
    padStopTask                             ,


-- ** storeStickyEvent #method:storeStickyEvent#

#if ENABLE_OVERLOADING
    PadStoreStickyEventMethodInfo           ,
#endif
    padStoreStickyEvent                     ,


-- ** unlink #method:unlink#

#if ENABLE_OVERLOADING
    PadUnlinkMethodInfo                     ,
#endif
    padUnlink                               ,


-- ** useFixedCaps #method:useFixedCaps#

#if ENABLE_OVERLOADING
    PadUseFixedCapsMethodInfo               ,
#endif
    padUseFixedCaps                         ,




 -- * Properties
-- ** caps #attr:caps#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    PadCapsPropertyInfo                     ,
#endif
    getPadCaps                              ,
#if ENABLE_OVERLOADING
    padCaps                                 ,
#endif


-- ** direction #attr:direction#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    PadDirectionPropertyInfo                ,
#endif
    constructPadDirection                   ,
    getPadDirection                         ,
#if ENABLE_OVERLOADING
    padDirection                            ,
#endif


-- ** offset #attr:offset#
{- | The offset that will be applied to the running time of the pad.

/Since: 1.6/
-}
#if ENABLE_OVERLOADING
    PadOffsetPropertyInfo                   ,
#endif
    constructPadOffset                      ,
    getPadOffset                            ,
#if ENABLE_OVERLOADING
    padOffset                               ,
#endif
    setPadOffset                            ,


-- ** template #attr:template#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    PadTemplatePropertyInfo                 ,
#endif
    clearPadTemplate                        ,
    constructPadTemplate                    ,
    getPadTemplate                          ,
#if ENABLE_OVERLOADING
    padTemplate                             ,
#endif
    setPadTemplate                          ,




 -- * Signals
-- ** linked #signal:linked#

    C_PadLinkedCallback                     ,
    PadLinkedCallback                       ,
#if ENABLE_OVERLOADING
    PadLinkedSignalInfo                     ,
#endif
    afterPadLinked                          ,
    genClosure_PadLinked                    ,
    mk_PadLinkedCallback                    ,
    noPadLinkedCallback                     ,
    onPadLinked                             ,
    wrap_PadLinkedCallback                  ,


-- ** unlinked #signal:unlinked#

    C_PadUnlinkedCallback                   ,
    PadUnlinkedCallback                     ,
#if ENABLE_OVERLOADING
    PadUnlinkedSignalInfo                   ,
#endif
    afterPadUnlinked                        ,
    genClosure_PadUnlinked                  ,
    mk_PadUnlinkedCallback                  ,
    noPadUnlinkedCallback                   ,
    onPadUnlinked                           ,
    wrap_PadUnlinkedCallback                ,




    ) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL

import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gst.Callbacks as Gst.Callbacks
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Objects.Element as Gst.Element
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.PadTemplate as Gst.PadTemplate
import {-# SOURCE #-} qualified GI.Gst.Objects.Stream as Gst.Stream
import {-# SOURCE #-} qualified GI.Gst.Structs.Buffer as Gst.Buffer
import {-# SOURCE #-} qualified GI.Gst.Structs.BufferList as Gst.BufferList
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.Event as Gst.Event
import {-# SOURCE #-} qualified GI.Gst.Structs.Iterator as Gst.Iterator
import {-# SOURCE #-} qualified GI.Gst.Structs.Query as Gst.Query
import {-# SOURCE #-} qualified GI.Gst.Structs.StaticPadTemplate as Gst.StaticPadTemplate

-- | Memory-managed wrapper type.
newtype Pad = Pad (ManagedPtr Pad)
foreign import ccall "gst_pad_get_type"
    c_gst_pad_get_type :: IO GType

instance GObject Pad where
    gobjectType = c_gst_pad_get_type


-- | Type class for types which can be safely cast to `Pad`, for instance with `toPad`.
class (GObject o, O.IsDescendantOf Pad o) => IsPad o
instance (GObject o, O.IsDescendantOf Pad o) => IsPad o

instance O.HasParentTypes Pad
type instance O.ParentTypes Pad = '[Gst.Object.Object, GObject.Object.Object]

-- | Cast to `Pad`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toPad :: (MonadIO m, IsPad o) => o -> m Pad
toPad = liftIO . unsafeCastTo Pad

-- | A convenience alias for `Nothing` :: `Maybe` `Pad`.
noPad :: Maybe Pad
noPad = Nothing

#if ENABLE_OVERLOADING
type family ResolvePadMethod (t :: Symbol) (o :: *) :: * where
    ResolvePadMethod "activateMode" o = PadActivateModeMethodInfo
    ResolvePadMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolvePadMethod "addProbe" o = PadAddProbeMethodInfo
    ResolvePadMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolvePadMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolvePadMethod "canLink" o = PadCanLinkMethodInfo
    ResolvePadMethod "chain" o = PadChainMethodInfo
    ResolvePadMethod "chainList" o = PadChainListMethodInfo
    ResolvePadMethod "checkReconfigure" o = PadCheckReconfigureMethodInfo
    ResolvePadMethod "createStreamId" o = PadCreateStreamIdMethodInfo
    ResolvePadMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolvePadMethod "eventDefault" o = PadEventDefaultMethodInfo
    ResolvePadMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolvePadMethod "forward" o = PadForwardMethodInfo
    ResolvePadMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolvePadMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolvePadMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolvePadMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolvePadMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolvePadMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolvePadMethod "hasCurrentCaps" o = PadHasCurrentCapsMethodInfo
    ResolvePadMethod "isActive" o = PadIsActiveMethodInfo
    ResolvePadMethod "isBlocked" o = PadIsBlockedMethodInfo
    ResolvePadMethod "isBlocking" o = PadIsBlockingMethodInfo
    ResolvePadMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolvePadMethod "isLinked" o = PadIsLinkedMethodInfo
    ResolvePadMethod "iterateInternalLinks" o = PadIterateInternalLinksMethodInfo
    ResolvePadMethod "iterateInternalLinksDefault" o = PadIterateInternalLinksDefaultMethodInfo
    ResolvePadMethod "link" o = PadLinkMethodInfo
    ResolvePadMethod "linkFull" o = PadLinkFullMethodInfo
    ResolvePadMethod "linkMaybeGhosting" o = PadLinkMaybeGhostingMethodInfo
    ResolvePadMethod "linkMaybeGhostingFull" o = PadLinkMaybeGhostingFullMethodInfo
    ResolvePadMethod "markReconfigure" o = PadMarkReconfigureMethodInfo
    ResolvePadMethod "needsReconfigure" o = PadNeedsReconfigureMethodInfo
    ResolvePadMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolvePadMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolvePadMethod "pauseTask" o = PadPauseTaskMethodInfo
    ResolvePadMethod "peerQuery" o = PadPeerQueryMethodInfo
    ResolvePadMethod "peerQueryAcceptCaps" o = PadPeerQueryAcceptCapsMethodInfo
    ResolvePadMethod "peerQueryCaps" o = PadPeerQueryCapsMethodInfo
    ResolvePadMethod "peerQueryConvert" o = PadPeerQueryConvertMethodInfo
    ResolvePadMethod "peerQueryDuration" o = PadPeerQueryDurationMethodInfo
    ResolvePadMethod "peerQueryPosition" o = PadPeerQueryPositionMethodInfo
    ResolvePadMethod "proxyQueryAcceptCaps" o = PadProxyQueryAcceptCapsMethodInfo
    ResolvePadMethod "proxyQueryCaps" o = PadProxyQueryCapsMethodInfo
    ResolvePadMethod "pullRange" o = PadPullRangeMethodInfo
    ResolvePadMethod "push" o = PadPushMethodInfo
    ResolvePadMethod "pushEvent" o = PadPushEventMethodInfo
    ResolvePadMethod "pushList" o = PadPushListMethodInfo
    ResolvePadMethod "query" o = PadQueryMethodInfo
    ResolvePadMethod "queryAcceptCaps" o = PadQueryAcceptCapsMethodInfo
    ResolvePadMethod "queryCaps" o = PadQueryCapsMethodInfo
    ResolvePadMethod "queryConvert" o = PadQueryConvertMethodInfo
    ResolvePadMethod "queryDefault" o = PadQueryDefaultMethodInfo
    ResolvePadMethod "queryDuration" o = PadQueryDurationMethodInfo
    ResolvePadMethod "queryPosition" o = PadQueryPositionMethodInfo
    ResolvePadMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolvePadMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolvePadMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolvePadMethod "removeProbe" o = PadRemoveProbeMethodInfo
    ResolvePadMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolvePadMethod "sendEvent" o = PadSendEventMethodInfo
    ResolvePadMethod "startTask" o = PadStartTaskMethodInfo
    ResolvePadMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolvePadMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolvePadMethod "stickyEventsForeach" o = PadStickyEventsForeachMethodInfo
    ResolvePadMethod "stopTask" o = PadStopTaskMethodInfo
    ResolvePadMethod "storeStickyEvent" o = PadStoreStickyEventMethodInfo
    ResolvePadMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolvePadMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolvePadMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolvePadMethod "unlink" o = PadUnlinkMethodInfo
    ResolvePadMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolvePadMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolvePadMethod "useFixedCaps" o = PadUseFixedCapsMethodInfo
    ResolvePadMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolvePadMethod "getAllowedCaps" o = PadGetAllowedCapsMethodInfo
    ResolvePadMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolvePadMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolvePadMethod "getCurrentCaps" o = PadGetCurrentCapsMethodInfo
    ResolvePadMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolvePadMethod "getDirection" o = PadGetDirectionMethodInfo
    ResolvePadMethod "getElementPrivate" o = PadGetElementPrivateMethodInfo
    ResolvePadMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolvePadMethod "getLastFlowReturn" o = PadGetLastFlowReturnMethodInfo
    ResolvePadMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolvePadMethod "getOffset" o = PadGetOffsetMethodInfo
    ResolvePadMethod "getPadTemplate" o = PadGetPadTemplateMethodInfo
    ResolvePadMethod "getPadTemplateCaps" o = PadGetPadTemplateCapsMethodInfo
    ResolvePadMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolvePadMethod "getParentElement" o = PadGetParentElementMethodInfo
    ResolvePadMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolvePadMethod "getPeer" o = PadGetPeerMethodInfo
    ResolvePadMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolvePadMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolvePadMethod "getRange" o = PadGetRangeMethodInfo
    ResolvePadMethod "getStickyEvent" o = PadGetStickyEventMethodInfo
    ResolvePadMethod "getStream" o = PadGetStreamMethodInfo
    ResolvePadMethod "getStreamId" o = PadGetStreamIdMethodInfo
    ResolvePadMethod "getTaskState" o = PadGetTaskStateMethodInfo
    ResolvePadMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolvePadMethod "setActivateFunctionFull" o = PadSetActivateFunctionFullMethodInfo
    ResolvePadMethod "setActivatemodeFunctionFull" o = PadSetActivatemodeFunctionFullMethodInfo
    ResolvePadMethod "setActive" o = PadSetActiveMethodInfo
    ResolvePadMethod "setChainFunctionFull" o = PadSetChainFunctionFullMethodInfo
    ResolvePadMethod "setChainListFunctionFull" o = PadSetChainListFunctionFullMethodInfo
    ResolvePadMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolvePadMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolvePadMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolvePadMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolvePadMethod "setElementPrivate" o = PadSetElementPrivateMethodInfo
    ResolvePadMethod "setEventFullFunctionFull" o = PadSetEventFullFunctionFullMethodInfo
    ResolvePadMethod "setEventFunctionFull" o = PadSetEventFunctionFullMethodInfo
    ResolvePadMethod "setGetrangeFunctionFull" o = PadSetGetrangeFunctionFullMethodInfo
    ResolvePadMethod "setIterateInternalLinksFunctionFull" o = PadSetIterateInternalLinksFunctionFullMethodInfo
    ResolvePadMethod "setLinkFunctionFull" o = PadSetLinkFunctionFullMethodInfo
    ResolvePadMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolvePadMethod "setOffset" o = PadSetOffsetMethodInfo
    ResolvePadMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolvePadMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolvePadMethod "setQueryFunctionFull" o = PadSetQueryFunctionFullMethodInfo
    ResolvePadMethod "setUnlinkFunctionFull" o = PadSetUnlinkFunctionFullMethodInfo
    ResolvePadMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolvePadMethod t Pad, O.MethodInfo info Pad p) => OL.IsLabel t (Pad -> 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

-- signal Pad::linked
{- |
Signals that a pad has been linked to the peer pad.
-}
type PadLinkedCallback =
    Pad
    {- ^ /@peer@/: the peer pad that has been connected -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadLinkedCallback`@.
noPadLinkedCallback :: Maybe PadLinkedCallback
noPadLinkedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PadLinkedCallback =
    Ptr () ->                               -- object
    Ptr Pad ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PadLinkedCallback`.
foreign import ccall "wrapper"
    mk_PadLinkedCallback :: C_PadLinkedCallback -> IO (FunPtr C_PadLinkedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PadLinked :: MonadIO m => PadLinkedCallback -> m (GClosure C_PadLinkedCallback)
genClosure_PadLinked cb = liftIO $ do
    let cb' = wrap_PadLinkedCallback cb
    mk_PadLinkedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadLinkedCallback` into a `C_PadLinkedCallback`.
wrap_PadLinkedCallback ::
    PadLinkedCallback ->
    C_PadLinkedCallback
wrap_PadLinkedCallback _cb _ peer _ = do
    peer' <- (newObject Pad) peer
    _cb  peer'


{- |
Connect a signal handler for the “@linked@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' pad #linked callback
@
-}
onPadLinked :: (IsPad a, MonadIO m) => a -> PadLinkedCallback -> m SignalHandlerId
onPadLinked obj cb = liftIO $ do
    let cb' = wrap_PadLinkedCallback cb
    cb'' <- mk_PadLinkedCallback cb'
    connectSignalFunPtr obj "linked" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@linked@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' pad #linked callback
@
-}
afterPadLinked :: (IsPad a, MonadIO m) => a -> PadLinkedCallback -> m SignalHandlerId
afterPadLinked obj cb = liftIO $ do
    let cb' = wrap_PadLinkedCallback cb
    cb'' <- mk_PadLinkedCallback cb'
    connectSignalFunPtr obj "linked" cb'' SignalConnectAfter


-- signal Pad::unlinked
{- |
Signals that a pad has been unlinked from the peer pad.
-}
type PadUnlinkedCallback =
    Pad
    {- ^ /@peer@/: the peer pad that has been disconnected -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadUnlinkedCallback`@.
noPadUnlinkedCallback :: Maybe PadUnlinkedCallback
noPadUnlinkedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PadUnlinkedCallback =
    Ptr () ->                               -- object
    Ptr Pad ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PadUnlinkedCallback`.
foreign import ccall "wrapper"
    mk_PadUnlinkedCallback :: C_PadUnlinkedCallback -> IO (FunPtr C_PadUnlinkedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PadUnlinked :: MonadIO m => PadUnlinkedCallback -> m (GClosure C_PadUnlinkedCallback)
genClosure_PadUnlinked cb = liftIO $ do
    let cb' = wrap_PadUnlinkedCallback cb
    mk_PadUnlinkedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadUnlinkedCallback` into a `C_PadUnlinkedCallback`.
wrap_PadUnlinkedCallback ::
    PadUnlinkedCallback ->
    C_PadUnlinkedCallback
wrap_PadUnlinkedCallback _cb _ peer _ = do
    peer' <- (newObject Pad) peer
    _cb  peer'


{- |
Connect a signal handler for the “@unlinked@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' pad #unlinked callback
@
-}
onPadUnlinked :: (IsPad a, MonadIO m) => a -> PadUnlinkedCallback -> m SignalHandlerId
onPadUnlinked obj cb = liftIO $ do
    let cb' = wrap_PadUnlinkedCallback cb
    cb'' <- mk_PadUnlinkedCallback cb'
    connectSignalFunPtr obj "unlinked" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@unlinked@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' pad #unlinked callback
@
-}
afterPadUnlinked :: (IsPad a, MonadIO m) => a -> PadUnlinkedCallback -> m SignalHandlerId
afterPadUnlinked obj cb = liftIO $ do
    let cb' = wrap_PadUnlinkedCallback cb
    cb'' <- mk_PadUnlinkedCallback cb'
    connectSignalFunPtr obj "unlinked" cb'' SignalConnectAfter


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

{- |
Get the value of the “@caps@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' pad #caps
@
-}
getPadCaps :: (MonadIO m, IsPad o) => o -> m (Maybe Gst.Caps.Caps)
getPadCaps obj = liftIO $ B.Properties.getObjectPropertyBoxed obj "caps" Gst.Caps.Caps

#if ENABLE_OVERLOADING
data PadCapsPropertyInfo
instance AttrInfo PadCapsPropertyInfo where
    type AttrAllowedOps PadCapsPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint PadCapsPropertyInfo = (~) ()
    type AttrBaseTypeConstraint PadCapsPropertyInfo = IsPad
    type AttrGetType PadCapsPropertyInfo = (Maybe Gst.Caps.Caps)
    type AttrLabel PadCapsPropertyInfo = "caps"
    type AttrOrigin PadCapsPropertyInfo = Pad
    attrGet _ = getPadCaps
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "direction"
   -- Type: TInterface (Name {namespace = "Gst", name = "PadDirection"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@direction@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' pad #direction
@
-}
getPadDirection :: (MonadIO m, IsPad o) => o -> m Gst.Enums.PadDirection
getPadDirection obj = liftIO $ B.Properties.getObjectPropertyEnum obj "direction"

{- |
Construct a `GValueConstruct` with valid value for the “@direction@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadDirection :: (IsPad o) => Gst.Enums.PadDirection -> IO (GValueConstruct o)
constructPadDirection val = B.Properties.constructObjectPropertyEnum "direction" val

#if ENABLE_OVERLOADING
data PadDirectionPropertyInfo
instance AttrInfo PadDirectionPropertyInfo where
    type AttrAllowedOps PadDirectionPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint PadDirectionPropertyInfo = (~) Gst.Enums.PadDirection
    type AttrBaseTypeConstraint PadDirectionPropertyInfo = IsPad
    type AttrGetType PadDirectionPropertyInfo = Gst.Enums.PadDirection
    type AttrLabel PadDirectionPropertyInfo = "direction"
    type AttrOrigin PadDirectionPropertyInfo = Pad
    attrGet _ = getPadDirection
    attrSet _ = undefined
    attrConstruct _ = constructPadDirection
    attrClear _ = undefined
#endif

-- VVV Prop "offset"
   -- Type: TBasicType TInt64
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@offset@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' pad #offset
@
-}
getPadOffset :: (MonadIO m, IsPad o) => o -> m Int64
getPadOffset obj = liftIO $ B.Properties.getObjectPropertyInt64 obj "offset"

{- |
Set the value of the “@offset@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' pad [ #offset 'Data.GI.Base.Attributes.:=' value ]
@
-}
setPadOffset :: (MonadIO m, IsPad o) => o -> Int64 -> m ()
setPadOffset obj val = liftIO $ B.Properties.setObjectPropertyInt64 obj "offset" val

{- |
Construct a `GValueConstruct` with valid value for the “@offset@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadOffset :: (IsPad o) => Int64 -> IO (GValueConstruct o)
constructPadOffset val = B.Properties.constructObjectPropertyInt64 "offset" val

#if ENABLE_OVERLOADING
data PadOffsetPropertyInfo
instance AttrInfo PadOffsetPropertyInfo where
    type AttrAllowedOps PadOffsetPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint PadOffsetPropertyInfo = (~) Int64
    type AttrBaseTypeConstraint PadOffsetPropertyInfo = IsPad
    type AttrGetType PadOffsetPropertyInfo = Int64
    type AttrLabel PadOffsetPropertyInfo = "offset"
    type AttrOrigin PadOffsetPropertyInfo = Pad
    attrGet _ = getPadOffset
    attrSet _ = setPadOffset
    attrConstruct _ = constructPadOffset
    attrClear _ = undefined
#endif

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

{- |
Get the value of the “@template@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' pad #template
@
-}
getPadTemplate :: (MonadIO m, IsPad o) => o -> m (Maybe Gst.PadTemplate.PadTemplate)
getPadTemplate obj = liftIO $ B.Properties.getObjectPropertyObject obj "template" Gst.PadTemplate.PadTemplate

{- |
Set the value of the “@template@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' pad [ #template 'Data.GI.Base.Attributes.:=' value ]
@
-}
setPadTemplate :: (MonadIO m, IsPad o, Gst.PadTemplate.IsPadTemplate a) => o -> a -> m ()
setPadTemplate obj val = liftIO $ B.Properties.setObjectPropertyObject obj "template" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@template@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadTemplate :: (IsPad o, Gst.PadTemplate.IsPadTemplate a) => a -> IO (GValueConstruct o)
constructPadTemplate val = B.Properties.constructObjectPropertyObject "template" (Just val)

{- |
Set the value of the “@template@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #template
@
-}
clearPadTemplate :: (MonadIO m, IsPad o) => o -> m ()
clearPadTemplate obj = liftIO $ B.Properties.setObjectPropertyObject obj "template" (Nothing :: Maybe Gst.PadTemplate.PadTemplate)

#if ENABLE_OVERLOADING
data PadTemplatePropertyInfo
instance AttrInfo PadTemplatePropertyInfo where
    type AttrAllowedOps PadTemplatePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint PadTemplatePropertyInfo = Gst.PadTemplate.IsPadTemplate
    type AttrBaseTypeConstraint PadTemplatePropertyInfo = IsPad
    type AttrGetType PadTemplatePropertyInfo = (Maybe Gst.PadTemplate.PadTemplate)
    type AttrLabel PadTemplatePropertyInfo = "template"
    type AttrOrigin PadTemplatePropertyInfo = Pad
    attrGet _ = getPadTemplate
    attrSet _ = setPadTemplate
    attrConstruct _ = constructPadTemplate
    attrClear _ = clearPadTemplate
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList Pad
type instance O.AttributeList Pad = PadAttributeList
type PadAttributeList = ('[ '("caps", PadCapsPropertyInfo), '("direction", PadDirectionPropertyInfo), '("name", Gst.Object.ObjectNamePropertyInfo), '("offset", PadOffsetPropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("template", PadTemplatePropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
padCaps :: AttrLabelProxy "caps"
padCaps = AttrLabelProxy

padDirection :: AttrLabelProxy "direction"
padDirection = AttrLabelProxy

padOffset :: AttrLabelProxy "offset"
padOffset = AttrLabelProxy

padTemplate :: AttrLabelProxy "template"
padTemplate = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data PadLinkedSignalInfo
instance SignalInfo PadLinkedSignalInfo where
    type HaskellCallbackType PadLinkedSignalInfo = PadLinkedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PadLinkedCallback cb
        cb'' <- mk_PadLinkedCallback cb'
        connectSignalFunPtr obj "linked" cb'' connectMode

data PadUnlinkedSignalInfo
instance SignalInfo PadUnlinkedSignalInfo where
    type HaskellCallbackType PadUnlinkedSignalInfo = PadUnlinkedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PadUnlinkedCallback cb
        cb'' <- mk_PadUnlinkedCallback cb'
        connectSignalFunPtr obj "unlinked" cb'' connectMode

type instance O.SignalList Pad = PadSignalList
type PadSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("linked", PadLinkedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("unlinked", PadUnlinkedSignalInfo)] :: [(Symbol, *)])

#endif

-- method Pad::new
-- method type : Constructor
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the name of the new pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "direction", argType = TInterface (Name {namespace = "Gst", name = "PadDirection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadDirection of the pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Pad"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_new" gst_pad_new ::
    CString ->                              -- name : TBasicType TUTF8
    CUInt ->                                -- direction : TInterface (Name {namespace = "Gst", name = "PadDirection"})
    IO (Ptr Pad)

{- |
Creates a new pad with the given name in the given direction.
If name is 'Nothing', a guaranteed unique name (across all pads)
will be assigned.
This function makes a copy of the name so you can safely free the name.
-}
padNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@name@/: the name of the new pad. -}
    -> Gst.Enums.PadDirection
    {- ^ /@direction@/: the 'GI.Gst.Enums.PadDirection' of the pad. -}
    -> m (Maybe Pad)
    {- ^ __Returns:__ a new 'GI.Gst.Objects.Pad.Pad'.

MT safe. -}
padNew name direction = liftIO $ do
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    let direction' = (fromIntegral . fromEnum) direction
    result <- gst_pad_new maybeName direction'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Pad) result'
        return result''
    freeMem maybeName
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Pad::new_from_static_template
-- method type : Constructor
-- Args : [Arg {argCName = "templ", argType = TInterface (Name {namespace = "Gst", name = "StaticPadTemplate"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStaticPadTemplate to use", 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 of the pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Pad"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_new_from_static_template" gst_pad_new_from_static_template ::
    Ptr Gst.StaticPadTemplate.StaticPadTemplate -> -- templ : TInterface (Name {namespace = "Gst", name = "StaticPadTemplate"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Pad)

{- |
Creates a new pad with the given name from the given static template.
If name is 'Nothing', a guaranteed unique name (across all pads)
will be assigned.
This function makes a copy of the name so you can safely free the name.
-}
padNewFromStaticTemplate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.StaticPadTemplate.StaticPadTemplate
    {- ^ /@templ@/: the 'GI.Gst.Structs.StaticPadTemplate.StaticPadTemplate' to use -}
    -> T.Text
    {- ^ /@name@/: the name of the pad -}
    -> m (Maybe Pad)
    {- ^ __Returns:__ a new 'GI.Gst.Objects.Pad.Pad'. -}
padNewFromStaticTemplate templ name = liftIO $ do
    templ' <- unsafeManagedPtrGetPtr templ
    name' <- textToCString name
    result <- gst_pad_new_from_static_template templ' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Pad) result'
        return result''
    touchManagedPtr templ
    freeMem name'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Pad::new_from_template
-- method type : Constructor
-- Args : [Arg {argCName = "templ", argType = TInterface (Name {namespace = "Gst", name = "PadTemplate"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pad template to use", 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 "the name of the pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Pad"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_new_from_template" gst_pad_new_from_template ::
    Ptr Gst.PadTemplate.PadTemplate ->      -- templ : TInterface (Name {namespace = "Gst", name = "PadTemplate"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Pad)

{- |
Creates a new pad with the given name from the given template.
If name is 'Nothing', a guaranteed unique name (across all pads)
will be assigned.
This function makes a copy of the name so you can safely free the name.
-}
padNewFromTemplate ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.PadTemplate.IsPadTemplate a) =>
    a
    {- ^ /@templ@/: the pad template to use -}
    -> Maybe (T.Text)
    {- ^ /@name@/: the name of the pad -}
    -> m (Maybe Pad)
    {- ^ __Returns:__ a new 'GI.Gst.Objects.Pad.Pad'. -}
padNewFromTemplate templ name = liftIO $ do
    templ' <- unsafeManagedPtrCastPtr templ
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    result <- gst_pad_new_from_template templ' maybeName
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Pad) result'
        return result''
    touchManagedPtr templ
    freeMem maybeName
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Pad::activate_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to activate or deactivate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "PadMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested activation mode", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether or not the pad should be active.", 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_pad_activate_mode" gst_pad_activate_mode ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "PadMode"})
    CInt ->                                 -- active : TBasicType TBoolean
    IO CInt

{- |
Activates or deactivates the given pad in /@mode@/ via dispatching to the
pad\'s activatemodefunc. For use from within pad activation functions only.

If you don\'t know what this is, you probably don\'t want to call it.
-}
padActivateMode ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to activate or deactivate. -}
    -> Gst.Enums.PadMode
    {- ^ /@mode@/: the requested activation mode -}
    -> Bool
    {- ^ /@active@/: whether or not the pad should be active. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the operation was successful.

MT safe. -}
padActivateMode pad mode active = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let mode' = (fromIntegral . fromEnum) mode
    let active' = (fromIntegral . fromEnum) active
    result <- gst_pad_activate_mode pad' mode' active'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadActivateModeMethodInfo
instance (signature ~ (Gst.Enums.PadMode -> Bool -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadActivateModeMethodInfo a signature where
    overloadedMethod _ = padActivateMode

#endif

-- method Pad::add_probe
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to add the probe to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mask", argType = TInterface (Name {namespace = "Gst", name = "PadProbeType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the probe mask", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gst", name = "PadProbeCallback"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstPadProbeCallback that will be called with notifications of\n          the pad state", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy_data", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GDestroyNotify for user_data", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TULong)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_add_probe" gst_pad_add_probe ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- mask : TInterface (Name {namespace = "Gst", name = "PadProbeType"})
    FunPtr Gst.Callbacks.C_PadProbeCallback -> -- callback : TInterface (Name {namespace = "Gst", name = "PadProbeCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy_data : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO CULong

{- |
Be notified of different states of pads. The provided callback is called for
every state that matches /@mask@/.

Probes are called in groups: First GST_PAD_PROBE_TYPE_BLOCK probes are
called, then others, then finally GST_PAD_PROBE_TYPE_IDLE. The only
exception here are GST_PAD_PROBE_TYPE_IDLE probes that are called
immediately if the pad is already idle while calling 'GI.Gst.Objects.Pad.padAddProbe'.
In each of the groups, probes are called in the order in which they were
added.
-}
padAddProbe ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to add the probe to -}
    -> [Gst.Flags.PadProbeType]
    {- ^ /@mask@/: the probe mask -}
    -> Gst.Callbacks.PadProbeCallback
    {- ^ /@callback@/: 'GI.Gst.Callbacks.PadProbeCallback' that will be called with notifications of
          the pad state -}
    -> m CULong
    {- ^ __Returns:__ an id or 0 if no probe is pending. The id can be used to remove the
probe with 'GI.Gst.Objects.Pad.padRemoveProbe'. When using GST_PAD_PROBE_TYPE_IDLE it can
happen that the probe can be run immediately and if the probe returns
GST_PAD_PROBE_REMOVE this functions returns 0.

MT safe. -}
padAddProbe pad mask callback = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let mask' = gflagsToWord mask
    callback' <- Gst.Callbacks.mk_PadProbeCallback (Gst.Callbacks.wrap_PadProbeCallback Nothing (Gst.Callbacks.drop_closures_PadProbeCallback callback))
    let userData = castFunPtrToPtr callback'
    let destroyData = safeFreeFunPtrPtr
    result <- gst_pad_add_probe pad' mask' callback' userData destroyData
    touchManagedPtr pad
    return result

#if ENABLE_OVERLOADING
data PadAddProbeMethodInfo
instance (signature ~ ([Gst.Flags.PadProbeType] -> Gst.Callbacks.PadProbeCallback -> m CULong), MonadIO m, IsPad a) => O.MethodInfo PadAddProbeMethodInfo a signature where
    overloadedMethod _ = padAddProbe

#endif

-- method Pad::can_link
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srcpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "sinkpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad.", 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_pad_can_link" gst_pad_can_link ::
    Ptr Pad ->                              -- srcpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Pad ->                              -- sinkpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Checks if the source pad and the sink pad are compatible so they can be
linked.
-}
padCanLink ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, IsPad b) =>
    a
    {- ^ /@srcpad@/: the source 'GI.Gst.Objects.Pad.Pad'. -}
    -> b
    {- ^ /@sinkpad@/: the sink 'GI.Gst.Objects.Pad.Pad'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pads can be linked. -}
padCanLink srcpad sinkpad = liftIO $ do
    srcpad' <- unsafeManagedPtrCastPtr srcpad
    sinkpad' <- unsafeManagedPtrCastPtr sinkpad
    result <- gst_pad_can_link srcpad' sinkpad'
    let result' = (/= 0) result
    touchManagedPtr srcpad
    touchManagedPtr sinkpad
    return result'

#if ENABLE_OVERLOADING
data PadCanLinkMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsPad a, IsPad b) => O.MethodInfo PadCanLinkMethodInfo a signature where
    overloadedMethod _ = padCanLink

#endif

-- method Pad::chain
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a sink #GstPad, returns GST_FLOW_ERROR if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBuffer to send, return GST_FLOW_ERROR\n    if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_chain" gst_pad_chain ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO CInt

{- |
Chain a buffer to /@pad@/.

The function returns @/GST_FLOW_FLUSHING/@ if the pad was flushing.

If the buffer type is not acceptable for /@pad@/ (as negotiated with a
preceding GST_EVENT_CAPS event), this function returns
@/GST_FLOW_NOT_NEGOTIATED/@.

The function proceeds calling the chain function installed on /@pad@/ (see
@/gst_pad_set_chain_function()/@) and the return value of that function is
returned to the caller. @/GST_FLOW_NOT_SUPPORTED/@ is returned if /@pad@/ has no
chain function.

In all cases, success or failure, the caller loses its reference to /@buffer@/
after calling this function.
-}
padChain ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a sink 'GI.Gst.Objects.Pad.Pad', returns GST_FLOW_ERROR if not. -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: the 'GI.Gst.Structs.Buffer.Buffer' to send, return GST_FLOW_ERROR
    if not. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' from the pad.

MT safe. -}
padChain pad buffer = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    buffer' <- B.ManagedPtr.disownBoxed buffer
    result <- gst_pad_chain pad' buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    touchManagedPtr buffer
    return result'

#if ENABLE_OVERLOADING
data PadChainMethodInfo
instance (signature ~ (Gst.Buffer.Buffer -> m Gst.Enums.FlowReturn), MonadIO m, IsPad a) => O.MethodInfo PadChainMethodInfo a signature where
    overloadedMethod _ = padChain

#endif

-- method Pad::chain_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a sink #GstPad, returns GST_FLOW_ERROR if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TInterface (Name {namespace = "Gst", name = "BufferList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferList to send, return GST_FLOW_ERROR\n    if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_chain_list" gst_pad_chain_list ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.BufferList.BufferList ->        -- list : TInterface (Name {namespace = "Gst", name = "BufferList"})
    IO CInt

{- |
Chain a bufferlist to /@pad@/.

The function returns @/GST_FLOW_FLUSHING/@ if the pad was flushing.

If /@pad@/ was not negotiated properly with a CAPS event, this function
returns @/GST_FLOW_NOT_NEGOTIATED/@.

The function proceeds calling the chainlist function installed on /@pad@/ (see
@/gst_pad_set_chain_list_function()/@) and the return value of that function is
returned to the caller. @/GST_FLOW_NOT_SUPPORTED/@ is returned if /@pad@/ has no
chainlist function.

In all cases, success or failure, the caller loses its reference to /@list@/
after calling this function.

MT safe.
-}
padChainList ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a sink 'GI.Gst.Objects.Pad.Pad', returns GST_FLOW_ERROR if not. -}
    -> Gst.BufferList.BufferList
    {- ^ /@list@/: the 'GI.Gst.Structs.BufferList.BufferList' to send, return GST_FLOW_ERROR
    if not. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' from the pad. -}
padChainList pad list = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    list' <- B.ManagedPtr.disownBoxed list
    result <- gst_pad_chain_list pad' list'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    touchManagedPtr list
    return result'

#if ENABLE_OVERLOADING
data PadChainListMethodInfo
instance (signature ~ (Gst.BufferList.BufferList -> m Gst.Enums.FlowReturn), MonadIO m, IsPad a) => O.MethodInfo PadChainListMethodInfo a signature where
    overloadedMethod _ = padChainList

#endif

-- method Pad::check_reconfigure
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to check", 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_pad_check_reconfigure" gst_pad_check_reconfigure ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Check and clear the @/GST_PAD_FLAG_NEED_RECONFIGURE/@ flag on /@pad@/ and return 'True'
if the flag was set.
-}
padCheckReconfigure ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on /@pad@/. -}
padCheckReconfigure pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_check_reconfigure pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadCheckReconfigureMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadCheckReconfigureMethodInfo a signature where
    overloadedMethod _ = padCheckReconfigure

#endif

-- method Pad::create_stream_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A source #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Parent #GstElement of @pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stream_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The stream-id", 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_pad_create_stream_id" gst_pad_create_stream_id ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Element.Element ->              -- parent : TInterface (Name {namespace = "Gst", name = "Element"})
    CString ->                              -- stream_id : TBasicType TUTF8
    IO CString

{- |
Creates a stream-id for the source 'GI.Gst.Objects.Pad.Pad' /@pad@/ by combining the
upstream information with the optional /@streamId@/ of the stream
of /@pad@/. /@pad@/ must have a parent 'GI.Gst.Objects.Element.Element' and which must have zero
or one sinkpad. /@streamId@/ can only be 'Nothing' if the parent element
of /@pad@/ has only a single source pad.

This function generates an unique stream-id by getting the upstream
stream-start event stream ID and appending /@streamId@/ to it. If the
element has no sinkpad it will generate an upstream stream-id by
doing an URI query on the element and in the worst case just uses
a random number. Source elements that don\'t implement the URI
handler interface should ideally generate a unique, deterministic
stream-id manually instead.

Since stream IDs are sorted alphabetically, any numbers in the
stream ID should be printed with a fixed number of characters,
preceded by 0\'s, such as by using the format %03u instead of %u.
-}
padCreateStreamId ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, Gst.Element.IsElement b) =>
    a
    {- ^ /@pad@/: A source 'GI.Gst.Objects.Pad.Pad' -}
    -> b
    {- ^ /@parent@/: Parent 'GI.Gst.Objects.Element.Element' of /@pad@/ -}
    -> Maybe (T.Text)
    {- ^ /@streamId@/: The stream-id -}
    -> m T.Text
    {- ^ __Returns:__ A stream-id for /@pad@/. 'GI.GLib.Functions.free' after usage. -}
padCreateStreamId pad parent streamId = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    parent' <- unsafeManagedPtrCastPtr parent
    maybeStreamId <- case streamId of
        Nothing -> return nullPtr
        Just jStreamId -> do
            jStreamId' <- textToCString jStreamId
            return jStreamId'
    result <- gst_pad_create_stream_id pad' parent' maybeStreamId
    checkUnexpectedReturnNULL "padCreateStreamId" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr pad
    touchManagedPtr parent
    freeMem maybeStreamId
    return result'

#if ENABLE_OVERLOADING
data PadCreateStreamIdMethodInfo
instance (signature ~ (b -> Maybe (T.Text) -> m T.Text), MonadIO m, IsPad a, Gst.Element.IsElement b) => O.MethodInfo PadCreateStreamIdMethodInfo a signature where
    overloadedMethod _ = padCreateStreamId

#endif

-- method Pad::event_default
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to call the default event handler on.", 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 = True, argDoc = Documentation {rawDocText = Just "the parent of @pad or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEvent to handle.", 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_pad_event_default" gst_pad_event_default ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Object.Object ->                -- parent : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    IO CInt

{- |
Invokes the default event handler for the given pad.

The EOS event will pause the task associated with /@pad@/ before it is forwarded
to all internally linked pads,

The event is sent to all pads internally linked to /@pad@/. This function
takes ownership of /@event@/.
-}
padEventDefault ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, Gst.Object.IsObject b) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to call the default event handler on. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/ or 'Nothing' -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' to handle. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the event was sent successfully. -}
padEventDefault pad parent event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    event' <- B.ManagedPtr.disownBoxed event
    result <- gst_pad_event_default pad' maybeParent event'
    let result' = (/= 0) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr event
    return result'

#if ENABLE_OVERLOADING
data PadEventDefaultMethodInfo
instance (signature ~ (Maybe (b) -> Gst.Event.Event -> m Bool), MonadIO m, IsPad a, Gst.Object.IsObject b) => O.MethodInfo PadEventDefaultMethodInfo a signature where
    overloadedMethod _ = padEventDefault

#endif

-- method Pad::forward
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "forward", argType = TInterface (Name {namespace = "Gst", name = "PadForwardFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPadForwardFunction", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @forward", 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_pad_forward" gst_pad_forward ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadForwardFunction -> -- forward : TInterface (Name {namespace = "Gst", name = "PadForwardFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO CInt

{- |
Calls /@forward@/ for all internally linked pads of /@pad@/. This function deals with
dynamically changing internal pads and will make sure that the /@forward@/
function is only called once for each pad.

When /@forward@/ returns 'True', no further pads will be processed.
-}
padForward ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> Gst.Callbacks.PadForwardFunction
    {- ^ /@forward@/: a 'GI.Gst.Callbacks.PadForwardFunction' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if one of the dispatcher functions returned 'True'. -}
padForward pad forward = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    forward' <- Gst.Callbacks.mk_PadForwardFunction (Gst.Callbacks.wrap_PadForwardFunction Nothing (Gst.Callbacks.drop_closures_PadForwardFunction forward))
    let userData = nullPtr
    result <- gst_pad_forward pad' forward' userData
    let result' = (/= 0) result
    safeFreeFunPtr $ castFunPtrToPtr forward'
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadForwardMethodInfo
instance (signature ~ (Gst.Callbacks.PadForwardFunction -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadForwardMethodInfo a signature where
    overloadedMethod _ = padForward

#endif

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

foreign import ccall "gst_pad_get_allowed_caps" gst_pad_get_allowed_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Gst.Caps.Caps)

{- |
Gets the capabilities of the allowed media types that can flow through
/@pad@/ and its peer.

The allowed capabilities is calculated as the intersection of the results of
calling 'GI.Gst.Objects.Pad.padQueryCaps' on /@pad@/ and its peer. The caller owns a reference
on the resulting caps.
-}
padGetAllowedCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad'. -}
    -> m (Maybe Gst.Caps.Caps)
    {- ^ __Returns:__ the allowed 'GI.Gst.Structs.Caps.Caps' of the
    pad link. Unref the caps when you no longer need it. This
    function returns 'Nothing' when /@pad@/ has no peer.

MT safe. -}
padGetAllowedCaps pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_allowed_caps pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Caps.Caps) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetAllowedCapsMethodInfo
instance (signature ~ (m (Maybe Gst.Caps.Caps)), MonadIO m, IsPad a) => O.MethodInfo PadGetAllowedCapsMethodInfo a signature where
    overloadedMethod _ = padGetAllowedCaps

#endif

-- method Pad::get_current_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a  #GstPad to get the current capabilities of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_current_caps" gst_pad_get_current_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Gst.Caps.Caps)

{- |
Gets the capabilities currently configured on /@pad@/ with the last
@/GST_EVENT_CAPS/@ event.
-}
padGetCurrentCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a  'GI.Gst.Objects.Pad.Pad' to get the current capabilities of. -}
    -> m (Maybe Gst.Caps.Caps)
    {- ^ __Returns:__ the current caps of the pad with
incremented ref-count or 'Nothing' when pad has no caps. Unref after usage. -}
padGetCurrentCaps pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_current_caps pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Caps.Caps) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetCurrentCapsMethodInfo
instance (signature ~ (m (Maybe Gst.Caps.Caps)), MonadIO m, IsPad a) => O.MethodInfo PadGetCurrentCapsMethodInfo a signature where
    overloadedMethod _ = padGetCurrentCaps

#endif

-- method Pad::get_direction
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to get the direction of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PadDirection"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_direction" gst_pad_get_direction ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CUInt

{- |
Gets the direction of the pad. The direction of the pad is
decided at construction time so this function does not take
the LOCK.
-}
padGetDirection ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to get the direction of. -}
    -> m Gst.Enums.PadDirection
    {- ^ __Returns:__ the 'GI.Gst.Enums.PadDirection' of the pad.

MT safe. -}
padGetDirection pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_direction pad'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadGetDirectionMethodInfo
instance (signature ~ (m Gst.Enums.PadDirection), MonadIO m, IsPad a) => O.MethodInfo PadGetDirectionMethodInfo a signature where
    overloadedMethod _ = padGetDirection

#endif

-- method Pad::get_element_private
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to get the private data of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_element_private" gst_pad_get_element_private ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr ())

{- |
Gets the private data of a pad.
No locking is performed in this function.
-}
padGetElementPrivate ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to get the private data of. -}
    -> m (Ptr ())
    {- ^ __Returns:__ a @/gpointer/@ to the private data. -}
padGetElementPrivate pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_element_private pad'
    touchManagedPtr pad
    return result

#if ENABLE_OVERLOADING
data PadGetElementPrivateMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsPad a) => O.MethodInfo PadGetElementPrivateMethodInfo a signature where
    overloadedMethod _ = padGetElementPrivate

#endif

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

foreign import ccall "gst_pad_get_last_flow_return" gst_pad_get_last_flow_return ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Gets the 'GI.Gst.Enums.FlowReturn' return from the last data passed by this pad.

/Since: 1.4/
-}
padGetLastFlowReturn ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' -}
    -> m Gst.Enums.FlowReturn
padGetLastFlowReturn pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_last_flow_return pad'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadGetLastFlowReturnMethodInfo
instance (signature ~ (m Gst.Enums.FlowReturn), MonadIO m, IsPad a) => O.MethodInfo PadGetLastFlowReturnMethodInfo a signature where
    overloadedMethod _ = padGetLastFlowReturn

#endif

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

foreign import ccall "gst_pad_get_offset" gst_pad_get_offset ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO Int64

{- |
Get the offset applied to the running time of /@pad@/. /@pad@/ has to be a source
pad.
-}
padGetOffset ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> m Int64
    {- ^ __Returns:__ the offset. -}
padGetOffset pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_offset pad'
    touchManagedPtr pad
    return result

#if ENABLE_OVERLOADING
data PadGetOffsetMethodInfo
instance (signature ~ (m Int64), MonadIO m, IsPad a) => O.MethodInfo PadGetOffsetMethodInfo a signature where
    overloadedMethod _ = padGetOffset

#endif

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

foreign import ccall "gst_pad_get_pad_template" gst_pad_get_pad_template ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Gst.PadTemplate.PadTemplate)

{- |
Gets the template for /@pad@/.
-}
padGetPadTemplate ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad'. -}
    -> m (Maybe Gst.PadTemplate.PadTemplate)
    {- ^ __Returns:__ the 'GI.Gst.Objects.PadTemplate.PadTemplate' from which
    this pad was instantiated, or 'Nothing' if this pad has no
    template. Unref after usage. -}
padGetPadTemplate pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_pad_template pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.PadTemplate.PadTemplate) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetPadTemplateMethodInfo
instance (signature ~ (m (Maybe Gst.PadTemplate.PadTemplate)), MonadIO m, IsPad a) => O.MethodInfo PadGetPadTemplateMethodInfo a signature where
    overloadedMethod _ = padGetPadTemplate

#endif

-- method Pad::get_pad_template_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to get the template capabilities from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_pad_template_caps" gst_pad_get_pad_template_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Gst.Caps.Caps)

{- |
Gets the capabilities for /@pad@/\'s template.
-}
padGetPadTemplateCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to get the template capabilities from. -}
    -> m Gst.Caps.Caps
    {- ^ __Returns:__ the 'GI.Gst.Structs.Caps.Caps' of this pad template.
Unref after usage. -}
padGetPadTemplateCaps pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_pad_template_caps pad'
    checkUnexpectedReturnNULL "padGetPadTemplateCaps" result
    result' <- (wrapBoxed Gst.Caps.Caps) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadGetPadTemplateCapsMethodInfo
instance (signature ~ (m Gst.Caps.Caps), MonadIO m, IsPad a) => O.MethodInfo PadGetPadTemplateCapsMethodInfo a signature where
    overloadedMethod _ = padGetPadTemplateCaps

#endif

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

foreign import ccall "gst_pad_get_parent_element" gst_pad_get_parent_element ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Gst.Element.Element)

{- |
Gets the parent of /@pad@/, cast to a 'GI.Gst.Objects.Element.Element'. If a /@pad@/ has no parent or
its parent is not an element, return 'Nothing'.
-}
padGetParentElement ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a pad -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ the parent of the pad. The
caller has a reference on the parent, so unref when you\'re finished
with it.

MT safe. -}
padGetParentElement pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_parent_element pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Element.Element) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetParentElementMethodInfo
instance (signature ~ (m (Maybe Gst.Element.Element)), MonadIO m, IsPad a) => O.MethodInfo PadGetParentElementMethodInfo a signature where
    overloadedMethod _ = padGetParentElement

#endif

-- method Pad::get_peer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to get the peer of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Pad"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_peer" gst_pad_get_peer ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Pad)

{- |
Gets the peer of /@pad@/. This function refs the peer pad so
you need to unref it after use.
-}
padGetPeer ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to get the peer of. -}
    -> m (Maybe Pad)
    {- ^ __Returns:__ the peer 'GI.Gst.Objects.Pad.Pad'. Unref after usage.

MT safe. -}
padGetPeer pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_peer pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Pad) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetPeerMethodInfo
instance (signature ~ (m (Maybe Pad)), MonadIO m, IsPad a) => O.MethodInfo PadGetPeerMethodInfo a signature where
    overloadedMethod _ = padGetPeer

#endif

-- method Pad::get_range
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a src #GstPad, returns #GST_FLOW_ERROR if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The start offset of the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The length of the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the #GstBuffer,\n    returns #GST_FLOW_ERROR if %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_range" gst_pad_get_range ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Word64 ->                               -- offset : TBasicType TUInt64
    Word32 ->                               -- size : TBasicType TUInt
    Ptr (Ptr Gst.Buffer.Buffer) ->          -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO CInt

{- |
When /@pad@/ is flushing this function returns @/GST_FLOW_FLUSHING/@
immediately and /@buffer@/ is 'Nothing'.

Calls the getrange function of /@pad@/, see 'GI.Gst.Callbacks.PadGetRangeFunction' for a
description of a getrange function. If /@pad@/ has no getrange function
installed (see @/gst_pad_set_getrange_function()/@) this function returns
@/GST_FLOW_NOT_SUPPORTED/@.

If /@buffer@/ points to a variable holding 'Nothing', a valid new 'GI.Gst.Structs.Buffer.Buffer' will be
placed in /@buffer@/ when this function returns @/GST_FLOW_OK/@. The new buffer
must be freed with @/gst_buffer_unref()/@ after usage.

When /@buffer@/ points to a variable that points to a valid 'GI.Gst.Structs.Buffer.Buffer', the
buffer will be filled with the result data when this function returns
@/GST_FLOW_OK/@. If the provided buffer is larger than /@size@/, only
/@size@/ bytes will be filled in the result buffer and its size will be updated
accordingly.

Note that less than /@size@/ bytes can be returned in /@buffer@/ when, for example,
an EOS condition is near or when /@buffer@/ is not large enough to hold /@size@/
bytes. The caller should check the result buffer size to get the result size.

When this function returns any other result value than @/GST_FLOW_OK/@, /@buffer@/
will be unchanged.

This is a lowlevel function. Usually 'GI.Gst.Objects.Pad.padPullRange' is used.
-}
padGetRange ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a src 'GI.Gst.Objects.Pad.Pad', returns @/GST_FLOW_ERROR/@ if not. -}
    -> Word64
    {- ^ /@offset@/: The start offset of the buffer -}
    -> Word32
    {- ^ /@size@/: The length of the buffer -}
    -> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' from the pad.

MT safe. -}
padGetRange pad offset size = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    buffer <- allocMem :: IO (Ptr (Ptr Gst.Buffer.Buffer))
    result <- gst_pad_get_range pad' offset size buffer
    let result' = (toEnum . fromIntegral) result
    buffer' <- peek buffer
    buffer'' <- (wrapBoxed Gst.Buffer.Buffer) buffer'
    touchManagedPtr pad
    freeMem buffer
    return (result', buffer'')

#if ENABLE_OVERLOADING
data PadGetRangeMethodInfo
instance (signature ~ (Word64 -> Word32 -> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))), MonadIO m, IsPad a) => O.MethodInfo PadGetRangeMethodInfo a signature where
    overloadedMethod _ = padGetRange

#endif

-- method Pad::get_sticky_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to get the event from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event_type", argType = TInterface (Name {namespace = "Gst", name = "EventType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEventType that should be retrieved.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index of the event", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Event"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_sticky_event" gst_pad_get_sticky_event ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- event_type : TInterface (Name {namespace = "Gst", name = "EventType"})
    Word32 ->                               -- idx : TBasicType TUInt
    IO (Ptr Gst.Event.Event)

{- |
Returns a new reference of the sticky event of type /@eventType@/
from the event.
-}
padGetStickyEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to get the event from. -}
    -> Gst.Enums.EventType
    {- ^ /@eventType@/: the 'GI.Gst.Enums.EventType' that should be retrieved. -}
    -> Word32
    {- ^ /@idx@/: the index of the event -}
    -> m (Maybe Gst.Event.Event)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Event.Event' of type
/@eventType@/ or 'Nothing' when no event of /@eventType@/ was on
/@pad@/. Unref after usage. -}
padGetStickyEvent pad eventType idx = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let eventType' = (fromIntegral . fromEnum) eventType
    result <- gst_pad_get_sticky_event pad' eventType' idx
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Event.Event) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetStickyEventMethodInfo
instance (signature ~ (Gst.Enums.EventType -> Word32 -> m (Maybe Gst.Event.Event)), MonadIO m, IsPad a) => O.MethodInfo PadGetStickyEventMethodInfo a signature where
    overloadedMethod _ = padGetStickyEvent

#endif

-- method Pad::get_stream
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A source #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Stream"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_stream" gst_pad_get_stream ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Gst.Stream.Stream)

{- |
Returns the current 'GI.Gst.Objects.Stream.Stream' for the /@pad@/, or 'Nothing' if none has been
set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around 'GI.Gst.Objects.Pad.padGetStickyEvent' and
'GI.Gst.Structs.Event.eventParseStream'.

/Since: 1.10/
-}
padGetStream ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: A source 'GI.Gst.Objects.Pad.Pad' -}
    -> m (Maybe Gst.Stream.Stream)
    {- ^ __Returns:__ the current 'GI.Gst.Objects.Stream.Stream' for /@pad@/, or 'Nothing'.
    unref the returned stream when no longer needed. -}
padGetStream pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_stream pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Stream.Stream) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetStreamMethodInfo
instance (signature ~ (m (Maybe Gst.Stream.Stream)), MonadIO m, IsPad a) => O.MethodInfo PadGetStreamMethodInfo a signature where
    overloadedMethod _ = padGetStream

#endif

-- method Pad::get_stream_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A source #GstPad", 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_pad_get_stream_id" gst_pad_get_stream_id ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CString

{- |
Returns the current stream-id for the /@pad@/, or 'Nothing' if none has been
set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around 'GI.Gst.Objects.Pad.padGetStickyEvent' and
'GI.Gst.Structs.Event.eventParseStreamStart'.

The returned stream-id string should be treated as an opaque string, its
contents should not be interpreted.

/Since: 1.2/
-}
padGetStreamId ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: A source 'GI.Gst.Objects.Pad.Pad' -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ a newly-allocated copy of the stream-id for
    /@pad@/, or 'Nothing'.  'GI.GLib.Functions.free' the returned string when no longer
    needed. -}
padGetStreamId pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_stream_id pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadGetStreamIdMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsPad a) => O.MethodInfo PadGetStreamIdMethodInfo a signature where
    overloadedMethod _ = padGetStreamId

#endif

-- method Pad::get_task_state
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to get task state from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "TaskState"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_get_task_state" gst_pad_get_task_state ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CUInt

{- |
Get /@pad@/ task state. If no task is currently
set, @/GST_TASK_STOPPED/@ is returned.

/Since: 1.12/
-}
padGetTaskState ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to get task state from -}
    -> m Gst.Enums.TaskState
    {- ^ __Returns:__ The current state of /@pad@/\'s task. -}
padGetTaskState pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_get_task_state pad'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadGetTaskStateMethodInfo
instance (signature ~ (m Gst.Enums.TaskState), MonadIO m, IsPad a) => O.MethodInfo PadGetTaskStateMethodInfo a signature where
    overloadedMethod _ = padGetTaskState

#endif

-- method Pad::has_current_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a  #GstPad to check", 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_pad_has_current_caps" gst_pad_has_current_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Check if /@pad@/ has caps set on it with a @/GST_EVENT_CAPS/@ event.
-}
padHasCurrentCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a  'GI.Gst.Objects.Pad.Pad' to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' when /@pad@/ has caps associated with it. -}
padHasCurrentCaps pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_has_current_caps pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadHasCurrentCapsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadHasCurrentCapsMethodInfo a signature where
    overloadedMethod _ = padHasCurrentCaps

#endif

-- method Pad::is_active
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to query", 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_pad_is_active" gst_pad_is_active ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Query if a pad is active
-}
padIsActive ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to query -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad is active.

MT safe. -}
padIsActive pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_is_active pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadIsActiveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadIsActiveMethodInfo a signature where
    overloadedMethod _ = padIsActive

#endif

-- method Pad::is_blocked
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to query", 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_pad_is_blocked" gst_pad_is_blocked ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Checks if the pad is blocked or not. This function returns the
last requested state of the pad. It is not certain that the pad
is actually blocking at this point (see 'GI.Gst.Objects.Pad.padIsBlocking').
-}
padIsBlocked ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to query -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad is blocked.

MT safe. -}
padIsBlocked pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_is_blocked pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadIsBlockedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadIsBlockedMethodInfo a signature where
    overloadedMethod _ = padIsBlocked

#endif

-- method Pad::is_blocking
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to query", 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_pad_is_blocking" gst_pad_is_blocking ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Checks if the pad is blocking or not. This is a guaranteed state
of whether the pad is actually blocking on a 'GI.Gst.Structs.Buffer.Buffer' or a 'GI.Gst.Structs.Event.Event'.
-}
padIsBlocking ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to query -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad is blocking.

MT safe. -}
padIsBlocking pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_is_blocking pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadIsBlockingMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadIsBlockingMethodInfo a signature where
    overloadedMethod _ = padIsBlocking

#endif

-- method Pad::is_linked
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pad to check", 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_pad_is_linked" gst_pad_is_linked ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Checks if a /@pad@/ is linked to another pad or not.
-}
padIsLinked ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: pad to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad is linked, 'False' otherwise.

MT safe. -}
padIsLinked pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_is_linked pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadIsLinkedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadIsLinkedMethodInfo a signature where
    overloadedMethod _ = padIsLinked

#endif

-- method Pad::iterate_internal_links
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the GstPad to get the internal links of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Iterator"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_iterate_internal_links" gst_pad_iterate_internal_links ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO (Ptr Gst.Iterator.Iterator)

{- |
Gets an iterator for the pads to which the given pad is linked to inside
of the parent element.

Each 'GI.Gst.Objects.Pad.Pad' element yielded by the iterator will have its refcount increased,
so unref after use.

Free-function: gst_iterator_free
-}
padIterateInternalLinks ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the GstPad to get the internal links of. -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Pad.Pad'
    or 'Nothing' when the pad does not have an iterator function
    configured. Use 'GI.Gst.Structs.Iterator.iteratorFree' after usage. -}
padIterateInternalLinks pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_iterate_internal_links pad'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr pad
    return maybeResult

#if ENABLE_OVERLOADING
data PadIterateInternalLinksMethodInfo
instance (signature ~ (m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsPad a) => O.MethodInfo PadIterateInternalLinksMethodInfo a signature where
    overloadedMethod _ = padIterateInternalLinks

#endif

-- method Pad::iterate_internal_links_default
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to get the internal links of.", 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 = True, argDoc = Documentation {rawDocText = Just "the parent of @pad or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Iterator"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_iterate_internal_links_default" gst_pad_iterate_internal_links_default ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Object.Object ->                -- parent : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Gst.Iterator.Iterator)

{- |
Iterate the list of pads to which the given pad is linked to inside of
the parent element.
This is the default handler, and thus returns an iterator of all of the
pads inside the parent element with opposite direction.

The caller must free this iterator after use with 'GI.Gst.Structs.Iterator.iteratorFree'.
-}
padIterateInternalLinksDefault ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, Gst.Object.IsObject b) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to get the internal links of. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/ or 'Nothing' -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Pad.Pad', or 'Nothing' if /@pad@/
has no parent. Unref each returned pad with 'GI.Gst.Objects.Object.objectUnref'. -}
padIterateInternalLinksDefault pad parent = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    result <- gst_pad_iterate_internal_links_default pad' maybeParent
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    return maybeResult

#if ENABLE_OVERLOADING
data PadIterateInternalLinksDefaultMethodInfo
instance (signature ~ (Maybe (b) -> m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsPad a, Gst.Object.IsObject b) => O.MethodInfo PadIterateInternalLinksDefaultMethodInfo a signature where
    overloadedMethod _ = padIterateInternalLinksDefault

#endif

-- method Pad::link
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srcpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GstPad to link.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "sinkpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad to link.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PadLinkReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_link" gst_pad_link ::
    Ptr Pad ->                              -- srcpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Pad ->                              -- sinkpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Links the source pad and the sink pad.
-}
padLink ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, IsPad b) =>
    a
    {- ^ /@srcpad@/: the source 'GI.Gst.Objects.Pad.Pad' to link. -}
    -> b
    {- ^ /@sinkpad@/: the sink 'GI.Gst.Objects.Pad.Pad' to link. -}
    -> m Gst.Enums.PadLinkReturn
    {- ^ __Returns:__ A result code indicating if the connection worked or
         what went wrong.

MT Safe. -}
padLink srcpad sinkpad = liftIO $ do
    srcpad' <- unsafeManagedPtrCastPtr srcpad
    sinkpad' <- unsafeManagedPtrCastPtr sinkpad
    result <- gst_pad_link srcpad' sinkpad'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr srcpad
    touchManagedPtr sinkpad
    return result'

#if ENABLE_OVERLOADING
data PadLinkMethodInfo
instance (signature ~ (b -> m Gst.Enums.PadLinkReturn), MonadIO m, IsPad a, IsPad b) => O.MethodInfo PadLinkMethodInfo a signature where
    overloadedMethod _ = padLink

#endif

-- method Pad::link_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srcpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GstPad to link.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "sinkpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad to link.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "PadLinkCheck"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the checks to validate when linking", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PadLinkReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_link_full" gst_pad_link_full ::
    Ptr Pad ->                              -- srcpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Pad ->                              -- sinkpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "PadLinkCheck"})
    IO CInt

{- |
Links the source pad and the sink pad.

This variant of @/gst_pad_link/@ provides a more granular control on the
checks being done when linking. While providing some considerable speedups
the caller of this method must be aware that wrong usage of those flags
can cause severe issues. Refer to the documentation of 'GI.Gst.Flags.PadLinkCheck'
for more information.

MT Safe.
-}
padLinkFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, IsPad b) =>
    a
    {- ^ /@srcpad@/: the source 'GI.Gst.Objects.Pad.Pad' to link. -}
    -> b
    {- ^ /@sinkpad@/: the sink 'GI.Gst.Objects.Pad.Pad' to link. -}
    -> [Gst.Flags.PadLinkCheck]
    {- ^ /@flags@/: the checks to validate when linking -}
    -> m Gst.Enums.PadLinkReturn
    {- ^ __Returns:__ A result code indicating if the connection worked or
         what went wrong. -}
padLinkFull srcpad sinkpad flags = liftIO $ do
    srcpad' <- unsafeManagedPtrCastPtr srcpad
    sinkpad' <- unsafeManagedPtrCastPtr sinkpad
    let flags' = gflagsToWord flags
    result <- gst_pad_link_full srcpad' sinkpad' flags'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr srcpad
    touchManagedPtr sinkpad
    return result'

#if ENABLE_OVERLOADING
data PadLinkFullMethodInfo
instance (signature ~ (b -> [Gst.Flags.PadLinkCheck] -> m Gst.Enums.PadLinkReturn), MonadIO m, IsPad a, IsPad b) => O.MethodInfo PadLinkFullMethodInfo a signature where
    overloadedMethod _ = padLinkFull

#endif

-- method Pad::link_maybe_ghosting
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "sink", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", 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_pad_link_maybe_ghosting" gst_pad_link_maybe_ghosting ::
    Ptr Pad ->                              -- src : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Pad ->                              -- sink : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Links /@src@/ to /@sink@/, creating any 'GI.Gst.Objects.GhostPad.GhostPad'\'s in between as necessary.

This is a convenience function to save having to create and add intermediate
'GI.Gst.Objects.GhostPad.GhostPad'\'s as required for linking across 'GI.Gst.Objects.Bin.Bin' boundaries.

If /@src@/ or /@sink@/ pads don\'t have parent elements or do not share a common
ancestor, the link will fail.

/Since: 1.10/
-}
padLinkMaybeGhosting ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, IsPad b) =>
    a
    {- ^ /@src@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> b
    {- ^ /@sink@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> m Bool
    {- ^ __Returns:__ whether the link succeeded. -}
padLinkMaybeGhosting src sink = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    sink' <- unsafeManagedPtrCastPtr sink
    result <- gst_pad_link_maybe_ghosting src' sink'
    let result' = (/= 0) result
    touchManagedPtr src
    touchManagedPtr sink
    return result'

#if ENABLE_OVERLOADING
data PadLinkMaybeGhostingMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsPad a, IsPad b) => O.MethodInfo PadLinkMaybeGhostingMethodInfo a signature where
    overloadedMethod _ = padLinkMaybeGhosting

#endif

-- method Pad::link_maybe_ghosting_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "sink", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "PadLinkCheck"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "some #GstPadLinkCheck flags", 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_pad_link_maybe_ghosting_full" gst_pad_link_maybe_ghosting_full ::
    Ptr Pad ->                              -- src : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Pad ->                              -- sink : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "PadLinkCheck"})
    IO CInt

{- |
Links /@src@/ to /@sink@/, creating any 'GI.Gst.Objects.GhostPad.GhostPad'\'s in between as necessary.

This is a convenience function to save having to create and add intermediate
'GI.Gst.Objects.GhostPad.GhostPad'\'s as required for linking across 'GI.Gst.Objects.Bin.Bin' boundaries.

If /@src@/ or /@sink@/ pads don\'t have parent elements or do not share a common
ancestor, the link will fail.

Calling 'GI.Gst.Objects.Pad.padLinkMaybeGhostingFull' with
/@flags@/ == 'GI.Gst.Flags.PadLinkCheckDefault' is the recommended way of linking
pads with safety checks applied.

/Since: 1.10/
-}
padLinkMaybeGhostingFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, IsPad b) =>
    a
    {- ^ /@src@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> b
    {- ^ /@sink@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> [Gst.Flags.PadLinkCheck]
    {- ^ /@flags@/: some 'GI.Gst.Flags.PadLinkCheck' flags -}
    -> m Bool
    {- ^ __Returns:__ whether the link succeeded. -}
padLinkMaybeGhostingFull src sink flags = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    sink' <- unsafeManagedPtrCastPtr sink
    let flags' = gflagsToWord flags
    result <- gst_pad_link_maybe_ghosting_full src' sink' flags'
    let result' = (/= 0) result
    touchManagedPtr src
    touchManagedPtr sink
    return result'

#if ENABLE_OVERLOADING
data PadLinkMaybeGhostingFullMethodInfo
instance (signature ~ (b -> [Gst.Flags.PadLinkCheck] -> m Bool), MonadIO m, IsPad a, IsPad b) => O.MethodInfo PadLinkMaybeGhostingFullMethodInfo a signature where
    overloadedMethod _ = padLinkMaybeGhostingFull

#endif

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

foreign import ccall "gst_pad_mark_reconfigure" gst_pad_mark_reconfigure ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO ()

{- |
Mark a pad for needing reconfiguration. The next call to
'GI.Gst.Objects.Pad.padCheckReconfigure' will return 'True' after this call.
-}
padMarkReconfigure ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to mark -}
    -> m ()
padMarkReconfigure pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    gst_pad_mark_reconfigure pad'
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadMarkReconfigureMethodInfo
instance (signature ~ (m ()), MonadIO m, IsPad a) => O.MethodInfo PadMarkReconfigureMethodInfo a signature where
    overloadedMethod _ = padMarkReconfigure

#endif

-- method Pad::needs_reconfigure
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to check", 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_pad_needs_reconfigure" gst_pad_needs_reconfigure ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Check the @/GST_PAD_FLAG_NEED_RECONFIGURE/@ flag on /@pad@/ and return 'True'
if the flag was set.
-}
padNeedsReconfigure ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on /@pad@/. -}
padNeedsReconfigure pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_needs_reconfigure pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadNeedsReconfigureMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadNeedsReconfigureMethodInfo a signature where
    overloadedMethod _ = padNeedsReconfigure

#endif

-- method Pad::pause_task
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to pause the task of", 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_pad_pause_task" gst_pad_pause_task ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Pause the task of /@pad@/. This function will also wait until the
function executed by the task is finished if this function is not
called from the task function.
-}
padPauseTask ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to pause the task of -}
    -> m Bool
    {- ^ __Returns:__ a 'True' if the task could be paused or 'False' when the pad
has no task. -}
padPauseTask pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_pause_task pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadPauseTaskMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadPauseTaskMethodInfo a signature where
    overloadedMethod _ = padPauseTask

#endif

-- method Pad::peer_query
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to invoke the peer query on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstQuery to perform.", 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_pad_peer_query" gst_pad_peer_query ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO CInt

{- |
Performs 'GI.Gst.Objects.Pad.padQuery' on the peer of /@pad@/.

The caller is responsible for both the allocation and deallocation of
the query structure.
-}
padPeerQuery ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to invoke the peer query on. -}
    -> Gst.Query.Query
    {- ^ /@query@/: the 'GI.Gst.Structs.Query.Query' to perform. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the query could be performed. This function returns 'False'
if /@pad@/ has no peer. -}
padPeerQuery pad query = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_pad_peer_query pad' query'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data PadPeerQueryMethodInfo
instance (signature ~ (Gst.Query.Query -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadPeerQueryMethodInfo a signature where
    overloadedMethod _ = padPeerQuery

#endif

-- method Pad::peer_query_accept_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a  #GstPad to check the peer of", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCaps to check on the pad", 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_pad_peer_query_accept_caps" gst_pad_peer_query_accept_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CInt

{- |
Check if the peer of /@pad@/ accepts /@caps@/. If /@pad@/ has no peer, this function
returns 'True'.
-}
padPeerQueryAcceptCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a  'GI.Gst.Objects.Pad.Pad' to check the peer of -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: a 'GI.Gst.Structs.Caps.Caps' to check on the pad -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the peer of /@pad@/ can accept the caps or /@pad@/ has no peer. -}
padPeerQueryAcceptCaps pad caps = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    caps' <- unsafeManagedPtrGetPtr caps
    result <- gst_pad_peer_query_accept_caps pad' caps'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
data PadPeerQueryAcceptCapsMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadPeerQueryAcceptCapsMethodInfo a signature where
    overloadedMethod _ = padPeerQueryAcceptCaps

#endif

-- method Pad::peer_query_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a  #GstPad to get the capabilities of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstCaps filter, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_peer_query_caps" gst_pad_peer_query_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Caps.Caps ->                    -- filter : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO (Ptr Gst.Caps.Caps)

{- |
Gets the capabilities of the peer connected to this pad. Similar to
'GI.Gst.Objects.Pad.padQueryCaps'.

When called on srcpads /@filter@/ contains the caps that
upstream could produce in the order preferred by upstream. When
called on sinkpads /@filter@/ contains the caps accepted by
downstream in the preferred order. /@filter@/ might be 'Nothing' but
if it is not 'Nothing' the returned caps will be a subset of /@filter@/.
-}
padPeerQueryCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a  'GI.Gst.Objects.Pad.Pad' to get the capabilities of. -}
    -> Maybe (Gst.Caps.Caps)
    {- ^ /@filter@/: a 'GI.Gst.Structs.Caps.Caps' filter, or 'Nothing'. -}
    -> m Gst.Caps.Caps
    {- ^ __Returns:__ the caps of the peer pad with incremented
ref-count. When there is no peer pad, this function returns /@filter@/ or,
when /@filter@/ is 'Nothing', ANY caps. -}
padPeerQueryCaps pad filter = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeFilter <- case filter of
        Nothing -> return nullPtr
        Just jFilter -> do
            jFilter' <- unsafeManagedPtrGetPtr jFilter
            return jFilter'
    result <- gst_pad_peer_query_caps pad' maybeFilter
    checkUnexpectedReturnNULL "padPeerQueryCaps" result
    result' <- (wrapBoxed Gst.Caps.Caps) result
    touchManagedPtr pad
    whenJust filter touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
data PadPeerQueryCapsMethodInfo
instance (signature ~ (Maybe (Gst.Caps.Caps) -> m Gst.Caps.Caps), MonadIO m, IsPad a) => O.MethodInfo PadPeerQueryCapsMethodInfo a signature where
    overloadedMethod _ = padPeerQueryCaps

#endif

-- method Pad::peer_query_convert
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad, on whose peer pad to invoke the convert query on.\n      Must be a sink pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstFormat to convert from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_val", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to convert.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat to convert to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_val", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the result.", 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_pad_peer_query_convert" gst_pad_peer_query_convert ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- src_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- src_val : TBasicType TInt64
    CUInt ->                                -- dest_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- dest_val : TBasicType TInt64
    IO CInt

{- |
Queries the peer pad of a given sink pad to convert /@srcVal@/ in /@srcFormat@/
to /@destFormat@/.
-}
padPeerQueryConvert ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad', on whose peer pad to invoke the convert query on.
      Must be a sink pad. -}
    -> Gst.Enums.Format
    {- ^ /@srcFormat@/: a 'GI.Gst.Enums.Format' to convert from. -}
    -> Int64
    {- ^ /@srcVal@/: a value to convert. -}
    -> Gst.Enums.Format
    {- ^ /@destFormat@/: the 'GI.Gst.Enums.Format' to convert to. -}
    -> m ((Bool, Int64))
    {- ^ __Returns:__ 'True' if the query could be performed. -}
padPeerQueryConvert pad srcFormat srcVal destFormat = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let srcFormat' = (fromIntegral . fromEnum) srcFormat
    let destFormat' = (fromIntegral . fromEnum) destFormat
    destVal <- allocMem :: IO (Ptr Int64)
    result <- gst_pad_peer_query_convert pad' srcFormat' srcVal destFormat' destVal
    let result' = (/= 0) result
    destVal' <- peek destVal
    touchManagedPtr pad
    freeMem destVal
    return (result', destVal')

#if ENABLE_OVERLOADING
data PadPeerQueryConvertMethodInfo
instance (signature ~ (Gst.Enums.Format -> Int64 -> Gst.Enums.Format -> m ((Bool, Int64))), MonadIO m, IsPad a) => O.MethodInfo PadPeerQueryConvertMethodInfo a signature where
    overloadedMethod _ = padPeerQueryConvert

#endif

-- method Pad::peer_query_duration
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad on whose peer pad to invoke the duration query on.\n      Must be a sink pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat requested", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "duration", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location in which to store the total\n    duration, or %NULL.", 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_pad_peer_query_duration" gst_pad_peer_query_duration ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- duration : TBasicType TInt64
    IO CInt

{- |
Queries the peer pad of a given sink pad for the total stream duration.
-}
padPeerQueryDuration ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' on whose peer pad to invoke the duration query on.
      Must be a sink pad. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' requested -}
    -> m ((Bool, Int64))
    {- ^ __Returns:__ 'True' if the query could be performed. -}
padPeerQueryDuration pad format = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let format' = (fromIntegral . fromEnum) format
    duration <- allocMem :: IO (Ptr Int64)
    result <- gst_pad_peer_query_duration pad' format' duration
    let result' = (/= 0) result
    duration' <- peek duration
    touchManagedPtr pad
    freeMem duration
    return (result', duration')

#if ENABLE_OVERLOADING
data PadPeerQueryDurationMethodInfo
instance (signature ~ (Gst.Enums.Format -> m ((Bool, Int64))), MonadIO m, IsPad a) => O.MethodInfo PadPeerQueryDurationMethodInfo a signature where
    overloadedMethod _ = padPeerQueryDuration

#endif

-- method Pad::peer_query_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad on whose peer to invoke the position query on.\n      Must be a sink pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat requested", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cur", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location in which to store the current\n    position, or %NULL.", 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_pad_peer_query_position" gst_pad_peer_query_position ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- cur : TBasicType TInt64
    IO CInt

{- |
Queries the peer of a given sink pad for the stream position.
-}
padPeerQueryPosition ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' on whose peer to invoke the position query on.
      Must be a sink pad. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' requested -}
    -> m ((Bool, Int64))
    {- ^ __Returns:__ 'True' if the query could be performed. -}
padPeerQueryPosition pad format = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let format' = (fromIntegral . fromEnum) format
    cur <- allocMem :: IO (Ptr Int64)
    result <- gst_pad_peer_query_position pad' format' cur
    let result' = (/= 0) result
    cur' <- peek cur
    touchManagedPtr pad
    freeMem cur
    return (result', cur')

#if ENABLE_OVERLOADING
data PadPeerQueryPositionMethodInfo
instance (signature ~ (Gst.Enums.Format -> m ((Bool, Int64))), MonadIO m, IsPad a) => O.MethodInfo PadPeerQueryPositionMethodInfo a signature where
    overloadedMethod _ = padPeerQueryPosition

#endif

-- method Pad::proxy_query_accept_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to proxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an ACCEPT_CAPS #GstQuery.", 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_pad_proxy_query_accept_caps" gst_pad_proxy_query_accept_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO CInt

{- |
Checks if all internally linked pads of /@pad@/ accepts the caps in /@query@/ and
returns the intersection of the results.

This function is useful as a default accept caps query function for an element
that can handle any stream format, but requires caps that are acceptable for
all opposite pads.
-}
padProxyQueryAcceptCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to proxy. -}
    -> Gst.Query.Query
    {- ^ /@query@/: an ACCEPT_CAPS 'GI.Gst.Structs.Query.Query'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@query@/ could be executed -}
padProxyQueryAcceptCaps pad query = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_pad_proxy_query_accept_caps pad' query'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data PadProxyQueryAcceptCapsMethodInfo
instance (signature ~ (Gst.Query.Query -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadProxyQueryAcceptCapsMethodInfo a signature where
    overloadedMethod _ = padProxyQueryAcceptCaps

#endif

-- method Pad::proxy_query_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to proxy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a CAPS #GstQuery.", 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_pad_proxy_query_caps" gst_pad_proxy_query_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO CInt

{- |
Calls 'GI.Gst.Objects.Pad.padQueryCaps' for all internally linked pads of /@pad@/ and returns
the intersection of the results.

This function is useful as a default caps query function for an element
that can handle any stream format, but requires all its pads to have
the same caps.  Two such elements are tee and adder.
-}
padProxyQueryCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to proxy. -}
    -> Gst.Query.Query
    {- ^ /@query@/: a CAPS 'GI.Gst.Structs.Query.Query'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@query@/ could be executed -}
padProxyQueryCaps pad query = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_pad_proxy_query_caps pad' query'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data PadProxyQueryCapsMethodInfo
instance (signature ~ (Gst.Query.Query -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadProxyQueryCapsMethodInfo a signature where
    overloadedMethod _ = padProxyQueryCaps

#endif

-- method Pad::pull_range
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a sink #GstPad, returns GST_FLOW_ERROR if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The start offset of the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The length of the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the #GstBuffer, returns\n    GST_FLOW_ERROR if %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_pull_range" gst_pad_pull_range ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Word64 ->                               -- offset : TBasicType TUInt64
    Word32 ->                               -- size : TBasicType TUInt
    Ptr (Ptr Gst.Buffer.Buffer) ->          -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO CInt

{- |
Pulls a /@buffer@/ from the peer pad or fills up a provided buffer.

This function will first trigger the pad block signal if it was
installed.

When /@pad@/ is not linked @/GST_FLOW_NOT_LINKED/@ is returned else this
function returns the result of 'GI.Gst.Objects.Pad.padGetRange' on the peer pad.
See 'GI.Gst.Objects.Pad.padGetRange' for a list of return values and for the
semantics of the arguments of this function.

If /@buffer@/ points to a variable holding 'Nothing', a valid new 'GI.Gst.Structs.Buffer.Buffer' will be
placed in /@buffer@/ when this function returns @/GST_FLOW_OK/@. The new buffer
must be freed with @/gst_buffer_unref()/@ after usage. When this function
returns any other result value, /@buffer@/ will still point to 'Nothing'.

When /@buffer@/ points to a variable that points to a valid 'GI.Gst.Structs.Buffer.Buffer', the
buffer will be filled with the result data when this function returns
@/GST_FLOW_OK/@. When this function returns any other result value,
/@buffer@/ will be unchanged. If the provided buffer is larger than /@size@/, only
/@size@/ bytes will be filled in the result buffer and its size will be updated
accordingly.

Note that less than /@size@/ bytes can be returned in /@buffer@/ when, for example,
an EOS condition is near or when /@buffer@/ is not large enough to hold /@size@/
bytes. The caller should check the result buffer size to get the result size.
-}
padPullRange ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a sink 'GI.Gst.Objects.Pad.Pad', returns GST_FLOW_ERROR if not. -}
    -> Word64
    {- ^ /@offset@/: The start offset of the buffer -}
    -> Word32
    {- ^ /@size@/: The length of the buffer -}
    -> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' from the peer pad.

MT safe. -}
padPullRange pad offset size = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    buffer <- allocMem :: IO (Ptr (Ptr Gst.Buffer.Buffer))
    result <- gst_pad_pull_range pad' offset size buffer
    let result' = (toEnum . fromIntegral) result
    buffer' <- peek buffer
    buffer'' <- (wrapBoxed Gst.Buffer.Buffer) buffer'
    touchManagedPtr pad
    freeMem buffer
    return (result', buffer'')

#if ENABLE_OVERLOADING
data PadPullRangeMethodInfo
instance (signature ~ (Word64 -> Word32 -> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))), MonadIO m, IsPad a) => O.MethodInfo PadPullRangeMethodInfo a signature where
    overloadedMethod _ = padPullRange

#endif

-- method Pad::push
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a source #GstPad, returns #GST_FLOW_ERROR if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBuffer to push returns GST_FLOW_ERROR\n    if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_push" gst_pad_push ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO CInt

{- |
Pushes a buffer to the peer of /@pad@/.

This function will call installed block probes before triggering any
installed data probes.

The function proceeds calling 'GI.Gst.Objects.Pad.padChain' on the peer pad and returns
the value from that function. If /@pad@/ has no peer, @/GST_FLOW_NOT_LINKED/@ will
be returned.

In all cases, success or failure, the caller loses its reference to /@buffer@/
after calling this function.
-}
padPush ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a source 'GI.Gst.Objects.Pad.Pad', returns @/GST_FLOW_ERROR/@ if not. -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: the 'GI.Gst.Structs.Buffer.Buffer' to push returns GST_FLOW_ERROR
    if not. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' from the peer pad.

MT safe. -}
padPush pad buffer = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    buffer' <- B.ManagedPtr.disownBoxed buffer
    result <- gst_pad_push pad' buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    touchManagedPtr buffer
    return result'

#if ENABLE_OVERLOADING
data PadPushMethodInfo
instance (signature ~ (Gst.Buffer.Buffer -> m Gst.Enums.FlowReturn), MonadIO m, IsPad a) => O.MethodInfo PadPushMethodInfo a signature where
    overloadedMethod _ = padPush

#endif

-- method Pad::push_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to push the event to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEvent to send to the pad.", 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_pad_push_event" gst_pad_push_event ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    IO CInt

{- |
Sends the event to the peer of the given pad. This function is
mainly used by elements to send events to their peer
elements.

This function takes ownership of the provided event so you should
@/gst_event_ref()/@ it if you want to reuse the event after this call.
-}
padPushEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to push the event to. -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' to send to the pad. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the event was handled.

MT safe. -}
padPushEvent pad event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    event' <- B.ManagedPtr.disownBoxed event
    result <- gst_pad_push_event pad' event'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr event
    return result'

#if ENABLE_OVERLOADING
data PadPushEventMethodInfo
instance (signature ~ (Gst.Event.Event -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadPushEventMethodInfo a signature where
    overloadedMethod _ = padPushEvent

#endif

-- method Pad::push_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a source #GstPad, returns #GST_FLOW_ERROR if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TInterface (Name {namespace = "Gst", name = "BufferList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferList to push returns GST_FLOW_ERROR\n    if not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_push_list" gst_pad_push_list ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.BufferList.BufferList ->        -- list : TInterface (Name {namespace = "Gst", name = "BufferList"})
    IO CInt

{- |
Pushes a buffer list to the peer of /@pad@/.

This function will call installed block probes before triggering any
installed data probes.

The function proceeds calling the chain function on the peer pad and returns
the value from that function. If /@pad@/ has no peer, @/GST_FLOW_NOT_LINKED/@ will
be returned. If the peer pad does not have any installed chainlist function
every group buffer of the list will be merged into a normal 'GI.Gst.Structs.Buffer.Buffer' and
chained via 'GI.Gst.Objects.Pad.padChain'.

In all cases, success or failure, the caller loses its reference to /@list@/
after calling this function.
-}
padPushList ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a source 'GI.Gst.Objects.Pad.Pad', returns @/GST_FLOW_ERROR/@ if not. -}
    -> Gst.BufferList.BufferList
    {- ^ /@list@/: the 'GI.Gst.Structs.BufferList.BufferList' to push returns GST_FLOW_ERROR
    if not. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' from the peer pad.

MT safe. -}
padPushList pad list = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    list' <- B.ManagedPtr.disownBoxed list
    result <- gst_pad_push_list pad' list'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    touchManagedPtr list
    return result'

#if ENABLE_OVERLOADING
data PadPushListMethodInfo
instance (signature ~ (Gst.BufferList.BufferList -> m Gst.Enums.FlowReturn), MonadIO m, IsPad a) => O.MethodInfo PadPushListMethodInfo a signature where
    overloadedMethod _ = padPushList

#endif

-- method Pad::query
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to invoke the default query on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstQuery to perform.", 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_pad_query" gst_pad_query ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO CInt

{- |
Dispatches a query to a pad. The query should have been allocated by the
caller via one of the type-specific allocation functions. The element that
the pad belongs to is responsible for filling the query with an appropriate
response, which should then be parsed with a type-specific query parsing
function.

Again, the caller is responsible for both the allocation and deallocation of
the query structure.

Please also note that some queries might need a running pipeline to work.
-}
padQuery ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to invoke the default query on. -}
    -> Gst.Query.Query
    {- ^ /@query@/: the 'GI.Gst.Structs.Query.Query' to perform. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the query could be performed. -}
padQuery pad query = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_pad_query pad' query'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data PadQueryMethodInfo
instance (signature ~ (Gst.Query.Query -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadQueryMethodInfo a signature where
    overloadedMethod _ = padQuery

#endif

-- method Pad::query_accept_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCaps to check on the pad", 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_pad_query_accept_caps" gst_pad_query_accept_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CInt

{- |
Check if the given pad accepts the caps.
-}
padQueryAcceptCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to check -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: a 'GI.Gst.Structs.Caps.Caps' to check on the pad -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad can accept the caps. -}
padQueryAcceptCaps pad caps = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    caps' <- unsafeManagedPtrGetPtr caps
    result <- gst_pad_query_accept_caps pad' caps'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
data PadQueryAcceptCapsMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadQueryAcceptCapsMethodInfo a signature where
    overloadedMethod _ = padQueryAcceptCaps

#endif

-- method Pad::query_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a  #GstPad to get the capabilities of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "suggested #GstCaps, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_query_caps" gst_pad_query_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Caps.Caps ->                    -- filter : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO (Ptr Gst.Caps.Caps)

{- |
Gets the capabilities this pad can produce or consume.
Note that this method doesn\'t necessarily return the caps set by sending a
'GI.Gst.Structs.Event.eventNewCaps' - use 'GI.Gst.Objects.Pad.padGetCurrentCaps' for that instead.
gst_pad_query_caps returns all possible caps a pad can operate with, using
the pad\'s CAPS query function, If the query fails, this function will return
/@filter@/, if not 'Nothing', otherwise ANY.

When called on sinkpads /@filter@/ contains the caps that
upstream could produce in the order preferred by upstream. When
called on srcpads /@filter@/ contains the caps accepted by
downstream in the preferred order. /@filter@/ might be 'Nothing' but
if it is not 'Nothing' the returned caps will be a subset of /@filter@/.

Note that this function does not return writable 'GI.Gst.Structs.Caps.Caps', use
@/gst_caps_make_writable()/@ before modifying the caps.
-}
padQueryCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a  'GI.Gst.Objects.Pad.Pad' to get the capabilities of. -}
    -> Maybe (Gst.Caps.Caps)
    {- ^ /@filter@/: suggested 'GI.Gst.Structs.Caps.Caps', or 'Nothing' -}
    -> m Gst.Caps.Caps
    {- ^ __Returns:__ the caps of the pad with incremented ref-count. -}
padQueryCaps pad filter = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeFilter <- case filter of
        Nothing -> return nullPtr
        Just jFilter -> do
            jFilter' <- unsafeManagedPtrGetPtr jFilter
            return jFilter'
    result <- gst_pad_query_caps pad' maybeFilter
    checkUnexpectedReturnNULL "padQueryCaps" result
    result' <- (wrapBoxed Gst.Caps.Caps) result
    touchManagedPtr pad
    whenJust filter touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
data PadQueryCapsMethodInfo
instance (signature ~ (Maybe (Gst.Caps.Caps) -> m Gst.Caps.Caps), MonadIO m, IsPad a) => O.MethodInfo PadQueryCapsMethodInfo a signature where
    overloadedMethod _ = padQueryCaps

#endif

-- method Pad::query_convert
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to invoke the convert query on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstFormat to convert from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_val", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to convert.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat to convert to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_val", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the result.", 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_pad_query_convert" gst_pad_query_convert ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- src_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- src_val : TBasicType TInt64
    CUInt ->                                -- dest_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- dest_val : TBasicType TInt64
    IO CInt

{- |
Queries a pad to convert /@srcVal@/ in /@srcFormat@/ to /@destFormat@/.
-}
padQueryConvert ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to invoke the convert query on. -}
    -> Gst.Enums.Format
    {- ^ /@srcFormat@/: a 'GI.Gst.Enums.Format' to convert from. -}
    -> Int64
    {- ^ /@srcVal@/: a value to convert. -}
    -> Gst.Enums.Format
    {- ^ /@destFormat@/: the 'GI.Gst.Enums.Format' to convert to. -}
    -> m ((Bool, Int64))
    {- ^ __Returns:__ 'True' if the query could be performed. -}
padQueryConvert pad srcFormat srcVal destFormat = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let srcFormat' = (fromIntegral . fromEnum) srcFormat
    let destFormat' = (fromIntegral . fromEnum) destFormat
    destVal <- allocMem :: IO (Ptr Int64)
    result <- gst_pad_query_convert pad' srcFormat' srcVal destFormat' destVal
    let result' = (/= 0) result
    destVal' <- peek destVal
    touchManagedPtr pad
    freeMem destVal
    return (result', destVal')

#if ENABLE_OVERLOADING
data PadQueryConvertMethodInfo
instance (signature ~ (Gst.Enums.Format -> Int64 -> Gst.Enums.Format -> m ((Bool, Int64))), MonadIO m, IsPad a) => O.MethodInfo PadQueryConvertMethodInfo a signature where
    overloadedMethod _ = padQueryConvert

#endif

-- method Pad::query_default
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to call the default query handler on.", 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 = True, argDoc = Documentation {rawDocText = Just "the parent of @pad or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstQuery to handle.", 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_pad_query_default" gst_pad_query_default ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Object.Object ->                -- parent : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO CInt

{- |
Invokes the default query handler for the given pad.
The query is sent to all pads internally linked to /@pad@/. Note that
if there are many possible sink pads that are internally linked to
/@pad@/, only one will be sent the query.
Multi-sinkpad elements should implement custom query handlers.
-}
padQueryDefault ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, Gst.Object.IsObject b) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to call the default query handler on. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/ or 'Nothing' -}
    -> Gst.Query.Query
    {- ^ /@query@/: the 'GI.Gst.Structs.Query.Query' to handle. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the query was performed successfully. -}
padQueryDefault pad parent query = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_pad_query_default pad' maybeParent query'
    let result' = (/= 0) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data PadQueryDefaultMethodInfo
instance (signature ~ (Maybe (b) -> Gst.Query.Query -> m Bool), MonadIO m, IsPad a, Gst.Object.IsObject b) => O.MethodInfo PadQueryDefaultMethodInfo a signature where
    overloadedMethod _ = padQueryDefault

#endif

-- method Pad::query_duration
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to invoke the duration query on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat requested", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "duration", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location in which to store the total\n    duration, or %NULL.", 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_pad_query_duration" gst_pad_query_duration ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- duration : TBasicType TInt64
    IO CInt

{- |
Queries a pad for the total stream duration.
-}
padQueryDuration ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to invoke the duration query on. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' requested -}
    -> m ((Bool, Int64))
    {- ^ __Returns:__ 'True' if the query could be performed. -}
padQueryDuration pad format = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let format' = (fromIntegral . fromEnum) format
    duration <- allocMem :: IO (Ptr Int64)
    result <- gst_pad_query_duration pad' format' duration
    let result' = (/= 0) result
    duration' <- peek duration
    touchManagedPtr pad
    freeMem duration
    return (result', duration')

#if ENABLE_OVERLOADING
data PadQueryDurationMethodInfo
instance (signature ~ (Gst.Enums.Format -> m ((Bool, Int64))), MonadIO m, IsPad a) => O.MethodInfo PadQueryDurationMethodInfo a signature where
    overloadedMethod _ = padQueryDuration

#endif

-- method Pad::query_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to invoke the position query on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat requested", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cur", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A location in which to store the current position, or %NULL.", 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_pad_query_position" gst_pad_query_position ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- cur : TBasicType TInt64
    IO CInt

{- |
Queries a pad for the stream position.
-}
padQueryPosition ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to invoke the position query on. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' requested -}
    -> m ((Bool, Int64))
    {- ^ __Returns:__ 'True' if the query could be performed. -}
padQueryPosition pad format = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let format' = (fromIntegral . fromEnum) format
    cur <- allocMem :: IO (Ptr Int64)
    result <- gst_pad_query_position pad' format' cur
    let result' = (/= 0) result
    cur' <- peek cur
    touchManagedPtr pad
    freeMem cur
    return (result', cur')

#if ENABLE_OVERLOADING
data PadQueryPositionMethodInfo
instance (signature ~ (Gst.Enums.Format -> m ((Bool, Int64))), MonadIO m, IsPad a) => O.MethodInfo PadQueryPositionMethodInfo a signature where
    overloadedMethod _ = padQueryPosition

#endif

-- method Pad::remove_probe
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad with the probe", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TULong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the probe id to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_remove_probe" gst_pad_remove_probe ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CULong ->                               -- id : TBasicType TULong
    IO ()

{- |
Remove the probe with /@id@/ from /@pad@/.

MT safe.
-}
padRemoveProbe ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' with the probe -}
    -> CULong
    {- ^ /@id@/: the probe id to remove -}
    -> m ()
padRemoveProbe pad id = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    gst_pad_remove_probe pad' id
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadRemoveProbeMethodInfo
instance (signature ~ (CULong -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadRemoveProbeMethodInfo a signature where
    overloadedMethod _ = padRemoveProbe

#endif

-- method Pad::send_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad to send the event to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEvent to send to the pad.", 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_pad_send_event" gst_pad_send_event ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    IO CInt

{- |
Sends the event to the pad. This function can be used
by applications to send events in the pipeline.

If /@pad@/ is a source pad, /@event@/ should be an upstream event. If /@pad@/ is a
sink pad, /@event@/ should be a downstream event. For example, you would not
send a @/GST_EVENT_EOS/@ on a src pad; EOS events only propagate downstream.
Furthermore, some downstream events have to be serialized with data flow,
like EOS, while some can travel out-of-band, like @/GST_EVENT_FLUSH_START/@. If
the event needs to be serialized with data flow, this function will take the
pad\'s stream lock while calling its event function.

To find out whether an event type is upstream, downstream, or downstream and
serialized, see 'GI.Gst.Flags.EventTypeFlags', 'GI.Gst.Functions.eventTypeGetFlags',
@/GST_EVENT_IS_UPSTREAM/@, @/GST_EVENT_IS_DOWNSTREAM/@, and
@/GST_EVENT_IS_SERIALIZED/@. Note that in practice that an application or
plugin doesn\'t need to bother itself with this information; the core handles
all necessary locks and checks.

This function takes ownership of the provided event so you should
@/gst_event_ref()/@ it if you want to reuse the event after this call.
-}
padSendEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' to send the event to. -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' to send to the pad. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the event was handled. -}
padSendEvent pad event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    event' <- B.ManagedPtr.disownBoxed event
    result <- gst_pad_send_event pad' event'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr event
    return result'

#if ENABLE_OVERLOADING
data PadSendEventMethodInfo
instance (signature ~ (Gst.Event.Event -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadSendEventMethodInfo a signature where
    overloadedMethod _ = padSendEvent

#endif

-- method Pad::set_activate_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "activate", argType = TInterface (Name {namespace = "Gst", name = "PadActivateFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadActivateFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @activate will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_activate_function_full" gst_pad_set_activate_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadActivateFunction -> -- activate : TInterface (Name {namespace = "Gst", name = "PadActivateFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given activate function for /@pad@/. The activate function will
dispatch to 'GI.Gst.Objects.Pad.padActivateMode' to perform the actual activation.
Only makes sense to set on sink pads.

Call this function if your sink pad can start a pull-based task.
-}
padSetActivateFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad'. -}
    -> Gst.Callbacks.PadActivateFunction
    {- ^ /@activate@/: the 'GI.Gst.Callbacks.PadActivateFunction' to set. -}
    -> m ()
padSetActivateFunctionFull pad activate = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    activate' <- Gst.Callbacks.mk_PadActivateFunction (Gst.Callbacks.wrap_PadActivateFunction Nothing activate)
    let userData = castFunPtrToPtr activate'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_activate_function_full pad' activate' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetActivateFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadActivateFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetActivateFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetActivateFunctionFull

#endif

-- method Pad::set_activatemode_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "activatemode", argType = TInterface (Name {namespace = "Gst", name = "PadActivateModeFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadActivateModeFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @activatemode will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_activatemode_function_full" gst_pad_set_activatemode_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadActivateModeFunction -> -- activatemode : TInterface (Name {namespace = "Gst", name = "PadActivateModeFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given activate_mode function for the pad. An activate_mode function
prepares the element for data passing.
-}
padSetActivatemodeFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad'. -}
    -> Gst.Callbacks.PadActivateModeFunction
    {- ^ /@activatemode@/: the 'GI.Gst.Callbacks.PadActivateModeFunction' to set. -}
    -> m ()
padSetActivatemodeFunctionFull pad activatemode = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    activatemode' <- Gst.Callbacks.mk_PadActivateModeFunction (Gst.Callbacks.wrap_PadActivateModeFunction Nothing activatemode)
    let userData = castFunPtrToPtr activatemode'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_activatemode_function_full pad' activatemode' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetActivatemodeFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadActivateModeFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetActivatemodeFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetActivatemodeFunctionFull

#endif

-- method Pad::set_active
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to activate or deactivate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether or not the pad should be active.", 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_pad_set_active" gst_pad_set_active ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    CInt ->                                 -- active : TBasicType TBoolean
    IO CInt

{- |
Activates or deactivates the given pad.
Normally called from within core state change functions.

If /@active@/, makes sure the pad is active. If it is already active, either in
push or pull mode, just return. Otherwise dispatches to the pad\'s activate
function to perform the actual activation.

If not /@active@/, calls 'GI.Gst.Objects.Pad.padActivateMode' with the pad\'s current mode
and a 'False' argument.
-}
padSetActive ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to activate or deactivate. -}
    -> Bool
    {- ^ /@active@/: whether or not the pad should be active. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the operation was successful.

MT safe. -}
padSetActive pad active = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    let active' = (fromIntegral . fromEnum) active
    result <- gst_pad_set_active pad' active'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadSetActiveMethodInfo
instance (signature ~ (Bool -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadSetActiveMethodInfo a signature where
    overloadedMethod _ = padSetActive

#endif

-- method Pad::set_chain_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a sink #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "chain", argType = TInterface (Name {namespace = "Gst", name = "PadChainFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadChainFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @chain will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_chain_function_full" gst_pad_set_chain_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadChainFunction -> -- chain : TInterface (Name {namespace = "Gst", name = "PadChainFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given chain function for the pad. The chain function is called to
process a 'GI.Gst.Structs.Buffer.Buffer' input buffer. see 'GI.Gst.Callbacks.PadChainFunction' for more details.
-}
padSetChainFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a sink 'GI.Gst.Objects.Pad.Pad'. -}
    -> Gst.Callbacks.PadChainFunction
    {- ^ /@chain@/: the 'GI.Gst.Callbacks.PadChainFunction' to set. -}
    -> m ()
padSetChainFunctionFull pad chain = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    chain' <- Gst.Callbacks.mk_PadChainFunction (Gst.Callbacks.wrap_PadChainFunction Nothing chain)
    let userData = castFunPtrToPtr chain'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_chain_function_full pad' chain' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetChainFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadChainFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetChainFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetChainFunctionFull

#endif

-- method Pad::set_chain_list_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a sink #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "chainlist", argType = TInterface (Name {namespace = "Gst", name = "PadChainListFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadChainListFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @chainlist will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_chain_list_function_full" gst_pad_set_chain_list_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadChainListFunction -> -- chainlist : TInterface (Name {namespace = "Gst", name = "PadChainListFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given chain list function for the pad. The chainlist function is
called to process a 'GI.Gst.Structs.BufferList.BufferList' input buffer list. See
'GI.Gst.Callbacks.PadChainListFunction' for more details.
-}
padSetChainListFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a sink 'GI.Gst.Objects.Pad.Pad'. -}
    -> Gst.Callbacks.PadChainListFunction
    {- ^ /@chainlist@/: the 'GI.Gst.Callbacks.PadChainListFunction' to set. -}
    -> m ()
padSetChainListFunctionFull pad chainlist = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    chainlist' <- Gst.Callbacks.mk_PadChainListFunction (Gst.Callbacks.wrap_PadChainListFunction Nothing chainlist)
    let userData = castFunPtrToPtr chainlist'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_chain_list_function_full pad' chainlist' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetChainListFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadChainListFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetChainListFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetChainListFunctionFull

#endif

-- method Pad::set_element_private
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to set the private data of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "priv", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The private data to attach to the pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_element_private" gst_pad_set_element_private ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr () ->                               -- priv : TBasicType TPtr
    IO ()

{- |
Set the given private data gpointer on the pad.
This function can only be used by the element that owns the pad.
No locking is performed in this function.
-}
padSetElementPrivate ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to set the private data of. -}
    -> Ptr ()
    {- ^ /@priv@/: The private data to attach to the pad. -}
    -> m ()
padSetElementPrivate pad priv = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    gst_pad_set_element_private pad' priv
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetElementPrivateMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetElementPrivateMethodInfo a signature where
    overloadedMethod _ = padSetElementPrivate

#endif

-- method Pad::set_event_full_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad of either direction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "PadEventFullFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadEventFullFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @event will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_event_full_function_full" gst_pad_set_event_full_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadEventFullFunction -> -- event : TInterface (Name {namespace = "Gst", name = "PadEventFullFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given event handler for the pad.

/Since: 1.8/
-}
padSetEventFullFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' of either direction. -}
    -> Gst.Callbacks.PadEventFullFunction
    {- ^ /@event@/: the 'GI.Gst.Callbacks.PadEventFullFunction' to set. -}
    -> m ()
padSetEventFullFunctionFull pad event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    event' <- Gst.Callbacks.mk_PadEventFullFunction (Gst.Callbacks.wrap_PadEventFullFunction Nothing event)
    let userData = castFunPtrToPtr event'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_event_full_function_full pad' event' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetEventFullFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadEventFullFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetEventFullFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetEventFullFunctionFull

#endif

-- method Pad::set_event_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad of either direction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "PadEventFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadEventFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @event will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_event_function_full" gst_pad_set_event_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadEventFunction -> -- event : TInterface (Name {namespace = "Gst", name = "PadEventFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given event handler for the pad.
-}
padSetEventFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' of either direction. -}
    -> Gst.Callbacks.PadEventFunction
    {- ^ /@event@/: the 'GI.Gst.Callbacks.PadEventFunction' to set. -}
    -> m ()
padSetEventFunctionFull pad event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    event' <- Gst.Callbacks.mk_PadEventFunction (Gst.Callbacks.wrap_PadEventFunction Nothing event)
    let userData = castFunPtrToPtr event'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_event_function_full pad' event' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetEventFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadEventFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetEventFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetEventFunctionFull

#endif

-- method Pad::set_getrange_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a source #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "get", argType = TInterface (Name {namespace = "Gst", name = "PadGetRangeFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadGetRangeFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @get will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_getrange_function_full" gst_pad_set_getrange_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadGetRangeFunction -> -- get : TInterface (Name {namespace = "Gst", name = "PadGetRangeFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given getrange function for the pad. The getrange function is
called to produce a new 'GI.Gst.Structs.Buffer.Buffer' to start the processing pipeline. see
'GI.Gst.Callbacks.PadGetRangeFunction' for a description of the getrange function.
-}
padSetGetrangeFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a source 'GI.Gst.Objects.Pad.Pad'. -}
    -> Gst.Callbacks.PadGetRangeFunction
    {- ^ /@get@/: the 'GI.Gst.Callbacks.PadGetRangeFunction' to set. -}
    -> m ()
padSetGetrangeFunctionFull pad get = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    get' <- Gst.Callbacks.mk_PadGetRangeFunction (Gst.Callbacks.wrap_PadGetRangeFunction Nothing get)
    let userData = castFunPtrToPtr get'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_getrange_function_full pad' get' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetGetrangeFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadGetRangeFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetGetrangeFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetGetrangeFunctionFull

#endif

-- method Pad::set_iterate_internal_links_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad of either direction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iterintlink", argType = TInterface (Name {namespace = "Gst", name = "PadIterIntLinkFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadIterIntLinkFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @iterintlink will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_iterate_internal_links_function_full" gst_pad_set_iterate_internal_links_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadIterIntLinkFunction -> -- iterintlink : TInterface (Name {namespace = "Gst", name = "PadIterIntLinkFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given internal link iterator function for the pad.
-}
padSetIterateInternalLinksFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' of either direction. -}
    -> Gst.Callbacks.PadIterIntLinkFunction
    {- ^ /@iterintlink@/: the 'GI.Gst.Callbacks.PadIterIntLinkFunction' to set. -}
    -> m ()
padSetIterateInternalLinksFunctionFull pad iterintlink = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    iterintlink' <- Gst.Callbacks.mk_PadIterIntLinkFunction (Gst.Callbacks.wrap_PadIterIntLinkFunction Nothing iterintlink)
    let userData = castFunPtrToPtr iterintlink'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_iterate_internal_links_function_full pad' iterintlink' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetIterateInternalLinksFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadIterIntLinkFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetIterateInternalLinksFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetIterateInternalLinksFunctionFull

#endif

-- method Pad::set_link_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "link", argType = TInterface (Name {namespace = "Gst", name = "PadLinkFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadLinkFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @link will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_link_function_full" gst_pad_set_link_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadLinkFunction -> -- link : TInterface (Name {namespace = "Gst", name = "PadLinkFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given link function for the pad. It will be called when
the pad is linked with another pad.

The return value @/GST_PAD_LINK_OK/@ should be used when the connection can be
made.

The return value @/GST_PAD_LINK_REFUSED/@ should be used when the connection
cannot be made for some reason.

If /@link@/ is installed on a source pad, it should call the 'GI.Gst.Callbacks.PadLinkFunction'
of the peer sink pad, if present.
-}
padSetLinkFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad'. -}
    -> Gst.Callbacks.PadLinkFunction
    {- ^ /@link@/: the 'GI.Gst.Callbacks.PadLinkFunction' to set. -}
    -> m ()
padSetLinkFunctionFull pad link = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    link' <- Gst.Callbacks.mk_PadLinkFunction (Gst.Callbacks.wrap_PadLinkFunction Nothing link)
    let userData = castFunPtrToPtr link'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_link_function_full pad' link' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetLinkFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadLinkFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetLinkFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetLinkFunctionFull

#endif

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

foreign import ccall "gst_pad_set_offset" gst_pad_set_offset ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Int64 ->                                -- offset : TBasicType TInt64
    IO ()

{- |
Set the offset that will be applied to the running time of /@pad@/.
-}
padSetOffset ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> Int64
    {- ^ /@offset@/: the offset -}
    -> m ()
padSetOffset pad offset = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    gst_pad_set_offset pad' offset
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetOffsetMethodInfo
instance (signature ~ (Int64 -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetOffsetMethodInfo a signature where
    overloadedMethod _ = padSetOffset

#endif

-- method Pad::set_query_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad of either direction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "PadQueryFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadQueryFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @query will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_query_function_full" gst_pad_set_query_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadQueryFunction -> -- query : TInterface (Name {namespace = "Gst", name = "PadQueryFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Set the given query function for the pad.
-}
padSetQueryFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' of either direction. -}
    -> Gst.Callbacks.PadQueryFunction
    {- ^ /@query@/: the 'GI.Gst.Callbacks.PadQueryFunction' to set. -}
    -> m ()
padSetQueryFunctionFull pad query = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    query' <- Gst.Callbacks.mk_PadQueryFunction (Gst.Callbacks.wrap_PadQueryFunction Nothing query)
    let userData = castFunPtrToPtr query'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_query_function_full pad' query' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetQueryFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadQueryFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetQueryFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetQueryFunctionFull

#endif

-- method Pad::set_unlink_function_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "unlink", argType = TInterface (Name {namespace = "Gst", name = "PadUnlinkFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadUnlinkFunction to set.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data passed to @notify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "notify called when @unlink will not be used anymore.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_set_unlink_function_full" gst_pad_set_unlink_function_full ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadUnlinkFunction -> -- unlink : TInterface (Name {namespace = "Gst", name = "PadUnlinkFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the given unlink function for the pad. It will be called
when the pad is unlinked.

Note that the pad\'s lock is already held when the unlink
function is called, so most pad functions cannot be called
from within the callback.
-}
padSetUnlinkFunctionFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad'. -}
    -> Gst.Callbacks.PadUnlinkFunction
    {- ^ /@unlink@/: the 'GI.Gst.Callbacks.PadUnlinkFunction' to set. -}
    -> m ()
padSetUnlinkFunctionFull pad unlink = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    unlink' <- Gst.Callbacks.mk_PadUnlinkFunction (Gst.Callbacks.wrap_PadUnlinkFunction Nothing unlink)
    let userData = castFunPtrToPtr unlink'
    let notify = safeFreeFunPtrPtr
    gst_pad_set_unlink_function_full pad' unlink' userData notify
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadSetUnlinkFunctionFullMethodInfo
instance (signature ~ (Gst.Callbacks.PadUnlinkFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadSetUnlinkFunctionFullMethodInfo a signature where
    overloadedMethod _ = padSetUnlinkFunctionFull

#endif

-- method Pad::start_task
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to start the task of", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "TaskFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the task function to call", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the task function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "called when @user_data is no longer referenced", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_start_task" gst_pad_start_task ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_TaskFunction ->  -- func : TInterface (Name {namespace = "Gst", name = "TaskFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO CInt

{- |
Starts a task that repeatedly calls /@func@/ with /@userData@/. This function
is mostly used in pad activation functions to start the dataflow.
The @/GST_PAD_STREAM_LOCK/@ of /@pad@/ will automatically be acquired
before /@func@/ is called.
-}
padStartTask ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to start the task of -}
    -> Gst.Callbacks.TaskFunction
    {- ^ /@func@/: the task function to call -}
    -> m Bool
    {- ^ __Returns:__ a 'True' if the task could be started. -}
padStartTask pad func = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    func' <- Gst.Callbacks.mk_TaskFunction (Gst.Callbacks.wrap_TaskFunction Nothing (Gst.Callbacks.drop_closures_TaskFunction func))
    let userData = castFunPtrToPtr func'
    let notify = safeFreeFunPtrPtr
    result <- gst_pad_start_task pad' func' userData notify
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadStartTaskMethodInfo
instance (signature ~ (Gst.Callbacks.TaskFunction -> m Bool), MonadIO m, IsPad a) => O.MethodInfo PadStartTaskMethodInfo a signature where
    overloadedMethod _ = padStartTask

#endif

-- method Pad::sticky_events_foreach
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that should be used for iteration.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "foreach_func", argType = TInterface (Name {namespace = "Gst", name = "PadStickyEventsForeachFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadStickyEventsForeachFunction that\n               should be called for every event.", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the optional user data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pad_sticky_events_foreach" gst_pad_sticky_events_foreach ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    FunPtr Gst.Callbacks.C_PadStickyEventsForeachFunction -> -- foreach_func : TInterface (Name {namespace = "Gst", name = "PadStickyEventsForeachFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Iterates all sticky events on /@pad@/ and calls /@foreachFunc@/ for every
event. If /@foreachFunc@/ returns 'False' the iteration is immediately stopped.
-}
padStickyEventsForeach ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that should be used for iteration. -}
    -> Gst.Callbacks.PadStickyEventsForeachFunction
    {- ^ /@foreachFunc@/: the 'GI.Gst.Callbacks.PadStickyEventsForeachFunction' that
               should be called for every event. -}
    -> m ()
padStickyEventsForeach pad foreachFunc = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    foreachFunc' <- Gst.Callbacks.mk_PadStickyEventsForeachFunction (Gst.Callbacks.wrap_PadStickyEventsForeachFunction Nothing (Gst.Callbacks.drop_closures_PadStickyEventsForeachFunction foreachFunc))
    let userData = nullPtr
    gst_pad_sticky_events_foreach pad' foreachFunc' userData
    safeFreeFunPtr $ castFunPtrToPtr foreachFunc'
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadStickyEventsForeachMethodInfo
instance (signature ~ (Gst.Callbacks.PadStickyEventsForeachFunction -> m ()), MonadIO m, IsPad a) => O.MethodInfo PadStickyEventsForeachMethodInfo a signature where
    overloadedMethod _ = padStickyEventsForeach

#endif

-- method Pad::stop_task
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to stop the task of", 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_pad_stop_task" gst_pad_stop_task ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Stop the task of /@pad@/. This function will also make sure that the
function executed by the task will effectively stop if not called
from the GstTaskFunction.

This function will deadlock if called from the GstTaskFunction of
the task. Use 'GI.Gst.Objects.Task.taskPause' instead.

Regardless of whether the pad has a task, the stream lock is acquired and
released so as to ensure that streaming through this pad has finished.
-}
padStopTask ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to stop the task of -}
    -> m Bool
    {- ^ __Returns:__ a 'True' if the task could be stopped or 'False' on error. -}
padStopTask pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- gst_pad_stop_task pad'
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

#if ENABLE_OVERLOADING
data PadStopTaskMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsPad a) => O.MethodInfo PadStopTaskMethodInfo a signature where
    overloadedMethod _ = padStopTask

#endif

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

foreign import ccall "gst_pad_store_sticky_event" gst_pad_store_sticky_event ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    IO CInt

{- |
Store the sticky /@event@/ on /@pad@/

/Since: 1.2/
-}
padStoreStickyEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> Gst.Event.Event
    {- ^ /@event@/: a 'GI.Gst.Structs.Event.Event' -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ @/GST_FLOW_OK/@ on success, @/GST_FLOW_FLUSHING/@ when the pad
was flushing or @/GST_FLOW_EOS/@ when the pad was EOS. -}
padStoreStickyEvent pad event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    event' <- unsafeManagedPtrGetPtr event
    result <- gst_pad_store_sticky_event pad' event'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    touchManagedPtr event
    return result'

#if ENABLE_OVERLOADING
data PadStoreStickyEventMethodInfo
instance (signature ~ (Gst.Event.Event -> m Gst.Enums.FlowReturn), MonadIO m, IsPad a) => O.MethodInfo PadStoreStickyEventMethodInfo a signature where
    overloadedMethod _ = padStoreStickyEvent

#endif

-- method Pad::unlink
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srcpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GstPad to unlink.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "sinkpad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad to unlink.", 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_pad_unlink" gst_pad_unlink ::
    Ptr Pad ->                              -- srcpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    Ptr Pad ->                              -- sinkpad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO CInt

{- |
Unlinks the source pad from the sink pad. Will emit the 'GI.Gst.Objects.Pad.Pad'::@/unlinked/@
signal on both pads.
-}
padUnlink ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a, IsPad b) =>
    a
    {- ^ /@srcpad@/: the source 'GI.Gst.Objects.Pad.Pad' to unlink. -}
    -> b
    {- ^ /@sinkpad@/: the sink 'GI.Gst.Objects.Pad.Pad' to unlink. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pads were unlinked. This function returns 'False' if
the pads were not linked together.

MT safe. -}
padUnlink srcpad sinkpad = liftIO $ do
    srcpad' <- unsafeManagedPtrCastPtr srcpad
    sinkpad' <- unsafeManagedPtrCastPtr sinkpad
    result <- gst_pad_unlink srcpad' sinkpad'
    let result' = (/= 0) result
    touchManagedPtr srcpad
    touchManagedPtr sinkpad
    return result'

#if ENABLE_OVERLOADING
data PadUnlinkMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsPad a, IsPad b) => O.MethodInfo PadUnlinkMethodInfo a signature where
    overloadedMethod _ = padUnlink

#endif

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

foreign import ccall "gst_pad_use_fixed_caps" gst_pad_use_fixed_caps ::
    Ptr Pad ->                              -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
    IO ()

{- |
A helper function you can use that sets the FIXED_CAPS flag
This way the default CAPS query will always return the negotiated caps
or in case the pad is not negotiated, the padtemplate caps.

The negotiated caps are the caps of the last CAPS event that passed on the
pad. Use this function on a pad that, once it negotiated to a CAPS, cannot
be renegotiated to something else.
-}
padUseFixedCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsPad a) =>
    a
    {- ^ /@pad@/: the pad to use -}
    -> m ()
padUseFixedCaps pad = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    gst_pad_use_fixed_caps pad'
    touchManagedPtr pad
    return ()

#if ENABLE_OVERLOADING
data PadUseFixedCapsMethodInfo
instance (signature ~ (m ()), MonadIO m, IsPad a) => O.MethodInfo PadUseFixedCapsMethodInfo a signature where
    overloadedMethod _ = padUseFixedCaps

#endif

-- method Pad::link_get_name
-- method type : MemberFunction
-- Args : [Arg {argCName = "ret", argType = TInterface (Name {namespace = "Gst", name = "PadLinkReturn"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPadLinkReturn to get the name of.", 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_pad_link_get_name" gst_pad_link_get_name ::
    CInt ->                                 -- ret : TInterface (Name {namespace = "Gst", name = "PadLinkReturn"})
    IO CString

{- |
Gets a string representing the given pad-link return.

/Since: 1.4/
-}
padLinkGetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.PadLinkReturn
    {- ^ /@ret@/: a 'GI.Gst.Enums.PadLinkReturn' to get the name of. -}
    -> m T.Text
    {- ^ __Returns:__ a static string with the name of the pad-link return. -}
padLinkGetName ret = liftIO $ do
    let ret' = (fromIntegral . fromEnum) ret
    result <- gst_pad_link_get_name ret'
    checkUnexpectedReturnNULL "padLinkGetName" result
    result' <- cstringToText result
    return result'

#if ENABLE_OVERLOADING
#endif