-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

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

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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R

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 = DirectionOut
          , 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 = TransferEverything
          }
      ]
  , 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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_TypeFindHelperGetRangeFunction =
    Ptr Gst.Object.Object ->
    Ptr Gst.Object.Object ->
    Word64 ->
    Word32 ->
    Ptr (Ptr Gst.Buffer.Buffer) ->
    IO CInt

-- 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 = DirectionOut
--           , 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 = TransferEverything
--           }
--       ]
-- 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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TypeFindHelperGetRangeFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Object.IsObject b) =>
    FunPtr C_TypeFindHelperGetRangeFunction
    -> a
    -- ^ /@obj@/: a t'GI.Gst.Objects.Object.Object' that will handle the getrange request
    -> Maybe (b)
    -- ^ /@parent@/: the parent of /@obj@/ or 'P.Nothing'
    -> Word64
    -- ^ /@offset@/: the offset of the range
    -> Word32
    -- ^ /@length@/: the length of the range
    -> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
    -- ^ __Returns:__ GST_FLOW_OK for success
dynamic_TypeFindHelperGetRangeFunction :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsObject a, IsObject b) =>
FunPtr C_TypeFindHelperGetRangeFunction
-> a -> Maybe b -> Word64 -> Word32 -> m (FlowReturn, Buffer)
dynamic_TypeFindHelperGetRangeFunction FunPtr C_TypeFindHelperGetRangeFunction
__funPtr a
obj Maybe b
parent Word64
offset Word32
length_ = IO (FlowReturn, Buffer) -> m (FlowReturn, Buffer)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (FlowReturn, Buffer) -> m (FlowReturn, Buffer))
-> IO (FlowReturn, Buffer) -> m (FlowReturn, Buffer)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
obj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
obj
    Ptr Object
maybeParent <- case Maybe b
parent of
        Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
        Just b
jParent -> do
            Ptr Object
jParent' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jParent
            Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jParent'
    Ptr (Ptr Buffer)
buffer <- IO (Ptr (Ptr Buffer))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gst.Buffer.Buffer))
    CInt
result <- (FunPtr C_TypeFindHelperGetRangeFunction
-> C_TypeFindHelperGetRangeFunction
__dynamic_C_TypeFindHelperGetRangeFunction FunPtr C_TypeFindHelperGetRangeFunction
__funPtr) Ptr Object
obj' Ptr Object
maybeParent Word64
offset Word32
length_ Ptr (Ptr Buffer)
buffer
    let result' :: FlowReturn
result' = (Int -> FlowReturn
forall a. Enum a => Int -> a
toEnum (Int -> FlowReturn) -> (CInt -> Int) -> CInt -> FlowReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
result
    Ptr Buffer
buffer' <- Ptr (Ptr Buffer) -> IO (Ptr Buffer)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Buffer)
buffer
    Buffer
buffer'' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
buffer'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
obj
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
parent b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Ptr (Ptr Buffer) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Buffer)
buffer
    (FlowReturn, Buffer) -> IO (FlowReturn, Buffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (FlowReturn
result', Buffer
buffer'')

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

-- | This function will be called by 'GI.GstBase.Functions.typeFindHelperGetRange' when
-- typefinding functions request to peek at the data of a stream at certain
-- offsets. If this function returns GST_FLOW_OK, the result buffer will be
-- stored in /@buffer@/. The  contents of /@buffer@/ is invalid for any other
-- return value.
-- 
-- This function is supposed to behave exactly like a t'GI.Gst.Callbacks.PadGetRangeFunction'.
type TypeFindHelperGetRangeFunction =
    Gst.Object.Object
    -- ^ /@obj@/: a t'GI.Gst.Objects.Object.Object' that will handle the getrange request
    -> Maybe Gst.Object.Object
    -- ^ /@parent@/: the parent of /@obj@/ or 'P.Nothing'
    -> Word64
    -- ^ /@offset@/: the offset of the range
    -> Word32
    -- ^ /@length@/: the length of the range
    -> IO ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
    -- ^ __Returns:__ GST_FLOW_OK for success

-- | A convenience synonym for @`Nothing` :: `Maybe` `TypeFindHelperGetRangeFunction`@.
noTypeFindHelperGetRangeFunction :: Maybe TypeFindHelperGetRangeFunction
noTypeFindHelperGetRangeFunction :: Maybe TypeFindHelperGetRangeFunction
noTypeFindHelperGetRangeFunction = Maybe TypeFindHelperGetRangeFunction
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_TypeFindHelperGetRangeFunction :: MonadIO m => TypeFindHelperGetRangeFunction -> m (GClosure C_TypeFindHelperGetRangeFunction)
genClosure_TypeFindHelperGetRangeFunction :: forall (m :: * -> *).
MonadIO m =>
TypeFindHelperGetRangeFunction
-> m (GClosure C_TypeFindHelperGetRangeFunction)
genClosure_TypeFindHelperGetRangeFunction TypeFindHelperGetRangeFunction
cb = IO (GClosure C_TypeFindHelperGetRangeFunction)
-> m (GClosure C_TypeFindHelperGetRangeFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_TypeFindHelperGetRangeFunction)
 -> m (GClosure C_TypeFindHelperGetRangeFunction))
-> IO (GClosure C_TypeFindHelperGetRangeFunction)
-> m (GClosure C_TypeFindHelperGetRangeFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_TypeFindHelperGetRangeFunction
cb' = Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
-> TypeFindHelperGetRangeFunction
-> C_TypeFindHelperGetRangeFunction
wrap_TypeFindHelperGetRangeFunction Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
forall a. Maybe a
Nothing TypeFindHelperGetRangeFunction
cb
    C_TypeFindHelperGetRangeFunction
-> IO (FunPtr C_TypeFindHelperGetRangeFunction)
mk_TypeFindHelperGetRangeFunction C_TypeFindHelperGetRangeFunction
cb' IO (FunPtr C_TypeFindHelperGetRangeFunction)
-> (FunPtr C_TypeFindHelperGetRangeFunction
    -> IO (GClosure C_TypeFindHelperGetRangeFunction))
-> IO (GClosure C_TypeFindHelperGetRangeFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_TypeFindHelperGetRangeFunction
-> IO (GClosure C_TypeFindHelperGetRangeFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `TypeFindHelperGetRangeFunction` into a `C_TypeFindHelperGetRangeFunction`.
wrap_TypeFindHelperGetRangeFunction :: 
    Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction)) ->
    TypeFindHelperGetRangeFunction ->
    C_TypeFindHelperGetRangeFunction
wrap_TypeFindHelperGetRangeFunction :: Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
-> TypeFindHelperGetRangeFunction
-> C_TypeFindHelperGetRangeFunction
wrap_TypeFindHelperGetRangeFunction Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
gi'funptrptr TypeFindHelperGetRangeFunction
gi'cb Ptr Object
obj Ptr Object
parent Word64
offset Word32
length_ Ptr (Ptr Buffer)
buffer = do
    Object
obj' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
Gst.Object.Object) Ptr Object
obj
    Maybe Object
maybeParent <-
        if Ptr Object
parent Ptr Object -> Ptr Object -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Object
forall a. Ptr a
nullPtr
        then Maybe Object -> IO (Maybe Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Object
forall a. Maybe a
Nothing
        else do
            Object
parent' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
Gst.Object.Object) Ptr Object
parent
            Maybe Object -> IO (Maybe Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Object -> IO (Maybe Object))
-> Maybe Object -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ Object -> Maybe Object
forall a. a -> Maybe a
Just Object
parent'
    (FlowReturn
result, Buffer
outbuffer) <- TypeFindHelperGetRangeFunction
gi'cb  Object
obj' Maybe Object
maybeParent Word64
offset Word32
length_
    Ptr Buffer
outbuffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Buffer
outbuffer
    Ptr (Ptr Buffer) -> Ptr Buffer -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (Ptr Buffer)
buffer Ptr Buffer
outbuffer'
    Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
gi'funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (FlowReturn -> Int) -> FlowReturn -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FlowReturn -> Int
forall a. Enum a => a -> Int
fromEnum) FlowReturn
result
    CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
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 }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DataQueueFullCallback ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.DataQueue.IsDataQueue a) =>
    FunPtr C_DataQueueFullCallback
    -> a
    -> Ptr ()
    -> m ()
