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

module GI.GstBase.Callbacks
    ( 

 -- * Signals
-- ** CollectDataDestroyNotify #signal:CollectDataDestroyNotify#
    C_CollectDataDestroyNotify              ,
    CollectDataDestroyNotify                ,
    dynamic_CollectDataDestroyNotify        ,
    genClosure_CollectDataDestroyNotify     ,
    mk_CollectDataDestroyNotify             ,
    noCollectDataDestroyNotify              ,
    wrap_CollectDataDestroyNotify           ,


-- ** CollectPadsBufferFunction #signal:CollectPadsBufferFunction#
    C_CollectPadsBufferFunction             ,
    CollectPadsBufferFunction               ,
    CollectPadsBufferFunction_WithClosures  ,
    drop_closures_CollectPadsBufferFunction ,
    dynamic_CollectPadsBufferFunction       ,
    genClosure_CollectPadsBufferFunction    ,
    mk_CollectPadsBufferFunction            ,
    noCollectPadsBufferFunction             ,
    noCollectPadsBufferFunction_WithClosures,
    wrap_CollectPadsBufferFunction          ,


-- ** CollectPadsClipFunction #signal:CollectPadsClipFunction#
    C_CollectPadsClipFunction               ,
    CollectPadsClipFunction                 ,
    CollectPadsClipFunction_WithClosures    ,
    drop_closures_CollectPadsClipFunction   ,
    dynamic_CollectPadsClipFunction         ,
    genClosure_CollectPadsClipFunction      ,
    mk_CollectPadsClipFunction              ,
    noCollectPadsClipFunction               ,
    noCollectPadsClipFunction_WithClosures  ,
    wrap_CollectPadsClipFunction            ,


-- ** CollectPadsCompareFunction #signal:CollectPadsCompareFunction#
    C_CollectPadsCompareFunction            ,
    CollectPadsCompareFunction              ,
    CollectPadsCompareFunction_WithClosures ,
    drop_closures_CollectPadsCompareFunction,
    dynamic_CollectPadsCompareFunction      ,
    genClosure_CollectPadsCompareFunction   ,
    mk_CollectPadsCompareFunction           ,
    noCollectPadsCompareFunction            ,
    noCollectPadsCompareFunction_WithClosures,
    wrap_CollectPadsCompareFunction         ,


-- ** CollectPadsEventFunction #signal:CollectPadsEventFunction#
    C_CollectPadsEventFunction              ,
    CollectPadsEventFunction                ,
    CollectPadsEventFunction_WithClosures   ,
    drop_closures_CollectPadsEventFunction  ,
    dynamic_CollectPadsEventFunction        ,
    genClosure_CollectPadsEventFunction     ,
    mk_CollectPadsEventFunction             ,
    noCollectPadsEventFunction              ,
    noCollectPadsEventFunction_WithClosures ,
    wrap_CollectPadsEventFunction           ,


-- ** CollectPadsFlushFunction #signal:CollectPadsFlushFunction#
    C_CollectPadsFlushFunction              ,
    CollectPadsFlushFunction                ,
    CollectPadsFlushFunction_WithClosures   ,
    drop_closures_CollectPadsFlushFunction  ,
    dynamic_CollectPadsFlushFunction        ,
    genClosure_CollectPadsFlushFunction     ,
    mk_CollectPadsFlushFunction             ,
    noCollectPadsFlushFunction              ,
    noCollectPadsFlushFunction_WithClosures ,
    wrap_CollectPadsFlushFunction           ,


-- ** CollectPadsFunction #signal:CollectPadsFunction#
    C_CollectPadsFunction                   ,
    CollectPadsFunction                     ,
    CollectPadsFunction_WithClosures        ,
    drop_closures_CollectPadsFunction       ,
    dynamic_CollectPadsFunction             ,
    genClosure_CollectPadsFunction          ,
    mk_CollectPadsFunction                  ,
    noCollectPadsFunction                   ,
    noCollectPadsFunction_WithClosures      ,
    wrap_CollectPadsFunction                ,


-- ** CollectPadsQueryFunction #signal:CollectPadsQueryFunction#
    C_CollectPadsQueryFunction              ,
    CollectPadsQueryFunction                ,
    CollectPadsQueryFunction_WithClosures   ,
    drop_closures_CollectPadsQueryFunction  ,
    dynamic_CollectPadsQueryFunction        ,
    genClosure_CollectPadsQueryFunction     ,
    mk_CollectPadsQueryFunction             ,
    noCollectPadsQueryFunction              ,
    noCollectPadsQueryFunction_WithClosures ,
    wrap_CollectPadsQueryFunction           ,


-- ** DataQueueEmptyCallback #signal:DataQueueEmptyCallback#
    C_DataQueueEmptyCallback                ,
    DataQueueEmptyCallback                  ,
    dynamic_DataQueueEmptyCallback          ,
    genClosure_DataQueueEmptyCallback       ,
    mk_DataQueueEmptyCallback               ,
    noDataQueueEmptyCallback                ,
    wrap_DataQueueEmptyCallback             ,


-- ** DataQueueFullCallback #signal:DataQueueFullCallback#
    C_DataQueueFullCallback                 ,
    DataQueueFullCallback                   ,
    dynamic_DataQueueFullCallback           ,
    genClosure_DataQueueFullCallback        ,
    mk_DataQueueFullCallback                ,
    noDataQueueFullCallback                 ,
    wrap_DataQueueFullCallback              ,


-- ** TypeFindHelperGetRangeFunction #signal:TypeFindHelperGetRangeFunction#
    C_TypeFindHelperGetRangeFunction        ,
    TypeFindHelperGetRangeFunction          ,
    dynamic_TypeFindHelperGetRangeFunction  ,
    genClosure_TypeFindHelperGetRangeFunction,
    mk_TypeFindHelperGetRangeFunction       ,
    noTypeFindHelperGetRangeFunction        ,
    wrap_TypeFindHelperGetRangeFunction     ,




    ) where

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

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