dynamic_DataQueueFullCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDataQueue a) =>
FunPtr C_DataQueueFullCallback -> a -> Ptr () -> m ()
dynamic_DataQueueFullCallback FunPtr C_DataQueueFullCallback
__funPtr a
queue Ptr ()
checkdata = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DataQueue
queue' <- a -> IO (Ptr DataQueue)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
queue
    (FunPtr C_DataQueueFullCallback -> C_DataQueueFullCallback
__dynamic_C_DataQueueFullCallback FunPtr C_DataQueueFullCallback
__funPtr) Ptr DataQueue
queue' Ptr ()
checkdata
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
queue
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | /No description available in the introspection data./
type DataQueueFullCallback =
    GstBase.DataQueue.DataQueue
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DataQueueFullCallback`@.
noDataQueueFullCallback :: Maybe DataQueueFullCallback
noDataQueueFullCallback :: Maybe DataQueueFullCallback
noDataQueueFullCallback = Maybe DataQueueFullCallback
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_DataQueueFullCallback :: MonadIO m => DataQueueFullCallback -> m (GClosure C_DataQueueFullCallback)
genClosure_DataQueueFullCallback :: forall (m :: * -> *).
MonadIO m =>
DataQueueFullCallback -> m (GClosure C_DataQueueFullCallback)
genClosure_DataQueueFullCallback DataQueueFullCallback
cb = IO (GClosure C_DataQueueFullCallback)
-> m (GClosure C_DataQueueFullCallback)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DataQueueFullCallback)
 -> m (GClosure C_DataQueueFullCallback))
-> IO (GClosure C_DataQueueFullCallback)
-> m (GClosure C_DataQueueFullCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DataQueueFullCallback
cb' = Maybe (Ptr (FunPtr C_DataQueueFullCallback))
-> DataQueueFullCallback -> C_DataQueueFullCallback
wrap_DataQueueFullCallback Maybe (Ptr (FunPtr C_DataQueueFullCallback))
forall a. Maybe a
Nothing DataQueueFullCallback
cb
    C_DataQueueFullCallback -> IO (FunPtr C_DataQueueFullCallback)
mk_DataQueueFullCallback C_DataQueueFullCallback
cb' IO (FunPtr C_DataQueueFullCallback)
-> (FunPtr C_DataQueueFullCallback
    -> IO (GClosure C_DataQueueFullCallback))
-> IO (GClosure C_DataQueueFullCallback)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DataQueueFullCallback
-> IO (GClosure C_DataQueueFullCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DataQueueFullCallback` into a `C_DataQueueFullCallback`.
wrap_DataQueueFullCallback :: 
    Maybe (Ptr (FunPtr C_DataQueueFullCallback)) ->
    DataQueueFullCallback ->
    C_DataQueueFullCallback
wrap_DataQueueFullCallback :: Maybe (Ptr (FunPtr C_DataQueueFullCallback))
-> DataQueueFullCallback -> C_DataQueueFullCallback
wrap_DataQueueFullCallback Maybe (Ptr (FunPtr C_DataQueueFullCallback))
gi'funptrptr DataQueueFullCallback
gi'cb Ptr DataQueue
queue Ptr ()
checkdata = do
    DataQueue
queue' <- ((ManagedPtr DataQueue -> DataQueue)
-> Ptr DataQueue -> IO DataQueue
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DataQueue -> DataQueue
GstBase.DataQueue.DataQueue) Ptr DataQueue
queue
    DataQueueFullCallback
gi'cb  DataQueue
queue' Ptr ()
checkdata
    Maybe (Ptr (FunPtr C_DataQueueFullCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DataQueueFullCallback))
gi'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 }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DataQueueEmptyCallback ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.DataQueue.IsDataQueue a) =>
    FunPtr C_DataQueueEmptyCallback
    -> a
    -> Ptr ()
    -> m ()
dynamic_DataQueueEmptyCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDataQueue a) =>
FunPtr C_DataQueueFullCallback -> a -> Ptr () -> m ()
dynamic_DataQueueEmptyCallback FunPtr C_DataQueueFullCallback
__funPtr a
queue Ptr ()
checkdata = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr DataQueue
queue' <- a -> IO (Ptr DataQueue)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
queue
    (FunPtr C_DataQueueFullCallback -> C_DataQueueFullCallback
__dynamic_C_DataQueueEmptyCallback FunPtr C_DataQueueFullCallback
__funPtr) Ptr DataQueue
queue' Ptr ()
checkdata
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
queue
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | /No description available in the introspection data./
type DataQueueEmptyCallback =
    GstBase.DataQueue.DataQueue
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DataQueueEmptyCallback`@.
noDataQueueEmptyCallback :: Maybe DataQueueEmptyCallback
noDataQueueEmptyCallback :: Maybe DataQueueFullCallback
noDataQueueEmptyCallback = Maybe DataQueueFullCallback
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_DataQueueEmptyCallback :: MonadIO m => DataQueueEmptyCallback -> m (GClosure C_DataQueueEmptyCallback)
genClosure_DataQueueEmptyCallback :: forall (m :: * -> *).
MonadIO m =>
DataQueueFullCallback -> m (GClosure C_DataQueueFullCallback)
genClosure_DataQueueEmptyCallback DataQueueFullCallback
cb = IO (GClosure C_DataQueueFullCallback)
-> m (GClosure C_DataQueueFullCallback)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DataQueueFullCallback)
 -> m (GClosure C_DataQueueFullCallback))
-> IO (GClosure C_DataQueueFullCallback)
-> m (GClosure C_DataQueueFullCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DataQueueFullCallback
cb' = Maybe (Ptr (FunPtr C_DataQueueFullCallback))
-> DataQueueFullCallback -> C_DataQueueFullCallback
wrap_DataQueueEmptyCallback Maybe (Ptr (FunPtr C_DataQueueFullCallback))
forall a. Maybe a
Nothing DataQueueFullCallback
cb
    C_DataQueueFullCallback -> IO (FunPtr C_DataQueueFullCallback)
mk_DataQueueEmptyCallback C_DataQueueFullCallback
cb' IO (FunPtr C_DataQueueFullCallback)
-> (FunPtr C_DataQueueFullCallback
    -> IO (GClosure C_DataQueueFullCallback))
-> IO (GClosure C_DataQueueFullCallback)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DataQueueFullCallback
-> IO (GClosure C_DataQueueFullCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DataQueueEmptyCallback` into a `C_DataQueueEmptyCallback`.
wrap_DataQueueEmptyCallback :: 
    Maybe (Ptr (FunPtr C_DataQueueEmptyCallback)) ->
    DataQueueEmptyCallback ->
    C_DataQueueEmptyCallback
wrap_DataQueueEmptyCallback :: Maybe (Ptr (FunPtr C_DataQueueFullCallback))
-> DataQueueFullCallback -> C_DataQueueFullCallback
wrap_DataQueueEmptyCallback Maybe (Ptr (FunPtr C_DataQueueFullCallback))
gi'funptrptr DataQueueFullCallback
gi'cb Ptr DataQueue
queue Ptr ()
checkdata = do
    DataQueue
queue' <- ((ManagedPtr DataQueue -> DataQueue)
-> Ptr DataQueue -> IO DataQueue
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr DataQueue -> DataQueue
GstBase.DataQueue.DataQueue) Ptr DataQueue
queue
    DataQueueFullCallback
gi'cb  DataQueue
queue' Ptr ()
checkdata
    Maybe (Ptr (FunPtr C_DataQueueFullCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DataQueueFullCallback))
gi'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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectPadsQueryFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsQueryFunction
    -> a
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@pad@/: the t'GI.Gst.Objects.Pad.Pad' that received an event
    -> Gst.Query.Query
    -- ^ /@query@/: the t'GI.Gst.Structs.Event.Event' received
    -> Ptr ()
    -- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetQueryFunction'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the pad could handle the event
dynamic_CollectPadsQueryFunction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCollectPads a) =>
FunPtr C_CollectPadsQueryFunction
-> a -> CollectData -> Query -> Ptr () -> m Bool
dynamic_CollectPadsQueryFunction FunPtr C_CollectPadsQueryFunction
__funPtr a
pads CollectData
pad Query
query Ptr ()
userData = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectPads
pads' <- a -> IO (Ptr CollectPads)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pads
    Ptr CollectData
pad' <- CollectData -> IO (Ptr CollectData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectData
pad
    Ptr Query
query' <- Query -> IO (Ptr Query)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Query
query
    CInt
result <- (FunPtr C_CollectPadsQueryFunction -> C_CollectPadsQueryFunction
__dynamic_C_CollectPadsQueryFunction FunPtr C_CollectPadsQueryFunction
__funPtr) Ptr CollectPads
pads' Ptr CollectData
pad' Ptr Query
query' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pads
    CollectData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectData
pad
    Query -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Query
query
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | A function that will be called while processing a query. It takes
-- ownership of the query and is responsible for chaining up (to
-- events downstream (with 'GI.Gst.Objects.Pad.padEventDefault').
type CollectPadsQueryFunction =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@pad@/: the t'GI.Gst.Objects.Pad.Pad' that received an event
    -> Gst.Query.Query
    -- ^ /@query@/: the t'GI.Gst.Structs.Event.Event' received
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the pad could handle the event

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsQueryFunction`@.
noCollectPadsQueryFunction :: Maybe CollectPadsQueryFunction
noCollectPadsQueryFunction :: Maybe CollectPadsQueryFunction
noCollectPadsQueryFunction = Maybe CollectPadsQueryFunction
forall a. Maybe a
Nothing

-- | A function that will be called while processing a query. It takes
-- ownership of the query and is responsible for chaining up (to
-- events downstream (with 'GI.Gst.Objects.Pad.padEventDefault').
type CollectPadsQueryFunction_WithClosures =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@pad@/: the t'GI.Gst.Objects.Pad.Pad' that received an event
    -> Gst.Query.Query
    -- ^ /@query@/: the t'GI.Gst.Structs.Event.Event' received
    -> Ptr ()
    -- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetQueryFunction'
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the pad could handle the event

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsQueryFunction_WithClosures`@.
noCollectPadsQueryFunction_WithClosures :: Maybe CollectPadsQueryFunction_WithClosures
noCollectPadsQueryFunction_WithClosures :: Maybe CollectPadsQueryFunction_WithClosures
noCollectPadsQueryFunction_WithClosures = Maybe CollectPadsQueryFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CollectPadsQueryFunction :: CollectPadsQueryFunction -> CollectPadsQueryFunction_WithClosures
drop_closures_CollectPadsQueryFunction :: CollectPadsQueryFunction -> CollectPadsQueryFunction_WithClosures
drop_closures_CollectPadsQueryFunction CollectPadsQueryFunction
_f CollectPads
pads CollectData
pad Query
query Ptr ()
_ = CollectPadsQueryFunction
_f CollectPads
pads CollectData
pad Query
query

-- | Wrap the callback into a `GClosure`.
genClosure_CollectPadsQueryFunction :: MonadIO m => CollectPadsQueryFunction -> m (GClosure C_CollectPadsQueryFunction)
genClosure_CollectPadsQueryFunction :: forall (m :: * -> *).
MonadIO m =>
CollectPadsQueryFunction -> m (GClosure C_CollectPadsQueryFunction)
genClosure_CollectPadsQueryFunction CollectPadsQueryFunction
cb = IO (GClosure C_CollectPadsQueryFunction)
-> m (GClosure C_CollectPadsQueryFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectPadsQueryFunction)
 -> m (GClosure C_CollectPadsQueryFunction))
-> IO (GClosure C_CollectPadsQueryFunction)
-> m (GClosure C_CollectPadsQueryFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CollectPadsQueryFunction_WithClosures
cb' = CollectPadsQueryFunction -> CollectPadsQueryFunction_WithClosures
drop_closures_CollectPadsQueryFunction CollectPadsQueryFunction
cb
    let cb'' :: C_CollectPadsQueryFunction
cb'' = Maybe (Ptr (FunPtr C_CollectPadsQueryFunction))
-> CollectPadsQueryFunction_WithClosures
-> C_CollectPadsQueryFunction
wrap_CollectPadsQueryFunction Maybe (Ptr (FunPtr C_CollectPadsQueryFunction))
forall a. Maybe a
Nothing CollectPadsQueryFunction_WithClosures
cb'
    C_CollectPadsQueryFunction
-> IO (FunPtr C_CollectPadsQueryFunction)
mk_CollectPadsQueryFunction C_CollectPadsQueryFunction
cb'' IO (FunPtr C_CollectPadsQueryFunction)
-> (FunPtr C_CollectPadsQueryFunction
    -> IO (GClosure C_CollectPadsQueryFunction))
-> IO (GClosure C_CollectPadsQueryFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectPadsQueryFunction
-> IO (GClosure C_CollectPadsQueryFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectPadsQueryFunction` into a `C_CollectPadsQueryFunction`.
wrap_CollectPadsQueryFunction :: 
    Maybe (Ptr (FunPtr C_CollectPadsQueryFunction)) ->
    CollectPadsQueryFunction_WithClosures ->
    C_CollectPadsQueryFunction
wrap_CollectPadsQueryFunction :: Maybe (Ptr (FunPtr C_CollectPadsQueryFunction))
-> CollectPadsQueryFunction_WithClosures
-> C_CollectPadsQueryFunction
wrap_CollectPadsQueryFunction Maybe (Ptr (FunPtr C_CollectPadsQueryFunction))
gi'funptrptr CollectPadsQueryFunction_WithClosures
gi'cb Ptr CollectPads
pads Ptr CollectData
pad Ptr Query
query Ptr ()
userData = do
    CollectPads
pads' <- ((ManagedPtr CollectPads -> CollectPads)
-> Ptr CollectPads -> IO CollectPads
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CollectPads -> CollectPads
GstBase.CollectPads.CollectPads) Ptr CollectPads
pads
    CollectData
pad' <- ((ManagedPtr CollectData -> CollectData)
-> Ptr CollectData -> IO CollectData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CollectData -> CollectData
GstBase.CollectData.CollectData) Ptr CollectData
pad
    Ptr Query -> (Query -> IO CInt) -> IO CInt
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr Query
query ((Query -> IO CInt) -> IO CInt) -> (Query -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Query
query' -> do
        Bool
result <- CollectPadsQueryFunction_WithClosures
gi'cb  CollectPads
pads' CollectData
pad' Query
query' Ptr ()
userData
        Maybe (Ptr (FunPtr C_CollectPadsQueryFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectPadsQueryFunction))
gi'funptrptr
        let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
        CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_CollectPadsFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    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 = "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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectPadsFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsFunction
    -> a
    -- ^ /@pads@/: the t'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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCollectPads a) =>
FunPtr C_CollectPadsFunction -> a -> Ptr () -> m FlowReturn
dynamic_CollectPadsFunction FunPtr C_CollectPadsFunction
__funPtr a
pads Ptr ()
userData = IO FlowReturn -> m FlowReturn
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FlowReturn -> m FlowReturn) -> IO FlowReturn -> m FlowReturn
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectPads
pads' <- a -> IO (Ptr CollectPads)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pads
    CInt
result <- (FunPtr C_CollectPadsFunction -> C_CollectPadsFunction
__dynamic_C_CollectPadsFunction FunPtr C_CollectPadsFunction
__funPtr) Ptr CollectPads
pads' Ptr ()
userData
    let result' :: FlowReturn
result' = (Int -> FlowReturn
forall a. Enum a => Int -> a
toEnum (Int -> FlowReturn) -> (CInt -> Int) -> CInt -> FlowReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pads
    FlowReturn -> IO FlowReturn
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FlowReturn
result'

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

-- | A function that will be called when all pads have received data.
type CollectPadsFunction =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> IO Gst.Enums.FlowReturn
    -- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' for success

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsFunction`@.
noCollectPadsFunction :: Maybe CollectPadsFunction
noCollectPadsFunction :: Maybe CollectPadsFunction
noCollectPadsFunction = Maybe CollectPadsFunction
forall a. Maybe a
Nothing

-- | A function that will be called when all pads have received data.
type CollectPadsFunction_WithClosures =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> Ptr ()
    -- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetFunction'
    -> IO Gst.Enums.FlowReturn
    -- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' for success

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsFunction_WithClosures`@.
noCollectPadsFunction_WithClosures :: Maybe CollectPadsFunction_WithClosures
noCollectPadsFunction_WithClosures :: Maybe CollectPadsFunction_WithClosures
noCollectPadsFunction_WithClosures = Maybe CollectPadsFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CollectPadsFunction :: CollectPadsFunction -> CollectPadsFunction_WithClosures
drop_closures_CollectPadsFunction :: CollectPadsFunction -> CollectPadsFunction_WithClosures
drop_closures_CollectPadsFunction CollectPadsFunction
_f CollectPads
pads Ptr ()
_ = CollectPadsFunction
_f CollectPads
pads

-- | Wrap the callback into a `GClosure`.
genClosure_CollectPadsFunction :: MonadIO m => CollectPadsFunction -> m (GClosure C_CollectPadsFunction)
genClosure_CollectPadsFunction :: forall (m :: * -> *).
MonadIO m =>
CollectPadsFunction -> m (GClosure C_CollectPadsFunction)
genClosure_CollectPadsFunction CollectPadsFunction
cb = IO (GClosure C_CollectPadsFunction)
-> m (GClosure C_CollectPadsFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectPadsFunction)
 -> m (GClosure C_CollectPadsFunction))
-> IO (GClosure C_CollectPadsFunction)
-> m (GClosure C_CollectPadsFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CollectPadsFunction_WithClosures
cb' = CollectPadsFunction -> CollectPadsFunction_WithClosures
drop_closures_CollectPadsFunction CollectPadsFunction
cb
    let cb'' :: C_CollectPadsFunction
cb'' = Maybe (Ptr (FunPtr C_CollectPadsFunction))
-> CollectPadsFunction_WithClosures -> C_CollectPadsFunction
wrap_CollectPadsFunction Maybe (Ptr (FunPtr C_CollectPadsFunction))
forall a. Maybe a
Nothing CollectPadsFunction_WithClosures
cb'
    C_CollectPadsFunction -> IO (FunPtr C_CollectPadsFunction)
mk_CollectPadsFunction C_CollectPadsFunction
cb'' IO (FunPtr C_CollectPadsFunction)
-> (FunPtr C_CollectPadsFunction
    -> IO (GClosure C_CollectPadsFunction))
-> IO (GClosure C_CollectPadsFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectPadsFunction -> IO (GClosure C_CollectPadsFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectPadsFunction` into a `C_CollectPadsFunction`.
wrap_CollectPadsFunction :: 
    Maybe (Ptr (FunPtr C_CollectPadsFunction)) ->
    CollectPadsFunction_WithClosures ->
    C_CollectPadsFunction
wrap_CollectPadsFunction :: Maybe (Ptr (FunPtr C_CollectPadsFunction))
-> CollectPadsFunction_WithClosures -> C_CollectPadsFunction
wrap_CollectPadsFunction Maybe (Ptr (FunPtr C_CollectPadsFunction))
gi'funptrptr CollectPadsFunction_WithClosures
gi'cb Ptr CollectPads
pads Ptr ()
userData = do
    CollectPads
pads' <- ((ManagedPtr CollectPads -> CollectPads)
-> Ptr CollectPads -> IO CollectPads
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CollectPads -> CollectPads
GstBase.CollectPads.CollectPads) Ptr CollectPads
pads
    FlowReturn
result <- CollectPadsFunction_WithClosures
gi'cb  CollectPads
pads' Ptr ()
userData
    Maybe (Ptr (FunPtr C_CollectPadsFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectPadsFunction))
gi'funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (FlowReturn -> Int) -> FlowReturn -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FlowReturn -> Int
forall a. Enum a => a -> Int
fromEnum) FlowReturn
result
    CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
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"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectPadsFlushFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsFlushFunction
    -> a
    -- ^ /@pads@/: a t'GI.GstBase.Objects.CollectPads.CollectPads'
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> m ()
dynamic_CollectPadsFlushFunction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCollectPads a) =>
FunPtr C_CollectPadsFlushFunction -> a -> Ptr () -> m ()
dynamic_CollectPadsFlushFunction FunPtr C_CollectPadsFlushFunction
__funPtr a
pads Ptr ()
userData = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectPads
pads' <- a -> IO (Ptr CollectPads)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pads
    (FunPtr C_CollectPadsFlushFunction -> C_CollectPadsFlushFunction
__dynamic_C_CollectPadsFlushFunction FunPtr C_CollectPadsFlushFunction
__funPtr) Ptr CollectPads
pads' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pads
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | A function that will be called while processing a flushing seek event.
-- 
-- The function should flush any internal state of the element and the state of
-- all the pads. It should clear only the state not directly managed by the
-- /@pads@/ object. It is therefore not necessary to call
-- gst_collect_pads_set_flushing nor gst_collect_pads_clear from this function.
-- 
-- /Since: 1.4/
type CollectPadsFlushFunction =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: a t'GI.GstBase.Objects.CollectPads.CollectPads'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsFlushFunction`@.
noCollectPadsFlushFunction :: Maybe CollectPadsFlushFunction
noCollectPadsFlushFunction :: Maybe CollectPadsFlushFunction
noCollectPadsFlushFunction = Maybe CollectPadsFlushFunction
forall a. Maybe a
Nothing

-- | A function that will be called while processing a flushing seek event.
-- 
-- The function should flush any internal state of the element and the state of
-- all the pads. It should clear only the state not directly managed by the
-- /@pads@/ object. It is therefore not necessary to call
-- gst_collect_pads_set_flushing nor gst_collect_pads_clear from this function.
-- 
-- /Since: 1.4/
type CollectPadsFlushFunction_WithClosures =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: a t'GI.GstBase.Objects.CollectPads.CollectPads'
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsFlushFunction_WithClosures`@.
noCollectPadsFlushFunction_WithClosures :: Maybe CollectPadsFlushFunction_WithClosures
noCollectPadsFlushFunction_WithClosures :: Maybe CollectPadsFlushFunction_WithClosures
noCollectPadsFlushFunction_WithClosures = Maybe CollectPadsFlushFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CollectPadsFlushFunction :: CollectPadsFlushFunction -> CollectPadsFlushFunction_WithClosures
drop_closures_CollectPadsFlushFunction :: CollectPadsFlushFunction -> CollectPadsFlushFunction_WithClosures
drop_closures_CollectPadsFlushFunction CollectPadsFlushFunction
_f CollectPads
pads Ptr ()
_ = CollectPadsFlushFunction
_f CollectPads
pads