import qualified GI.Gst.Enums as Gst.Enums
import qualified GI.Gst.Objects.Object as Gst.Object
import qualified GI.Gst.Structs.Buffer as Gst.Buffer
import qualified GI.Gst.Structs.Event as Gst.Event
import qualified GI.Gst.Structs.Query as Gst.Query
import {-# SOURCE #-} qualified GI.GstBase.Objects.CollectPads as GstBase.CollectPads
import {-# SOURCE #-} qualified GI.GstBase.Objects.DataQueue as GstBase.DataQueue
import {-# SOURCE #-} qualified GI.GstBase.Structs.CollectData as GstBase.CollectData

-- callback TypeFindHelperGetRangeFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "GST_FLOW_OK for success", sinceVersion = Nothing}, args = [Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject that will handle the getrange request", 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 @obj or %NULL", 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 offset of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the range", 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 "a memory location to hold the result buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function will be called by gst_type_find_helper_get_range() when\ntypefinding functions request to peek at the data of a stream at certain\noffsets. If this function returns GST_FLOW_OK, the result buffer will be\nstored in @buffer. The  contents of @buffer is invalid for any other\nreturn value.\n\nThis function is supposed to behave exactly like a #GstPadGetRangeFunction.", sinceVersion = Nothing}}
type C_TypeFindHelperGetRangeFunction =
    Ptr Gst.Object.Object ->
    Ptr Gst.Object.Object ->
    Word64 ->
    Word32 ->
    Ptr Gst.Buffer.Buffer ->
    IO CUInt

-- Args : [Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstObject that will handle the getrange request", 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 @obj or %NULL", 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 offset of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the range", 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 "a memory location to hold the result buffer", 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 "dynamic" __dynamic_C_TypeFindHelperGetRangeFunction :: FunPtr C_TypeFindHelperGetRangeFunction -> C_TypeFindHelperGetRangeFunction

dynamic_TypeFindHelperGetRangeFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Object.IsObject b) =>
    FunPtr C_TypeFindHelperGetRangeFunction
    -> a
    {- ^ /@obj@/: a 'GI.Gst.Objects.Object.Object' that will handle the getrange request -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@obj@/ or 'Nothing' -}
    -> Word64
    {- ^ /@offset@/: the offset of the range -}
    -> Word32
    {- ^ /@length@/: the length of the range -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a memory location to hold the result buffer -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ GST_FLOW_OK for success -}
dynamic_TypeFindHelperGetRangeFunction __funPtr obj parent offset length_ buffer = liftIO $ do
    obj' <- unsafeManagedPtrCastPtr obj
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- (__dynamic_C_TypeFindHelperGetRangeFunction __funPtr) obj' maybeParent offset length_ buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr obj
    whenJust parent touchManagedPtr
    touchManagedPtr buffer
    return result'

foreign import ccall "wrapper"
    mk_TypeFindHelperGetRangeFunction :: C_TypeFindHelperGetRangeFunction -> IO (FunPtr C_TypeFindHelperGetRangeFunction)

type TypeFindHelperGetRangeFunction =
    Gst.Object.Object ->
    Maybe Gst.Object.Object ->
    Word64 ->
    Word32 ->
    Gst.Buffer.Buffer ->
    IO Gst.Enums.FlowReturn

noTypeFindHelperGetRangeFunction :: Maybe TypeFindHelperGetRangeFunction
noTypeFindHelperGetRangeFunction = Nothing

genClosure_TypeFindHelperGetRangeFunction :: TypeFindHelperGetRangeFunction -> IO Closure
genClosure_TypeFindHelperGetRangeFunction cb = do
    let cb' = wrap_TypeFindHelperGetRangeFunction Nothing cb
    mk_TypeFindHelperGetRangeFunction cb' >>= newCClosure


wrap_TypeFindHelperGetRangeFunction ::
    Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction)) ->
    TypeFindHelperGetRangeFunction ->
    Ptr Gst.Object.Object ->
    Ptr Gst.Object.Object ->
    Word64 ->
    Word32 ->
    Ptr Gst.Buffer.Buffer ->
    IO CUInt
wrap_TypeFindHelperGetRangeFunction funptrptr _cb obj parent offset length_ buffer = do
    obj' <- (newObject Gst.Object.Object) obj
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    buffer' <- (newBoxed Gst.Buffer.Buffer) buffer
    result <- _cb  obj' maybeParent offset length_ buffer'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback DataQueueFullCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "queue", argType = TInterface (Name {namespace = "GstBase", name = "DataQueue"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "checkdata", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
type C_DataQueueFullCallback =
    Ptr GstBase.DataQueue.DataQueue ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "queue", argType = TInterface (Name {namespace = "GstBase", name = "DataQueue"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "checkdata", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DataQueueFullCallback :: FunPtr C_DataQueueFullCallback -> C_DataQueueFullCallback

dynamic_DataQueueFullCallback ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.DataQueue.IsDataQueue a) =>
    FunPtr C_DataQueueFullCallback
    -> a
    -> Ptr ()
    -> m ()
dynamic_DataQueueFullCallback __funPtr queue checkdata = liftIO $ do
    queue' <- unsafeManagedPtrCastPtr queue
    (__dynamic_C_DataQueueFullCallback __funPtr) queue' checkdata
    touchManagedPtr queue
    return ()

foreign import ccall "wrapper"
    mk_DataQueueFullCallback :: C_DataQueueFullCallback -> IO (FunPtr C_DataQueueFullCallback)

type DataQueueFullCallback =
    GstBase.DataQueue.DataQueue ->
    Ptr () ->
    IO ()

noDataQueueFullCallback :: Maybe DataQueueFullCallback
noDataQueueFullCallback = Nothing

genClosure_DataQueueFullCallback :: DataQueueFullCallback -> IO Closure
genClosure_DataQueueFullCallback cb = do
    let cb' = wrap_DataQueueFullCallback Nothing cb
    mk_DataQueueFullCallback cb' >>= newCClosure


wrap_DataQueueFullCallback ::
    Maybe (Ptr (FunPtr C_DataQueueFullCallback)) ->
    DataQueueFullCallback ->
    Ptr GstBase.DataQueue.DataQueue ->
    Ptr () ->
    IO ()
wrap_DataQueueFullCallback funptrptr _cb queue checkdata = do
    queue' <- (newObject GstBase.DataQueue.DataQueue) queue
    _cb  queue' checkdata
    maybeReleaseFunPtr funptrptr


-- callback DataQueueEmptyCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "queue", argType = TInterface (Name {namespace = "GstBase", name = "DataQueue"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "checkdata", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
type C_DataQueueEmptyCallback =
    Ptr GstBase.DataQueue.DataQueue ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "queue", argType = TInterface (Name {namespace = "GstBase", name = "DataQueue"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "checkdata", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DataQueueEmptyCallback :: FunPtr C_DataQueueEmptyCallback -> C_DataQueueEmptyCallback

dynamic_DataQueueEmptyCallback ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.DataQueue.IsDataQueue a) =>
    FunPtr C_DataQueueEmptyCallback
    -> a
    -> Ptr ()
    -> m ()
dynamic_DataQueueEmptyCallback __funPtr queue checkdata = liftIO $ do
    queue' <- unsafeManagedPtrCastPtr queue
    (__dynamic_C_DataQueueEmptyCallback __funPtr) queue' checkdata
    touchManagedPtr queue
    return ()

foreign import ccall "wrapper"
    mk_DataQueueEmptyCallback :: C_DataQueueEmptyCallback -> IO (FunPtr C_DataQueueEmptyCallback)

type DataQueueEmptyCallback =
    GstBase.DataQueue.DataQueue ->
    Ptr () ->
    IO ()

noDataQueueEmptyCallback :: Maybe DataQueueEmptyCallback
noDataQueueEmptyCallback = Nothing

genClosure_DataQueueEmptyCallback :: DataQueueEmptyCallback -> IO Closure
genClosure_DataQueueEmptyCallback cb = do
    let cb' = wrap_DataQueueEmptyCallback Nothing cb
    mk_DataQueueEmptyCallback cb' >>= newCClosure


wrap_DataQueueEmptyCallback ::
    Maybe (Ptr (FunPtr C_DataQueueEmptyCallback)) ->
    DataQueueEmptyCallback ->
    Ptr GstBase.DataQueue.DataQueue ->
    Ptr () ->
    IO ()
wrap_DataQueueEmptyCallback funptrptr _cb queue checkdata = do
    queue' <- (newObject GstBase.DataQueue.DataQueue) queue
    _cb  queue' checkdata
    maybeReleaseFunPtr funptrptr


-- callback CollectPadsQueryFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the pad could handle the event", sinceVersion = Nothing}, args = [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that received an event", 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 #GstEvent received", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_query_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called while processing a query. It takes\nownership of the query and is responsible for chaining up (to\nevents downstream (with gst_pad_event_default()).", sinceVersion = Nothing}}
type C_CollectPadsQueryFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Query.Query ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that received an event", 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 #GstEvent received", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_query_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CollectPadsQueryFunction :: FunPtr C_CollectPadsQueryFunction -> C_CollectPadsQueryFunction

dynamic_CollectPadsQueryFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsQueryFunction
    -> a
    {- ^ /@pads@/: the 'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback -}
    -> GstBase.CollectData.CollectData
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that received an event -}
    -> Gst.Query.Query
    {- ^ /@query@/: the 'GI.Gst.Structs.Event.Event' received -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetQueryFunction' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad could handle the event -}
dynamic_CollectPadsQueryFunction __funPtr pads pad query userData = liftIO $ do
    pads' <- unsafeManagedPtrCastPtr pads
    pad' <- unsafeManagedPtrGetPtr pad
    query' <- unsafeManagedPtrGetPtr query
    result <- (__dynamic_C_CollectPadsQueryFunction __funPtr) pads' pad' query' userData
    let result' = (/= 0) result
    touchManagedPtr pads
    touchManagedPtr pad
    touchManagedPtr query
    return result'

foreign import ccall "wrapper"
    mk_CollectPadsQueryFunction :: C_CollectPadsQueryFunction -> IO (FunPtr C_CollectPadsQueryFunction)

type CollectPadsQueryFunction =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Query.Query ->
    IO Bool

noCollectPadsQueryFunction :: Maybe CollectPadsQueryFunction
noCollectPadsQueryFunction = Nothing

type CollectPadsQueryFunction_WithClosures =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Query.Query ->
    Ptr () ->
    IO Bool

noCollectPadsQueryFunction_WithClosures :: Maybe CollectPadsQueryFunction_WithClosures
noCollectPadsQueryFunction_WithClosures = Nothing

drop_closures_CollectPadsQueryFunction :: CollectPadsQueryFunction -> CollectPadsQueryFunction_WithClosures
drop_closures_CollectPadsQueryFunction _f pads pad query _ = _f pads pad query

genClosure_CollectPadsQueryFunction :: CollectPadsQueryFunction -> IO Closure
genClosure_CollectPadsQueryFunction cb = do
    let cb' = drop_closures_CollectPadsQueryFunction cb
    let cb'' = wrap_CollectPadsQueryFunction Nothing cb'
    mk_CollectPadsQueryFunction cb'' >>= newCClosure


wrap_CollectPadsQueryFunction ::
    Maybe (Ptr (FunPtr C_CollectPadsQueryFunction)) ->
    CollectPadsQueryFunction_WithClosures ->
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Query.Query ->
    Ptr () ->
    IO CInt
wrap_CollectPadsQueryFunction funptrptr _cb pads pad query userData = do
    pads' <- (newObject GstBase.CollectPads.CollectPads) pads
    pad' <- (newPtr GstBase.CollectData.CollectData) pad
    query' <- (newBoxed Gst.Query.Query) query
    result <- _cb  pads' pad' query' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback CollectPadsFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%GST_FLOW_OK for success", sinceVersion = Nothing}, args = [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called when all pads have received data.", sinceVersion = Nothing}}
type C_CollectPadsFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr () ->
    IO CUInt

-- Args : [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_function()", 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 "dynamic" __dynamic_C_CollectPadsFunction :: FunPtr C_CollectPadsFunction -> C_CollectPadsFunction

dynamic_CollectPadsFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsFunction
    -> a
    {- ^ /@pads@/: the 'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetFunction' -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' for success -}
dynamic_CollectPadsFunction __funPtr pads userData = liftIO $ do
    pads' <- unsafeManagedPtrCastPtr pads
    result <- (__dynamic_C_CollectPadsFunction __funPtr) pads' userData
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pads
    return result'

foreign import ccall "wrapper"
    mk_CollectPadsFunction :: C_CollectPadsFunction -> IO (FunPtr C_CollectPadsFunction)

type CollectPadsFunction =
    GstBase.CollectPads.CollectPads ->
    IO Gst.Enums.FlowReturn

noCollectPadsFunction :: Maybe CollectPadsFunction
noCollectPadsFunction = Nothing

type CollectPadsFunction_WithClosures =
    GstBase.CollectPads.CollectPads ->
    Ptr () ->
    IO Gst.Enums.FlowReturn

noCollectPadsFunction_WithClosures :: Maybe CollectPadsFunction_WithClosures
noCollectPadsFunction_WithClosures = Nothing

drop_closures_CollectPadsFunction :: CollectPadsFunction -> CollectPadsFunction_WithClosures
drop_closures_CollectPadsFunction _f pads _ = _f pads

genClosure_CollectPadsFunction :: CollectPadsFunction -> IO Closure
genClosure_CollectPadsFunction cb = do
    let cb' = drop_closures_CollectPadsFunction cb
    let cb'' = wrap_CollectPadsFunction Nothing cb'
    mk_CollectPadsFunction cb'' >>= newCClosure


wrap_CollectPadsFunction ::
    Maybe (Ptr (FunPtr C_CollectPadsFunction)) ->
    CollectPadsFunction_WithClosures ->
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr () ->
    IO CUInt
wrap_CollectPadsFunction funptrptr _cb pads userData = do
    pads' <- (newObject GstBase.CollectPads.CollectPads) pads
    result <- _cb  pads' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback CollectPadsFlushFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCollectPads", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called while processing a flushing seek event.\n\nThe function should flush any internal state of the element and the state of\nall the pads. It should clear only the state not directly managed by the\n@pads object. It is therefore not necessary to call\ngst_collect_pads_set_flushing nor gst_collect_pads_clear from this function.", sinceVersion = Just "1.4"}}
type C_CollectPadsFlushFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCollectPads", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "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 "dynamic" __dynamic_C_CollectPadsFlushFunction :: FunPtr C_CollectPadsFlushFunction -> C_CollectPadsFlushFunction

dynamic_CollectPadsFlushFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsFlushFunction
    -> a
    {- ^ /@pads@/: a 'GI.GstBase.Objects.CollectPads.CollectPads' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m ()
dynamic_CollectPadsFlushFunction __funPtr pads userData = liftIO $ do
    pads' <- unsafeManagedPtrCastPtr pads
    (__dynamic_C_CollectPadsFlushFunction __funPtr) pads' userData
    touchManagedPtr pads
    return ()

foreign import ccall "wrapper"
    mk_CollectPadsFlushFunction :: C_CollectPadsFlushFunction -> IO (FunPtr C_CollectPadsFlushFunction)

type CollectPadsFlushFunction =
    GstBase.CollectPads.CollectPads ->
    IO ()

noCollectPadsFlushFunction :: Maybe CollectPadsFlushFunction
noCollectPadsFlushFunction = Nothing

type CollectPadsFlushFunction_WithClosures =
    GstBase.CollectPads.CollectPads ->
    Ptr () ->
    IO ()

noCollectPadsFlushFunction_WithClosures :: Maybe CollectPadsFlushFunction_WithClosures
noCollectPadsFlushFunction_WithClosures = Nothing

drop_closures_CollectPadsFlushFunction :: CollectPadsFlushFunction -> CollectPadsFlushFunction_WithClosures
drop_closures_CollectPadsFlushFunction _f pads _ = _f pads

genClosure_CollectPadsFlushFunction :: CollectPadsFlushFunction -> IO Closure
genClosure_CollectPadsFlushFunction cb = do
    let cb' = drop_closures_CollectPadsFlushFunction cb
    let cb'' = wrap_CollectPadsFlushFunction Nothing cb'
    mk_CollectPadsFlushFunction cb'' >>= newCClosure


wrap_CollectPadsFlushFunction ::
    Maybe (Ptr (FunPtr C_CollectPadsFlushFunction)) ->
    CollectPadsFlushFunction_WithClosures ->
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr () ->
    IO ()
wrap_CollectPadsFlushFunction funptrptr _cb pads userData = do
    pads' <- (newObject GstBase.CollectPads.CollectPads) pads
    _cb  pads' userData
    maybeReleaseFunPtr funptrptr


-- callback CollectPadsEventFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the pad could handle the event", sinceVersion = Nothing}, args = [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that received an event", 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 received", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_event_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called while processing an event. It takes\nownership of the event and is responsible for chaining up (to\ngst_collect_pads_event_default()) or dropping events (such typical cases\nbeing handled by the default handler).", sinceVersion = Nothing}}
type C_CollectPadsEventFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Event.Event ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that received an event", 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 received", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_event_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CollectPadsEventFunction :: FunPtr C_CollectPadsEventFunction -> C_CollectPadsEventFunction

dynamic_CollectPadsEventFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsEventFunction
    -> a
    {- ^ /@pads@/: the 'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback -}
    -> GstBase.CollectData.CollectData
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that received an event -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' received -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetEventFunction' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad could handle the event -}
dynamic_CollectPadsEventFunction __funPtr pads pad event userData = liftIO $ do
    pads' <- unsafeManagedPtrCastPtr pads
    pad' <- unsafeManagedPtrGetPtr pad
    event' <- unsafeManagedPtrGetPtr event
    result <- (__dynamic_C_CollectPadsEventFunction __funPtr) pads' pad' event' userData
    let result' = (/= 0) result
    touchManagedPtr pads
    touchManagedPtr pad
    touchManagedPtr event
    return result'

foreign import ccall "wrapper"
    mk_CollectPadsEventFunction :: C_CollectPadsEventFunction -> IO (FunPtr C_CollectPadsEventFunction)

type CollectPadsEventFunction =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Event.Event ->
    IO Bool

noCollectPadsEventFunction :: Maybe CollectPadsEventFunction
noCollectPadsEventFunction = Nothing

type CollectPadsEventFunction_WithClosures =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Event.Event ->
    Ptr () ->
    IO Bool

noCollectPadsEventFunction_WithClosures :: Maybe CollectPadsEventFunction_WithClosures
noCollectPadsEventFunction_WithClosures = Nothing

drop_closures_CollectPadsEventFunction :: CollectPadsEventFunction -> CollectPadsEventFunction_WithClosures
drop_closures_CollectPadsEventFunction _f pads pad event _ = _f pads pad event

genClosure_CollectPadsEventFunction :: CollectPadsEventFunction -> IO Closure
genClosure_CollectPadsEventFunction cb = do
    let cb' = drop_closures_CollectPadsEventFunction cb
    let cb'' = wrap_CollectPadsEventFunction Nothing cb'
    mk_CollectPadsEventFunction cb'' >>= newCClosure


wrap_CollectPadsEventFunction ::
    Maybe (Ptr (FunPtr C_CollectPadsEventFunction)) ->
    CollectPadsEventFunction_WithClosures ->
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Event.Event ->
    Ptr () ->
    IO CInt
wrap_CollectPadsEventFunction funptrptr _cb pads pad event userData = do
    pads' <- (newObject GstBase.CollectPads.CollectPads) pads
    pad' <- (newPtr GstBase.CollectData.CollectData) pad
    event' <- (newBoxed Gst.Event.Event) event
    result <- _cb  pads' pad' event' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback CollectPadsCompareFunction
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "Integer less than zero when first timestamp is deemed older than the second one.\n         Zero if the timestamps are deemed equally old.\n         Integer greater than zero when second timestamp is deemed older than the first one.", sinceVersion = Nothing}, args = [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that is comparing the timestamps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data1", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first #GstCollectData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp1", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first timestamp", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data2", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second #GstCollectData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp2", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second timestamp", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_compare_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function for comparing two timestamps of buffers or newsegments collected on one pad.", sinceVersion = Nothing}}
type C_CollectPadsCompareFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Word64 ->
    Ptr GstBase.CollectData.CollectData ->
    Word64 ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that is comparing the timestamps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data1", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first #GstCollectData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp1", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first timestamp", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data2", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second #GstCollectData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp2", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second timestamp", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, 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 gst_collect_pads_set_compare_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CollectPadsCompareFunction :: FunPtr C_CollectPadsCompareFunction -> C_CollectPadsCompareFunction

dynamic_CollectPadsCompareFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsCompareFunction
    -> a
    {- ^ /@pads@/: the 'GI.GstBase.Objects.CollectPads.CollectPads' that is comparing the timestamps -}
    -> GstBase.CollectData.CollectData
    {- ^ /@data1@/: the first 'GI.GstBase.Structs.CollectData.CollectData' -}
    -> Word64
    {- ^ /@timestamp1@/: the first timestamp -}
    -> GstBase.CollectData.CollectData
    {- ^ /@data2@/: the second 'GI.GstBase.Structs.CollectData.CollectData' -}
    -> Word64
    {- ^ /@timestamp2@/: the second timestamp -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetCompareFunction' -}
    -> m Int32
    {- ^ __Returns:__ Integer less than zero when first timestamp is deemed older than the second one.
         Zero if the timestamps are deemed equally old.
         Integer greater than zero when second timestamp is deemed older than the first one. -}
dynamic_CollectPadsCompareFunction __funPtr pads data1 timestamp1 data2 timestamp2 userData = liftIO $ do
    pads' <- unsafeManagedPtrCastPtr pads
    data1' <- unsafeManagedPtrGetPtr data1
    data2' <- unsafeManagedPtrGetPtr data2
    result <- (__dynamic_C_CollectPadsCompareFunction __funPtr) pads' data1' timestamp1 data2' timestamp2 userData
    touchManagedPtr pads
    touchManagedPtr data1
    touchManagedPtr data2
    return result

foreign import ccall "wrapper"
    mk_CollectPadsCompareFunction :: C_CollectPadsCompareFunction -> IO (FunPtr C_CollectPadsCompareFunction)

type CollectPadsCompareFunction =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Word64 ->
    GstBase.CollectData.CollectData ->
    Word64 ->
    IO Int32

noCollectPadsCompareFunction :: Maybe CollectPadsCompareFunction
noCollectPadsCompareFunction = Nothing

type CollectPadsCompareFunction_WithClosures =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Word64 ->
    GstBase.CollectData.CollectData ->
    Word64 ->
    Ptr () ->
    IO Int32

noCollectPadsCompareFunction_WithClosures :: Maybe CollectPadsCompareFunction_WithClosures
noCollectPadsCompareFunction_WithClosures = Nothing

drop_closures_CollectPadsCompareFunction :: CollectPadsCompareFunction -> CollectPadsCompareFunction_WithClosures
drop_closures_CollectPadsCompareFunction _f pads data1 timestamp1 data2 timestamp2 _ = _f pads data1 timestamp1 data2 timestamp2

genClosure_CollectPadsCompareFunction :: CollectPadsCompareFunction -> IO Closure
genClosure_CollectPadsCompareFunction cb = do
    let cb' = drop_closures_CollectPadsCompareFunction cb
    let cb'' = wrap_CollectPadsCompareFunction Nothing cb'
    mk_CollectPadsCompareFunction cb'' >>= newCClosure


wrap_CollectPadsCompareFunction ::
    Maybe (Ptr (FunPtr C_CollectPadsCompareFunction)) ->
    CollectPadsCompareFunction_WithClosures ->
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Word64 ->
    Ptr GstBase.CollectData.CollectData ->
    Word64 ->
    Ptr () ->
    IO Int32
wrap_CollectPadsCompareFunction funptrptr _cb pads data1 timestamp1 data2 timestamp2 userData = do
    pads' <- (newObject GstBase.CollectPads.CollectPads) pads
    data1' <- (newPtr GstBase.CollectData.CollectData) data1
    data2' <- (newPtr GstBase.CollectData.CollectData) data2
    result <- _cb  pads' data1' timestamp1 data2' timestamp2 userData
    maybeReleaseFunPtr funptrptr
    return result


-- callback CollectPadsClipFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "a #GstFlowReturn that corresponds to the result of clipping.", sinceVersion = Nothing}, args = [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCollectPads", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCollectData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "inbuffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the input #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "outbuffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the output #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called when @inbuffer is received on the pad managed\nby @data in the collectpad object @pads.\n\nThe function should use the segment of @data and the negotiated media type on\nthe pad to perform clipping of @inbuffer.\n\nThis function takes ownership of @inbuffer and should output a buffer in\n@outbuffer or return %NULL in @outbuffer if the buffer should be dropped.", sinceVersion = Nothing}}
type C_CollectPadsClipFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Buffer.Buffer ->
    Ptr Gst.Buffer.Buffer ->
    Ptr () ->
    IO CUInt

-- Args : [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCollectPads", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCollectData", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "inbuffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the input #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "outbuffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the output #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CollectPadsClipFunction :: FunPtr C_CollectPadsClipFunction -> C_CollectPadsClipFunction

dynamic_CollectPadsClipFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsClipFunction
    -> a
    {- ^ /@pads@/: a 'GI.GstBase.Objects.CollectPads.CollectPads' -}
    -> GstBase.CollectData.CollectData
    {- ^ /@data@/: a 'GI.GstBase.Structs.CollectData.CollectData' -}
    -> Gst.Buffer.Buffer
    {- ^ /@inbuffer@/: the input 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Gst.Buffer.Buffer
    {- ^ /@outbuffer@/: the output 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' that corresponds to the result of clipping. -}
dynamic_CollectPadsClipFunction __funPtr pads data_ inbuffer outbuffer userData = liftIO $ do
    pads' <- unsafeManagedPtrCastPtr pads
    data_' <- unsafeManagedPtrGetPtr data_
    inbuffer' <- B.ManagedPtr.disownBoxed inbuffer
    outbuffer' <- unsafeManagedPtrGetPtr outbuffer
    result <- (__dynamic_C_CollectPadsClipFunction __funPtr) pads' data_' inbuffer' outbuffer' userData
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pads
    touchManagedPtr data_
    touchManagedPtr inbuffer
    touchManagedPtr outbuffer
    return result'

foreign import ccall "wrapper"
    mk_CollectPadsClipFunction :: C_CollectPadsClipFunction -> IO (FunPtr C_CollectPadsClipFunction)

type CollectPadsClipFunction =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Buffer.Buffer ->
    Gst.Buffer.Buffer ->
    IO Gst.Enums.FlowReturn

noCollectPadsClipFunction :: Maybe CollectPadsClipFunction
noCollectPadsClipFunction = Nothing

type CollectPadsClipFunction_WithClosures =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Buffer.Buffer ->
    Gst.Buffer.Buffer ->
    Ptr () ->
    IO Gst.Enums.FlowReturn

noCollectPadsClipFunction_WithClosures :: Maybe CollectPadsClipFunction_WithClosures
noCollectPadsClipFunction_WithClosures = Nothing

drop_closures_CollectPadsClipFunction :: CollectPadsClipFunction -> CollectPadsClipFunction_WithClosures
drop_closures_CollectPadsClipFunction _f pads data_ inbuffer outbuffer _ = _f pads data_ inbuffer outbuffer

genClosure_CollectPadsClipFunction :: CollectPadsClipFunction -> IO Closure
genClosure_CollectPadsClipFunction cb = do
    let cb' = drop_closures_CollectPadsClipFunction cb
    let cb'' = wrap_CollectPadsClipFunction Nothing cb'
    mk_CollectPadsClipFunction cb'' >>= newCClosure


wrap_CollectPadsClipFunction ::
    Maybe (Ptr (FunPtr C_CollectPadsClipFunction)) ->
    CollectPadsClipFunction_WithClosures ->
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Buffer.Buffer ->
    Ptr Gst.Buffer.Buffer ->
    Ptr () ->
    IO CUInt
wrap_CollectPadsClipFunction funptrptr _cb pads data_ inbuffer outbuffer userData = do
    pads' <- (newObject GstBase.CollectPads.CollectPads) pads
    data_' <- (newPtr GstBase.CollectData.CollectData) data_
    inbuffer' <- (wrapBoxed Gst.Buffer.Buffer) inbuffer
    outbuffer' <- (newBoxed Gst.Buffer.Buffer) outbuffer
    result <- _cb  pads' data_' inbuffer' outbuffer' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback CollectPadsBufferFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%GST_FLOW_OK for success", sinceVersion = Nothing}, args = [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectData of pad that has received 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 = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to gst_collect_pads_set_buffer_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called when a (considered oldest) buffer can be muxed.\nIf all pads have reached EOS, this function is called with %NULL @buffer\nand %NULL @data.", sinceVersion = Nothing}}
type C_CollectPadsBufferFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Buffer.Buffer ->
    Ptr () ->
    IO CUInt

-- Args : [Arg {argCName = "pads", argType = TInterface (Name {namespace = "GstBase", name = "CollectPads"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectPads that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectData of pad that has received 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 = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to gst_collect_pads_set_buffer_function()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CollectPadsBufferFunction :: FunPtr C_CollectPadsBufferFunction -> C_CollectPadsBufferFunction

dynamic_CollectPadsBufferFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsBufferFunction
    -> a
    {- ^ /@pads@/: the 'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback -}
    -> GstBase.CollectData.CollectData
    {- ^ /@data@/: the 'GI.GstBase.Structs.CollectData.CollectData' of pad that has received the buffer -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: the 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetBufferFunction' -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' for success -}
dynamic_CollectPadsBufferFunction __funPtr pads data_ buffer userData = liftIO $ do
    pads' <- unsafeManagedPtrCastPtr pads
    data_' <- unsafeManagedPtrGetPtr data_
    buffer' <- B.ManagedPtr.disownBoxed buffer
    result <- (__dynamic_C_CollectPadsBufferFunction __funPtr) pads' data_' buffer' userData
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pads
    touchManagedPtr data_
    touchManagedPtr buffer
    return result'

foreign import ccall "wrapper"
    mk_CollectPadsBufferFunction :: C_CollectPadsBufferFunction -> IO (FunPtr C_CollectPadsBufferFunction)

type CollectPadsBufferFunction =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Buffer.Buffer ->
    IO Gst.Enums.FlowReturn

noCollectPadsBufferFunction :: Maybe CollectPadsBufferFunction
noCollectPadsBufferFunction = Nothing

type CollectPadsBufferFunction_WithClosures =
    GstBase.CollectPads.CollectPads ->
    GstBase.CollectData.CollectData ->
    Gst.Buffer.Buffer ->
    Ptr () ->
    IO Gst.Enums.FlowReturn

noCollectPadsBufferFunction_WithClosures :: Maybe CollectPadsBufferFunction_WithClosures
noCollectPadsBufferFunction_WithClosures = Nothing

drop_closures_CollectPadsBufferFunction :: CollectPadsBufferFunction -> CollectPadsBufferFunction_WithClosures
drop_closures_CollectPadsBufferFunction _f pads data_ buffer _ = _f pads data_ buffer

genClosure_CollectPadsBufferFunction :: CollectPadsBufferFunction -> IO Closure
genClosure_CollectPadsBufferFunction cb = do
    let cb' = drop_closures_CollectPadsBufferFunction cb
    let cb'' = wrap_CollectPadsBufferFunction Nothing cb'
    mk_CollectPadsBufferFunction cb'' >>= newCClosure


wrap_CollectPadsBufferFunction ::
    Maybe (Ptr (FunPtr C_CollectPadsBufferFunction)) ->
    CollectPadsBufferFunction_WithClosures ->
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Buffer.Buffer ->
    Ptr () ->
    IO CUInt
wrap_CollectPadsBufferFunction funptrptr _cb pads data_ buffer userData = do
    pads' <- (newObject GstBase.CollectPads.CollectPads) pads
    data_' <- (newPtr GstBase.CollectData.CollectData) data_
    buffer' <- (wrapBoxed Gst.Buffer.Buffer) buffer
    result <- _cb  pads' data_' buffer' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback CollectDataDestroyNotify
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "data", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectData that will be freed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called when the #GstCollectData will be freed.\nIt is passed the pointer to the structure and should free any custom\nmemory and resources allocated for it.", sinceVersion = Nothing}}
type C_CollectDataDestroyNotify =
    Ptr GstBase.CollectData.CollectData ->
    IO ()

-- Args : [Arg {argCName = "data", argType = TInterface (Name {namespace = "GstBase", name = "CollectData"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCollectData that will be freed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CollectDataDestroyNotify :: FunPtr C_CollectDataDestroyNotify -> C_CollectDataDestroyNotify

dynamic_CollectDataDestroyNotify ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_CollectDataDestroyNotify
    -> GstBase.CollectData.CollectData
    {- ^ /@data@/: the 'GI.GstBase.Structs.CollectData.CollectData' that will be freed -}
    -> m ()
dynamic_CollectDataDestroyNotify __funPtr data_ = liftIO $ do
    data_' <- unsafeManagedPtrGetPtr data_
    (__dynamic_C_CollectDataDestroyNotify __funPtr) data_'
    touchManagedPtr data_
    return ()

foreign import ccall "wrapper"
    mk_CollectDataDestroyNotify :: C_CollectDataDestroyNotify -> IO (FunPtr C_CollectDataDestroyNotify)

type CollectDataDestroyNotify =
    GstBase.CollectData.CollectData ->
    IO ()

noCollectDataDestroyNotify :: Maybe CollectDataDestroyNotify
noCollectDataDestroyNotify = Nothing

genClosure_CollectDataDestroyNotify :: CollectDataDestroyNotify -> IO Closure
genClosure_CollectDataDestroyNotify cb = do
    let cb' = wrap_CollectDataDestroyNotify Nothing cb
    mk_CollectDataDestroyNotify cb' >>= newCClosure


wrap_CollectDataDestroyNotify ::
    Maybe (Ptr (FunPtr C_CollectDataDestroyNotify)) ->
    CollectDataDestroyNotify ->
    Ptr GstBase.CollectData.CollectData ->
    IO ()
wrap_CollectDataDestroyNotify funptrptr _cb data_ = do
    data_' <- (newPtr GstBase.CollectData.CollectData) data_
    _cb  data_'
    maybeReleaseFunPtr funptrptr