-- | Wrap the callback into a `GClosure`.
genClosure_CollectPadsFlushFunction :: MonadIO m => CollectPadsFlushFunction -> m (GClosure C_CollectPadsFlushFunction)
genClosure_CollectPadsFlushFunction :: forall (m :: * -> *).
MonadIO m =>
CollectPadsFlushFunction -> m (GClosure C_CollectPadsFlushFunction)
genClosure_CollectPadsFlushFunction CollectPadsFlushFunction
cb = IO (GClosure C_CollectPadsFlushFunction)
-> m (GClosure C_CollectPadsFlushFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectPadsFlushFunction)
 -> m (GClosure C_CollectPadsFlushFunction))
-> IO (GClosure C_CollectPadsFlushFunction)
-> m (GClosure C_CollectPadsFlushFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CollectPadsFlushFunction_WithClosures
cb' = CollectPadsFlushFunction -> CollectPadsFlushFunction_WithClosures
drop_closures_CollectPadsFlushFunction CollectPadsFlushFunction
cb
    let cb'' :: C_CollectPadsFlushFunction
cb'' = Maybe (Ptr (FunPtr C_CollectPadsFlushFunction))
-> CollectPadsFlushFunction_WithClosures
-> C_CollectPadsFlushFunction
wrap_CollectPadsFlushFunction Maybe (Ptr (FunPtr C_CollectPadsFlushFunction))
forall a. Maybe a
Nothing CollectPadsFlushFunction_WithClosures
cb'
    C_CollectPadsFlushFunction
-> IO (FunPtr C_CollectPadsFlushFunction)
mk_CollectPadsFlushFunction C_CollectPadsFlushFunction
cb'' IO (FunPtr C_CollectPadsFlushFunction)
-> (FunPtr C_CollectPadsFlushFunction
    -> IO (GClosure C_CollectPadsFlushFunction))
-> IO (GClosure C_CollectPadsFlushFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectPadsFlushFunction
-> IO (GClosure C_CollectPadsFlushFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectPadsFlushFunction` into a `C_CollectPadsFlushFunction`.
wrap_CollectPadsFlushFunction :: 
    Maybe (Ptr (FunPtr C_CollectPadsFlushFunction)) ->
    CollectPadsFlushFunction_WithClosures ->
    C_CollectPadsFlushFunction
wrap_CollectPadsFlushFunction :: Maybe (Ptr (FunPtr C_CollectPadsFlushFunction))
-> CollectPadsFlushFunction_WithClosures
-> C_CollectPadsFlushFunction
wrap_CollectPadsFlushFunction Maybe (Ptr (FunPtr C_CollectPadsFlushFunction))
gi'funptrptr CollectPadsFlushFunction_WithClosures
gi'cb Ptr CollectPads
pads Ptr ()
userData = do
    CollectPads
pads' <- ((ManagedPtr CollectPads -> CollectPads)
-> Ptr CollectPads -> IO CollectPads
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CollectPads -> CollectPads
GstBase.CollectPads.CollectPads) Ptr CollectPads
pads
    CollectPadsFlushFunction_WithClosures
gi'cb  CollectPads
pads' Ptr ()
userData
    Maybe (Ptr (FunPtr C_CollectPadsFlushFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectPadsFlushFunction))
gi'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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectPadsEventFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsEventFunction
    -> a
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@pad@/: the t'GI.Gst.Objects.Pad.Pad' that received an event
    -> Gst.Event.Event
    -- ^ /@event@/: the t'GI.Gst.Structs.Event.Event' received
    -> Ptr ()
    -- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetEventFunction'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the pad could handle the event
dynamic_CollectPadsEventFunction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCollectPads a) =>
FunPtr C_CollectPadsEventFunction
-> a -> CollectData -> Event -> Ptr () -> m Bool
dynamic_CollectPadsEventFunction FunPtr C_CollectPadsEventFunction
__funPtr a
pads CollectData
pad Event
event Ptr ()
userData = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectPads
pads' <- a -> IO (Ptr CollectPads)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pads
    Ptr CollectData
pad' <- CollectData -> IO (Ptr CollectData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectData
pad
    Ptr Event
event' <- Event -> IO (Ptr Event)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Event
event
    CInt
result <- (FunPtr C_CollectPadsEventFunction -> C_CollectPadsEventFunction
__dynamic_C_CollectPadsEventFunction FunPtr C_CollectPadsEventFunction
__funPtr) Ptr CollectPads
pads' Ptr CollectData
pad' Ptr Event
event' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pads
    CollectData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectData
pad
    Event -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Event
event
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | A function that will be called while processing an event. It takes
-- ownership of the event and is responsible for chaining up (to
-- 'GI.GstBase.Objects.CollectPads.collectPadsEventDefault') or dropping events (such typical cases
-- being handled by the default handler).
type CollectPadsEventFunction =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@pad@/: the t'GI.Gst.Objects.Pad.Pad' that received an event
    -> Gst.Event.Event
    -- ^ /@event@/: the t'GI.Gst.Structs.Event.Event' received
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the pad could handle the event

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsEventFunction`@.
noCollectPadsEventFunction :: Maybe CollectPadsEventFunction
noCollectPadsEventFunction :: Maybe CollectPadsEventFunction
noCollectPadsEventFunction = Maybe CollectPadsEventFunction
forall a. Maybe a
Nothing

-- | A function that will be called while processing an event. It takes
-- ownership of the event and is responsible for chaining up (to
-- 'GI.GstBase.Objects.CollectPads.collectPadsEventDefault') or dropping events (such typical cases
-- being handled by the default handler).
type CollectPadsEventFunction_WithClosures =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@pad@/: the t'GI.Gst.Objects.Pad.Pad' that received an event
    -> Gst.Event.Event
    -- ^ /@event@/: the t'GI.Gst.Structs.Event.Event' received
    -> Ptr ()
    -- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetEventFunction'
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if the pad could handle the event

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsEventFunction_WithClosures`@.
noCollectPadsEventFunction_WithClosures :: Maybe CollectPadsEventFunction_WithClosures
noCollectPadsEventFunction_WithClosures :: Maybe CollectPadsEventFunction_WithClosures
noCollectPadsEventFunction_WithClosures = Maybe CollectPadsEventFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CollectPadsEventFunction :: CollectPadsEventFunction -> CollectPadsEventFunction_WithClosures
drop_closures_CollectPadsEventFunction :: CollectPadsEventFunction -> CollectPadsEventFunction_WithClosures
drop_closures_CollectPadsEventFunction CollectPadsEventFunction
_f CollectPads
pads CollectData
pad Event
event Ptr ()
_ = CollectPadsEventFunction
_f CollectPads
pads CollectData
pad Event
event

-- | Wrap the callback into a `GClosure`.
genClosure_CollectPadsEventFunction :: MonadIO m => CollectPadsEventFunction -> m (GClosure C_CollectPadsEventFunction)
genClosure_CollectPadsEventFunction :: forall (m :: * -> *).
MonadIO m =>
CollectPadsEventFunction -> m (GClosure C_CollectPadsEventFunction)
genClosure_CollectPadsEventFunction CollectPadsEventFunction
cb = IO (GClosure C_CollectPadsEventFunction)
-> m (GClosure C_CollectPadsEventFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectPadsEventFunction)
 -> m (GClosure C_CollectPadsEventFunction))
-> IO (GClosure C_CollectPadsEventFunction)
-> m (GClosure C_CollectPadsEventFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CollectPadsEventFunction_WithClosures
cb' = CollectPadsEventFunction -> CollectPadsEventFunction_WithClosures
drop_closures_CollectPadsEventFunction CollectPadsEventFunction
cb
    let cb'' :: C_CollectPadsEventFunction
cb'' = Maybe (Ptr (FunPtr C_CollectPadsEventFunction))
-> CollectPadsEventFunction_WithClosures
-> C_CollectPadsEventFunction
wrap_CollectPadsEventFunction Maybe (Ptr (FunPtr C_CollectPadsEventFunction))
forall a. Maybe a
Nothing CollectPadsEventFunction_WithClosures
cb'
    C_CollectPadsEventFunction
-> IO (FunPtr C_CollectPadsEventFunction)
mk_CollectPadsEventFunction C_CollectPadsEventFunction
cb'' IO (FunPtr C_CollectPadsEventFunction)
-> (FunPtr C_CollectPadsEventFunction
    -> IO (GClosure C_CollectPadsEventFunction))
-> IO (GClosure C_CollectPadsEventFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectPadsEventFunction
-> IO (GClosure C_CollectPadsEventFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectPadsEventFunction` into a `C_CollectPadsEventFunction`.
wrap_CollectPadsEventFunction :: 
    Maybe (Ptr (FunPtr C_CollectPadsEventFunction)) ->
    CollectPadsEventFunction_WithClosures ->
    C_CollectPadsEventFunction
wrap_CollectPadsEventFunction :: Maybe (Ptr (FunPtr C_CollectPadsEventFunction))
-> CollectPadsEventFunction_WithClosures
-> C_CollectPadsEventFunction
wrap_CollectPadsEventFunction Maybe (Ptr (FunPtr C_CollectPadsEventFunction))
gi'funptrptr CollectPadsEventFunction_WithClosures
gi'cb Ptr CollectPads
pads Ptr CollectData
pad Ptr Event
event Ptr ()
userData = do
    CollectPads
pads' <- ((ManagedPtr CollectPads -> CollectPads)
-> Ptr CollectPads -> IO CollectPads
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CollectPads -> CollectPads
GstBase.CollectPads.CollectPads) Ptr CollectPads
pads
    CollectData
pad' <- ((ManagedPtr CollectData -> CollectData)
-> Ptr CollectData -> IO CollectData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CollectData -> CollectData
GstBase.CollectData.CollectData) Ptr CollectData
pad
    Ptr Event -> (Event -> IO CInt) -> IO CInt
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr Event
event ((Event -> IO CInt) -> IO CInt) -> (Event -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Event
event' -> do
        Bool
result <- CollectPadsEventFunction_WithClosures
gi'cb  CollectPads
pads' CollectData
pad' Event
event' Ptr ()
userData
        Maybe (Ptr (FunPtr C_CollectPadsEventFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectPadsEventFunction))
gi'funptrptr
        let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
        CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectPadsCompareFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsCompareFunction
    -> a
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that is comparing the timestamps
    -> GstBase.CollectData.CollectData
    -- ^ /@data1@/: the first t'GI.GstBase.Structs.CollectData.CollectData'
    -> Word64
    -- ^ /@timestamp1@/: the first timestamp
    -> GstBase.CollectData.CollectData
    -- ^ /@data2@/: the second t'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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCollectPads a) =>
FunPtr C_CollectPadsCompareFunction
-> a
-> CollectData
-> Word64
-> CollectData
-> Word64
-> Ptr ()
-> m Int32
dynamic_CollectPadsCompareFunction FunPtr C_CollectPadsCompareFunction
__funPtr a
pads CollectData
data1 Word64
timestamp1 CollectData
data2 Word64
timestamp2 Ptr ()
userData = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectPads
pads' <- a -> IO (Ptr CollectPads)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pads
    Ptr CollectData
data1' <- CollectData -> IO (Ptr CollectData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectData
data1
    Ptr CollectData
data2' <- CollectData -> IO (Ptr CollectData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectData
data2
    Int32
result <- (FunPtr C_CollectPadsCompareFunction -> C_CollectPadsCompareFunction
__dynamic_C_CollectPadsCompareFunction FunPtr C_CollectPadsCompareFunction
__funPtr) Ptr CollectPads
pads' Ptr CollectData
data1' Word64
timestamp1 Ptr CollectData
data2' Word64
timestamp2 Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pads
    CollectData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectData
data1
    CollectData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectData
data2
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

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

-- | A function for comparing two timestamps of buffers or newsegments collected on one pad.
type CollectPadsCompareFunction =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that is comparing the timestamps
    -> GstBase.CollectData.CollectData
    -- ^ /@data1@/: the first t'GI.GstBase.Structs.CollectData.CollectData'
    -> Word64
    -- ^ /@timestamp1@/: the first timestamp
    -> GstBase.CollectData.CollectData
    -- ^ /@data2@/: the second t'GI.GstBase.Structs.CollectData.CollectData'
    -> Word64
    -- ^ /@timestamp2@/: the second timestamp
    -> IO 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.

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsCompareFunction`@.
noCollectPadsCompareFunction :: Maybe CollectPadsCompareFunction
noCollectPadsCompareFunction :: Maybe CollectPadsCompareFunction
noCollectPadsCompareFunction = Maybe CollectPadsCompareFunction
forall a. Maybe a
Nothing

-- | A function for comparing two timestamps of buffers or newsegments collected on one pad.
type CollectPadsCompareFunction_WithClosures =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that is comparing the timestamps
    -> GstBase.CollectData.CollectData
    -- ^ /@data1@/: the first t'GI.GstBase.Structs.CollectData.CollectData'
    -> Word64
    -- ^ /@timestamp1@/: the first timestamp
    -> GstBase.CollectData.CollectData
    -- ^ /@data2@/: the second t'GI.GstBase.Structs.CollectData.CollectData'
    -> Word64
    -- ^ /@timestamp2@/: the second timestamp
    -> Ptr ()
    -- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetCompareFunction'
    -> IO 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.

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsCompareFunction_WithClosures`@.
noCollectPadsCompareFunction_WithClosures :: Maybe CollectPadsCompareFunction_WithClosures
noCollectPadsCompareFunction_WithClosures :: Maybe CollectPadsCompareFunction_WithClosures
noCollectPadsCompareFunction_WithClosures = Maybe CollectPadsCompareFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CollectPadsCompareFunction :: CollectPadsCompareFunction -> CollectPadsCompareFunction_WithClosures
drop_closures_CollectPadsCompareFunction :: CollectPadsCompareFunction
-> CollectPadsCompareFunction_WithClosures
drop_closures_CollectPadsCompareFunction CollectPadsCompareFunction
_f CollectPads
pads CollectData
data1 Word64
timestamp1 CollectData
data2 Word64
timestamp2 Ptr ()
_ = CollectPadsCompareFunction
_f CollectPads
pads CollectData
data1 Word64
timestamp1 CollectData
data2 Word64
timestamp2

-- | Wrap the callback into a `GClosure`.
genClosure_CollectPadsCompareFunction :: MonadIO m => CollectPadsCompareFunction -> m (GClosure C_CollectPadsCompareFunction)
genClosure_CollectPadsCompareFunction :: forall (m :: * -> *).
MonadIO m =>
CollectPadsCompareFunction
-> m (GClosure C_CollectPadsCompareFunction)
genClosure_CollectPadsCompareFunction CollectPadsCompareFunction
cb = IO (GClosure C_CollectPadsCompareFunction)
-> m (GClosure C_CollectPadsCompareFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectPadsCompareFunction)
 -> m (GClosure C_CollectPadsCompareFunction))
-> IO (GClosure C_CollectPadsCompareFunction)
-> m (GClosure C_CollectPadsCompareFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CollectPadsCompareFunction_WithClosures
cb' = CollectPadsCompareFunction
-> CollectPadsCompareFunction_WithClosures
drop_closures_CollectPadsCompareFunction CollectPadsCompareFunction
cb
    let cb'' :: C_CollectPadsCompareFunction
cb'' = Maybe (Ptr (FunPtr C_CollectPadsCompareFunction))
-> CollectPadsCompareFunction_WithClosures
-> C_CollectPadsCompareFunction
wrap_CollectPadsCompareFunction Maybe (Ptr (FunPtr C_CollectPadsCompareFunction))
forall a. Maybe a
Nothing CollectPadsCompareFunction_WithClosures
cb'
    C_CollectPadsCompareFunction
-> IO (FunPtr C_CollectPadsCompareFunction)
mk_CollectPadsCompareFunction C_CollectPadsCompareFunction
cb'' IO (FunPtr C_CollectPadsCompareFunction)
-> (FunPtr C_CollectPadsCompareFunction
    -> IO (GClosure C_CollectPadsCompareFunction))
-> IO (GClosure C_CollectPadsCompareFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectPadsCompareFunction
-> IO (GClosure C_CollectPadsCompareFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectPadsCompareFunction` into a `C_CollectPadsCompareFunction`.
wrap_CollectPadsCompareFunction :: 
    Maybe (Ptr (FunPtr C_CollectPadsCompareFunction)) ->
    CollectPadsCompareFunction_WithClosures ->
    C_CollectPadsCompareFunction
wrap_CollectPadsCompareFunction :: Maybe (Ptr (FunPtr C_CollectPadsCompareFunction))
-> CollectPadsCompareFunction_WithClosures
-> C_CollectPadsCompareFunction
wrap_CollectPadsCompareFunction Maybe (Ptr (FunPtr C_CollectPadsCompareFunction))
gi'funptrptr CollectPadsCompareFunction_WithClosures
gi'cb Ptr CollectPads
pads Ptr CollectData
data1 Word64
timestamp1 Ptr CollectData
data2 Word64
timestamp2 Ptr ()
userData = do
    CollectPads
pads' <- ((ManagedPtr CollectPads -> CollectPads)
-> Ptr CollectPads -> IO CollectPads
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CollectPads -> CollectPads
GstBase.CollectPads.CollectPads) Ptr CollectPads
pads
    CollectData
data1' <- ((ManagedPtr CollectData -> CollectData)
-> Ptr CollectData -> IO CollectData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CollectData -> CollectData
GstBase.CollectData.CollectData) Ptr CollectData
data1
    CollectData
data2' <- ((ManagedPtr CollectData -> CollectData)
-> Ptr CollectData -> IO CollectData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CollectData -> CollectData
GstBase.CollectData.CollectData) Ptr CollectData
data2
    Int32
result <- CollectPadsCompareFunction_WithClosures
gi'cb  CollectPads
pads' CollectData
data1' Word64
timestamp1 CollectData
data2' Word64
timestamp2 Ptr ()
userData
    Maybe (Ptr (FunPtr C_CollectPadsCompareFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectPadsCompareFunction))
gi'funptrptr
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
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 = DirectionOut
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the output #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" , 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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_CollectPadsClipFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Buffer.Buffer ->
    Ptr (Ptr Gst.Buffer.Buffer) ->
    Ptr () ->
    IO CInt

-- 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 = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the output #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" , 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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectPadsClipFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsClipFunction
    -> a
    -- ^ /@pads@/: a t'GI.GstBase.Objects.CollectPads.CollectPads'
    -> GstBase.CollectData.CollectData
    -- ^ /@data@/: a t'GI.GstBase.Structs.CollectData.CollectData'
    -> Gst.Buffer.Buffer
    -- ^ /@inbuffer@/: the input t'GI.Gst.Structs.Buffer.Buffer'
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
    -- ^ __Returns:__ a t'GI.Gst.Enums.FlowReturn' that corresponds to the result of clipping.
dynamic_CollectPadsClipFunction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCollectPads a) =>
FunPtr C_CollectPadsClipFunction
-> a -> CollectData -> Buffer -> Ptr () -> m (FlowReturn, Buffer)
dynamic_CollectPadsClipFunction FunPtr C_CollectPadsClipFunction
__funPtr a
pads CollectData
data_ Buffer
inbuffer Ptr ()
userData = IO (FlowReturn, Buffer) -> m (FlowReturn, Buffer)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (FlowReturn, Buffer) -> m (FlowReturn, Buffer))
-> IO (FlowReturn, Buffer) -> m (FlowReturn, Buffer)
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectPads
pads' <- a -> IO (Ptr CollectPads)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pads
    Ptr CollectData
data_' <- CollectData -> IO (Ptr CollectData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectData
data_
    Ptr Buffer
inbuffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Buffer
inbuffer
    Ptr (Ptr Buffer)
outbuffer <- IO (Ptr (Ptr Buffer))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gst.Buffer.Buffer))
    CInt
result <- (FunPtr C_CollectPadsClipFunction -> C_CollectPadsClipFunction
__dynamic_C_CollectPadsClipFunction FunPtr C_CollectPadsClipFunction
__funPtr) Ptr CollectPads
pads' Ptr CollectData
data_' Ptr Buffer
inbuffer' Ptr (Ptr Buffer)
outbuffer Ptr ()
userData
    let result' :: FlowReturn
result' = (Int -> FlowReturn
forall a. Enum a => Int -> a
toEnum (Int -> FlowReturn) -> (CInt -> Int) -> CInt -> FlowReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
result
    Ptr Buffer
outbuffer' <- Ptr (Ptr Buffer) -> IO (Ptr Buffer)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Buffer)
outbuffer
    Buffer
outbuffer'' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
outbuffer'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pads
    CollectData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectData
data_
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
inbuffer
    Ptr (Ptr Buffer) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Buffer)
outbuffer
    (FlowReturn, Buffer) -> IO (FlowReturn, Buffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (FlowReturn
result', Buffer
outbuffer'')

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

-- | A function that will be called when /@inbuffer@/ is received on the pad managed
-- by /@data@/ in the collectpad object /@pads@/.
-- 
-- The function should use the segment of /@data@/ and the negotiated media type on
-- the pad to perform clipping of /@inbuffer@/.
-- 
-- This function takes ownership of /@inbuffer@/ and should output a buffer in
-- /@outbuffer@/ or return 'P.Nothing' in /@outbuffer@/ if the buffer should be dropped.
type CollectPadsClipFunction =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: a t'GI.GstBase.Objects.CollectPads.CollectPads'
    -> GstBase.CollectData.CollectData
    -- ^ /@data@/: a t'GI.GstBase.Structs.CollectData.CollectData'
    -> Gst.Buffer.Buffer
    -- ^ /@inbuffer@/: the input t'GI.Gst.Structs.Buffer.Buffer'
    -> IO ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
    -- ^ __Returns:__ a t'GI.Gst.Enums.FlowReturn' that corresponds to the result of clipping.

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsClipFunction`@.
noCollectPadsClipFunction :: Maybe CollectPadsClipFunction
noCollectPadsClipFunction :: Maybe CollectPadsClipFunction
noCollectPadsClipFunction = Maybe CollectPadsClipFunction
forall a. Maybe a
Nothing

-- | A function that will be called when /@inbuffer@/ is received on the pad managed
-- by /@data@/ in the collectpad object /@pads@/.
-- 
-- The function should use the segment of /@data@/ and the negotiated media type on
-- the pad to perform clipping of /@inbuffer@/.
-- 
-- This function takes ownership of /@inbuffer@/ and should output a buffer in
-- /@outbuffer@/ or return 'P.Nothing' in /@outbuffer@/ if the buffer should be dropped.
type CollectPadsClipFunction_WithClosures =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: a t'GI.GstBase.Objects.CollectPads.CollectPads'
    -> GstBase.CollectData.CollectData
    -- ^ /@data@/: a t'GI.GstBase.Structs.CollectData.CollectData'
    -> Gst.Buffer.Buffer
    -- ^ /@inbuffer@/: the input t'GI.Gst.Structs.Buffer.Buffer'
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> IO ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
    -- ^ __Returns:__ a t'GI.Gst.Enums.FlowReturn' that corresponds to the result of clipping.

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsClipFunction_WithClosures`@.
noCollectPadsClipFunction_WithClosures :: Maybe CollectPadsClipFunction_WithClosures
noCollectPadsClipFunction_WithClosures :: Maybe CollectPadsClipFunction_WithClosures
noCollectPadsClipFunction_WithClosures = Maybe CollectPadsClipFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CollectPadsClipFunction :: CollectPadsClipFunction -> CollectPadsClipFunction_WithClosures
drop_closures_CollectPadsClipFunction :: CollectPadsClipFunction -> CollectPadsClipFunction_WithClosures
drop_closures_CollectPadsClipFunction CollectPadsClipFunction
_f CollectPads
pads CollectData
data_ Buffer
inbuffer Ptr ()
_ = CollectPadsClipFunction
_f CollectPads
pads CollectData
data_ Buffer
inbuffer

-- | Wrap the callback into a `GClosure`.
genClosure_CollectPadsClipFunction :: MonadIO m => CollectPadsClipFunction -> m (GClosure C_CollectPadsClipFunction)
genClosure_CollectPadsClipFunction :: forall (m :: * -> *).
MonadIO m =>
CollectPadsClipFunction -> m (GClosure C_CollectPadsClipFunction)
genClosure_CollectPadsClipFunction CollectPadsClipFunction
cb = IO (GClosure C_CollectPadsClipFunction)
-> m (GClosure C_CollectPadsClipFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectPadsClipFunction)
 -> m (GClosure C_CollectPadsClipFunction))
-> IO (GClosure C_CollectPadsClipFunction)
-> m (GClosure C_CollectPadsClipFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CollectPadsClipFunction_WithClosures
cb' = CollectPadsClipFunction -> CollectPadsClipFunction_WithClosures
drop_closures_CollectPadsClipFunction CollectPadsClipFunction
cb
    let cb'' :: C_CollectPadsClipFunction
cb'' = Maybe (Ptr (FunPtr C_CollectPadsClipFunction))
-> CollectPadsClipFunction_WithClosures
-> C_CollectPadsClipFunction
wrap_CollectPadsClipFunction Maybe (Ptr (FunPtr C_CollectPadsClipFunction))
forall a. Maybe a
Nothing CollectPadsClipFunction_WithClosures
cb'
    C_CollectPadsClipFunction -> IO (FunPtr C_CollectPadsClipFunction)
mk_CollectPadsClipFunction C_CollectPadsClipFunction
cb'' IO (FunPtr C_CollectPadsClipFunction)
-> (FunPtr C_CollectPadsClipFunction
    -> IO (GClosure C_CollectPadsClipFunction))
-> IO (GClosure C_CollectPadsClipFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectPadsClipFunction
-> IO (GClosure C_CollectPadsClipFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectPadsClipFunction` into a `C_CollectPadsClipFunction`.
wrap_CollectPadsClipFunction :: 
    Maybe (Ptr (FunPtr C_CollectPadsClipFunction)) ->
    CollectPadsClipFunction_WithClosures ->
    C_CollectPadsClipFunction
wrap_CollectPadsClipFunction :: Maybe (Ptr (FunPtr C_CollectPadsClipFunction))
-> CollectPadsClipFunction_WithClosures
-> C_CollectPadsClipFunction
wrap_CollectPadsClipFunction Maybe (Ptr (FunPtr C_CollectPadsClipFunction))
gi'funptrptr CollectPadsClipFunction_WithClosures
gi'cb Ptr CollectPads
pads Ptr CollectData
data_ Ptr Buffer
inbuffer Ptr (Ptr Buffer)
outbuffer Ptr ()
userData = do
    CollectPads
pads' <- ((ManagedPtr CollectPads -> CollectPads)
-> Ptr CollectPads -> IO CollectPads
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CollectPads -> CollectPads
GstBase.CollectPads.CollectPads) Ptr CollectPads
pads
    CollectData
data_' <- ((ManagedPtr CollectData -> CollectData)
-> Ptr CollectData -> IO CollectData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CollectData -> CollectData
GstBase.CollectData.CollectData) Ptr CollectData
data_
    Buffer
inbuffer' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
inbuffer
    (FlowReturn
result, Buffer
outoutbuffer) <- CollectPadsClipFunction_WithClosures
gi'cb  CollectPads
pads' CollectData
data_' Buffer
inbuffer' Ptr ()
userData
    Ptr Buffer
outoutbuffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Buffer
outoutbuffer
    Ptr (Ptr Buffer) -> Ptr Buffer -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (Ptr Buffer)
outbuffer Ptr Buffer
outoutbuffer'
    Maybe (Ptr (FunPtr C_CollectPadsClipFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectPadsClipFunction))
gi'funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (FlowReturn -> Int) -> FlowReturn -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FlowReturn -> Int
forall a. Enum a => a -> Int
fromEnum) FlowReturn
result
    CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_CollectPadsBufferFunction =
    Ptr GstBase.CollectPads.CollectPads ->
    Ptr GstBase.CollectData.CollectData ->
    Ptr Gst.Buffer.Buffer ->
    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 = "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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectPadsBufferFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GstBase.CollectPads.IsCollectPads a) =>
    FunPtr C_CollectPadsBufferFunction
    -> a
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@data@/: the t'GI.GstBase.Structs.CollectData.CollectData' of pad that has received the buffer
    -> Gst.Buffer.Buffer
    -- ^ /@buffer@/: the t'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 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCollectPads a) =>
FunPtr C_CollectPadsBufferFunction
-> a -> CollectData -> Buffer -> Ptr () -> m FlowReturn
dynamic_CollectPadsBufferFunction FunPtr C_CollectPadsBufferFunction
__funPtr a
pads CollectData
data_ Buffer
buffer Ptr ()
userData = IO FlowReturn -> m FlowReturn
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FlowReturn -> m FlowReturn) -> IO FlowReturn -> m FlowReturn
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectPads
pads' <- a -> IO (Ptr CollectPads)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pads
    Ptr CollectData
data_' <- CollectData -> IO (Ptr CollectData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectData
data_
    Ptr Buffer
buffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Buffer
buffer
    CInt
result <- (FunPtr C_CollectPadsBufferFunction -> C_CollectPadsBufferFunction
__dynamic_C_CollectPadsBufferFunction FunPtr C_CollectPadsBufferFunction
__funPtr) Ptr CollectPads
pads' Ptr CollectData
data_' Ptr Buffer
buffer' Ptr ()
userData
    let result' :: FlowReturn
result' = (Int -> FlowReturn
forall a. Enum a => Int -> a
toEnum (Int -> FlowReturn) -> (CInt -> Int) -> CInt -> FlowReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pads
    CollectData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectData
data_
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buffer
    FlowReturn -> IO FlowReturn
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FlowReturn
result'

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

-- | A function that will be called when a (considered oldest) buffer can be muxed.
-- If all pads have reached EOS, this function is called with 'P.Nothing' /@buffer@/
-- and 'P.Nothing' /@data@/.
type CollectPadsBufferFunction =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@data@/: the t'GI.GstBase.Structs.CollectData.CollectData' of pad that has received the buffer
    -> Gst.Buffer.Buffer
    -- ^ /@buffer@/: the t'GI.Gst.Structs.Buffer.Buffer'
    -> IO Gst.Enums.FlowReturn
    -- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' for success

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsBufferFunction`@.
noCollectPadsBufferFunction :: Maybe CollectPadsBufferFunction
noCollectPadsBufferFunction :: Maybe CollectPadsBufferFunction
noCollectPadsBufferFunction = Maybe CollectPadsBufferFunction
forall a. Maybe a
Nothing

-- | A function that will be called when a (considered oldest) buffer can be muxed.
-- If all pads have reached EOS, this function is called with 'P.Nothing' /@buffer@/
-- and 'P.Nothing' /@data@/.
type CollectPadsBufferFunction_WithClosures =
    GstBase.CollectPads.CollectPads
    -- ^ /@pads@/: the t'GI.GstBase.Objects.CollectPads.CollectPads' that triggered the callback
    -> GstBase.CollectData.CollectData
    -- ^ /@data@/: the t'GI.GstBase.Structs.CollectData.CollectData' of pad that has received the buffer
    -> Gst.Buffer.Buffer
    -- ^ /@buffer@/: the t'GI.Gst.Structs.Buffer.Buffer'
    -> Ptr ()
    -- ^ /@userData@/: user data passed to 'GI.GstBase.Objects.CollectPads.collectPadsSetBufferFunction'
    -> IO Gst.Enums.FlowReturn
    -- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' for success

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectPadsBufferFunction_WithClosures`@.
noCollectPadsBufferFunction_WithClosures :: Maybe CollectPadsBufferFunction_WithClosures
noCollectPadsBufferFunction_WithClosures :: Maybe CollectPadsBufferFunction_WithClosures
noCollectPadsBufferFunction_WithClosures = Maybe CollectPadsBufferFunction_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CollectPadsBufferFunction :: CollectPadsBufferFunction -> CollectPadsBufferFunction_WithClosures
drop_closures_CollectPadsBufferFunction :: CollectPadsBufferFunction -> CollectPadsBufferFunction_WithClosures
drop_closures_CollectPadsBufferFunction CollectPadsBufferFunction
_f CollectPads
pads CollectData
data_ Buffer
buffer Ptr ()
_ = CollectPadsBufferFunction
_f CollectPads
pads CollectData
data_ Buffer
buffer

-- | Wrap the callback into a `GClosure`.
genClosure_CollectPadsBufferFunction :: MonadIO m => CollectPadsBufferFunction -> m (GClosure C_CollectPadsBufferFunction)
genClosure_CollectPadsBufferFunction :: forall (m :: * -> *).
MonadIO m =>
CollectPadsBufferFunction
-> m (GClosure C_CollectPadsBufferFunction)
genClosure_CollectPadsBufferFunction CollectPadsBufferFunction
cb = IO (GClosure C_CollectPadsBufferFunction)
-> m (GClosure C_CollectPadsBufferFunction)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectPadsBufferFunction)
 -> m (GClosure C_CollectPadsBufferFunction))
-> IO (GClosure C_CollectPadsBufferFunction)
-> m (GClosure C_CollectPadsBufferFunction)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CollectPadsBufferFunction_WithClosures
cb' = CollectPadsBufferFunction -> CollectPadsBufferFunction_WithClosures
drop_closures_CollectPadsBufferFunction CollectPadsBufferFunction
cb
    let cb'' :: C_CollectPadsBufferFunction
cb'' = Maybe (Ptr (FunPtr C_CollectPadsBufferFunction))
-> CollectPadsBufferFunction_WithClosures
-> C_CollectPadsBufferFunction
wrap_CollectPadsBufferFunction Maybe (Ptr (FunPtr C_CollectPadsBufferFunction))
forall a. Maybe a
Nothing CollectPadsBufferFunction_WithClosures
cb'
    C_CollectPadsBufferFunction
-> IO (FunPtr C_CollectPadsBufferFunction)
mk_CollectPadsBufferFunction C_CollectPadsBufferFunction
cb'' IO (FunPtr C_CollectPadsBufferFunction)
-> (FunPtr C_CollectPadsBufferFunction
    -> IO (GClosure C_CollectPadsBufferFunction))
-> IO (GClosure C_CollectPadsBufferFunction)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectPadsBufferFunction
-> IO (GClosure C_CollectPadsBufferFunction)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectPadsBufferFunction` into a `C_CollectPadsBufferFunction`.
wrap_CollectPadsBufferFunction :: 
    Maybe (Ptr (FunPtr C_CollectPadsBufferFunction)) ->
    CollectPadsBufferFunction_WithClosures ->
    C_CollectPadsBufferFunction
wrap_CollectPadsBufferFunction :: Maybe (Ptr (FunPtr C_CollectPadsBufferFunction))
-> CollectPadsBufferFunction_WithClosures
-> C_CollectPadsBufferFunction
wrap_CollectPadsBufferFunction Maybe (Ptr (FunPtr C_CollectPadsBufferFunction))
gi'funptrptr CollectPadsBufferFunction_WithClosures
gi'cb Ptr CollectPads
pads Ptr CollectData
data_ Ptr Buffer
buffer Ptr ()
userData = do
    CollectPads
pads' <- ((ManagedPtr CollectPads -> CollectPads)
-> Ptr CollectPads -> IO CollectPads
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CollectPads -> CollectPads
GstBase.CollectPads.CollectPads) Ptr CollectPads
pads
    CollectData
data_' <- ((ManagedPtr CollectData -> CollectData)
-> Ptr CollectData -> IO CollectData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CollectData -> CollectData
GstBase.CollectData.CollectData) Ptr CollectData
data_
    Buffer
buffer' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
buffer
    FlowReturn
result <- CollectPadsBufferFunction_WithClosures
gi'cb  CollectPads
pads' CollectData
data_' Buffer
buffer' Ptr ()
userData
    Maybe (Ptr (FunPtr C_CollectPadsBufferFunction)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectPadsBufferFunction))
gi'funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (FlowReturn -> Int) -> FlowReturn -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FlowReturn -> Int
forall a. Enum a => a -> Int
fromEnum) FlowReturn
result
    CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
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
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
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

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CollectDataDestroyNotify ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_CollectDataDestroyNotify
    -> GstBase.CollectData.CollectData
    -- ^ /@data@/: the t'GI.GstBase.Structs.CollectData.CollectData' that will be freed
    -> m ()
dynamic_CollectDataDestroyNotify :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_CollectDataDestroyNotify -> CollectData -> m ()
dynamic_CollectDataDestroyNotify FunPtr C_CollectDataDestroyNotify
__funPtr CollectData
data_ = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr CollectData
data_' <- CollectData -> IO (Ptr CollectData)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectData
data_
    (FunPtr C_CollectDataDestroyNotify -> C_CollectDataDestroyNotify
__dynamic_C_CollectDataDestroyNotify FunPtr C_CollectDataDestroyNotify
__funPtr) Ptr CollectData
data_'
    CollectData -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectData
data_
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | A function that will be called when the t'GI.GstBase.Structs.CollectData.CollectData' will be freed.
-- It is passed the pointer to the structure and should free any custom
-- memory and resources allocated for it.
type CollectDataDestroyNotify =
    GstBase.CollectData.CollectData
    -- ^ /@data@/: the t'GI.GstBase.Structs.CollectData.CollectData' that will be freed
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `CollectDataDestroyNotify`@.
noCollectDataDestroyNotify :: Maybe CollectDataDestroyNotify
noCollectDataDestroyNotify :: Maybe (CollectData -> IO ())
noCollectDataDestroyNotify = Maybe (CollectData -> IO ())
forall a. Maybe a
Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_CollectDataDestroyNotify :: MonadIO m => CollectDataDestroyNotify -> m (GClosure C_CollectDataDestroyNotify)
genClosure_CollectDataDestroyNotify :: forall (m :: * -> *).
MonadIO m =>
(CollectData -> IO ()) -> m (GClosure C_CollectDataDestroyNotify)
genClosure_CollectDataDestroyNotify CollectData -> IO ()
cb = IO (GClosure C_CollectDataDestroyNotify)
-> m (GClosure C_CollectDataDestroyNotify)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CollectDataDestroyNotify)
 -> m (GClosure C_CollectDataDestroyNotify))
-> IO (GClosure C_CollectDataDestroyNotify)
-> m (GClosure C_CollectDataDestroyNotify)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_CollectDataDestroyNotify
cb' = Maybe (Ptr (FunPtr C_CollectDataDestroyNotify))
-> (CollectData -> IO ()) -> C_CollectDataDestroyNotify
wrap_CollectDataDestroyNotify Maybe (Ptr (FunPtr C_CollectDataDestroyNotify))
forall a. Maybe a
Nothing CollectData -> IO ()
cb
    C_CollectDataDestroyNotify
-> IO (FunPtr C_CollectDataDestroyNotify)
mk_CollectDataDestroyNotify C_CollectDataDestroyNotify
cb' IO (FunPtr C_CollectDataDestroyNotify)
-> (FunPtr C_CollectDataDestroyNotify
    -> IO (GClosure C_CollectDataDestroyNotify))
-> IO (GClosure C_CollectDataDestroyNotify)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CollectDataDestroyNotify
-> IO (GClosure C_CollectDataDestroyNotify)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CollectDataDestroyNotify` into a `C_CollectDataDestroyNotify`.
wrap_CollectDataDestroyNotify :: 
    Maybe (Ptr (FunPtr C_CollectDataDestroyNotify)) ->
    CollectDataDestroyNotify ->
    C_CollectDataDestroyNotify
wrap_CollectDataDestroyNotify :: Maybe (Ptr (FunPtr C_CollectDataDestroyNotify))
-> (CollectData -> IO ()) -> C_CollectDataDestroyNotify
wrap_CollectDataDestroyNotify Maybe (Ptr (FunPtr C_CollectDataDestroyNotify))
gi'funptrptr CollectData -> IO ()
gi'cb Ptr CollectData
data_ = do
    CollectData
data_' <- ((ManagedPtr CollectData -> CollectData)
-> Ptr CollectData -> IO CollectData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CollectData -> CollectData
GstBase.CollectData.CollectData) Ptr CollectData
data_
    CollectData -> IO ()
gi'cb  CollectData
data_'
    Maybe (Ptr (FunPtr C_CollectDataDestroyNotify)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CollectDataDestroyNotify))
gi'funptrptr