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

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

module GI.Gst.Callbacks
    (

 -- * Signals
-- ** BufferForeachMetaFunc #signal:BufferForeachMetaFunc#

    BufferForeachMetaFunc                   ,
    BufferForeachMetaFunc_WithClosures      ,
    C_BufferForeachMetaFunc                 ,
    drop_closures_BufferForeachMetaFunc     ,
    dynamic_BufferForeachMetaFunc           ,
    genClosure_BufferForeachMetaFunc        ,
    mk_BufferForeachMetaFunc                ,
    noBufferForeachMetaFunc                 ,
    noBufferForeachMetaFunc_WithClosures    ,
    wrap_BufferForeachMetaFunc              ,


-- ** BufferListFunc #signal:BufferListFunc#

    BufferListFunc                          ,
    BufferListFunc_WithClosures             ,
    C_BufferListFunc                        ,
    drop_closures_BufferListFunc            ,
    dynamic_BufferListFunc                  ,
    genClosure_BufferListFunc               ,
    mk_BufferListFunc                       ,
    noBufferListFunc                        ,
    noBufferListFunc_WithClosures           ,
    wrap_BufferListFunc                     ,


-- ** BusFunc #signal:BusFunc#

    BusFunc                                 ,
    BusFunc_WithClosures                    ,
    C_BusFunc                               ,
    drop_closures_BusFunc                   ,
    dynamic_BusFunc                         ,
    genClosure_BusFunc                      ,
    mk_BusFunc                              ,
    noBusFunc                               ,
    noBusFunc_WithClosures                  ,
    wrap_BusFunc                            ,


-- ** BusSyncHandler #signal:BusSyncHandler#

    BusSyncHandler                          ,
    BusSyncHandler_WithClosures             ,
    C_BusSyncHandler                        ,
    drop_closures_BusSyncHandler            ,
    dynamic_BusSyncHandler                  ,
    genClosure_BusSyncHandler               ,
    mk_BusSyncHandler                       ,
    noBusSyncHandler                        ,
    noBusSyncHandler_WithClosures           ,
    wrap_BusSyncHandler                     ,


-- ** CapsFilterMapFunc #signal:CapsFilterMapFunc#

    C_CapsFilterMapFunc                     ,
    CapsFilterMapFunc                       ,
    CapsFilterMapFunc_WithClosures          ,
    drop_closures_CapsFilterMapFunc         ,
    dynamic_CapsFilterMapFunc               ,
    genClosure_CapsFilterMapFunc            ,
    mk_CapsFilterMapFunc                    ,
    noCapsFilterMapFunc                     ,
    noCapsFilterMapFunc_WithClosures        ,
    wrap_CapsFilterMapFunc                  ,


-- ** CapsForeachFunc #signal:CapsForeachFunc#

    C_CapsForeachFunc                       ,
    CapsForeachFunc                         ,
    CapsForeachFunc_WithClosures            ,
    drop_closures_CapsForeachFunc           ,
    dynamic_CapsForeachFunc                 ,
    genClosure_CapsForeachFunc              ,
    mk_CapsForeachFunc                      ,
    noCapsForeachFunc                       ,
    noCapsForeachFunc_WithClosures          ,
    wrap_CapsForeachFunc                    ,


-- ** CapsMapFunc #signal:CapsMapFunc#

    C_CapsMapFunc                           ,
    CapsMapFunc                             ,
    CapsMapFunc_WithClosures                ,
    drop_closures_CapsMapFunc               ,
    dynamic_CapsMapFunc                     ,
    genClosure_CapsMapFunc                  ,
    mk_CapsMapFunc                          ,
    noCapsMapFunc                           ,
    noCapsMapFunc_WithClosures              ,
    wrap_CapsMapFunc                        ,


-- ** ClockCallback #signal:ClockCallback#

    C_ClockCallback                         ,
    ClockCallback                           ,
    ClockCallback_WithClosures              ,
    drop_closures_ClockCallback             ,
    dynamic_ClockCallback                   ,
    genClosure_ClockCallback                ,
    mk_ClockCallback                        ,
    noClockCallback                         ,
    noClockCallback_WithClosures            ,
    wrap_ClockCallback                      ,


-- ** ControlBindingConvert #signal:ControlBindingConvert#

    C_ControlBindingConvert                 ,
    ControlBindingConvert                   ,
    dynamic_ControlBindingConvert           ,
    genClosure_ControlBindingConvert        ,
    mk_ControlBindingConvert                ,
    noControlBindingConvert                 ,
    wrap_ControlBindingConvert              ,


-- ** ControlSourceGetValue #signal:ControlSourceGetValue#

    C_ControlSourceGetValue                 ,
    ControlSourceGetValue                   ,
    dynamic_ControlSourceGetValue           ,
    genClosure_ControlSourceGetValue        ,
    mk_ControlSourceGetValue                ,
    noControlSourceGetValue                 ,
    wrap_ControlSourceGetValue              ,


-- ** ControlSourceGetValueArray #signal:ControlSourceGetValueArray#

    C_ControlSourceGetValueArray            ,
    ControlSourceGetValueArray              ,
    dynamic_ControlSourceGetValueArray      ,
    genClosure_ControlSourceGetValueArray   ,
    mk_ControlSourceGetValueArray           ,
    noControlSourceGetValueArray            ,
    wrap_ControlSourceGetValueArray         ,


-- ** DebugFuncPtr #signal:DebugFuncPtr#

    C_DebugFuncPtr                          ,
    DebugFuncPtr                            ,
    dynamic_DebugFuncPtr                    ,
    genClosure_DebugFuncPtr                 ,
    mk_DebugFuncPtr                         ,
    noDebugFuncPtr                          ,
    wrap_DebugFuncPtr                       ,


-- ** ElementCallAsyncFunc #signal:ElementCallAsyncFunc#

    C_ElementCallAsyncFunc                  ,
    ElementCallAsyncFunc                    ,
    ElementCallAsyncFunc_WithClosures       ,
    drop_closures_ElementCallAsyncFunc      ,
    dynamic_ElementCallAsyncFunc            ,
    genClosure_ElementCallAsyncFunc         ,
    mk_ElementCallAsyncFunc                 ,
    noElementCallAsyncFunc                  ,
    noElementCallAsyncFunc_WithClosures     ,
    wrap_ElementCallAsyncFunc               ,


-- ** ElementForeachPadFunc #signal:ElementForeachPadFunc#

    C_ElementForeachPadFunc                 ,
    ElementForeachPadFunc                   ,
    ElementForeachPadFunc_WithClosures      ,
    drop_closures_ElementForeachPadFunc     ,
    dynamic_ElementForeachPadFunc           ,
    genClosure_ElementForeachPadFunc        ,
    mk_ElementForeachPadFunc                ,
    noElementForeachPadFunc                 ,
    noElementForeachPadFunc_WithClosures    ,
    wrap_ElementForeachPadFunc              ,


-- ** IteratorCopyFunction #signal:IteratorCopyFunction#

    C_IteratorCopyFunction                  ,
    IteratorCopyFunction                    ,
    dynamic_IteratorCopyFunction            ,
    genClosure_IteratorCopyFunction         ,
    mk_IteratorCopyFunction                 ,
    noIteratorCopyFunction                  ,
    wrap_IteratorCopyFunction               ,


-- ** IteratorFoldFunction #signal:IteratorFoldFunction#

    C_IteratorFoldFunction                  ,
    IteratorFoldFunction                    ,
    IteratorFoldFunction_WithClosures       ,
    drop_closures_IteratorFoldFunction      ,
    dynamic_IteratorFoldFunction            ,
    genClosure_IteratorFoldFunction         ,
    mk_IteratorFoldFunction                 ,
    noIteratorFoldFunction                  ,
    noIteratorFoldFunction_WithClosures     ,
    wrap_IteratorFoldFunction               ,


-- ** IteratorForeachFunction #signal:IteratorForeachFunction#

    C_IteratorForeachFunction               ,
    IteratorForeachFunction                 ,
    IteratorForeachFunction_WithClosures    ,
    drop_closures_IteratorForeachFunction   ,
    dynamic_IteratorForeachFunction         ,
    genClosure_IteratorForeachFunction      ,
    mk_IteratorForeachFunction              ,
    noIteratorForeachFunction               ,
    noIteratorForeachFunction_WithClosures  ,
    wrap_IteratorForeachFunction            ,


-- ** IteratorFreeFunction #signal:IteratorFreeFunction#

    C_IteratorFreeFunction                  ,
    IteratorFreeFunction                    ,
    dynamic_IteratorFreeFunction            ,
    genClosure_IteratorFreeFunction         ,
    mk_IteratorFreeFunction                 ,
    noIteratorFreeFunction                  ,
    wrap_IteratorFreeFunction               ,


-- ** IteratorItemFunction #signal:IteratorItemFunction#

    C_IteratorItemFunction                  ,
    IteratorItemFunction                    ,
    dynamic_IteratorItemFunction            ,
    genClosure_IteratorItemFunction         ,
    mk_IteratorItemFunction                 ,
    noIteratorItemFunction                  ,
    wrap_IteratorItemFunction               ,


-- ** IteratorNextFunction #signal:IteratorNextFunction#

    C_IteratorNextFunction                  ,
    IteratorNextFunction                    ,
    dynamic_IteratorNextFunction            ,
    genClosure_IteratorNextFunction         ,
    mk_IteratorNextFunction                 ,
    noIteratorNextFunction                  ,
    wrap_IteratorNextFunction               ,


-- ** IteratorResyncFunction #signal:IteratorResyncFunction#

    C_IteratorResyncFunction                ,
    IteratorResyncFunction                  ,
    dynamic_IteratorResyncFunction          ,
    genClosure_IteratorResyncFunction       ,
    mk_IteratorResyncFunction               ,
    noIteratorResyncFunction                ,
    wrap_IteratorResyncFunction             ,


-- ** LogFunction #signal:LogFunction#

    C_LogFunction                           ,
    LogFunction                             ,
    LogFunction_WithClosures                ,
    drop_closures_LogFunction               ,
    dynamic_LogFunction                     ,
    genClosure_LogFunction                  ,
    mk_LogFunction                          ,
    noLogFunction                           ,
    noLogFunction_WithClosures              ,
    wrap_LogFunction                        ,


-- ** MemoryCopyFunction #signal:MemoryCopyFunction#

    C_MemoryCopyFunction                    ,
    MemoryCopyFunction                      ,
    dynamic_MemoryCopyFunction              ,
    genClosure_MemoryCopyFunction           ,
    mk_MemoryCopyFunction                   ,
    noMemoryCopyFunction                    ,
    wrap_MemoryCopyFunction                 ,


-- ** MemoryIsSpanFunction #signal:MemoryIsSpanFunction#

    C_MemoryIsSpanFunction                  ,
    MemoryIsSpanFunction                    ,
    dynamic_MemoryIsSpanFunction            ,
    genClosure_MemoryIsSpanFunction         ,
    mk_MemoryIsSpanFunction                 ,
    noMemoryIsSpanFunction                  ,
    wrap_MemoryIsSpanFunction               ,


-- ** MemoryMapFullFunction #signal:MemoryMapFullFunction#

    C_MemoryMapFullFunction                 ,
    MemoryMapFullFunction                   ,
    dynamic_MemoryMapFullFunction           ,
    genClosure_MemoryMapFullFunction        ,
    mk_MemoryMapFullFunction                ,
    noMemoryMapFullFunction                 ,
    wrap_MemoryMapFullFunction              ,


-- ** MemoryMapFunction #signal:MemoryMapFunction#

    C_MemoryMapFunction                     ,
    MemoryMapFunction                       ,
    dynamic_MemoryMapFunction               ,
    genClosure_MemoryMapFunction            ,
    mk_MemoryMapFunction                    ,
    noMemoryMapFunction                     ,
    wrap_MemoryMapFunction                  ,


-- ** MemoryShareFunction #signal:MemoryShareFunction#

    C_MemoryShareFunction                   ,
    MemoryShareFunction                     ,
    dynamic_MemoryShareFunction             ,
    genClosure_MemoryShareFunction          ,
    mk_MemoryShareFunction                  ,
    noMemoryShareFunction                   ,
    wrap_MemoryShareFunction                ,


-- ** MemoryUnmapFullFunction #signal:MemoryUnmapFullFunction#

    C_MemoryUnmapFullFunction               ,
    MemoryUnmapFullFunction                 ,
    dynamic_MemoryUnmapFullFunction         ,
    genClosure_MemoryUnmapFullFunction      ,
    mk_MemoryUnmapFullFunction              ,
    noMemoryUnmapFullFunction               ,
    wrap_MemoryUnmapFullFunction            ,


-- ** MemoryUnmapFunction #signal:MemoryUnmapFunction#

    C_MemoryUnmapFunction                   ,
    MemoryUnmapFunction                     ,
    dynamic_MemoryUnmapFunction             ,
    genClosure_MemoryUnmapFunction          ,
    mk_MemoryUnmapFunction                  ,
    noMemoryUnmapFunction                   ,
    wrap_MemoryUnmapFunction                ,


-- ** MetaFreeFunction #signal:MetaFreeFunction#

    C_MetaFreeFunction                      ,
    MetaFreeFunction                        ,
    dynamic_MetaFreeFunction                ,
    genClosure_MetaFreeFunction             ,
    mk_MetaFreeFunction                     ,
    noMetaFreeFunction                      ,
    wrap_MetaFreeFunction                   ,


-- ** MetaInitFunction #signal:MetaInitFunction#

    C_MetaInitFunction                      ,
    MetaInitFunction                        ,
    dynamic_MetaInitFunction                ,
    genClosure_MetaInitFunction             ,
    mk_MetaInitFunction                     ,
    noMetaInitFunction                      ,
    wrap_MetaInitFunction                   ,


-- ** MetaTransformFunction #signal:MetaTransformFunction#

    C_MetaTransformFunction                 ,
    MetaTransformFunction                   ,
    dynamic_MetaTransformFunction           ,
    genClosure_MetaTransformFunction        ,
    mk_MetaTransformFunction                ,
    noMetaTransformFunction                 ,
    wrap_MetaTransformFunction              ,


-- ** MiniObjectDisposeFunction #signal:MiniObjectDisposeFunction#

    C_MiniObjectDisposeFunction             ,
    MiniObjectDisposeFunction               ,
    dynamic_MiniObjectDisposeFunction       ,
    genClosure_MiniObjectDisposeFunction    ,
    mk_MiniObjectDisposeFunction            ,
    noMiniObjectDisposeFunction             ,
    wrap_MiniObjectDisposeFunction          ,


-- ** MiniObjectFreeFunction #signal:MiniObjectFreeFunction#

    C_MiniObjectFreeFunction                ,
    MiniObjectFreeFunction                  ,
    dynamic_MiniObjectFreeFunction          ,
    genClosure_MiniObjectFreeFunction       ,
    mk_MiniObjectFreeFunction               ,
    noMiniObjectFreeFunction                ,
    wrap_MiniObjectFreeFunction             ,


-- ** MiniObjectNotify #signal:MiniObjectNotify#

    C_MiniObjectNotify                      ,
    MiniObjectNotify                        ,
    MiniObjectNotify_WithClosures           ,
    drop_closures_MiniObjectNotify          ,
    dynamic_MiniObjectNotify                ,
    genClosure_MiniObjectNotify             ,
    mk_MiniObjectNotify                     ,
    noMiniObjectNotify                      ,
    noMiniObjectNotify_WithClosures         ,
    wrap_MiniObjectNotify                   ,


-- ** PadActivateFunction #signal:PadActivateFunction#

    C_PadActivateFunction                   ,
    PadActivateFunction                     ,
    dynamic_PadActivateFunction             ,
    genClosure_PadActivateFunction          ,
    mk_PadActivateFunction                  ,
    noPadActivateFunction                   ,
    wrap_PadActivateFunction                ,


-- ** PadActivateModeFunction #signal:PadActivateModeFunction#

    C_PadActivateModeFunction               ,
    PadActivateModeFunction                 ,
    dynamic_PadActivateModeFunction         ,
    genClosure_PadActivateModeFunction      ,
    mk_PadActivateModeFunction              ,
    noPadActivateModeFunction               ,
    wrap_PadActivateModeFunction            ,


-- ** PadChainFunction #signal:PadChainFunction#

    C_PadChainFunction                      ,
    PadChainFunction                        ,
    dynamic_PadChainFunction                ,
    genClosure_PadChainFunction             ,
    mk_PadChainFunction                     ,
    noPadChainFunction                      ,
    wrap_PadChainFunction                   ,


-- ** PadChainListFunction #signal:PadChainListFunction#

    C_PadChainListFunction                  ,
    PadChainListFunction                    ,
    dynamic_PadChainListFunction            ,
    genClosure_PadChainListFunction         ,
    mk_PadChainListFunction                 ,
    noPadChainListFunction                  ,
    wrap_PadChainListFunction               ,


-- ** PadEventFullFunction #signal:PadEventFullFunction#

    C_PadEventFullFunction                  ,
    PadEventFullFunction                    ,
    dynamic_PadEventFullFunction            ,
    genClosure_PadEventFullFunction         ,
    mk_PadEventFullFunction                 ,
    noPadEventFullFunction                  ,
    wrap_PadEventFullFunction               ,


-- ** PadEventFunction #signal:PadEventFunction#

    C_PadEventFunction                      ,
    PadEventFunction                        ,
    dynamic_PadEventFunction                ,
    genClosure_PadEventFunction             ,
    mk_PadEventFunction                     ,
    noPadEventFunction                      ,
    wrap_PadEventFunction                   ,


-- ** PadForwardFunction #signal:PadForwardFunction#

    C_PadForwardFunction                    ,
    PadForwardFunction                      ,
    PadForwardFunction_WithClosures         ,
    drop_closures_PadForwardFunction        ,
    dynamic_PadForwardFunction              ,
    genClosure_PadForwardFunction           ,
    mk_PadForwardFunction                   ,
    noPadForwardFunction                    ,
    noPadForwardFunction_WithClosures       ,
    wrap_PadForwardFunction                 ,


-- ** PadGetRangeFunction #signal:PadGetRangeFunction#

    C_PadGetRangeFunction                   ,
    PadGetRangeFunction                     ,
    dynamic_PadGetRangeFunction             ,
    genClosure_PadGetRangeFunction          ,
    mk_PadGetRangeFunction                  ,
    noPadGetRangeFunction                   ,
    wrap_PadGetRangeFunction                ,


-- ** PadIterIntLinkFunction #signal:PadIterIntLinkFunction#

    C_PadIterIntLinkFunction                ,
    PadIterIntLinkFunction                  ,
    dynamic_PadIterIntLinkFunction          ,
    genClosure_PadIterIntLinkFunction       ,
    mk_PadIterIntLinkFunction               ,
    noPadIterIntLinkFunction                ,
    wrap_PadIterIntLinkFunction             ,


-- ** PadLinkFunction #signal:PadLinkFunction#

    C_PadLinkFunction                       ,
    PadLinkFunction                         ,
    dynamic_PadLinkFunction                 ,
    genClosure_PadLinkFunction              ,
    mk_PadLinkFunction                      ,
    noPadLinkFunction                       ,
    wrap_PadLinkFunction                    ,


-- ** PadProbeCallback #signal:PadProbeCallback#

    C_PadProbeCallback                      ,
    PadProbeCallback                        ,
    PadProbeCallback_WithClosures           ,
    drop_closures_PadProbeCallback          ,
    dynamic_PadProbeCallback                ,
    genClosure_PadProbeCallback             ,
    mk_PadProbeCallback                     ,
    noPadProbeCallback                      ,
    noPadProbeCallback_WithClosures         ,
    wrap_PadProbeCallback                   ,


-- ** PadQueryFunction #signal:PadQueryFunction#

    C_PadQueryFunction                      ,
    PadQueryFunction                        ,
    dynamic_PadQueryFunction                ,
    genClosure_PadQueryFunction             ,
    mk_PadQueryFunction                     ,
    noPadQueryFunction                      ,
    wrap_PadQueryFunction                   ,


-- ** PadStickyEventsForeachFunction #signal:PadStickyEventsForeachFunction#

    C_PadStickyEventsForeachFunction        ,
    PadStickyEventsForeachFunction          ,
    PadStickyEventsForeachFunction_WithClosures,
    drop_closures_PadStickyEventsForeachFunction,
    dynamic_PadStickyEventsForeachFunction  ,
    genClosure_PadStickyEventsForeachFunction,
    mk_PadStickyEventsForeachFunction       ,
    noPadStickyEventsForeachFunction        ,
    noPadStickyEventsForeachFunction_WithClosures,
    wrap_PadStickyEventsForeachFunction     ,


-- ** PadUnlinkFunction #signal:PadUnlinkFunction#

    C_PadUnlinkFunction                     ,
    PadUnlinkFunction                       ,
    dynamic_PadUnlinkFunction               ,
    genClosure_PadUnlinkFunction            ,
    mk_PadUnlinkFunction                    ,
    noPadUnlinkFunction                     ,
    wrap_PadUnlinkFunction                  ,


-- ** PluginFeatureFilter #signal:PluginFeatureFilter#

    C_PluginFeatureFilter                   ,
    PluginFeatureFilter                     ,
    PluginFeatureFilter_WithClosures        ,
    drop_closures_PluginFeatureFilter       ,
    dynamic_PluginFeatureFilter             ,
    genClosure_PluginFeatureFilter          ,
    mk_PluginFeatureFilter                  ,
    noPluginFeatureFilter                   ,
    noPluginFeatureFilter_WithClosures      ,
    wrap_PluginFeatureFilter                ,


-- ** PluginFilter #signal:PluginFilter#

    C_PluginFilter                          ,
    PluginFilter                            ,
    PluginFilter_WithClosures               ,
    drop_closures_PluginFilter              ,
    dynamic_PluginFilter                    ,
    genClosure_PluginFilter                 ,
    mk_PluginFilter                         ,
    noPluginFilter                          ,
    noPluginFilter_WithClosures             ,
    wrap_PluginFilter                       ,


-- ** PluginInitFullFunc #signal:PluginInitFullFunc#

    C_PluginInitFullFunc                    ,
    PluginInitFullFunc                      ,
    PluginInitFullFunc_WithClosures         ,
    drop_closures_PluginInitFullFunc        ,
    dynamic_PluginInitFullFunc              ,
    genClosure_PluginInitFullFunc           ,
    mk_PluginInitFullFunc                   ,
    noPluginInitFullFunc                    ,
    noPluginInitFullFunc_WithClosures       ,
    wrap_PluginInitFullFunc                 ,


-- ** PluginInitFunc #signal:PluginInitFunc#

    C_PluginInitFunc                        ,
    PluginInitFunc                          ,
    dynamic_PluginInitFunc                  ,
    genClosure_PluginInitFunc               ,
    mk_PluginInitFunc                       ,
    noPluginInitFunc                        ,
    wrap_PluginInitFunc                     ,


-- ** PromiseChangeFunc #signal:PromiseChangeFunc#

    C_PromiseChangeFunc                     ,
    PromiseChangeFunc                       ,
    PromiseChangeFunc_WithClosures          ,
    drop_closures_PromiseChangeFunc         ,
    dynamic_PromiseChangeFunc               ,
    genClosure_PromiseChangeFunc            ,
    mk_PromiseChangeFunc                    ,
    noPromiseChangeFunc                     ,
    noPromiseChangeFunc_WithClosures        ,
    wrap_PromiseChangeFunc                  ,


-- ** StructureFilterMapFunc #signal:StructureFilterMapFunc#

    C_StructureFilterMapFunc                ,
    StructureFilterMapFunc                  ,
    StructureFilterMapFunc_WithClosures     ,
    drop_closures_StructureFilterMapFunc    ,
    dynamic_StructureFilterMapFunc          ,
    genClosure_StructureFilterMapFunc       ,
    mk_StructureFilterMapFunc               ,
    noStructureFilterMapFunc                ,
    noStructureFilterMapFunc_WithClosures   ,
    wrap_StructureFilterMapFunc             ,


-- ** StructureForeachFunc #signal:StructureForeachFunc#

    C_StructureForeachFunc                  ,
    StructureForeachFunc                    ,
    StructureForeachFunc_WithClosures       ,
    drop_closures_StructureForeachFunc      ,
    dynamic_StructureForeachFunc            ,
    genClosure_StructureForeachFunc         ,
    mk_StructureForeachFunc                 ,
    noStructureForeachFunc                  ,
    noStructureForeachFunc_WithClosures     ,
    wrap_StructureForeachFunc               ,


-- ** StructureMapFunc #signal:StructureMapFunc#

    C_StructureMapFunc                      ,
    StructureMapFunc                        ,
    StructureMapFunc_WithClosures           ,
    drop_closures_StructureMapFunc          ,
    dynamic_StructureMapFunc                ,
    genClosure_StructureMapFunc             ,
    mk_StructureMapFunc                     ,
    noStructureMapFunc                      ,
    noStructureMapFunc_WithClosures         ,
    wrap_StructureMapFunc                   ,


-- ** TagForeachFunc #signal:TagForeachFunc#

    C_TagForeachFunc                        ,
    TagForeachFunc                          ,
    TagForeachFunc_WithClosures             ,
    drop_closures_TagForeachFunc            ,
    dynamic_TagForeachFunc                  ,
    genClosure_TagForeachFunc               ,
    mk_TagForeachFunc                       ,
    noTagForeachFunc                        ,
    noTagForeachFunc_WithClosures           ,
    wrap_TagForeachFunc                     ,


-- ** TagMergeFunc #signal:TagMergeFunc#

    C_TagMergeFunc                          ,
    TagMergeFunc                            ,
    dynamic_TagMergeFunc                    ,
    genClosure_TagMergeFunc                 ,
    mk_TagMergeFunc                         ,
    noTagMergeFunc                          ,
    wrap_TagMergeFunc                       ,


-- ** TaskFunction #signal:TaskFunction#

    C_TaskFunction                          ,
    TaskFunction                            ,
    TaskFunction_WithClosures               ,
    drop_closures_TaskFunction              ,
    dynamic_TaskFunction                    ,
    genClosure_TaskFunction                 ,
    mk_TaskFunction                         ,
    noTaskFunction                          ,
    noTaskFunction_WithClosures             ,
    wrap_TaskFunction                       ,


-- ** TaskPoolFunction #signal:TaskPoolFunction#

    C_TaskPoolFunction                      ,
    TaskPoolFunction                        ,
    TaskPoolFunction_WithClosures           ,
    drop_closures_TaskPoolFunction          ,
    dynamic_TaskPoolFunction                ,
    genClosure_TaskPoolFunction             ,
    mk_TaskPoolFunction                     ,
    noTaskPoolFunction                      ,
    noTaskPoolFunction_WithClosures         ,
    wrap_TaskPoolFunction                   ,


-- ** TaskThreadFunc #signal:TaskThreadFunc#

    C_TaskThreadFunc                        ,
    TaskThreadFunc                          ,
    TaskThreadFunc_WithClosures             ,
    drop_closures_TaskThreadFunc            ,
    dynamic_TaskThreadFunc                  ,
    genClosure_TaskThreadFunc               ,
    mk_TaskThreadFunc                       ,
    noTaskThreadFunc                        ,
    noTaskThreadFunc_WithClosures           ,
    wrap_TaskThreadFunc                     ,


-- ** TypeFindFunction #signal:TypeFindFunction#

    C_TypeFindFunction                      ,
    TypeFindFunction                        ,
    TypeFindFunction_WithClosures           ,
    drop_closures_TypeFindFunction          ,
    dynamic_TypeFindFunction                ,
    genClosure_TypeFindFunction             ,
    mk_TypeFindFunction                     ,
    noTypeFindFunction                      ,
    noTypeFindFunction_WithClosures         ,
    wrap_TypeFindFunction                   ,


-- ** TypeFindGetLengthFieldCallback #signal:TypeFindGetLengthFieldCallback#

    C_TypeFindGetLengthFieldCallback        ,
    TypeFindGetLengthFieldCallback          ,
    dynamic_TypeFindGetLengthFieldCallback  ,
    genClosure_TypeFindGetLengthFieldCallback,
    mk_TypeFindGetLengthFieldCallback       ,
    noTypeFindGetLengthFieldCallback        ,
    wrap_TypeFindGetLengthFieldCallback     ,


-- ** TypeFindPeekFieldCallback #signal:TypeFindPeekFieldCallback#

    C_TypeFindPeekFieldCallback             ,
    TypeFindPeekFieldCallback               ,
    dynamic_TypeFindPeekFieldCallback       ,
    genClosure_TypeFindPeekFieldCallback    ,
    mk_TypeFindPeekFieldCallback            ,
    noTypeFindPeekFieldCallback             ,
    wrap_TypeFindPeekFieldCallback          ,


-- ** TypeFindSuggestFieldCallback #signal:TypeFindSuggestFieldCallback#

    C_TypeFindSuggestFieldCallback          ,
    TypeFindSuggestFieldCallback            ,
    dynamic_TypeFindSuggestFieldCallback    ,
    genClosure_TypeFindSuggestFieldCallback ,
    mk_TypeFindSuggestFieldCallback         ,
    noTypeFindSuggestFieldCallback          ,
    wrap_TypeFindSuggestFieldCallback       ,


-- ** ValueCompareFunc #signal:ValueCompareFunc#

    C_ValueCompareFunc                      ,
    ValueCompareFunc                        ,
    dynamic_ValueCompareFunc                ,
    genClosure_ValueCompareFunc             ,
    mk_ValueCompareFunc                     ,
    noValueCompareFunc                      ,
    wrap_ValueCompareFunc                   ,


-- ** ValueDeserializeFunc #signal:ValueDeserializeFunc#

    C_ValueDeserializeFunc                  ,
    ValueDeserializeFunc                    ,
    dynamic_ValueDeserializeFunc            ,
    genClosure_ValueDeserializeFunc         ,
    mk_ValueDeserializeFunc                 ,
    noValueDeserializeFunc                  ,
    wrap_ValueDeserializeFunc               ,


-- ** ValueSerializeFunc #signal:ValueSerializeFunc#

    C_ValueSerializeFunc                    ,
    ValueSerializeFunc                      ,
    dynamic_ValueSerializeFunc              ,
    genClosure_ValueSerializeFunc           ,
    mk_ValueSerializeFunc                   ,
    noValueSerializeFunc                    ,
    wrap_ValueSerializeFunc                 ,




    ) where

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

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GLib.Structs.Thread as GLib.Thread
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Objects.Bus as Gst.Bus
import {-# SOURCE #-} qualified GI.Gst.Objects.Clock as Gst.Clock
import {-# SOURCE #-} qualified GI.Gst.Objects.ControlBinding as Gst.ControlBinding
import {-# SOURCE #-} qualified GI.Gst.Objects.ControlSource as Gst.ControlSource
import {-# SOURCE #-} qualified GI.Gst.Objects.Element as Gst.Element
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Pad as Gst.Pad
import {-# SOURCE #-} qualified GI.Gst.Objects.Plugin as Gst.Plugin
import {-# SOURCE #-} qualified GI.Gst.Objects.PluginFeature as Gst.PluginFeature
import {-# SOURCE #-} qualified GI.Gst.Objects.Task as Gst.Task
import {-# SOURCE #-} qualified GI.Gst.Structs.Buffer as Gst.Buffer
import {-# SOURCE #-} qualified GI.Gst.Structs.BufferList as Gst.BufferList
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.CapsFeatures as Gst.CapsFeatures
import {-# SOURCE #-} qualified GI.Gst.Structs.DebugCategory as Gst.DebugCategory
import {-# SOURCE #-} qualified GI.Gst.Structs.DebugMessage as Gst.DebugMessage
import {-# SOURCE #-} qualified GI.Gst.Structs.Event as Gst.Event
import {-# SOURCE #-} qualified GI.Gst.Structs.Iterator as Gst.Iterator
import {-# SOURCE #-} qualified GI.Gst.Structs.MapInfo as Gst.MapInfo
import {-# SOURCE #-} qualified GI.Gst.Structs.Memory as Gst.Memory
import {-# SOURCE #-} qualified GI.Gst.Structs.Message as Gst.Message
import {-# SOURCE #-} qualified GI.Gst.Structs.Meta as Gst.Meta
import {-# SOURCE #-} qualified GI.Gst.Structs.MiniObject as Gst.MiniObject
import {-# SOURCE #-} qualified GI.Gst.Structs.PadProbeInfo as Gst.PadProbeInfo
import {-# SOURCE #-} qualified GI.Gst.Structs.Promise as Gst.Promise
import {-# SOURCE #-} qualified GI.Gst.Structs.Query as Gst.Query
import {-# SOURCE #-} qualified GI.Gst.Structs.Structure as Gst.Structure
import {-# SOURCE #-} qualified GI.Gst.Structs.TagList as Gst.TagList
import {-# SOURCE #-} qualified GI.Gst.Structs.TypeFind as Gst.TypeFind

-- callback ValueSerializeFunc
--          -> Callable {returnType = Just (TBasicType TUTF8), returnMayBeNull = False, returnTransfer = TransferEverything, returnDocumentation = Documentation {rawDocText = Just "the string representation of the value", sinceVersion = Nothing}, args = [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Used by gst_value_serialize() to obtain a non-binary form of the #GValue.\n\nFree-function: g_free", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ValueSerializeFunc =
    Ptr GValue ->
    IO CString

-- Args : [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ValueSerializeFunc :: FunPtr C_ValueSerializeFunc -> C_ValueSerializeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ValueSerializeFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ValueSerializeFunc
    -> GValue
    {- ^ /@value1@/: a 'GI.GObject.Structs.Value.Value' -}
    -> m T.Text
    {- ^ __Returns:__ the string representation of the value -}
dynamic_ValueSerializeFunc __funPtr value1 = liftIO $ do
    value1' <- unsafeManagedPtrGetPtr value1
    result <- (__dynamic_C_ValueSerializeFunc __funPtr) value1'
    checkUnexpectedReturnNULL "valueSerializeFunc" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr value1
    return result'

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

{- |
Used by 'GI.Gst.Functions.valueSerialize' to obtain a non-binary form of the 'GI.GObject.Structs.Value.Value'.

Free-function: g_free
-}
type ValueSerializeFunc =
    GValue
    {- ^ /@value1@/: a 'GI.GObject.Structs.Value.Value' -}
    -> IO T.Text
    {- ^ __Returns:__ the string representation of the value -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ValueSerializeFunc`@.
noValueSerializeFunc :: Maybe ValueSerializeFunc
noValueSerializeFunc = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ValueSerializeFunc :: MonadIO m => ValueSerializeFunc -> m (GClosure C_ValueSerializeFunc)
genClosure_ValueSerializeFunc cb = liftIO $ do
    let cb' = wrap_ValueSerializeFunc Nothing cb
    mk_ValueSerializeFunc cb' >>= B.GClosure.newGClosure


-- | Wrap a `ValueSerializeFunc` into a `C_ValueSerializeFunc`.
wrap_ValueSerializeFunc ::
    Maybe (Ptr (FunPtr C_ValueSerializeFunc)) ->
    ValueSerializeFunc ->
    C_ValueSerializeFunc
wrap_ValueSerializeFunc funptrptr _cb value1 = do
    B.ManagedPtr.withTransient GValue value1 $ \value1' -> do
        result <- _cb  value1'
        maybeReleaseFunPtr funptrptr
        result' <- textToCString result
        return result'


-- callback ValueDeserializeFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE for success", sinceVersion = Nothing}, args = [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "s", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Used by gst_value_deserialize() to parse a non-binary form into the #GValue.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ValueDeserializeFunc =
    Ptr GValue ->
    CString ->
    IO CInt

-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "s", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ValueDeserializeFunc :: FunPtr C_ValueDeserializeFunc -> C_ValueDeserializeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ValueDeserializeFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ValueDeserializeFunc
    -> GValue
    {- ^ /@dest@/: a 'GI.GObject.Structs.Value.Value' -}
    -> T.Text
    {- ^ /@s@/: a string -}
    -> m Bool
    {- ^ __Returns:__ 'True' for success -}
dynamic_ValueDeserializeFunc __funPtr dest s = liftIO $ do
    dest' <- unsafeManagedPtrGetPtr dest
    s' <- textToCString s
    result <- (__dynamic_C_ValueDeserializeFunc __funPtr) dest' s'
    let result' = (/= 0) result
    touchManagedPtr dest
    freeMem s'
    return result'

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

{- |
Used by 'GI.Gst.Functions.valueDeserialize' to parse a non-binary form into the 'GI.GObject.Structs.Value.Value'.
-}
type ValueDeserializeFunc =
    GValue
    {- ^ /@dest@/: a 'GI.GObject.Structs.Value.Value' -}
    -> T.Text
    {- ^ /@s@/: a string -}
    -> IO Bool
    {- ^ __Returns:__ 'True' for success -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ValueDeserializeFunc`@.
noValueDeserializeFunc :: Maybe ValueDeserializeFunc
noValueDeserializeFunc = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ValueDeserializeFunc :: MonadIO m => ValueDeserializeFunc -> m (GClosure C_ValueDeserializeFunc)
genClosure_ValueDeserializeFunc cb = liftIO $ do
    let cb' = wrap_ValueDeserializeFunc Nothing cb
    mk_ValueDeserializeFunc cb' >>= B.GClosure.newGClosure


-- | Wrap a `ValueDeserializeFunc` into a `C_ValueDeserializeFunc`.
wrap_ValueDeserializeFunc ::
    Maybe (Ptr (FunPtr C_ValueDeserializeFunc)) ->
    ValueDeserializeFunc ->
    C_ValueDeserializeFunc
wrap_ValueDeserializeFunc funptrptr _cb dest s = do
    B.ManagedPtr.withTransient GValue dest $ \dest' -> do
        s' <- cstringToText s
        result <- _cb  dest' s'
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback ValueCompareFunc
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "one of GST_VALUE_LESS_THAN, GST_VALUE_EQUAL, GST_VALUE_GREATER_THAN\nor GST_VALUE_UNORDERED", sinceVersion = Nothing}, args = [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "first value for comparison", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "second value for comparison", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Used together with gst_value_compare() to compare #GValue items.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ValueCompareFunc =
    Ptr GValue ->
    Ptr GValue ->
    IO Int32

-- Args : [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "first value for comparison", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "second value for comparison", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ValueCompareFunc :: FunPtr C_ValueCompareFunc -> C_ValueCompareFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ValueCompareFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ValueCompareFunc
    -> GValue
    {- ^ /@value1@/: first value for comparison -}
    -> GValue
    {- ^ /@value2@/: second value for comparison -}
    -> m Int32
    {- ^ __Returns:__ one of GST_VALUE_LESS_THAN, GST_VALUE_EQUAL, GST_VALUE_GREATER_THAN
or GST_VALUE_UNORDERED -}
dynamic_ValueCompareFunc __funPtr value1 value2 = liftIO $ do
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- (__dynamic_C_ValueCompareFunc __funPtr) value1' value2'
    touchManagedPtr value1
    touchManagedPtr value2
    return result

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

{- |
Used together with 'GI.Gst.Functions.valueCompare' to compare 'GI.GObject.Structs.Value.Value' items.
-}
type ValueCompareFunc =
    GValue
    {- ^ /@value1@/: first value for comparison -}
    -> GValue
    {- ^ /@value2@/: second value for comparison -}
    -> IO Int32
    {- ^ __Returns:__ one of GST_VALUE_LESS_THAN, GST_VALUE_EQUAL, GST_VALUE_GREATER_THAN
or GST_VALUE_UNORDERED -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ValueCompareFunc`@.
noValueCompareFunc :: Maybe ValueCompareFunc
noValueCompareFunc = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ValueCompareFunc :: MonadIO m => ValueCompareFunc -> m (GClosure C_ValueCompareFunc)
genClosure_ValueCompareFunc cb = liftIO $ do
    let cb' = wrap_ValueCompareFunc Nothing cb
    mk_ValueCompareFunc cb' >>= B.GClosure.newGClosure


-- | Wrap a `ValueCompareFunc` into a `C_ValueCompareFunc`.
wrap_ValueCompareFunc ::
    Maybe (Ptr (FunPtr C_ValueCompareFunc)) ->
    ValueCompareFunc ->
    C_ValueCompareFunc
wrap_ValueCompareFunc funptrptr _cb value1 value2 = do
    B.ManagedPtr.withTransient GValue value1 $ \value1' -> do
        B.ManagedPtr.withTransient GValue value2 $ \value2' -> do
            result <- _cb  value1' value2'
            maybeReleaseFunPtr funptrptr
            return result


-- callback TypeFindSuggestFieldCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "probability", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TypeFindSuggestFieldCallback =
    Ptr () ->
    Word32 ->
    Ptr Gst.Caps.Caps ->
    IO ()

-- Args : [Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "probability", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = 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_TypeFindSuggestFieldCallback :: FunPtr C_TypeFindSuggestFieldCallback -> C_TypeFindSuggestFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TypeFindSuggestFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TypeFindSuggestFieldCallback
    -> Ptr ()
    -> Word32
    -> Gst.Caps.Caps
    -> m ()
dynamic_TypeFindSuggestFieldCallback __funPtr data_ probability caps = liftIO $ do
    caps' <- unsafeManagedPtrGetPtr caps
    (__dynamic_C_TypeFindSuggestFieldCallback __funPtr) data_ probability caps'
    touchManagedPtr caps
    return ()

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

{- |
/No description available in the introspection data./
-}
type TypeFindSuggestFieldCallback =
    Ptr ()
    -> Word32
    -> Gst.Caps.Caps
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TypeFindSuggestFieldCallback`@.
noTypeFindSuggestFieldCallback :: Maybe TypeFindSuggestFieldCallback
noTypeFindSuggestFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_TypeFindSuggestFieldCallback :: MonadIO m => TypeFindSuggestFieldCallback -> m (GClosure C_TypeFindSuggestFieldCallback)
genClosure_TypeFindSuggestFieldCallback cb = liftIO $ do
    let cb' = wrap_TypeFindSuggestFieldCallback Nothing cb
    mk_TypeFindSuggestFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `TypeFindSuggestFieldCallback` into a `C_TypeFindSuggestFieldCallback`.
wrap_TypeFindSuggestFieldCallback ::
    Maybe (Ptr (FunPtr C_TypeFindSuggestFieldCallback)) ->
    TypeFindSuggestFieldCallback ->
    C_TypeFindSuggestFieldCallback
wrap_TypeFindSuggestFieldCallback funptrptr _cb data_ probability caps = do
    B.ManagedPtr.withTransient Gst.Caps.Caps caps $ \caps' -> do
        _cb  data_ probability caps'
        maybeReleaseFunPtr funptrptr


-- callback TypeFindPeekFieldCallback
--          -> Callable {returnType = Just (TBasicType TUInt8), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TypeFindPeekFieldCallback =
    Ptr () ->
    Int64 ->
    Word32 ->
    IO Word8

-- Args : [Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TypeFindPeekFieldCallback :: FunPtr C_TypeFindPeekFieldCallback -> C_TypeFindPeekFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TypeFindPeekFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TypeFindPeekFieldCallback
    -> Ptr ()
    -> Int64
    -> Word32
    -> m Word8
dynamic_TypeFindPeekFieldCallback __funPtr data_ offset size = liftIO $ do
    result <- (__dynamic_C_TypeFindPeekFieldCallback __funPtr) data_ offset size
    return result

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

{- |
/No description available in the introspection data./
-}
type TypeFindPeekFieldCallback =
    Ptr ()
    -> Int64
    -> Word32
    -> IO Word8

-- | A convenience synonym for @`Nothing` :: `Maybe` `TypeFindPeekFieldCallback`@.
noTypeFindPeekFieldCallback :: Maybe TypeFindPeekFieldCallback
noTypeFindPeekFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_TypeFindPeekFieldCallback :: MonadIO m => TypeFindPeekFieldCallback -> m (GClosure C_TypeFindPeekFieldCallback)
genClosure_TypeFindPeekFieldCallback cb = liftIO $ do
    let cb' = wrap_TypeFindPeekFieldCallback Nothing cb
    mk_TypeFindPeekFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `TypeFindPeekFieldCallback` into a `C_TypeFindPeekFieldCallback`.
wrap_TypeFindPeekFieldCallback ::
    Maybe (Ptr (FunPtr C_TypeFindPeekFieldCallback)) ->
    TypeFindPeekFieldCallback ->
    C_TypeFindPeekFieldCallback
wrap_TypeFindPeekFieldCallback funptrptr _cb data_ offset size = do
    result <- _cb  data_ offset size
    maybeReleaseFunPtr funptrptr
    return result


-- callback TypeFindGetLengthFieldCallback
--          -> Callable {returnType = Just (TBasicType TUInt64), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TypeFindGetLengthFieldCallback =
    Ptr () ->
    IO Word64

-- Args : [Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TypeFindGetLengthFieldCallback :: FunPtr C_TypeFindGetLengthFieldCallback -> C_TypeFindGetLengthFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TypeFindGetLengthFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TypeFindGetLengthFieldCallback
    -> Ptr ()
    -> m Word64
dynamic_TypeFindGetLengthFieldCallback __funPtr data_ = liftIO $ do
    result <- (__dynamic_C_TypeFindGetLengthFieldCallback __funPtr) data_
    return result

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

{- |
/No description available in the introspection data./
-}
type TypeFindGetLengthFieldCallback =
    Ptr ()
    -> IO Word64

-- | A convenience synonym for @`Nothing` :: `Maybe` `TypeFindGetLengthFieldCallback`@.
noTypeFindGetLengthFieldCallback :: Maybe TypeFindGetLengthFieldCallback
noTypeFindGetLengthFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_TypeFindGetLengthFieldCallback :: MonadIO m => TypeFindGetLengthFieldCallback -> m (GClosure C_TypeFindGetLengthFieldCallback)
genClosure_TypeFindGetLengthFieldCallback cb = liftIO $ do
    let cb' = wrap_TypeFindGetLengthFieldCallback Nothing cb
    mk_TypeFindGetLengthFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `TypeFindGetLengthFieldCallback` into a `C_TypeFindGetLengthFieldCallback`.
wrap_TypeFindGetLengthFieldCallback ::
    Maybe (Ptr (FunPtr C_TypeFindGetLengthFieldCallback)) ->
    TypeFindGetLengthFieldCallback ->
    C_TypeFindGetLengthFieldCallback
wrap_TypeFindGetLengthFieldCallback funptrptr _cb data_ = do
    result <- _cb  data_
    maybeReleaseFunPtr funptrptr
    return result


-- callback TypeFindFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "find", argType = TInterface (Name {namespace = "Gst", name = "TypeFind"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTypeFind structure", 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 "optional data to pass to the 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 by typefinding.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TypeFindFunction =
    Ptr Gst.TypeFind.TypeFind ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "find", argType = TInterface (Name {namespace = "Gst", name = "TypeFind"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTypeFind structure", 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 "optional data to pass to the function", 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_TypeFindFunction :: FunPtr C_TypeFindFunction -> C_TypeFindFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TypeFindFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TypeFindFunction
    -> Gst.TypeFind.TypeFind
    {- ^ /@find@/: A 'GI.Gst.Structs.TypeFind.TypeFind' structure -}
    -> Ptr ()
    {- ^ /@userData@/: optional data to pass to the function -}
    -> m ()
dynamic_TypeFindFunction __funPtr find userData = liftIO $ do
    find' <- unsafeManagedPtrGetPtr find
    (__dynamic_C_TypeFindFunction __funPtr) find' userData
    touchManagedPtr find
    return ()

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

{- |
A function that will be called by typefinding.
-}
type TypeFindFunction =
    Gst.TypeFind.TypeFind
    {- ^ /@find@/: A 'GI.Gst.Structs.TypeFind.TypeFind' structure -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TypeFindFunction`@.
noTypeFindFunction :: Maybe TypeFindFunction
noTypeFindFunction = Nothing

{- |
A function that will be called by typefinding.
-}
type TypeFindFunction_WithClosures =
    Gst.TypeFind.TypeFind
    {- ^ /@find@/: A 'GI.Gst.Structs.TypeFind.TypeFind' structure -}
    -> Ptr ()
    {- ^ /@userData@/: optional data to pass to the function -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TypeFindFunction_WithClosures`@.
noTypeFindFunction_WithClosures :: Maybe TypeFindFunction_WithClosures
noTypeFindFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TypeFindFunction :: TypeFindFunction -> TypeFindFunction_WithClosures
drop_closures_TypeFindFunction _f find _ = _f find

-- | Wrap the callback into a `GClosure`.
genClosure_TypeFindFunction :: MonadIO m => TypeFindFunction -> m (GClosure C_TypeFindFunction)
genClosure_TypeFindFunction cb = liftIO $ do
    let cb' = drop_closures_TypeFindFunction cb
    let cb'' = wrap_TypeFindFunction Nothing cb'
    mk_TypeFindFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `TypeFindFunction` into a `C_TypeFindFunction`.
wrap_TypeFindFunction ::
    Maybe (Ptr (FunPtr C_TypeFindFunction)) ->
    TypeFindFunction_WithClosures ->
    C_TypeFindFunction
wrap_TypeFindFunction funptrptr _cb find userData = do
    find' <- (newPtr Gst.TypeFind.TypeFind) find
    _cb  find' userData
    maybeReleaseFunPtr funptrptr


-- callback TaskThreadFunc
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "task", argType = TInterface (Name {namespace = "Gst", name = "Task"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstTask", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "thread", argType = TInterface (Name {namespace = "GLib", name = "Thread"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GThread", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Custom GstTask thread callback functions that can be installed.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TaskThreadFunc =
    Ptr Gst.Task.Task ->
    Ptr GLib.Thread.Thread ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "task", argType = TInterface (Name {namespace = "Gst", name = "Task"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstTask", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "thread", argType = TInterface (Name {namespace = "GLib", name = "Thread"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GThread", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TaskThreadFunc :: FunPtr C_TaskThreadFunc -> C_TaskThreadFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TaskThreadFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Task.IsTask a) =>
    FunPtr C_TaskThreadFunc
    -> a
    {- ^ /@task@/: The 'GI.Gst.Objects.Task.Task' -}
    -> GLib.Thread.Thread
    {- ^ /@thread@/: The 'GI.GLib.Structs.Thread.Thread' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m ()
dynamic_TaskThreadFunc __funPtr task thread userData = liftIO $ do
    task' <- unsafeManagedPtrCastPtr task
    thread' <- unsafeManagedPtrGetPtr thread
    (__dynamic_C_TaskThreadFunc __funPtr) task' thread' userData
    touchManagedPtr task
    touchManagedPtr thread
    return ()

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

{- |
Custom GstTask thread callback functions that can be installed.
-}
type TaskThreadFunc =
    Gst.Task.Task
    {- ^ /@task@/: The 'GI.Gst.Objects.Task.Task' -}
    -> GLib.Thread.Thread
    {- ^ /@thread@/: The 'GI.GLib.Structs.Thread.Thread' -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TaskThreadFunc`@.
noTaskThreadFunc :: Maybe TaskThreadFunc
noTaskThreadFunc = Nothing

{- |
Custom GstTask thread callback functions that can be installed.
-}
type TaskThreadFunc_WithClosures =
    Gst.Task.Task
    {- ^ /@task@/: The 'GI.Gst.Objects.Task.Task' -}
    -> GLib.Thread.Thread
    {- ^ /@thread@/: The 'GI.GLib.Structs.Thread.Thread' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TaskThreadFunc_WithClosures`@.
noTaskThreadFunc_WithClosures :: Maybe TaskThreadFunc_WithClosures
noTaskThreadFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TaskThreadFunc :: TaskThreadFunc -> TaskThreadFunc_WithClosures
drop_closures_TaskThreadFunc _f task thread _ = _f task thread

-- | Wrap the callback into a `GClosure`.
genClosure_TaskThreadFunc :: MonadIO m => TaskThreadFunc -> m (GClosure C_TaskThreadFunc)
genClosure_TaskThreadFunc cb = liftIO $ do
    let cb' = drop_closures_TaskThreadFunc cb
    let cb'' = wrap_TaskThreadFunc Nothing cb'
    mk_TaskThreadFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `TaskThreadFunc` into a `C_TaskThreadFunc`.
wrap_TaskThreadFunc ::
    Maybe (Ptr (FunPtr C_TaskThreadFunc)) ->
    TaskThreadFunc_WithClosures ->
    C_TaskThreadFunc
wrap_TaskThreadFunc funptrptr _cb task thread userData = do
    task' <- (newObject Gst.Task.Task) task
    B.ManagedPtr.withTransient GLib.Thread.Thread thread $ \thread' -> do
        _cb  task' thread' userData
        maybeReleaseFunPtr funptrptr


-- callback TaskPoolFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data for the task function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Task function, see gst_task_pool_push().", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TaskPoolFunction =
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data for the task function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TaskPoolFunction :: FunPtr C_TaskPoolFunction -> C_TaskPoolFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TaskPoolFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TaskPoolFunction
    -> Ptr ()
    {- ^ /@userData@/: user data for the task function -}
    -> m ()
dynamic_TaskPoolFunction __funPtr userData = liftIO $ do
    (__dynamic_C_TaskPoolFunction __funPtr) userData
    return ()

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

{- |
Task function, see 'GI.Gst.Objects.TaskPool.taskPoolPush'.
-}
type TaskPoolFunction =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TaskPoolFunction`@.
noTaskPoolFunction :: Maybe TaskPoolFunction
noTaskPoolFunction = Nothing

{- |
Task function, see 'GI.Gst.Objects.TaskPool.taskPoolPush'.
-}
type TaskPoolFunction_WithClosures =
    Ptr ()
    {- ^ /@userData@/: user data for the task function -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TaskPoolFunction_WithClosures`@.
noTaskPoolFunction_WithClosures :: Maybe TaskPoolFunction_WithClosures
noTaskPoolFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TaskPoolFunction :: TaskPoolFunction -> TaskPoolFunction_WithClosures
drop_closures_TaskPoolFunction _f _ = _f

-- | Wrap the callback into a `GClosure`.
genClosure_TaskPoolFunction :: MonadIO m => TaskPoolFunction -> m (GClosure C_TaskPoolFunction)
genClosure_TaskPoolFunction cb = liftIO $ do
    let cb' = drop_closures_TaskPoolFunction cb
    let cb'' = wrap_TaskPoolFunction Nothing cb'
    mk_TaskPoolFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `TaskPoolFunction` into a `C_TaskPoolFunction`.
wrap_TaskPoolFunction ::
    Maybe (Ptr (FunPtr C_TaskPoolFunction)) ->
    TaskPoolFunction_WithClosures ->
    C_TaskPoolFunction
wrap_TaskPoolFunction funptrptr _cb userData = do
    _cb  userData
    maybeReleaseFunPtr funptrptr


-- callback TaskFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will repeatedly be called in the thread created by\na #GstTask.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TaskFunction =
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TaskFunction :: FunPtr C_TaskFunction -> C_TaskFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TaskFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TaskFunction
    -> Ptr ()
    {- ^ /@userData@/: user data passed to the function -}
    -> m ()
dynamic_TaskFunction __funPtr userData = liftIO $ do
    (__dynamic_C_TaskFunction __funPtr) userData
    return ()

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

{- |
A function that will repeatedly be called in the thread created by
a 'GI.Gst.Objects.Task.Task'.
-}
type TaskFunction =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TaskFunction`@.
noTaskFunction :: Maybe TaskFunction
noTaskFunction = Nothing

{- |
A function that will repeatedly be called in the thread created by
a 'GI.Gst.Objects.Task.Task'.
-}
type TaskFunction_WithClosures =
    Ptr ()
    {- ^ /@userData@/: user data passed to the function -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TaskFunction_WithClosures`@.
noTaskFunction_WithClosures :: Maybe TaskFunction_WithClosures
noTaskFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TaskFunction :: TaskFunction -> TaskFunction_WithClosures
drop_closures_TaskFunction _f _ = _f

-- | Wrap the callback into a `GClosure`.
genClosure_TaskFunction :: MonadIO m => TaskFunction -> m (GClosure C_TaskFunction)
genClosure_TaskFunction cb = liftIO $ do
    let cb' = drop_closures_TaskFunction cb
    let cb'' = wrap_TaskFunction Nothing cb'
    mk_TaskFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `TaskFunction` into a `C_TaskFunction`.
wrap_TaskFunction ::
    Maybe (Ptr (FunPtr C_TaskFunction)) ->
    TaskFunction_WithClosures ->
    C_TaskFunction
wrap_TaskFunction funptrptr _cb userData = do
    _cb  userData
    maybeReleaseFunPtr funptrptr


-- callback TagMergeFunc
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the destination #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function for merging multiple values of a tag used when registering\ntags.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TagMergeFunc =
    Ptr GValue ->
    Ptr GValue ->
    IO ()

-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the destination #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GValue", 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_TagMergeFunc :: FunPtr C_TagMergeFunc -> C_TagMergeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TagMergeFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TagMergeFunc
    -> GValue
    {- ^ /@dest@/: the destination 'GI.GObject.Structs.Value.Value' -}
    -> GValue
    {- ^ /@src@/: the source 'GI.GObject.Structs.Value.Value' -}
    -> m ()
dynamic_TagMergeFunc __funPtr dest src = liftIO $ do
    dest' <- unsafeManagedPtrGetPtr dest
    src' <- unsafeManagedPtrGetPtr src
    (__dynamic_C_TagMergeFunc __funPtr) dest' src'
    touchManagedPtr dest
    touchManagedPtr src
    return ()

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

{- |
A function for merging multiple values of a tag used when registering
tags.
-}
type TagMergeFunc =
    GValue
    {- ^ /@dest@/: the destination 'GI.GObject.Structs.Value.Value' -}
    -> GValue
    {- ^ /@src@/: the source 'GI.GObject.Structs.Value.Value' -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TagMergeFunc`@.
noTagMergeFunc :: Maybe TagMergeFunc
noTagMergeFunc = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_TagMergeFunc :: MonadIO m => TagMergeFunc -> m (GClosure C_TagMergeFunc)
genClosure_TagMergeFunc cb = liftIO $ do
    let cb' = wrap_TagMergeFunc Nothing cb
    mk_TagMergeFunc cb' >>= B.GClosure.newGClosure


-- | Wrap a `TagMergeFunc` into a `C_TagMergeFunc`.
wrap_TagMergeFunc ::
    Maybe (Ptr (FunPtr C_TagMergeFunc)) ->
    TagMergeFunc ->
    C_TagMergeFunc
wrap_TagMergeFunc funptrptr _cb dest src = do
    B.ManagedPtr.withTransient GValue dest $ \dest' -> do
        B.ManagedPtr.withTransient GValue src $ \src' -> do
            _cb  dest' src'
            maybeReleaseFunPtr funptrptr


-- callback TagForeachFunc
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "list", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstTagList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a name of a tag in @list", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called in gst_tag_list_foreach(). The function may\nnot modify the tag list.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_TagForeachFunc =
    Ptr Gst.TagList.TagList ->
    CString ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "list", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstTagList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a name of a tag in @list", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TagForeachFunc :: FunPtr C_TagForeachFunc -> C_TagForeachFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TagForeachFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TagForeachFunc
    -> Gst.TagList.TagList
    {- ^ /@list@/: the 'GI.Gst.Structs.TagList.TagList' -}
    -> T.Text
    {- ^ /@tag@/: a name of a tag in /@list@/ -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m ()
dynamic_TagForeachFunc __funPtr list tag userData = liftIO $ do
    list' <- unsafeManagedPtrGetPtr list
    tag' <- textToCString tag
    (__dynamic_C_TagForeachFunc __funPtr) list' tag' userData
    touchManagedPtr list
    freeMem tag'
    return ()

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

{- |
A function that will be called in 'GI.Gst.Structs.TagList.tagListForeach'. The function may
not modify the tag list.
-}
type TagForeachFunc =
    Gst.TagList.TagList
    {- ^ /@list@/: the 'GI.Gst.Structs.TagList.TagList' -}
    -> T.Text
    {- ^ /@tag@/: a name of a tag in /@list@/ -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TagForeachFunc`@.
noTagForeachFunc :: Maybe TagForeachFunc
noTagForeachFunc = Nothing

{- |
A function that will be called in 'GI.Gst.Structs.TagList.tagListForeach'. The function may
not modify the tag list.
-}
type TagForeachFunc_WithClosures =
    Gst.TagList.TagList
    {- ^ /@list@/: the 'GI.Gst.Structs.TagList.TagList' -}
    -> T.Text
    {- ^ /@tag@/: a name of a tag in /@list@/ -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `TagForeachFunc_WithClosures`@.
noTagForeachFunc_WithClosures :: Maybe TagForeachFunc_WithClosures
noTagForeachFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TagForeachFunc :: TagForeachFunc -> TagForeachFunc_WithClosures
drop_closures_TagForeachFunc _f list tag _ = _f list tag

-- | Wrap the callback into a `GClosure`.
genClosure_TagForeachFunc :: MonadIO m => TagForeachFunc -> m (GClosure C_TagForeachFunc)
genClosure_TagForeachFunc cb = liftIO $ do
    let cb' = drop_closures_TagForeachFunc cb
    let cb'' = wrap_TagForeachFunc Nothing cb'
    mk_TagForeachFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `TagForeachFunc` into a `C_TagForeachFunc`.
wrap_TagForeachFunc ::
    Maybe (Ptr (FunPtr C_TagForeachFunc)) ->
    TagForeachFunc_WithClosures ->
    C_TagForeachFunc
wrap_TagForeachFunc funptrptr _cb list tag userData = do
    B.ManagedPtr.withTransient Gst.TagList.TagList list $ \list' -> do
        tag' <- cstringToText tag
        _cb  list' tag' userData
        maybeReleaseFunPtr funptrptr


-- callback StructureMapFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the map operation should continue, %FALSE if\nthe map operation should stop with %FALSE.", sinceVersion = Nothing}, args = [Arg {argCName = "field_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue of the field", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called in gst_structure_map_in_place(). The function\nmay modify @value.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_StructureMapFunc =
    Word32 ->
    Ptr GValue ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "field_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue of the field", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_StructureMapFunc :: FunPtr C_StructureMapFunc -> C_StructureMapFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_StructureMapFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_StructureMapFunc
    -> Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the map operation should continue, 'False' if
the map operation should stop with 'False'. -}
dynamic_StructureMapFunc __funPtr fieldId value userData = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- (__dynamic_C_StructureMapFunc __funPtr) fieldId value' userData
    let result' = (/= 0) result
    touchManagedPtr value
    return result'

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

{- |
A function that will be called in 'GI.Gst.Structs.Structure.structureMapInPlace'. The function
may modify /@value@/.
-}
type StructureMapFunc =
    Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the map operation should continue, 'False' if
the map operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `StructureMapFunc`@.
noStructureMapFunc :: Maybe StructureMapFunc
noStructureMapFunc = Nothing

{- |
A function that will be called in 'GI.Gst.Structs.Structure.structureMapInPlace'. The function
may modify /@value@/.
-}
type StructureMapFunc_WithClosures =
    Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the map operation should continue, 'False' if
the map operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `StructureMapFunc_WithClosures`@.
noStructureMapFunc_WithClosures :: Maybe StructureMapFunc_WithClosures
noStructureMapFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_StructureMapFunc :: StructureMapFunc -> StructureMapFunc_WithClosures
drop_closures_StructureMapFunc _f fieldId value _ = _f fieldId value

-- | Wrap the callback into a `GClosure`.
genClosure_StructureMapFunc :: MonadIO m => StructureMapFunc -> m (GClosure C_StructureMapFunc)
genClosure_StructureMapFunc cb = liftIO $ do
    let cb' = drop_closures_StructureMapFunc cb
    let cb'' = wrap_StructureMapFunc Nothing cb'
    mk_StructureMapFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `StructureMapFunc` into a `C_StructureMapFunc`.
wrap_StructureMapFunc ::
    Maybe (Ptr (FunPtr C_StructureMapFunc)) ->
    StructureMapFunc_WithClosures ->
    C_StructureMapFunc
wrap_StructureMapFunc funptrptr _cb fieldId value userData = do
    B.ManagedPtr.withTransient GValue value $ \value' -> do
        result <- _cb  fieldId value' userData
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback StructureForeachFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the foreach operation should continue, %FALSE if\nthe foreach operation should stop with %FALSE.", sinceVersion = Nothing}, args = [Arg {argCName = "field_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue of the field", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called in gst_structure_foreach(). The function may\nnot modify @value.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_StructureForeachFunc =
    Word32 ->
    Ptr GValue ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "field_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue of the field", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_StructureForeachFunc :: FunPtr C_StructureForeachFunc -> C_StructureForeachFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_StructureForeachFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_StructureForeachFunc
    -> Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the foreach operation should continue, 'False' if
the foreach operation should stop with 'False'. -}
dynamic_StructureForeachFunc __funPtr fieldId value userData = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- (__dynamic_C_StructureForeachFunc __funPtr) fieldId value' userData
    let result' = (/= 0) result
    touchManagedPtr value
    return result'

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

{- |
A function that will be called in 'GI.Gst.Structs.Structure.structureForeach'. The function may
not modify /@value@/.
-}
type StructureForeachFunc =
    Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the foreach operation should continue, 'False' if
the foreach operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `StructureForeachFunc`@.
noStructureForeachFunc :: Maybe StructureForeachFunc
noStructureForeachFunc = Nothing

{- |
A function that will be called in 'GI.Gst.Structs.Structure.structureForeach'. The function may
not modify /@value@/.
-}
type StructureForeachFunc_WithClosures =
    Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the foreach operation should continue, 'False' if
the foreach operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `StructureForeachFunc_WithClosures`@.
noStructureForeachFunc_WithClosures :: Maybe StructureForeachFunc_WithClosures
noStructureForeachFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_StructureForeachFunc :: StructureForeachFunc -> StructureForeachFunc_WithClosures
drop_closures_StructureForeachFunc _f fieldId value _ = _f fieldId value

-- | Wrap the callback into a `GClosure`.
genClosure_StructureForeachFunc :: MonadIO m => StructureForeachFunc -> m (GClosure C_StructureForeachFunc)
genClosure_StructureForeachFunc cb = liftIO $ do
    let cb' = drop_closures_StructureForeachFunc cb
    let cb'' = wrap_StructureForeachFunc Nothing cb'
    mk_StructureForeachFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `StructureForeachFunc` into a `C_StructureForeachFunc`.
wrap_StructureForeachFunc ::
    Maybe (Ptr (FunPtr C_StructureForeachFunc)) ->
    StructureForeachFunc_WithClosures ->
    C_StructureForeachFunc
wrap_StructureForeachFunc funptrptr _cb fieldId value userData = do
    B.ManagedPtr.withTransient GValue value $ \value' -> do
        result <- _cb  fieldId value' userData
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback StructureFilterMapFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the field should be preserved, %FALSE if it\nshould be removed.", sinceVersion = Nothing}, args = [Arg {argCName = "field_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue of the field", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called in gst_structure_filter_and_map_in_place().\nThe function may modify @value, and the value will be removed from\nthe structure if %FALSE is returned.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_StructureFilterMapFunc =
    Word32 ->
    Ptr GValue ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "field_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GQuark of the field name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue of the field", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_StructureFilterMapFunc :: FunPtr C_StructureFilterMapFunc -> C_StructureFilterMapFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_StructureFilterMapFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_StructureFilterMapFunc
    -> Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the field should be preserved, 'False' if it
should be removed. -}
dynamic_StructureFilterMapFunc __funPtr fieldId value userData = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- (__dynamic_C_StructureFilterMapFunc __funPtr) fieldId value' userData
    let result' = (/= 0) result
    touchManagedPtr value
    return result'

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

{- |
A function that will be called in 'GI.Gst.Structs.Structure.structureFilterAndMapInPlace'.
The function may modify /@value@/, and the value will be removed from
the structure if 'False' is returned.
-}
type StructureFilterMapFunc =
    Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the field should be preserved, 'False' if it
should be removed. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `StructureFilterMapFunc`@.
noStructureFilterMapFunc :: Maybe StructureFilterMapFunc
noStructureFilterMapFunc = Nothing

{- |
A function that will be called in 'GI.Gst.Structs.Structure.structureFilterAndMapInPlace'.
The function may modify /@value@/, and the value will be removed from
the structure if 'False' is returned.
-}
type StructureFilterMapFunc_WithClosures =
    Word32
    {- ^ /@fieldId@/: the @/GQuark/@ of the field name -}
    -> GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' of the field -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the field should be preserved, 'False' if it
should be removed. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `StructureFilterMapFunc_WithClosures`@.
noStructureFilterMapFunc_WithClosures :: Maybe StructureFilterMapFunc_WithClosures
noStructureFilterMapFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_StructureFilterMapFunc :: StructureFilterMapFunc -> StructureFilterMapFunc_WithClosures
drop_closures_StructureFilterMapFunc _f fieldId value _ = _f fieldId value

-- | Wrap the callback into a `GClosure`.
genClosure_StructureFilterMapFunc :: MonadIO m => StructureFilterMapFunc -> m (GClosure C_StructureFilterMapFunc)
genClosure_StructureFilterMapFunc cb = liftIO $ do
    let cb' = drop_closures_StructureFilterMapFunc cb
    let cb'' = wrap_StructureFilterMapFunc Nothing cb'
    mk_StructureFilterMapFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `StructureFilterMapFunc` into a `C_StructureFilterMapFunc`.
wrap_StructureFilterMapFunc ::
    Maybe (Ptr (FunPtr C_StructureFilterMapFunc)) ->
    StructureFilterMapFunc_WithClosures ->
    C_StructureFilterMapFunc
wrap_StructureFilterMapFunc funptrptr _cb fieldId value userData = do
    B.ManagedPtr.withTransient GValue value $ \value' -> do
        result <- _cb  fieldId value' userData
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback PromiseChangeFunc
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "promise", argType = TInterface (Name {namespace = "Gst", name = "Promise"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPromise", 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 = Nothing, sinceVersion = Just "1.14"}}
-- | Type for the callback on the (unwrapped) C side.
type C_PromiseChangeFunc =
    Ptr Gst.Promise.Promise ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "promise", argType = TInterface (Name {namespace = "Gst", name = "Promise"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPromise", 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_PromiseChangeFunc :: FunPtr C_PromiseChangeFunc -> C_PromiseChangeFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PromiseChangeFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PromiseChangeFunc
    -> Gst.Promise.Promise
    {- ^ /@promise@/: a 'GI.Gst.Structs.Promise.Promise' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m ()
dynamic_PromiseChangeFunc __funPtr promise userData = liftIO $ do
    promise' <- unsafeManagedPtrGetPtr promise
    (__dynamic_C_PromiseChangeFunc __funPtr) promise' userData
    touchManagedPtr promise
    return ()

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

{- |
/No description available in the introspection data./

/Since: 1.14/
-}
type PromiseChangeFunc =
    Gst.Promise.Promise
    {- ^ /@promise@/: a 'GI.Gst.Structs.Promise.Promise' -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PromiseChangeFunc`@.
noPromiseChangeFunc :: Maybe PromiseChangeFunc
noPromiseChangeFunc = Nothing

{- |
/No description available in the introspection data./

/Since: 1.14/
-}
type PromiseChangeFunc_WithClosures =
    Gst.Promise.Promise
    {- ^ /@promise@/: a 'GI.Gst.Structs.Promise.Promise' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PromiseChangeFunc_WithClosures`@.
noPromiseChangeFunc_WithClosures :: Maybe PromiseChangeFunc_WithClosures
noPromiseChangeFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PromiseChangeFunc :: PromiseChangeFunc -> PromiseChangeFunc_WithClosures
drop_closures_PromiseChangeFunc _f promise _ = _f promise

-- | Wrap the callback into a `GClosure`.
genClosure_PromiseChangeFunc :: MonadIO m => PromiseChangeFunc -> m (GClosure C_PromiseChangeFunc)
genClosure_PromiseChangeFunc cb = liftIO $ do
    let cb' = drop_closures_PromiseChangeFunc cb
    let cb'' = wrap_PromiseChangeFunc Nothing cb'
    mk_PromiseChangeFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PromiseChangeFunc` into a `C_PromiseChangeFunc`.
wrap_PromiseChangeFunc ::
    Maybe (Ptr (FunPtr C_PromiseChangeFunc)) ->
    PromiseChangeFunc_WithClosures ->
    C_PromiseChangeFunc
wrap_PromiseChangeFunc funptrptr _cb promise userData = do
    B.ManagedPtr.withTransient Gst.Promise.Promise promise $ \promise' -> do
        _cb  promise' userData
        maybeReleaseFunPtr funptrptr


-- callback PluginInitFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if plugin initialised successfully", sinceVersion = Nothing}, args = [Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The plugin object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A plugin should provide a pointer to a function of this type in the\nplugin_desc struct.\nThis function will be called by the loader at startup. One would then\nregister each #GstPluginFeature.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PluginInitFunc =
    Ptr Gst.Plugin.Plugin ->
    IO CInt

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

foreign import ccall "dynamic" __dynamic_C_PluginInitFunc :: FunPtr C_PluginInitFunc -> C_PluginInitFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PluginInitFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Plugin.IsPlugin a) =>
    FunPtr C_PluginInitFunc
    -> a
    {- ^ /@plugin@/: The plugin object -}
    -> m Bool
    {- ^ __Returns:__ 'True' if plugin initialised successfully -}
dynamic_PluginInitFunc __funPtr plugin = liftIO $ do
    plugin' <- unsafeManagedPtrCastPtr plugin
    result <- (__dynamic_C_PluginInitFunc __funPtr) plugin'
    let result' = (/= 0) result
    touchManagedPtr plugin
    return result'

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

{- |
A plugin should provide a pointer to a function of this type in the
plugin_desc struct.
This function will be called by the loader at startup. One would then
register each 'GI.Gst.Objects.PluginFeature.PluginFeature'.
-}
type PluginInitFunc =
    Gst.Plugin.Plugin
    {- ^ /@plugin@/: The plugin object -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if plugin initialised successfully -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PluginInitFunc`@.
noPluginInitFunc :: Maybe PluginInitFunc
noPluginInitFunc = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PluginInitFunc :: MonadIO m => PluginInitFunc -> m (GClosure C_PluginInitFunc)
genClosure_PluginInitFunc cb = liftIO $ do
    let cb' = wrap_PluginInitFunc Nothing cb
    mk_PluginInitFunc cb' >>= B.GClosure.newGClosure


-- | Wrap a `PluginInitFunc` into a `C_PluginInitFunc`.
wrap_PluginInitFunc ::
    Maybe (Ptr (FunPtr C_PluginInitFunc)) ->
    PluginInitFunc ->
    C_PluginInitFunc
wrap_PluginInitFunc funptrptr _cb plugin = do
    plugin' <- (newObject Gst.Plugin.Plugin) plugin
    result <- _cb  plugin'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PluginInitFullFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if plugin initialised successfully", sinceVersion = Nothing}, args = [Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The plugin object", 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 "extra data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A plugin should provide a pointer to a function of either #GstPluginInitFunc\nor this type in the plugin_desc struct.\nThe function will be called by the loader at startup. One would then\nregister each #GstPluginFeature. This version allows\nuser data to be passed to init function (useful for bindings).", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PluginInitFullFunc =
    Ptr Gst.Plugin.Plugin ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The plugin object", 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 "extra data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PluginInitFullFunc :: FunPtr C_PluginInitFullFunc -> C_PluginInitFullFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PluginInitFullFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Plugin.IsPlugin a) =>
    FunPtr C_PluginInitFullFunc
    -> a
    {- ^ /@plugin@/: The plugin object -}
    -> Ptr ()
    {- ^ /@userData@/: extra data -}
    -> m Bool
    {- ^ __Returns:__ 'True' if plugin initialised successfully -}
dynamic_PluginInitFullFunc __funPtr plugin userData = liftIO $ do
    plugin' <- unsafeManagedPtrCastPtr plugin
    result <- (__dynamic_C_PluginInitFullFunc __funPtr) plugin' userData
    let result' = (/= 0) result
    touchManagedPtr plugin
    return result'

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

{- |
A plugin should provide a pointer to a function of either 'GI.Gst.Callbacks.PluginInitFunc'
or this type in the plugin_desc struct.
The function will be called by the loader at startup. One would then
register each 'GI.Gst.Objects.PluginFeature.PluginFeature'. This version allows
user data to be passed to init function (useful for bindings).
-}
type PluginInitFullFunc =
    Gst.Plugin.Plugin
    {- ^ /@plugin@/: The plugin object -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if plugin initialised successfully -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PluginInitFullFunc`@.
noPluginInitFullFunc :: Maybe PluginInitFullFunc
noPluginInitFullFunc = Nothing

{- |
A plugin should provide a pointer to a function of either 'GI.Gst.Callbacks.PluginInitFunc'
or this type in the plugin_desc struct.
The function will be called by the loader at startup. One would then
register each 'GI.Gst.Objects.PluginFeature.PluginFeature'. This version allows
user data to be passed to init function (useful for bindings).
-}
type PluginInitFullFunc_WithClosures =
    Gst.Plugin.Plugin
    {- ^ /@plugin@/: The plugin object -}
    -> Ptr ()
    {- ^ /@userData@/: extra data -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if plugin initialised successfully -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PluginInitFullFunc_WithClosures`@.
noPluginInitFullFunc_WithClosures :: Maybe PluginInitFullFunc_WithClosures
noPluginInitFullFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PluginInitFullFunc :: PluginInitFullFunc -> PluginInitFullFunc_WithClosures
drop_closures_PluginInitFullFunc _f plugin _ = _f plugin

-- | Wrap the callback into a `GClosure`.
genClosure_PluginInitFullFunc :: MonadIO m => PluginInitFullFunc -> m (GClosure C_PluginInitFullFunc)
genClosure_PluginInitFullFunc cb = liftIO $ do
    let cb' = drop_closures_PluginInitFullFunc cb
    let cb'' = wrap_PluginInitFullFunc Nothing cb'
    mk_PluginInitFullFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PluginInitFullFunc` into a `C_PluginInitFullFunc`.
wrap_PluginInitFullFunc ::
    Maybe (Ptr (FunPtr C_PluginInitFullFunc)) ->
    PluginInitFullFunc_WithClosures ->
    C_PluginInitFullFunc
wrap_PluginInitFullFunc funptrptr _cb plugin userData = do
    plugin' <- (newObject Gst.Plugin.Plugin) plugin
    result <- _cb  plugin' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PluginFilter
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE for a positive match, %FALSE otherwise", sinceVersion = Nothing}, args = [Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the plugin to check", 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 "the user_data that has been passed on e.g. gst_registry_plugin_filter()", 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 can be used with e.g. gst_registry_plugin_filter()\nto get a list of plugins that match certain criteria.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PluginFilter =
    Ptr Gst.Plugin.Plugin ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the plugin to check", 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 "the user_data that has been passed on e.g. gst_registry_plugin_filter()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PluginFilter :: FunPtr C_PluginFilter -> C_PluginFilter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PluginFilter ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Plugin.IsPlugin a) =>
    FunPtr C_PluginFilter
    -> a
    {- ^ /@plugin@/: the plugin to check -}
    -> Ptr ()
    {- ^ /@userData@/: the user_data that has been passed on e.g. 'GI.Gst.Objects.Registry.registryPluginFilter' -}
    -> m Bool
    {- ^ __Returns:__ 'True' for a positive match, 'False' otherwise -}
dynamic_PluginFilter __funPtr plugin userData = liftIO $ do
    plugin' <- unsafeManagedPtrCastPtr plugin
    result <- (__dynamic_C_PluginFilter __funPtr) plugin' userData
    let result' = (/= 0) result
    touchManagedPtr plugin
    return result'

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

{- |
A function that can be used with e.g. 'GI.Gst.Objects.Registry.registryPluginFilter'
to get a list of plugins that match certain criteria.
-}
type PluginFilter =
    Gst.Plugin.Plugin
    {- ^ /@plugin@/: the plugin to check -}
    -> IO Bool
    {- ^ __Returns:__ 'True' for a positive match, 'False' otherwise -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PluginFilter`@.
noPluginFilter :: Maybe PluginFilter
noPluginFilter = Nothing

{- |
A function that can be used with e.g. 'GI.Gst.Objects.Registry.registryPluginFilter'
to get a list of plugins that match certain criteria.
-}
type PluginFilter_WithClosures =
    Gst.Plugin.Plugin
    {- ^ /@plugin@/: the plugin to check -}
    -> Ptr ()
    {- ^ /@userData@/: the user_data that has been passed on e.g. 'GI.Gst.Objects.Registry.registryPluginFilter' -}
    -> IO Bool
    {- ^ __Returns:__ 'True' for a positive match, 'False' otherwise -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PluginFilter_WithClosures`@.
noPluginFilter_WithClosures :: Maybe PluginFilter_WithClosures
noPluginFilter_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PluginFilter :: PluginFilter -> PluginFilter_WithClosures
drop_closures_PluginFilter _f plugin _ = _f plugin

-- | Wrap the callback into a `GClosure`.
genClosure_PluginFilter :: MonadIO m => PluginFilter -> m (GClosure C_PluginFilter)
genClosure_PluginFilter cb = liftIO $ do
    let cb' = drop_closures_PluginFilter cb
    let cb'' = wrap_PluginFilter Nothing cb'
    mk_PluginFilter cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PluginFilter` into a `C_PluginFilter`.
wrap_PluginFilter ::
    Maybe (Ptr (FunPtr C_PluginFilter)) ->
    PluginFilter_WithClosures ->
    C_PluginFilter
wrap_PluginFilter funptrptr _cb plugin userData = do
    plugin' <- (newObject Gst.Plugin.Plugin) plugin
    result <- _cb  plugin' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PluginFeatureFilter
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE for a positive match, %FALSE otherwise", sinceVersion = Nothing}, args = [Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pluginfeature to check", 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 "the user_data that has been passed on e.g.\n gst_registry_feature_filter()", 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 can be used with e.g. gst_registry_feature_filter()\nto get a list of pluginfeature that match certain criteria.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PluginFeatureFilter =
    Ptr Gst.PluginFeature.PluginFeature ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pluginfeature to check", 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 "the user_data that has been passed on e.g.\n gst_registry_feature_filter()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PluginFeatureFilter :: FunPtr C_PluginFeatureFilter -> C_PluginFeatureFilter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PluginFeatureFilter ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.PluginFeature.IsPluginFeature a) =>
    FunPtr C_PluginFeatureFilter
    -> a
    {- ^ /@feature@/: the pluginfeature to check -}
    -> Ptr ()
    {- ^ /@userData@/: the user_data that has been passed on e.g.
 'GI.Gst.Objects.Registry.registryFeatureFilter' -}
    -> m Bool
    {- ^ __Returns:__ 'True' for a positive match, 'False' otherwise -}
dynamic_PluginFeatureFilter __funPtr feature userData = liftIO $ do
    feature' <- unsafeManagedPtrCastPtr feature
    result <- (__dynamic_C_PluginFeatureFilter __funPtr) feature' userData
    let result' = (/= 0) result
    touchManagedPtr feature
    return result'

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

{- |
A function that can be used with e.g. 'GI.Gst.Objects.Registry.registryFeatureFilter'
to get a list of pluginfeature that match certain criteria.
-}
type PluginFeatureFilter =
    Gst.PluginFeature.PluginFeature
    {- ^ /@feature@/: the pluginfeature to check -}
    -> IO Bool
    {- ^ __Returns:__ 'True' for a positive match, 'False' otherwise -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PluginFeatureFilter`@.
noPluginFeatureFilter :: Maybe PluginFeatureFilter
noPluginFeatureFilter = Nothing

{- |
A function that can be used with e.g. 'GI.Gst.Objects.Registry.registryFeatureFilter'
to get a list of pluginfeature that match certain criteria.
-}
type PluginFeatureFilter_WithClosures =
    Gst.PluginFeature.PluginFeature
    {- ^ /@feature@/: the pluginfeature to check -}
    -> Ptr ()
    {- ^ /@userData@/: the user_data that has been passed on e.g.
 'GI.Gst.Objects.Registry.registryFeatureFilter' -}
    -> IO Bool
    {- ^ __Returns:__ 'True' for a positive match, 'False' otherwise -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PluginFeatureFilter_WithClosures`@.
noPluginFeatureFilter_WithClosures :: Maybe PluginFeatureFilter_WithClosures
noPluginFeatureFilter_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PluginFeatureFilter :: PluginFeatureFilter -> PluginFeatureFilter_WithClosures
drop_closures_PluginFeatureFilter _f feature _ = _f feature

-- | Wrap the callback into a `GClosure`.
genClosure_PluginFeatureFilter :: MonadIO m => PluginFeatureFilter -> m (GClosure C_PluginFeatureFilter)
genClosure_PluginFeatureFilter cb = liftIO $ do
    let cb' = drop_closures_PluginFeatureFilter cb
    let cb'' = wrap_PluginFeatureFilter Nothing cb'
    mk_PluginFeatureFilter cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PluginFeatureFilter` into a `C_PluginFeatureFilter`.
wrap_PluginFeatureFilter ::
    Maybe (Ptr (FunPtr C_PluginFeatureFilter)) ->
    PluginFeatureFilter_WithClosures ->
    C_PluginFeatureFilter
wrap_PluginFeatureFilter funptrptr _cb feature userData = do
    feature' <- (newObject Gst.PluginFeature.PluginFeature) feature
    result <- _cb  feature' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadUnlinkFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is linked.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function signature to handle a unlinking the pad prom its peer.\n\nThe pad's lock is already held when the unlink function is called, so most\npad functions cannot be called from within the callback.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadUnlinkFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    IO ()

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is linked.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", 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_PadUnlinkFunction :: FunPtr C_PadUnlinkFunction -> C_PadUnlinkFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadUnlinkFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadUnlinkFunction
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is linked. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> m ()
dynamic_PadUnlinkFunction __funPtr pad parent = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    (__dynamic_C_PadUnlinkFunction __funPtr) pad' maybeParent
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    return ()

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

{- |
Function signature to handle a unlinking the pad prom its peer.

The pad\'s lock is already held when the unlink function is called, so most
pad functions cannot be called from within the callback.
-}
type PadUnlinkFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is linked. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadUnlinkFunction`@.
noPadUnlinkFunction :: Maybe PadUnlinkFunction
noPadUnlinkFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadUnlinkFunction :: MonadIO m => PadUnlinkFunction -> m (GClosure C_PadUnlinkFunction)
genClosure_PadUnlinkFunction cb = liftIO $ do
    let cb' = wrap_PadUnlinkFunction Nothing cb
    mk_PadUnlinkFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadUnlinkFunction` into a `C_PadUnlinkFunction`.
wrap_PadUnlinkFunction ::
    Maybe (Ptr (FunPtr C_PadUnlinkFunction)) ->
    PadUnlinkFunction ->
    C_PadUnlinkFunction
wrap_PadUnlinkFunction funptrptr _cb pad parent = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    _cb  pad' maybeParent
    maybeReleaseFunPtr funptrptr


-- callback PadStickyEventsForeachFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the iteration should continue", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a sticky #GstEvent.", 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 "the #gpointer to optional user data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Callback used by gst_pad_sticky_events_foreach().\n\nWhen this function returns %TRUE, the next event will be\nreturned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.\n\nWhen @event is set to %NULL, the item will be removed from the list of sticky events.\n@event can be replaced by assigning a new reference to it.\nThis function is responsible for unreffing the old event when\nremoving or modifying.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadStickyEventsForeachFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Event.Event ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a sticky #GstEvent.", 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 "the #gpointer to optional user data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadStickyEventsForeachFunction :: FunPtr C_PadStickyEventsForeachFunction -> C_PadStickyEventsForeachFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadStickyEventsForeachFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a) =>
    FunPtr C_PadStickyEventsForeachFunction
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad'. -}
    -> Maybe (Gst.Event.Event)
    {- ^ /@event@/: a sticky 'GI.Gst.Structs.Event.Event'. -}
    -> Ptr ()
    {- ^ /@userData@/: the @/gpointer/@ to optional user data. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the iteration should continue -}
dynamic_PadStickyEventsForeachFunction __funPtr pad event userData = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeEvent <- case event of
        Nothing -> return nullPtr
        Just jEvent -> do
            jEvent' <- unsafeManagedPtrGetPtr jEvent
            return jEvent'
    result <- (__dynamic_C_PadStickyEventsForeachFunction __funPtr) pad' maybeEvent userData
    let result' = (/= 0) result
    touchManagedPtr pad
    whenJust event touchManagedPtr
    return result'

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

{- |
Callback used by 'GI.Gst.Objects.Pad.padStickyEventsForeach'.

When this function returns 'True', the next event will be
returned. When 'False' is returned, 'GI.Gst.Objects.Pad.padStickyEventsForeach' will return.

When /@event@/ is set to 'Nothing', the item will be removed from the list of sticky events.
/@event@/ can be replaced by assigning a new reference to it.
This function is responsible for unreffing the old event when
removing or modifying.
-}
type PadStickyEventsForeachFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad'. -}
    -> Maybe Gst.Event.Event
    {- ^ /@event@/: a sticky 'GI.Gst.Structs.Event.Event'. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the iteration should continue -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadStickyEventsForeachFunction`@.
noPadStickyEventsForeachFunction :: Maybe PadStickyEventsForeachFunction
noPadStickyEventsForeachFunction = Nothing

{- |
Callback used by 'GI.Gst.Objects.Pad.padStickyEventsForeach'.

When this function returns 'True', the next event will be
returned. When 'False' is returned, 'GI.Gst.Objects.Pad.padStickyEventsForeach' will return.

When /@event@/ is set to 'Nothing', the item will be removed from the list of sticky events.
/@event@/ can be replaced by assigning a new reference to it.
This function is responsible for unreffing the old event when
removing or modifying.
-}
type PadStickyEventsForeachFunction_WithClosures =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad'. -}
    -> Maybe Gst.Event.Event
    {- ^ /@event@/: a sticky 'GI.Gst.Structs.Event.Event'. -}
    -> Ptr ()
    {- ^ /@userData@/: the @/gpointer/@ to optional user data. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the iteration should continue -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadStickyEventsForeachFunction_WithClosures`@.
noPadStickyEventsForeachFunction_WithClosures :: Maybe PadStickyEventsForeachFunction_WithClosures
noPadStickyEventsForeachFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PadStickyEventsForeachFunction :: PadStickyEventsForeachFunction -> PadStickyEventsForeachFunction_WithClosures
drop_closures_PadStickyEventsForeachFunction _f pad event _ = _f pad event

-- | Wrap the callback into a `GClosure`.
genClosure_PadStickyEventsForeachFunction :: MonadIO m => PadStickyEventsForeachFunction -> m (GClosure C_PadStickyEventsForeachFunction)
genClosure_PadStickyEventsForeachFunction cb = liftIO $ do
    let cb' = drop_closures_PadStickyEventsForeachFunction cb
    let cb'' = wrap_PadStickyEventsForeachFunction Nothing cb'
    mk_PadStickyEventsForeachFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PadStickyEventsForeachFunction` into a `C_PadStickyEventsForeachFunction`.
wrap_PadStickyEventsForeachFunction ::
    Maybe (Ptr (FunPtr C_PadStickyEventsForeachFunction)) ->
    PadStickyEventsForeachFunction_WithClosures ->
    C_PadStickyEventsForeachFunction
wrap_PadStickyEventsForeachFunction funptrptr _cb pad event userData = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeEvent <-
        if event == nullPtr
        then return Nothing
        else do
            B.ManagedPtr.withTransient Gst.Event.Event event $ \event' -> do
                return $ Just event'
    result <- _cb  pad' maybeEvent userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadQueryFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the query could be performed.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstQuery object to execute", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The signature of the query function.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadQueryFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    Ptr Gst.Query.Query ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstQuery object to execute", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadQueryFunction :: FunPtr C_PadQueryFunction -> C_PadQueryFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadQueryFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadQueryFunction
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to query. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Query.Query
    {- ^ /@query@/: the 'GI.Gst.Structs.Query.Query' object to execute -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the query could be performed. -}
dynamic_PadQueryFunction __funPtr pad parent query = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    query' <- unsafeManagedPtrGetPtr query
    result <- (__dynamic_C_PadQueryFunction __funPtr) pad' maybeParent query'
    let result' = (/= 0) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr query
    return result'

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

{- |
The signature of the query function.
-}
type PadQueryFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to query. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Query.Query
    {- ^ /@query@/: the 'GI.Gst.Structs.Query.Query' object to execute -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the query could be performed. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadQueryFunction`@.
noPadQueryFunction :: Maybe PadQueryFunction
noPadQueryFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadQueryFunction :: MonadIO m => PadQueryFunction -> m (GClosure C_PadQueryFunction)
genClosure_PadQueryFunction cb = liftIO $ do
    let cb' = wrap_PadQueryFunction Nothing cb
    mk_PadQueryFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadQueryFunction` into a `C_PadQueryFunction`.
wrap_PadQueryFunction ::
    Maybe (Ptr (FunPtr C_PadQueryFunction)) ->
    PadQueryFunction ->
    C_PadQueryFunction
wrap_PadQueryFunction funptrptr _cb pad parent query = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    B.ManagedPtr.withTransient Gst.Query.Query query $ \query' -> do
        result <- _cb  pad' maybeParent query'
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback PadProbeCallback
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "PadProbeReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "a #GstPadProbeReturn", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is blocked", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "PadProbeInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstPadProbeInfo", 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 "the gpointer to optional user data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Callback used by gst_pad_add_probe(). Gets called to notify about the current\nblocking type.\n\nThe callback is allowed to modify the data pointer in @info.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadProbeCallback =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.PadProbeInfo.PadProbeInfo ->
    Ptr () ->
    IO CUInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is blocked", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "PadProbeInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstPadProbeInfo", 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 "the gpointer to optional user data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PadProbeReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadProbeCallback :: FunPtr C_PadProbeCallback -> C_PadProbeCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadProbeCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a) =>
    FunPtr C_PadProbeCallback
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is blocked -}
    -> Gst.PadProbeInfo.PadProbeInfo
    {- ^ /@info@/: 'GI.Gst.Structs.PadProbeInfo.PadProbeInfo' -}
    -> Ptr ()
    {- ^ /@userData@/: the gpointer to optional user data. -}
    -> m Gst.Enums.PadProbeReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.PadProbeReturn' -}
dynamic_PadProbeCallback __funPtr pad info userData = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    info' <- unsafeManagedPtrGetPtr info
    result <- (__dynamic_C_PadProbeCallback __funPtr) pad' info' userData
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    touchManagedPtr info
    return result'

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

{- |
Callback used by 'GI.Gst.Objects.Pad.padAddProbe'. Gets called to notify about the current
blocking type.

The callback is allowed to modify the data pointer in /@info@/.
-}
type PadProbeCallback =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is blocked -}
    -> Gst.PadProbeInfo.PadProbeInfo
    {- ^ /@info@/: 'GI.Gst.Structs.PadProbeInfo.PadProbeInfo' -}
    -> IO Gst.Enums.PadProbeReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.PadProbeReturn' -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadProbeCallback`@.
noPadProbeCallback :: Maybe PadProbeCallback
noPadProbeCallback = Nothing

{- |
Callback used by 'GI.Gst.Objects.Pad.padAddProbe'. Gets called to notify about the current
blocking type.

The callback is allowed to modify the data pointer in /@info@/.
-}
type PadProbeCallback_WithClosures =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is blocked -}
    -> Gst.PadProbeInfo.PadProbeInfo
    {- ^ /@info@/: 'GI.Gst.Structs.PadProbeInfo.PadProbeInfo' -}
    -> Ptr ()
    {- ^ /@userData@/: the gpointer to optional user data. -}
    -> IO Gst.Enums.PadProbeReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.PadProbeReturn' -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadProbeCallback_WithClosures`@.
noPadProbeCallback_WithClosures :: Maybe PadProbeCallback_WithClosures
noPadProbeCallback_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PadProbeCallback :: PadProbeCallback -> PadProbeCallback_WithClosures
drop_closures_PadProbeCallback _f pad info _ = _f pad info

-- | Wrap the callback into a `GClosure`.
genClosure_PadProbeCallback :: MonadIO m => PadProbeCallback -> m (GClosure C_PadProbeCallback)
genClosure_PadProbeCallback cb = liftIO $ do
    let cb' = drop_closures_PadProbeCallback cb
    let cb'' = wrap_PadProbeCallback Nothing cb'
    mk_PadProbeCallback cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PadProbeCallback` into a `C_PadProbeCallback`.
wrap_PadProbeCallback ::
    Maybe (Ptr (FunPtr C_PadProbeCallback)) ->
    PadProbeCallback_WithClosures ->
    C_PadProbeCallback
wrap_PadProbeCallback funptrptr _cb pad info userData = do
    pad' <- (newObject Gst.Pad.Pad) pad
    info' <- (newPtr Gst.PadProbeInfo.PadProbeInfo) info
    result <- _cb  pad' info' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadLinkFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "PadLinkReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "the result of the link with the specified peer.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is linked.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "peer", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the peer #GstPad of the link", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function signature to handle a new link on the pad.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadLinkFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    Ptr Gst.Pad.Pad ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is linked.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "peer", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the peer #GstPad of the link", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PadLinkReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadLinkFunction :: FunPtr C_PadLinkFunction -> C_PadLinkFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadLinkFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b, Gst.Pad.IsPad c) =>
    FunPtr C_PadLinkFunction
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is linked. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> c
    {- ^ /@peer@/: the peer 'GI.Gst.Objects.Pad.Pad' of the link -}
    -> m Gst.Enums.PadLinkReturn
    {- ^ __Returns:__ the result of the link with the specified peer. -}
dynamic_PadLinkFunction __funPtr pad parent peer = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    peer' <- unsafeManagedPtrCastPtr peer
    result <- (__dynamic_C_PadLinkFunction __funPtr) pad' maybeParent peer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr peer
    return result'

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

{- |
Function signature to handle a new link on the pad.
-}
type PadLinkFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is linked. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Pad.Pad
    {- ^ /@peer@/: the peer 'GI.Gst.Objects.Pad.Pad' of the link -}
    -> IO Gst.Enums.PadLinkReturn
    {- ^ __Returns:__ the result of the link with the specified peer. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadLinkFunction`@.
noPadLinkFunction :: Maybe PadLinkFunction
noPadLinkFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadLinkFunction :: MonadIO m => PadLinkFunction -> m (GClosure C_PadLinkFunction)
genClosure_PadLinkFunction cb = liftIO $ do
    let cb' = wrap_PadLinkFunction Nothing cb
    mk_PadLinkFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadLinkFunction` into a `C_PadLinkFunction`.
wrap_PadLinkFunction ::
    Maybe (Ptr (FunPtr C_PadLinkFunction)) ->
    PadLinkFunction ->
    C_PadLinkFunction
wrap_PadLinkFunction funptrptr _cb pad parent peer = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    peer' <- (newObject Gst.Pad.Pad) peer
    result <- _cb  pad' maybeParent peer'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadIterIntLinkFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "Iterator"})), returnMayBeNull = False, returnTransfer = TransferEverything, returnDocumentation = Documentation {rawDocText = Just "a new #GstIterator that will iterate over all pads that are\nlinked to the given pad on the inside of the parent element.\n\nthe caller must call gst_iterator_free() after usage.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstPad to query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The signature of the internal pad link iterator function.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadIterIntLinkFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    IO (Ptr Gst.Iterator.Iterator)

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstPad to query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Iterator"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadIterIntLinkFunction :: FunPtr C_PadIterIntLinkFunction -> C_PadIterIntLinkFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadIterIntLinkFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadIterIntLinkFunction
    -> a
    {- ^ /@pad@/: The 'GI.Gst.Objects.Pad.Pad' to query. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> m Gst.Iterator.Iterator
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Iterator.Iterator' that will iterate over all pads that are
linked to the given pad on the inside of the parent element.

the caller must call 'GI.Gst.Structs.Iterator.iteratorFree' after usage. -}
dynamic_PadIterIntLinkFunction __funPtr pad parent = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    result <- (__dynamic_C_PadIterIntLinkFunction __funPtr) pad' maybeParent
    checkUnexpectedReturnNULL "padIterIntLinkFunction" result
    result' <- (wrapBoxed Gst.Iterator.Iterator) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    return result'

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

{- |
The signature of the internal pad link iterator function.
-}
type PadIterIntLinkFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: The 'GI.Gst.Objects.Pad.Pad' to query. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> IO Gst.Iterator.Iterator
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Iterator.Iterator' that will iterate over all pads that are
linked to the given pad on the inside of the parent element.

the caller must call 'GI.Gst.Structs.Iterator.iteratorFree' after usage. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadIterIntLinkFunction`@.
noPadIterIntLinkFunction :: Maybe PadIterIntLinkFunction
noPadIterIntLinkFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadIterIntLinkFunction :: MonadIO m => PadIterIntLinkFunction -> m (GClosure C_PadIterIntLinkFunction)
genClosure_PadIterIntLinkFunction cb = liftIO $ do
    let cb' = wrap_PadIterIntLinkFunction Nothing cb
    mk_PadIterIntLinkFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadIterIntLinkFunction` into a `C_PadIterIntLinkFunction`.
wrap_PadIterIntLinkFunction ::
    Maybe (Ptr (FunPtr C_PadIterIntLinkFunction)) ->
    PadIterIntLinkFunction ->
    C_PadIterIntLinkFunction
wrap_PadIterIntLinkFunction funptrptr _cb pad parent = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    result <- _cb  pad' maybeParent
    maybeReleaseFunPtr funptrptr
    result' <- B.ManagedPtr.disownBoxed result
    return result'


-- callback PadGetRangeFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "#GST_FLOW_OK for success and a valid buffer in @buffer. Any other\nreturn value leaves @buffer undefined.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the src #GstPad to perform the getrange on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a memory location to hold the result buffer, cannot be %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function will be called on source pads when a peer element\nrequest a buffer at the specified @offset and @length. If this function\nreturns #GST_FLOW_OK, the result buffer will be stored in @buffer. The\ncontents of @buffer is invalid for any other return value.\n\nThis function is installed on a source pad with\ngst_pad_set_getrange_function() and can only be called on source pads after\nthey are successfully activated with gst_pad_activate_mode() with the\n#GST_PAD_MODE_PULL.\n\n@offset and @length are always given in byte units. @offset must normally be a value\nbetween 0 and the length in bytes of the data available on @pad. The\nlength (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a\n#GST_QUERY_SEEKING.\n\nAny @offset larger or equal than the length will make the function return\n#GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not\ncontain a valid buffer.\n\nThe buffer size of @buffer will only be smaller than @length when @offset is\nnear the end of the stream. In all other cases, the size of @buffer must be\nexactly the requested size.\n\nIt is allowed to call this function with a 0 @length and valid @offset, in\nwhich case @buffer will contain a 0-sized buffer and the function returns\n#GST_FLOW_OK.\n\nWhen this function is called with a -1 @offset, the sequentially next buffer\nof length @length in the stream is returned.\n\nWhen this function is called with a -1 @length, a buffer with a default\noptimal length is returned in @buffer. The length might depend on the value\nof @offset.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadGetRangeFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    Word64 ->
    Word32 ->
    Ptr Gst.Buffer.Buffer ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the src #GstPad to perform the getrange on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a memory location to hold the result buffer, cannot be %NULL.", 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_PadGetRangeFunction :: FunPtr C_PadGetRangeFunction -> C_PadGetRangeFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadGetRangeFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadGetRangeFunction
    -> a
    {- ^ /@pad@/: the src 'GI.Gst.Objects.Pad.Pad' to perform the getrange on. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Word64
    {- ^ /@offset@/: the offset of the range -}
    -> Word32
    {- ^ /@length@/: the length of the range -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a memory location to hold the result buffer, cannot be 'Nothing'. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ @/GST_FLOW_OK/@ for success and a valid buffer in /@buffer@/. Any other
return value leaves /@buffer@/ undefined. -}
dynamic_PadGetRangeFunction __funPtr pad parent offset length_ buffer = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- (__dynamic_C_PadGetRangeFunction __funPtr) pad' maybeParent offset length_ buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr buffer
    return result'

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

{- |
This function will be called on source pads when a peer element
request a buffer at the specified /@offset@/ and /@length@/. 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 installed on a source pad with
@/gst_pad_set_getrange_function()/@ and can only be called on source pads after
they are successfully activated with 'GI.Gst.Objects.Pad.padActivateMode' with the
@/GST_PAD_MODE_PULL/@.

/@offset@/ and /@length@/ are always given in byte units. /@offset@/ must normally be a value
between 0 and the length in bytes of the data available on /@pad@/. The
length (duration in bytes) can be retrieved with a @/GST_QUERY_DURATION/@ or with a
@/GST_QUERY_SEEKING/@.

Any /@offset@/ larger or equal than the length will make the function return
@/GST_FLOW_EOS/@, which corresponds to EOS. In this case /@buffer@/ does not
contain a valid buffer.

The buffer size of /@buffer@/ will only be smaller than /@length@/ when /@offset@/ is
near the end of the stream. In all other cases, the size of /@buffer@/ must be
exactly the requested size.

It is allowed to call this function with a 0 /@length@/ and valid /@offset@/, in
which case /@buffer@/ will contain a 0-sized buffer and the function returns
@/GST_FLOW_OK/@.

When this function is called with a -1 /@offset@/, the sequentially next buffer
of length /@length@/ in the stream is returned.

When this function is called with a -1 /@length@/, a buffer with a default
optimal length is returned in /@buffer@/. The length might depend on the value
of /@offset@/.
-}
type PadGetRangeFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the src 'GI.Gst.Objects.Pad.Pad' to perform the getrange on. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Word64
    {- ^ /@offset@/: the offset of the range -}
    -> Word32
    {- ^ /@length@/: the length of the range -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a memory location to hold the result buffer, cannot be 'Nothing'. -}
    -> IO Gst.Enums.FlowReturn
    {- ^ __Returns:__ @/GST_FLOW_OK/@ for success and a valid buffer in /@buffer@/. Any other
return value leaves /@buffer@/ undefined. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadGetRangeFunction`@.
noPadGetRangeFunction :: Maybe PadGetRangeFunction
noPadGetRangeFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadGetRangeFunction :: MonadIO m => PadGetRangeFunction -> m (GClosure C_PadGetRangeFunction)
genClosure_PadGetRangeFunction cb = liftIO $ do
    let cb' = wrap_PadGetRangeFunction Nothing cb
    mk_PadGetRangeFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadGetRangeFunction` into a `C_PadGetRangeFunction`.
wrap_PadGetRangeFunction ::
    Maybe (Ptr (FunPtr C_PadGetRangeFunction)) ->
    PadGetRangeFunction ->
    C_PadGetRangeFunction
wrap_PadGetRangeFunction funptrptr _cb pad parent offset length_ buffer = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    B.ManagedPtr.withTransient Gst.Buffer.Buffer buffer $ \buffer' -> do
        result <- _cb  pad' maybeParent offset length_ buffer'
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback PadForwardFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the dispatching procedure has to be stopped.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is forwarded.", 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 "the gpointer to optional 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 forward function is called for all internally linked pads, see\ngst_pad_forward().", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadForwardFunction =
    Ptr Gst.Pad.Pad ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that is forwarded.", 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 "the gpointer to optional user data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadForwardFunction :: FunPtr C_PadForwardFunction -> C_PadForwardFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadForwardFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a) =>
    FunPtr C_PadForwardFunction
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is forwarded. -}
    -> Ptr ()
    {- ^ /@userData@/: the gpointer to optional user data. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the dispatching procedure has to be stopped. -}
dynamic_PadForwardFunction __funPtr pad userData = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    result <- (__dynamic_C_PadForwardFunction __funPtr) pad' userData
    let result' = (/= 0) result
    touchManagedPtr pad
    return result'

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

{- |
A forward function is called for all internally linked pads, see
'GI.Gst.Objects.Pad.padForward'.
-}
type PadForwardFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is forwarded. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the dispatching procedure has to be stopped. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadForwardFunction`@.
noPadForwardFunction :: Maybe PadForwardFunction
noPadForwardFunction = Nothing

{- |
A forward function is called for all internally linked pads, see
'GI.Gst.Objects.Pad.padForward'.
-}
type PadForwardFunction_WithClosures =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that is forwarded. -}
    -> Ptr ()
    {- ^ /@userData@/: the gpointer to optional user data. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the dispatching procedure has to be stopped. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadForwardFunction_WithClosures`@.
noPadForwardFunction_WithClosures :: Maybe PadForwardFunction_WithClosures
noPadForwardFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PadForwardFunction :: PadForwardFunction -> PadForwardFunction_WithClosures
drop_closures_PadForwardFunction _f pad _ = _f pad

-- | Wrap the callback into a `GClosure`.
genClosure_PadForwardFunction :: MonadIO m => PadForwardFunction -> m (GClosure C_PadForwardFunction)
genClosure_PadForwardFunction cb = liftIO $ do
    let cb' = drop_closures_PadForwardFunction cb
    let cb'' = wrap_PadForwardFunction Nothing cb'
    mk_PadForwardFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PadForwardFunction` into a `C_PadForwardFunction`.
wrap_PadForwardFunction ::
    Maybe (Ptr (FunPtr C_PadForwardFunction)) ->
    PadForwardFunction_WithClosures ->
    C_PadForwardFunction
wrap_PadForwardFunction funptrptr _cb pad userData = do
    pad' <- (newObject Gst.Pad.Pad) pad
    result <- _cb  pad' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadEventFunction
--          -> 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 = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to handle the event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEvent to handle.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function signature to handle an event for the pad.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadEventFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    Ptr Gst.Event.Event ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to handle the event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEvent to handle.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadEventFunction :: FunPtr C_PadEventFunction -> C_PadEventFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadEventFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadEventFunction
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to handle the event. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' to handle. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad could handle the event. -}
dynamic_PadEventFunction __funPtr pad parent event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    event' <- B.ManagedPtr.disownBoxed event
    result <- (__dynamic_C_PadEventFunction __funPtr) pad' maybeParent event'
    let result' = (/= 0) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr event
    return result'

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

{- |
Function signature to handle an event for the pad.
-}
type PadEventFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to handle the event. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' to handle. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the pad could handle the event. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadEventFunction`@.
noPadEventFunction :: Maybe PadEventFunction
noPadEventFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadEventFunction :: MonadIO m => PadEventFunction -> m (GClosure C_PadEventFunction)
genClosure_PadEventFunction cb = liftIO $ do
    let cb' = wrap_PadEventFunction Nothing cb
    mk_PadEventFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadEventFunction` into a `C_PadEventFunction`.
wrap_PadEventFunction ::
    Maybe (Ptr (FunPtr C_PadEventFunction)) ->
    PadEventFunction ->
    C_PadEventFunction
wrap_PadEventFunction funptrptr _cb pad parent event = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    event' <- (wrapBoxed Gst.Event.Event) event
    result <- _cb  pad' maybeParent event'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadEventFullFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%GST_FLOW_OK if the event was handled properly, or any other\n#GstFlowReturn dependent on downstream state.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to handle the event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEvent to handle.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function signature to handle an event for the pad.\n\nThis variant is for specific elements that will take into account the\nlast downstream flow return (from a pad push), in which case they can\nreturn it.", sinceVersion = Just "1.8"}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadEventFullFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    Ptr Gst.Event.Event ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad to handle the event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEvent to handle.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadEventFullFunction :: FunPtr C_PadEventFullFunction -> C_PadEventFullFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadEventFullFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadEventFullFunction
    -> a
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to handle the event. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' to handle. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' if the event was handled properly, or any other
'GI.Gst.Enums.FlowReturn' dependent on downstream state. -}
dynamic_PadEventFullFunction __funPtr pad parent event = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    event' <- B.ManagedPtr.disownBoxed event
    result <- (__dynamic_C_PadEventFullFunction __funPtr) pad' maybeParent event'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr event
    return result'

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

{- |
Function signature to handle an event for the pad.

This variant is for specific elements that will take into account the
last downstream flow return (from a pad push), in which case they can
return it.

/Since: 1.8/
-}
type PadEventFullFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' to handle the event. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Event.Event
    {- ^ /@event@/: the 'GI.Gst.Structs.Event.Event' to handle. -}
    -> IO Gst.Enums.FlowReturn
    {- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' if the event was handled properly, or any other
'GI.Gst.Enums.FlowReturn' dependent on downstream state. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadEventFullFunction`@.
noPadEventFullFunction :: Maybe PadEventFullFunction
noPadEventFullFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadEventFullFunction :: MonadIO m => PadEventFullFunction -> m (GClosure C_PadEventFullFunction)
genClosure_PadEventFullFunction cb = liftIO $ do
    let cb' = wrap_PadEventFullFunction Nothing cb
    mk_PadEventFullFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadEventFullFunction` into a `C_PadEventFullFunction`.
wrap_PadEventFullFunction ::
    Maybe (Ptr (FunPtr C_PadEventFullFunction)) ->
    PadEventFullFunction ->
    C_PadEventFullFunction
wrap_PadEventFullFunction funptrptr _cb pad parent event = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    event' <- (wrapBoxed Gst.Event.Event) event
    result <- _cb  pad' maybeParent event'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadChainListFunction
--          -> 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 = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad that performed the chain.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TInterface (Name {namespace = "Gst", name = "BufferList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferList that is chained, not %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called on sinkpads when chaining buffer lists.\nThe function typically processes the data contained in the buffer list and\neither consumes the data or passes it on to the internally linked pad(s).\n\nThe implementer of this function receives a refcount to @list and\nshould gst_buffer_list_unref() when the list is no longer needed.\n\nWhen a chainlist function detects an error in the data stream, it must\npost an error on the bus and return an appropriate #GstFlowReturn value.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadChainListFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    Ptr Gst.BufferList.BufferList ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad that performed the chain.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TInterface (Name {namespace = "Gst", name = "BufferList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferList that is chained, not %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadChainListFunction :: FunPtr C_PadChainListFunction -> C_PadChainListFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadChainListFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadChainListFunction
    -> a
    {- ^ /@pad@/: the sink 'GI.Gst.Objects.Pad.Pad' that performed the chain. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.BufferList.BufferList
    {- ^ /@list@/: the 'GI.Gst.Structs.BufferList.BufferList' that is chained, not 'Nothing'. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ @/GST_FLOW_OK/@ for success -}
dynamic_PadChainListFunction __funPtr pad parent list = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    list' <- B.ManagedPtr.disownBoxed list
    result <- (__dynamic_C_PadChainListFunction __funPtr) pad' maybeParent list'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr list
    return result'

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

{- |
A function that will be called on sinkpads when chaining buffer lists.
The function typically processes the data contained in the buffer list and
either consumes the data or passes it on to the internally linked pad(s).

The implementer of this function receives a refcount to /@list@/ and
should @/gst_buffer_list_unref()/@ when the list is no longer needed.

When a chainlist function detects an error in the data stream, it must
post an error on the bus and return an appropriate 'GI.Gst.Enums.FlowReturn' value.
-}
type PadChainListFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the sink 'GI.Gst.Objects.Pad.Pad' that performed the chain. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.BufferList.BufferList
    {- ^ /@list@/: the 'GI.Gst.Structs.BufferList.BufferList' that is chained, not 'Nothing'. -}
    -> IO Gst.Enums.FlowReturn
    {- ^ __Returns:__ @/GST_FLOW_OK/@ for success -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadChainListFunction`@.
noPadChainListFunction :: Maybe PadChainListFunction
noPadChainListFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadChainListFunction :: MonadIO m => PadChainListFunction -> m (GClosure C_PadChainListFunction)
genClosure_PadChainListFunction cb = liftIO $ do
    let cb' = wrap_PadChainListFunction Nothing cb
    mk_PadChainListFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadChainListFunction` into a `C_PadChainListFunction`.
wrap_PadChainListFunction ::
    Maybe (Ptr (FunPtr C_PadChainListFunction)) ->
    PadChainListFunction ->
    C_PadChainListFunction
wrap_PadChainListFunction funptrptr _cb pad parent list = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    list' <- (wrapBoxed Gst.BufferList.BufferList) list
    result <- _cb  pad' maybeParent list'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadChainFunction
--          -> 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 = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad that performed the chain.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", 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 that is chained, not %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called on sinkpads when chaining buffers.\nThe function typically processes the data contained in the buffer and\neither consumes the data or passes it on to the internally linked pad(s).\n\nThe implementer of this function receives a refcount to @buffer and should\ngst_buffer_unref() when the buffer is no longer needed.\n\nWhen a chain function detects an error in the data stream, it must post an\nerror on the bus and return an appropriate #GstFlowReturn value.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadChainFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    Ptr Gst.Buffer.Buffer ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the sink #GstPad that performed the chain.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT\n         flag is set, @parent is guaranteed to be not-%NULL and remain valid\n         during the execution of this function.", 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 that is chained, not %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadChainFunction :: FunPtr C_PadChainFunction -> C_PadChainFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadChainFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadChainFunction
    -> a
    {- ^ /@pad@/: the sink 'GI.Gst.Objects.Pad.Pad' that performed the chain. -}
    -> Maybe (b)
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: the 'GI.Gst.Structs.Buffer.Buffer' that is chained, not 'Nothing'. -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ @/GST_FLOW_OK/@ for success -}
dynamic_PadChainFunction __funPtr pad parent buffer = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    buffer' <- B.ManagedPtr.disownBoxed buffer
    result <- (__dynamic_C_PadChainFunction __funPtr) pad' maybeParent buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr pad
    whenJust parent touchManagedPtr
    touchManagedPtr buffer
    return result'

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

{- |
A function that will be called on sinkpads when chaining buffers.
The function typically processes the data contained in the buffer and
either consumes the data or passes it on to the internally linked pad(s).

The implementer of this function receives a refcount to /@buffer@/ and should
@/gst_buffer_unref()/@ when the buffer is no longer needed.

When a chain function detects an error in the data stream, it must post an
error on the bus and return an appropriate 'GI.Gst.Enums.FlowReturn' value.
-}
type PadChainFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: the sink 'GI.Gst.Objects.Pad.Pad' that performed the chain. -}
    -> Maybe Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/. If the @/GST_PAD_FLAG_NEED_PARENT/@
         flag is set, /@parent@/ is guaranteed to be not-'Nothing' and remain valid
         during the execution of this function. -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: the 'GI.Gst.Structs.Buffer.Buffer' that is chained, not 'Nothing'. -}
    -> IO Gst.Enums.FlowReturn
    {- ^ __Returns:__ @/GST_FLOW_OK/@ for success -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadChainFunction`@.
noPadChainFunction :: Maybe PadChainFunction
noPadChainFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadChainFunction :: MonadIO m => PadChainFunction -> m (GClosure C_PadChainFunction)
genClosure_PadChainFunction cb = liftIO $ do
    let cb' = wrap_PadChainFunction Nothing cb
    mk_PadChainFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadChainFunction` into a `C_PadChainFunction`.
wrap_PadChainFunction ::
    Maybe (Ptr (FunPtr C_PadChainFunction)) ->
    PadChainFunction ->
    C_PadChainFunction
wrap_PadChainFunction funptrptr _cb pad parent buffer = do
    pad' <- (newObject Gst.Pad.Pad) pad
    maybeParent <-
        if parent == nullPtr
        then return Nothing
        else do
            parent' <- (newObject Gst.Object.Object) parent
            return $ Just parent'
    buffer' <- (wrapBoxed Gst.Buffer.Buffer) buffer
    result <- _cb  pad' maybeParent buffer'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadActivateModeFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the pad could be activated or deactivated.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the parent of @pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "PadMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested activation mode of @pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "activate or deactivate the pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The prototype of the push and pull activate functions.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadActivateModeFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    CUInt ->
    CInt ->
    IO CInt

-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the parent of @pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "PadMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested activation mode of @pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "activate or deactivate the pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PadActivateModeFunction :: FunPtr C_PadActivateModeFunction -> C_PadActivateModeFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadActivateModeFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadActivateModeFunction
    -> a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> b
    {- ^ /@parent@/: the parent of /@pad@/ -}
    -> Gst.Enums.PadMode
    {- ^ /@mode@/: the requested activation mode of /@pad@/ -}
    -> Bool
    {- ^ /@active@/: activate or deactivate the pad. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad could be activated or deactivated. -}
dynamic_PadActivateModeFunction __funPtr pad parent mode active = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    parent' <- unsafeManagedPtrCastPtr parent
    let mode' = (fromIntegral . fromEnum) mode
    let active' = (fromIntegral . fromEnum) active
    result <- (__dynamic_C_PadActivateModeFunction __funPtr) pad' parent' mode' active'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr parent
    return result'

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

{- |
The prototype of the push and pull activate functions.
-}
type PadActivateModeFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/ -}
    -> Gst.Enums.PadMode
    {- ^ /@mode@/: the requested activation mode of /@pad@/ -}
    -> Bool
    {- ^ /@active@/: activate or deactivate the pad. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the pad could be activated or deactivated. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadActivateModeFunction`@.
noPadActivateModeFunction :: Maybe PadActivateModeFunction
noPadActivateModeFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadActivateModeFunction :: MonadIO m => PadActivateModeFunction -> m (GClosure C_PadActivateModeFunction)
genClosure_PadActivateModeFunction cb = liftIO $ do
    let cb' = wrap_PadActivateModeFunction Nothing cb
    mk_PadActivateModeFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadActivateModeFunction` into a `C_PadActivateModeFunction`.
wrap_PadActivateModeFunction ::
    Maybe (Ptr (FunPtr C_PadActivateModeFunction)) ->
    PadActivateModeFunction ->
    C_PadActivateModeFunction
wrap_PadActivateModeFunction funptrptr _cb pad parent mode active = do
    pad' <- (newObject Gst.Pad.Pad) pad
    parent' <- (newObject Gst.Object.Object) parent
    let mode' = (toEnum . fromIntegral) mode
    let active' = (/= 0) active
    result <- _cb  pad' parent' mode' active'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback PadActivateFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the pad could be activated.", sinceVersion = Nothing}, args = [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the parent of @pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function is called when the pad is activated during the element\nREADY to PAUSED state change. By default this function will call the\nactivate function that puts the pad in push mode but elements can\noverride this function to activate the pad in pull mode if they wish.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_PadActivateFunction =
    Ptr Gst.Pad.Pad ->
    Ptr Gst.Object.Object ->
    IO CInt

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

foreign import ccall "dynamic" __dynamic_C_PadActivateFunction :: FunPtr C_PadActivateFunction -> C_PadActivateFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PadActivateFunction ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a, Gst.Object.IsObject b) =>
    FunPtr C_PadActivateFunction
    -> a
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> b
    {- ^ /@parent@/: the parent of /@pad@/ -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pad could be activated. -}
dynamic_PadActivateFunction __funPtr pad parent = liftIO $ do
    pad' <- unsafeManagedPtrCastPtr pad
    parent' <- unsafeManagedPtrCastPtr parent
    result <- (__dynamic_C_PadActivateFunction __funPtr) pad' parent'
    let result' = (/= 0) result
    touchManagedPtr pad
    touchManagedPtr parent
    return result'

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

{- |
This function is called when the pad is activated during the element
READY to PAUSED state change. By default this function will call the
activate function that puts the pad in push mode but elements can
override this function to activate the pad in pull mode if they wish.
-}
type PadActivateFunction =
    Gst.Pad.Pad
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> Gst.Object.Object
    {- ^ /@parent@/: the parent of /@pad@/ -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the pad could be activated. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `PadActivateFunction`@.
noPadActivateFunction :: Maybe PadActivateFunction
noPadActivateFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_PadActivateFunction :: MonadIO m => PadActivateFunction -> m (GClosure C_PadActivateFunction)
genClosure_PadActivateFunction cb = liftIO $ do
    let cb' = wrap_PadActivateFunction Nothing cb
    mk_PadActivateFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `PadActivateFunction` into a `C_PadActivateFunction`.
wrap_PadActivateFunction ::
    Maybe (Ptr (FunPtr C_PadActivateFunction)) ->
    PadActivateFunction ->
    C_PadActivateFunction
wrap_PadActivateFunction funptrptr _cb pad parent = do
    pad' <- (newObject Gst.Pad.Pad) pad
    parent' <- (newObject Gst.Object.Object) parent
    result <- _cb  pad' parent'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback MiniObjectNotify
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data that was provided when the notify was added", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "MiniObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the mini object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A #GstMiniObjectNotify function can be added to a mini object as a\ncallback that gets triggered when gst_mini_object_unref() drops the\nlast ref and @obj is about to be freed.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MiniObjectNotify =
    Ptr () ->
    Ptr Gst.MiniObject.MiniObject ->
    IO ()

-- Args : [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data that was provided when the notify was added", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "MiniObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the mini object", 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_MiniObjectNotify :: FunPtr C_MiniObjectNotify -> C_MiniObjectNotify

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MiniObjectNotify ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MiniObjectNotify
    -> Ptr ()
    {- ^ /@userData@/: data that was provided when the notify was added -}
    -> Gst.MiniObject.MiniObject
    {- ^ /@obj@/: the mini object -}
    -> m ()
dynamic_MiniObjectNotify __funPtr userData obj = liftIO $ do
    obj' <- unsafeManagedPtrGetPtr obj
    (__dynamic_C_MiniObjectNotify __funPtr) userData obj'
    touchManagedPtr obj
    return ()

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

{- |
A 'GI.Gst.Callbacks.MiniObjectNotify' function can be added to a mini object as a
callback that gets triggered when @/gst_mini_object_unref()/@ drops the
last ref and /@obj@/ is about to be freed.
-}
type MiniObjectNotify =
    Gst.MiniObject.MiniObject
    {- ^ /@obj@/: the mini object -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MiniObjectNotify`@.
noMiniObjectNotify :: Maybe MiniObjectNotify
noMiniObjectNotify = Nothing

{- |
A 'GI.Gst.Callbacks.MiniObjectNotify' function can be added to a mini object as a
callback that gets triggered when @/gst_mini_object_unref()/@ drops the
last ref and /@obj@/ is about to be freed.
-}
type MiniObjectNotify_WithClosures =
    Ptr ()
    {- ^ /@userData@/: data that was provided when the notify was added -}
    -> Gst.MiniObject.MiniObject
    {- ^ /@obj@/: the mini object -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MiniObjectNotify_WithClosures`@.
noMiniObjectNotify_WithClosures :: Maybe MiniObjectNotify_WithClosures
noMiniObjectNotify_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_MiniObjectNotify :: MiniObjectNotify -> MiniObjectNotify_WithClosures
drop_closures_MiniObjectNotify _f _ obj = _f obj

-- | Wrap the callback into a `GClosure`.
genClosure_MiniObjectNotify :: MonadIO m => MiniObjectNotify -> m (GClosure C_MiniObjectNotify)
genClosure_MiniObjectNotify cb = liftIO $ do
    let cb' = drop_closures_MiniObjectNotify cb
    let cb'' = wrap_MiniObjectNotify Nothing cb'
    mk_MiniObjectNotify cb'' >>= B.GClosure.newGClosure


-- | Wrap a `MiniObjectNotify` into a `C_MiniObjectNotify`.
wrap_MiniObjectNotify ::
    Maybe (Ptr (FunPtr C_MiniObjectNotify)) ->
    MiniObjectNotify_WithClosures ->
    C_MiniObjectNotify
wrap_MiniObjectNotify funptrptr _cb userData obj = do
    obj' <- (newPtr Gst.MiniObject.MiniObject) obj
    _cb  userData obj'
    maybeReleaseFunPtr funptrptr


-- callback MiniObjectFreeFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "MiniObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "MiniObject to free", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Virtual function prototype for methods to free resources used by\nmini-objects.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MiniObjectFreeFunction =
    Ptr Gst.MiniObject.MiniObject ->
    IO ()

-- Args : [Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "MiniObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "MiniObject to free", 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_MiniObjectFreeFunction :: FunPtr C_MiniObjectFreeFunction -> C_MiniObjectFreeFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MiniObjectFreeFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MiniObjectFreeFunction
    -> Gst.MiniObject.MiniObject
    {- ^ /@obj@/: MiniObject to free -}
    -> m ()
dynamic_MiniObjectFreeFunction __funPtr obj = liftIO $ do
    obj' <- unsafeManagedPtrGetPtr obj
    (__dynamic_C_MiniObjectFreeFunction __funPtr) obj'
    touchManagedPtr obj
    return ()

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

{- |
Virtual function prototype for methods to free resources used by
mini-objects.
-}
type MiniObjectFreeFunction =
    Gst.MiniObject.MiniObject
    {- ^ /@obj@/: MiniObject to free -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MiniObjectFreeFunction`@.
noMiniObjectFreeFunction :: Maybe MiniObjectFreeFunction
noMiniObjectFreeFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MiniObjectFreeFunction :: MonadIO m => MiniObjectFreeFunction -> m (GClosure C_MiniObjectFreeFunction)
genClosure_MiniObjectFreeFunction cb = liftIO $ do
    let cb' = wrap_MiniObjectFreeFunction Nothing cb
    mk_MiniObjectFreeFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MiniObjectFreeFunction` into a `C_MiniObjectFreeFunction`.
wrap_MiniObjectFreeFunction ::
    Maybe (Ptr (FunPtr C_MiniObjectFreeFunction)) ->
    MiniObjectFreeFunction ->
    C_MiniObjectFreeFunction
wrap_MiniObjectFreeFunction funptrptr _cb obj = do
    obj' <- (newPtr Gst.MiniObject.MiniObject) obj
    _cb  obj'
    maybeReleaseFunPtr funptrptr


-- callback MiniObjectDisposeFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the object should be cleaned up.", sinceVersion = Nothing}, args = [Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "MiniObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "MiniObject to dispose", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function prototype for when a miniobject has lost its last refcount.\nImplementation of the mini object are allowed to revive the\npassed object by doing a gst_mini_object_ref(). If the object is not\nrevived after the dispose function, the function should return %TRUE\nand the memory associated with the object is freed.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MiniObjectDisposeFunction =
    Ptr Gst.MiniObject.MiniObject ->
    IO CInt

-- Args : [Arg {argCName = "obj", argType = TInterface (Name {namespace = "Gst", name = "MiniObject"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "MiniObject to dispose", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MiniObjectDisposeFunction :: FunPtr C_MiniObjectDisposeFunction -> C_MiniObjectDisposeFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MiniObjectDisposeFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MiniObjectDisposeFunction
    -> Gst.MiniObject.MiniObject
    {- ^ /@obj@/: MiniObject to dispose -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the object should be cleaned up. -}
dynamic_MiniObjectDisposeFunction __funPtr obj = liftIO $ do
    obj' <- unsafeManagedPtrGetPtr obj
    result <- (__dynamic_C_MiniObjectDisposeFunction __funPtr) obj'
    let result' = (/= 0) result
    touchManagedPtr obj
    return result'

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

{- |
Function prototype for when a miniobject has lost its last refcount.
Implementation of the mini object are allowed to revive the
passed object by doing a @/gst_mini_object_ref()/@. If the object is not
revived after the dispose function, the function should return 'True'
and the memory associated with the object is freed.
-}
type MiniObjectDisposeFunction =
    Gst.MiniObject.MiniObject
    {- ^ /@obj@/: MiniObject to dispose -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the object should be cleaned up. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `MiniObjectDisposeFunction`@.
noMiniObjectDisposeFunction :: Maybe MiniObjectDisposeFunction
noMiniObjectDisposeFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MiniObjectDisposeFunction :: MonadIO m => MiniObjectDisposeFunction -> m (GClosure C_MiniObjectDisposeFunction)
genClosure_MiniObjectDisposeFunction cb = liftIO $ do
    let cb' = wrap_MiniObjectDisposeFunction Nothing cb
    mk_MiniObjectDisposeFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MiniObjectDisposeFunction` into a `C_MiniObjectDisposeFunction`.
wrap_MiniObjectDisposeFunction ::
    Maybe (Ptr (FunPtr C_MiniObjectDisposeFunction)) ->
    MiniObjectDisposeFunction ->
    C_MiniObjectDisposeFunction
wrap_MiniObjectDisposeFunction funptrptr _cb obj = do
    obj' <- (newPtr Gst.MiniObject.MiniObject) obj
    result <- _cb  obj'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback MetaTransformFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the transform could be performed", sinceVersion = Nothing}, args = [Arg {argCName = "transbuf", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMeta", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the transform type", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "transform specific data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function called for each @meta in @buffer as a result of performing a\ntransformation on @transbuf. Additional @type specific transform data\nis passed to the function as @data.\n\nImplementations should check the @type of the transform and parse\nadditional type specific fields in @data that should be used to update\nthe metadata on @transbuf.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MetaTransformFunction =
    Ptr Gst.Buffer.Buffer ->
    Ptr Gst.Meta.Meta ->
    Ptr Gst.Buffer.Buffer ->
    Word32 ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "transbuf", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMeta", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the transform type", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "transform specific data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MetaTransformFunction :: FunPtr C_MetaTransformFunction -> C_MetaTransformFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MetaTransformFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MetaTransformFunction
    -> Gst.Buffer.Buffer
    {- ^ /@transbuf@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Gst.Meta.Meta
    {- ^ /@meta@/: a 'GI.Gst.Structs.Meta.Meta' -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Word32
    {- ^ /@type@/: the transform type -}
    -> Ptr ()
    {- ^ /@data@/: transform specific data. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the transform could be performed -}
dynamic_MetaTransformFunction __funPtr transbuf meta buffer type_ data_ = liftIO $ do
    transbuf' <- unsafeManagedPtrGetPtr transbuf
    meta' <- unsafeManagedPtrGetPtr meta
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- (__dynamic_C_MetaTransformFunction __funPtr) transbuf' meta' buffer' type_ data_
    let result' = (/= 0) result
    touchManagedPtr transbuf
    touchManagedPtr meta
    touchManagedPtr buffer
    return result'

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

{- |
Function called for each /@meta@/ in /@buffer@/ as a result of performing a
transformation on /@transbuf@/. Additional /@type@/ specific transform data
is passed to the function as /@data@/.

Implementations should check the /@type@/ of the transform and parse
additional type specific fields in /@data@/ that should be used to update
the metadata on /@transbuf@/.
-}
type MetaTransformFunction =
    Gst.Buffer.Buffer
    {- ^ /@transbuf@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Gst.Meta.Meta
    {- ^ /@meta@/: a 'GI.Gst.Structs.Meta.Meta' -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Word32
    {- ^ /@type@/: the transform type -}
    -> Ptr ()
    {- ^ /@data@/: transform specific data. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the transform could be performed -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `MetaTransformFunction`@.
noMetaTransformFunction :: Maybe MetaTransformFunction
noMetaTransformFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MetaTransformFunction :: MonadIO m => MetaTransformFunction -> m (GClosure C_MetaTransformFunction)
genClosure_MetaTransformFunction cb = liftIO $ do
    let cb' = wrap_MetaTransformFunction Nothing cb
    mk_MetaTransformFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MetaTransformFunction` into a `C_MetaTransformFunction`.
wrap_MetaTransformFunction ::
    Maybe (Ptr (FunPtr C_MetaTransformFunction)) ->
    MetaTransformFunction ->
    C_MetaTransformFunction
wrap_MetaTransformFunction funptrptr _cb transbuf meta buffer type_ data_ = do
    B.ManagedPtr.withTransient Gst.Buffer.Buffer transbuf $ \transbuf' -> do
        meta' <- (newPtr Gst.Meta.Meta) meta
        B.ManagedPtr.withTransient Gst.Buffer.Buffer buffer $ \buffer' -> do
            result <- _cb  transbuf' meta' buffer' type_ data_
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback MetaInitFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMeta", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "parameters passed to the init function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function called when @meta is initialized in @buffer.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MetaInitFunction =
    Ptr Gst.Meta.Meta ->
    Ptr () ->
    Ptr Gst.Buffer.Buffer ->
    IO CInt

-- Args : [Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMeta", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "parameters passed to the init function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MetaInitFunction :: FunPtr C_MetaInitFunction -> C_MetaInitFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MetaInitFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MetaInitFunction
    -> Gst.Meta.Meta
    {- ^ /@meta@/: a 'GI.Gst.Structs.Meta.Meta' -}
    -> Ptr ()
    {- ^ /@params@/: parameters passed to the init function -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> m Bool
dynamic_MetaInitFunction __funPtr meta params buffer = liftIO $ do
    meta' <- unsafeManagedPtrGetPtr meta
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- (__dynamic_C_MetaInitFunction __funPtr) meta' params buffer'
    let result' = (/= 0) result
    touchManagedPtr meta
    touchManagedPtr buffer
    return result'

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

{- |
Function called when /@meta@/ is initialized in /@buffer@/.
-}
type MetaInitFunction =
    Gst.Meta.Meta
    {- ^ /@meta@/: a 'GI.Gst.Structs.Meta.Meta' -}
    -> Ptr ()
    {- ^ /@params@/: parameters passed to the init function -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `MetaInitFunction`@.
noMetaInitFunction :: Maybe MetaInitFunction
noMetaInitFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MetaInitFunction :: MonadIO m => MetaInitFunction -> m (GClosure C_MetaInitFunction)
genClosure_MetaInitFunction cb = liftIO $ do
    let cb' = wrap_MetaInitFunction Nothing cb
    mk_MetaInitFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MetaInitFunction` into a `C_MetaInitFunction`.
wrap_MetaInitFunction ::
    Maybe (Ptr (FunPtr C_MetaInitFunction)) ->
    MetaInitFunction ->
    C_MetaInitFunction
wrap_MetaInitFunction funptrptr _cb meta params buffer = do
    meta' <- (newPtr Gst.Meta.Meta) meta
    B.ManagedPtr.withTransient Gst.Buffer.Buffer buffer $ \buffer' -> do
        result <- _cb  meta' params buffer'
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback MetaFreeFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMeta", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function called when @meta is freed in @buffer.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MetaFreeFunction =
    Ptr Gst.Meta.Meta ->
    Ptr Gst.Buffer.Buffer ->
    IO ()

-- Args : [Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMeta", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", 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_MetaFreeFunction :: FunPtr C_MetaFreeFunction -> C_MetaFreeFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MetaFreeFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MetaFreeFunction
    -> Gst.Meta.Meta
    {- ^ /@meta@/: a 'GI.Gst.Structs.Meta.Meta' -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> m ()
dynamic_MetaFreeFunction __funPtr meta buffer = liftIO $ do
    meta' <- unsafeManagedPtrGetPtr meta
    buffer' <- unsafeManagedPtrGetPtr buffer
    (__dynamic_C_MetaFreeFunction __funPtr) meta' buffer'
    touchManagedPtr meta
    touchManagedPtr buffer
    return ()

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

{- |
Function called when /@meta@/ is freed in /@buffer@/.
-}
type MetaFreeFunction =
    Gst.Meta.Meta
    {- ^ /@meta@/: a 'GI.Gst.Structs.Meta.Meta' -}
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MetaFreeFunction`@.
noMetaFreeFunction :: Maybe MetaFreeFunction
noMetaFreeFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MetaFreeFunction :: MonadIO m => MetaFreeFunction -> m (GClosure C_MetaFreeFunction)
genClosure_MetaFreeFunction cb = liftIO $ do
    let cb' = wrap_MetaFreeFunction Nothing cb
    mk_MetaFreeFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MetaFreeFunction` into a `C_MetaFreeFunction`.
wrap_MetaFreeFunction ::
    Maybe (Ptr (FunPtr C_MetaFreeFunction)) ->
    MetaFreeFunction ->
    C_MetaFreeFunction
wrap_MetaFreeFunction funptrptr _cb meta buffer = do
    meta' <- (newPtr Gst.Meta.Meta) meta
    B.ManagedPtr.withTransient Gst.Buffer.Buffer buffer $ \buffer' -> do
        _cb  meta' buffer'
        maybeReleaseFunPtr funptrptr


-- callback MemoryUnmapFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Return the pointer previously retrieved with gst_memory_map().", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MemoryUnmapFunction =
    Ptr Gst.Memory.Memory ->
    IO ()

-- Args : [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", 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_MemoryUnmapFunction :: FunPtr C_MemoryUnmapFunction -> C_MemoryUnmapFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MemoryUnmapFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MemoryUnmapFunction
    -> Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> m ()
dynamic_MemoryUnmapFunction __funPtr mem = liftIO $ do
    mem' <- unsafeManagedPtrGetPtr mem
    (__dynamic_C_MemoryUnmapFunction __funPtr) mem'
    touchManagedPtr mem
    return ()

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

{- |
Return the pointer previously retrieved with 'GI.Gst.Structs.Memory.memoryMap'.
-}
type MemoryUnmapFunction =
    Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MemoryUnmapFunction`@.
noMemoryUnmapFunction :: Maybe MemoryUnmapFunction
noMemoryUnmapFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MemoryUnmapFunction :: MonadIO m => MemoryUnmapFunction -> m (GClosure C_MemoryUnmapFunction)
genClosure_MemoryUnmapFunction cb = liftIO $ do
    let cb' = wrap_MemoryUnmapFunction Nothing cb
    mk_MemoryUnmapFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MemoryUnmapFunction` into a `C_MemoryUnmapFunction`.
wrap_MemoryUnmapFunction ::
    Maybe (Ptr (FunPtr C_MemoryUnmapFunction)) ->
    MemoryUnmapFunction ->
    C_MemoryUnmapFunction
wrap_MemoryUnmapFunction funptrptr _cb mem = do
    B.ManagedPtr.withTransient Gst.Memory.Memory mem $ \mem' -> do
        _cb  mem'
        maybeReleaseFunPtr funptrptr


-- callback MemoryUnmapFullFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MapInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMapInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Return the pointer previously retrieved with gst_memory_map() with @info.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MemoryUnmapFullFunction =
    Ptr Gst.Memory.Memory ->
    Ptr Gst.MapInfo.MapInfo ->
    IO ()

-- Args : [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MapInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMapInfo", 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_MemoryUnmapFullFunction :: FunPtr C_MemoryUnmapFullFunction -> C_MemoryUnmapFullFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MemoryUnmapFullFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MemoryUnmapFullFunction
    -> Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Gst.MapInfo.MapInfo
    {- ^ /@info@/: a 'GI.Gst.Structs.MapInfo.MapInfo' -}
    -> m ()
dynamic_MemoryUnmapFullFunction __funPtr mem info = liftIO $ do
    mem' <- unsafeManagedPtrGetPtr mem
    info' <- unsafeManagedPtrGetPtr info
    (__dynamic_C_MemoryUnmapFullFunction __funPtr) mem' info'
    touchManagedPtr mem
    touchManagedPtr info
    return ()

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

{- |
Return the pointer previously retrieved with 'GI.Gst.Structs.Memory.memoryMap' with /@info@/.
-}
type MemoryUnmapFullFunction =
    Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Gst.MapInfo.MapInfo
    {- ^ /@info@/: a 'GI.Gst.Structs.MapInfo.MapInfo' -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MemoryUnmapFullFunction`@.
noMemoryUnmapFullFunction :: Maybe MemoryUnmapFullFunction
noMemoryUnmapFullFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MemoryUnmapFullFunction :: MonadIO m => MemoryUnmapFullFunction -> m (GClosure C_MemoryUnmapFullFunction)
genClosure_MemoryUnmapFullFunction cb = liftIO $ do
    let cb' = wrap_MemoryUnmapFullFunction Nothing cb
    mk_MemoryUnmapFullFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MemoryUnmapFullFunction` into a `C_MemoryUnmapFullFunction`.
wrap_MemoryUnmapFullFunction ::
    Maybe (Ptr (FunPtr C_MemoryUnmapFullFunction)) ->
    MemoryUnmapFullFunction ->
    C_MemoryUnmapFullFunction
wrap_MemoryUnmapFullFunction funptrptr _cb mem info = do
    B.ManagedPtr.withTransient Gst.Memory.Memory mem $ \mem' -> do
        info' <- (newPtr Gst.MapInfo.MapInfo) info
        _cb  mem' info'
        maybeReleaseFunPtr funptrptr


-- callback MemoryShareFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "Memory"})), returnMayBeNull = False, returnTransfer = TransferEverything, returnDocumentation = Documentation {rawDocText = Just "a new #GstMemory object sharing the requested region in @mem.", sinceVersion = Nothing}, args = [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a size or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Share @size bytes from @mem starting at @offset and return them wrapped in a\nnew GstMemory object. If @size is set to -1, all bytes starting at @offset are\nshared. This function does not make a copy of the bytes in @mem.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MemoryShareFunction =
    Ptr Gst.Memory.Memory ->
    Int64 ->
    Int64 ->
    IO (Ptr Gst.Memory.Memory)

-- Args : [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a size or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Memory"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MemoryShareFunction :: FunPtr C_MemoryShareFunction -> C_MemoryShareFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MemoryShareFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MemoryShareFunction
    -> Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Int64
    {- ^ /@offset@/: an offset -}
    -> Int64
    {- ^ /@size@/: a size or -1 -}
    -> m Gst.Memory.Memory
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Memory.Memory' object sharing the requested region in /@mem@/. -}
dynamic_MemoryShareFunction __funPtr mem offset size = liftIO $ do
    mem' <- unsafeManagedPtrGetPtr mem
    result <- (__dynamic_C_MemoryShareFunction __funPtr) mem' offset size
    checkUnexpectedReturnNULL "memoryShareFunction" result
    result' <- (wrapBoxed Gst.Memory.Memory) result
    touchManagedPtr mem
    return result'

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

{- |
Share /@size@/ bytes from /@mem@/ starting at /@offset@/ and return them wrapped in a
new GstMemory object. If /@size@/ is set to -1, all bytes starting at /@offset@/ are
shared. This function does not make a copy of the bytes in /@mem@/.
-}
type MemoryShareFunction =
    Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Int64
    {- ^ /@offset@/: an offset -}
    -> Int64
    {- ^ /@size@/: a size or -1 -}
    -> IO Gst.Memory.Memory
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Memory.Memory' object sharing the requested region in /@mem@/. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `MemoryShareFunction`@.
noMemoryShareFunction :: Maybe MemoryShareFunction
noMemoryShareFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MemoryShareFunction :: MonadIO m => MemoryShareFunction -> m (GClosure C_MemoryShareFunction)
genClosure_MemoryShareFunction cb = liftIO $ do
    let cb' = wrap_MemoryShareFunction Nothing cb
    mk_MemoryShareFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MemoryShareFunction` into a `C_MemoryShareFunction`.
wrap_MemoryShareFunction ::
    Maybe (Ptr (FunPtr C_MemoryShareFunction)) ->
    MemoryShareFunction ->
    C_MemoryShareFunction
wrap_MemoryShareFunction funptrptr _cb mem offset size = do
    B.ManagedPtr.withTransient Gst.Memory.Memory mem $ \mem' -> do
        result <- _cb  mem' offset size
        maybeReleaseFunPtr funptrptr
        result' <- B.ManagedPtr.disownBoxed result
        return result'


-- callback MemoryMapFunction
--          -> Callable {returnType = Just (TBasicType TPtr), returnMayBeNull = True, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "a pointer to memory of which at least @maxsize bytes can be\naccessed according to the access pattern in @flags.", sinceVersion = Nothing}, args = [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "maxsize", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size to map", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "MapFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "access mode for the memory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Get the memory of @mem that can be accessed according to the mode specified\nin @flags. The function should return a pointer that contains at least\n@maxsize bytes.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MemoryMapFunction =
    Ptr Gst.Memory.Memory ->
    Word64 ->
    CUInt ->
    IO (Ptr ())

-- Args : [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "maxsize", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size to map", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "MapFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "access mode for the memory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MemoryMapFunction :: FunPtr C_MemoryMapFunction -> C_MemoryMapFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MemoryMapFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MemoryMapFunction
    -> Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Word64
    {- ^ /@maxsize@/: size to map -}
    -> [Gst.Flags.MapFlags]
    {- ^ /@flags@/: access mode for the memory -}
    -> m (Ptr ())
    {- ^ __Returns:__ a pointer to memory of which at least /@maxsize@/ bytes can be
accessed according to the access pattern in /@flags@/. -}
dynamic_MemoryMapFunction __funPtr mem maxsize flags = liftIO $ do
    mem' <- unsafeManagedPtrGetPtr mem
    let flags' = gflagsToWord flags
    result <- (__dynamic_C_MemoryMapFunction __funPtr) mem' maxsize flags'
    touchManagedPtr mem
    return result

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

{- |
Get the memory of /@mem@/ that can be accessed according to the mode specified
in /@flags@/. The function should return a pointer that contains at least
/@maxsize@/ bytes.
-}
type MemoryMapFunction =
    Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Word64
    {- ^ /@maxsize@/: size to map -}
    -> [Gst.Flags.MapFlags]
    {- ^ /@flags@/: access mode for the memory -}
    -> IO (Ptr ())
    {- ^ __Returns:__ a pointer to memory of which at least /@maxsize@/ bytes can be
accessed according to the access pattern in /@flags@/. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `MemoryMapFunction`@.
noMemoryMapFunction :: Maybe MemoryMapFunction
noMemoryMapFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MemoryMapFunction :: MonadIO m => MemoryMapFunction -> m (GClosure C_MemoryMapFunction)
genClosure_MemoryMapFunction cb = liftIO $ do
    let cb' = wrap_MemoryMapFunction Nothing cb
    mk_MemoryMapFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MemoryMapFunction` into a `C_MemoryMapFunction`.
wrap_MemoryMapFunction ::
    Maybe (Ptr (FunPtr C_MemoryMapFunction)) ->
    MemoryMapFunction ->
    C_MemoryMapFunction
wrap_MemoryMapFunction funptrptr _cb mem maxsize flags = do
    B.ManagedPtr.withTransient Gst.Memory.Memory mem $ \mem' -> do
        let flags' = wordToGFlags flags
        result <- _cb  mem' maxsize flags'
        maybeReleaseFunPtr funptrptr
        return result


-- callback MemoryMapFullFunction
--          -> Callable {returnType = Just (TBasicType TPtr), returnMayBeNull = True, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "a pointer to memory of which at least @maxsize bytes can be\naccessed according to the access pattern in @info's flags.", sinceVersion = Nothing}, args = [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MapInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstMapInfo to map with", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "maxsize", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size to map", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Get the memory of @mem that can be accessed according to the mode specified\nin @info's flags. The function should return a pointer that contains at least\n@maxsize bytes.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MemoryMapFullFunction =
    Ptr Gst.Memory.Memory ->
    Ptr Gst.MapInfo.MapInfo ->
    Word64 ->
    IO (Ptr ())

-- Args : [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MapInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstMapInfo to map with", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "maxsize", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size to map", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MemoryMapFullFunction :: FunPtr C_MemoryMapFullFunction -> C_MemoryMapFullFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MemoryMapFullFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MemoryMapFullFunction
    -> Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Gst.MapInfo.MapInfo
    {- ^ /@info@/: the 'GI.Gst.Structs.MapInfo.MapInfo' to map with -}
    -> Word64
    {- ^ /@maxsize@/: size to map -}
    -> m (Ptr ())
    {- ^ __Returns:__ a pointer to memory of which at least /@maxsize@/ bytes can be
accessed according to the access pattern in /@info@/\'s flags. -}
dynamic_MemoryMapFullFunction __funPtr mem info maxsize = liftIO $ do
    mem' <- unsafeManagedPtrGetPtr mem
    info' <- unsafeManagedPtrGetPtr info
    result <- (__dynamic_C_MemoryMapFullFunction __funPtr) mem' info' maxsize
    touchManagedPtr mem
    touchManagedPtr info
    return result

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

{- |
Get the memory of /@mem@/ that can be accessed according to the mode specified
in /@info@/\'s flags. The function should return a pointer that contains at least
/@maxsize@/ bytes.
-}
type MemoryMapFullFunction =
    Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Gst.MapInfo.MapInfo
    {- ^ /@info@/: the 'GI.Gst.Structs.MapInfo.MapInfo' to map with -}
    -> Word64
    {- ^ /@maxsize@/: size to map -}
    -> IO (Ptr ())
    {- ^ __Returns:__ a pointer to memory of which at least /@maxsize@/ bytes can be
accessed according to the access pattern in /@info@/\'s flags. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `MemoryMapFullFunction`@.
noMemoryMapFullFunction :: Maybe MemoryMapFullFunction
noMemoryMapFullFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MemoryMapFullFunction :: MonadIO m => MemoryMapFullFunction -> m (GClosure C_MemoryMapFullFunction)
genClosure_MemoryMapFullFunction cb = liftIO $ do
    let cb' = wrap_MemoryMapFullFunction Nothing cb
    mk_MemoryMapFullFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MemoryMapFullFunction` into a `C_MemoryMapFullFunction`.
wrap_MemoryMapFullFunction ::
    Maybe (Ptr (FunPtr C_MemoryMapFullFunction)) ->
    MemoryMapFullFunction ->
    C_MemoryMapFullFunction
wrap_MemoryMapFullFunction funptrptr _cb mem info maxsize = do
    B.ManagedPtr.withTransient Gst.Memory.Memory mem $ \mem' -> do
        info' <- (newPtr Gst.MapInfo.MapInfo) info
        result <- _cb  mem' info' maxsize
        maybeReleaseFunPtr funptrptr
        return result


-- callback MemoryIsSpanFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if @mem1 and @mem2 are in contiguous memory.", sinceVersion = Nothing}, args = [Arg {argCName = "mem1", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mem2", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", 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 "a result offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Check if @mem1 and @mem2 occupy contiguous memory and return the offset of\n@mem1 in the parent buffer in @offset.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MemoryIsSpanFunction =
    Ptr Gst.Memory.Memory ->
    Ptr Gst.Memory.Memory ->
    Word64 ->
    IO CInt

-- Args : [Arg {argCName = "mem1", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mem2", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", 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 "a result offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MemoryIsSpanFunction :: FunPtr C_MemoryIsSpanFunction -> C_MemoryIsSpanFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MemoryIsSpanFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MemoryIsSpanFunction
    -> Gst.Memory.Memory
    {- ^ /@mem1@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Gst.Memory.Memory
    {- ^ /@mem2@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Word64
    {- ^ /@offset@/: a result offset -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@mem1@/ and /@mem2@/ are in contiguous memory. -}
dynamic_MemoryIsSpanFunction __funPtr mem1 mem2 offset = liftIO $ do
    mem1' <- unsafeManagedPtrGetPtr mem1
    mem2' <- unsafeManagedPtrGetPtr mem2
    result <- (__dynamic_C_MemoryIsSpanFunction __funPtr) mem1' mem2' offset
    let result' = (/= 0) result
    touchManagedPtr mem1
    touchManagedPtr mem2
    return result'

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

{- |
Check if /@mem1@/ and /@mem2@/ occupy contiguous memory and return the offset of
/@mem1@/ in the parent buffer in /@offset@/.
-}
type MemoryIsSpanFunction =
    Gst.Memory.Memory
    {- ^ /@mem1@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Gst.Memory.Memory
    {- ^ /@mem2@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Word64
    {- ^ /@offset@/: a result offset -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if /@mem1@/ and /@mem2@/ are in contiguous memory. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `MemoryIsSpanFunction`@.
noMemoryIsSpanFunction :: Maybe MemoryIsSpanFunction
noMemoryIsSpanFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MemoryIsSpanFunction :: MonadIO m => MemoryIsSpanFunction -> m (GClosure C_MemoryIsSpanFunction)
genClosure_MemoryIsSpanFunction cb = liftIO $ do
    let cb' = wrap_MemoryIsSpanFunction Nothing cb
    mk_MemoryIsSpanFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MemoryIsSpanFunction` into a `C_MemoryIsSpanFunction`.
wrap_MemoryIsSpanFunction ::
    Maybe (Ptr (FunPtr C_MemoryIsSpanFunction)) ->
    MemoryIsSpanFunction ->
    C_MemoryIsSpanFunction
wrap_MemoryIsSpanFunction funptrptr _cb mem1 mem2 offset = do
    B.ManagedPtr.withTransient Gst.Memory.Memory mem1 $ \mem1' -> do
        B.ManagedPtr.withTransient Gst.Memory.Memory mem2 $ \mem2' -> do
            result <- _cb  mem1' mem2' offset
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback MemoryCopyFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "Memory"})), returnMayBeNull = False, returnTransfer = TransferEverything, returnDocumentation = Documentation {rawDocText = Just "a new #GstMemory object wrapping a copy of the requested region in\n@mem.", sinceVersion = Nothing}, args = [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a size or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Copy @size bytes from @mem starting at @offset and return them wrapped in a\nnew GstMemory object.\nIf @size is set to -1, all bytes starting at @offset are copied.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_MemoryCopyFunction =
    Ptr Gst.Memory.Memory ->
    Int64 ->
    Int64 ->
    IO (Ptr Gst.Memory.Memory)

-- Args : [Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a size or -1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Memory"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MemoryCopyFunction :: FunPtr C_MemoryCopyFunction -> C_MemoryCopyFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MemoryCopyFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MemoryCopyFunction
    -> Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Int64
    {- ^ /@offset@/: an offset -}
    -> Int64
    {- ^ /@size@/: a size or -1 -}
    -> m Gst.Memory.Memory
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Memory.Memory' object wrapping a copy of the requested region in
/@mem@/. -}
dynamic_MemoryCopyFunction __funPtr mem offset size = liftIO $ do
    mem' <- unsafeManagedPtrGetPtr mem
    result <- (__dynamic_C_MemoryCopyFunction __funPtr) mem' offset size
    checkUnexpectedReturnNULL "memoryCopyFunction" result
    result' <- (wrapBoxed Gst.Memory.Memory) result
    touchManagedPtr mem
    return result'

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

{- |
Copy /@size@/ bytes from /@mem@/ starting at /@offset@/ and return them wrapped in a
new GstMemory object.
If /@size@/ is set to -1, all bytes starting at /@offset@/ are copied.
-}
type MemoryCopyFunction =
    Gst.Memory.Memory
    {- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
    -> Int64
    {- ^ /@offset@/: an offset -}
    -> Int64
    {- ^ /@size@/: a size or -1 -}
    -> IO Gst.Memory.Memory
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Memory.Memory' object wrapping a copy of the requested region in
/@mem@/. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `MemoryCopyFunction`@.
noMemoryCopyFunction :: Maybe MemoryCopyFunction
noMemoryCopyFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_MemoryCopyFunction :: MonadIO m => MemoryCopyFunction -> m (GClosure C_MemoryCopyFunction)
genClosure_MemoryCopyFunction cb = liftIO $ do
    let cb' = wrap_MemoryCopyFunction Nothing cb
    mk_MemoryCopyFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `MemoryCopyFunction` into a `C_MemoryCopyFunction`.
wrap_MemoryCopyFunction ::
    Maybe (Ptr (FunPtr C_MemoryCopyFunction)) ->
    MemoryCopyFunction ->
    C_MemoryCopyFunction
wrap_MemoryCopyFunction funptrptr _cb mem offset size = do
    B.ManagedPtr.withTransient Gst.Memory.Memory mem $ \mem' -> do
        result <- _cb  mem' offset size
        maybeReleaseFunPtr funptrptr
        result' <- B.ManagedPtr.disownBoxed result
        return result'


-- callback LogFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "category", argType = TInterface (Name {namespace = "Gst", name = "DebugCategory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDebugCategory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "level", argType = TInterface (Name {namespace = "Gst", name = "DebugLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDebugLevel", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "file name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "function", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "function name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "line number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "DebugMessage"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message", 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 for the log function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 7, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function prototype for a logging function that can be registered with\ngst_debug_add_log_function().\nUse G_GNUC_NO_INSTRUMENT on that function.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_LogFunction =
    Ptr Gst.DebugCategory.DebugCategory ->
    CUInt ->
    CString ->
    CString ->
    Int32 ->
    Ptr GObject.Object.Object ->
    Ptr Gst.DebugMessage.DebugMessage ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "category", argType = TInterface (Name {namespace = "Gst", name = "DebugCategory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDebugCategory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "level", argType = TInterface (Name {namespace = "Gst", name = "DebugLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDebugLevel", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "file name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "function", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "function name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "line number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GObject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "DebugMessage"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message", 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 for the log function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 7, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_LogFunction :: FunPtr C_LogFunction -> C_LogFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_LogFunction ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    FunPtr C_LogFunction
    -> Gst.DebugCategory.DebugCategory
    {- ^ /@category@/: a 'GI.Gst.Structs.DebugCategory.DebugCategory' -}
    -> Gst.Enums.DebugLevel
    {- ^ /@level@/: a 'GI.Gst.Enums.DebugLevel' -}
    -> T.Text
    {- ^ /@file@/: file name -}
    -> T.Text
    {- ^ /@function@/: function name -}
    -> Int32
    {- ^ /@line@/: line number -}
    -> a
    {- ^ /@object@/: a 'GI.GObject.Objects.Object.Object' -}
    -> Gst.DebugMessage.DebugMessage
    {- ^ /@message@/: the message -}
    -> Ptr ()
    {- ^ /@userData@/: user data for the log function -}
    -> m ()
dynamic_LogFunction __funPtr category level file function line object message userData = liftIO $ do
    category' <- unsafeManagedPtrGetPtr category
    let level' = (fromIntegral . fromEnum) level
    file' <- textToCString file
    function' <- textToCString function
    object' <- unsafeManagedPtrCastPtr object
    message' <- unsafeManagedPtrGetPtr message
    (__dynamic_C_LogFunction __funPtr) category' level' file' function' line object' message' userData
    touchManagedPtr category
    touchManagedPtr object
    touchManagedPtr message
    freeMem file'
    freeMem function'
    return ()

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

{- |
Function prototype for a logging function that can be registered with
'GI.Gst.Functions.debugAddLogFunction'.
Use G_GNUC_NO_INSTRUMENT on that function.
-}
type LogFunction =
    Gst.DebugCategory.DebugCategory
    {- ^ /@category@/: a 'GI.Gst.Structs.DebugCategory.DebugCategory' -}
    -> Gst.Enums.DebugLevel
    {- ^ /@level@/: a 'GI.Gst.Enums.DebugLevel' -}
    -> T.Text
    {- ^ /@file@/: file name -}
    -> T.Text
    {- ^ /@function@/: function name -}
    -> Int32
    {- ^ /@line@/: line number -}
    -> GObject.Object.Object
    {- ^ /@object@/: a 'GI.GObject.Objects.Object.Object' -}
    -> Gst.DebugMessage.DebugMessage
    {- ^ /@message@/: the message -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `LogFunction`@.
noLogFunction :: Maybe LogFunction
noLogFunction = Nothing

{- |
Function prototype for a logging function that can be registered with
'GI.Gst.Functions.debugAddLogFunction'.
Use G_GNUC_NO_INSTRUMENT on that function.
-}
type LogFunction_WithClosures =
    Gst.DebugCategory.DebugCategory
    {- ^ /@category@/: a 'GI.Gst.Structs.DebugCategory.DebugCategory' -}
    -> Gst.Enums.DebugLevel
    {- ^ /@level@/: a 'GI.Gst.Enums.DebugLevel' -}
    -> T.Text
    {- ^ /@file@/: file name -}
    -> T.Text
    {- ^ /@function@/: function name -}
    -> Int32
    {- ^ /@line@/: line number -}
    -> GObject.Object.Object
    {- ^ /@object@/: a 'GI.GObject.Objects.Object.Object' -}
    -> Gst.DebugMessage.DebugMessage
    {- ^ /@message@/: the message -}
    -> Ptr ()
    {- ^ /@userData@/: user data for the log function -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `LogFunction_WithClosures`@.
noLogFunction_WithClosures :: Maybe LogFunction_WithClosures
noLogFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_LogFunction :: LogFunction -> LogFunction_WithClosures
drop_closures_LogFunction _f category level file function line object message _ = _f category level file function line object message

-- | Wrap the callback into a `GClosure`.
genClosure_LogFunction :: MonadIO m => LogFunction -> m (GClosure C_LogFunction)
genClosure_LogFunction cb = liftIO $ do
    let cb' = drop_closures_LogFunction cb
    let cb'' = wrap_LogFunction Nothing cb'
    mk_LogFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `LogFunction` into a `C_LogFunction`.
wrap_LogFunction ::
    Maybe (Ptr (FunPtr C_LogFunction)) ->
    LogFunction_WithClosures ->
    C_LogFunction
wrap_LogFunction funptrptr _cb category level file function line object message userData = do
    category' <- (newPtr Gst.DebugCategory.DebugCategory) category
    let level' = (toEnum . fromIntegral) level
    file' <- cstringToText file
    function' <- cstringToText function
    object' <- (newObject GObject.Object.Object) object
    message' <- (newPtr Gst.DebugMessage.DebugMessage) message
    _cb  category' level' file' function' line object' message' userData
    maybeReleaseFunPtr funptrptr


-- callback IteratorResyncFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function will be called whenever a concurrent update happened\nto the iterated datastructure. The implementor of the iterator should\nrestart the iterator from the beginning and clean up any state it might\nhave.\n\nImplementors of a #GstIterator should implement this\nfunction and pass it to the constructor of the custom iterator.\nThe function will be called with the iterator lock held.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorResyncFunction =
    Ptr Gst.Iterator.Iterator ->
    IO ()

-- Args : [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", 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_IteratorResyncFunction :: FunPtr C_IteratorResyncFunction -> C_IteratorResyncFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorResyncFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorResyncFunction
    -> Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> m ()
dynamic_IteratorResyncFunction __funPtr it = liftIO $ do
    it' <- unsafeManagedPtrGetPtr it
    (__dynamic_C_IteratorResyncFunction __funPtr) it'
    touchManagedPtr it
    return ()

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

{- |
This function will be called whenever a concurrent update happened
to the iterated datastructure. The implementor of the iterator should
restart the iterator from the beginning and clean up any state it might
have.

Implementors of a 'GI.Gst.Structs.Iterator.Iterator' should implement this
function and pass it to the constructor of the custom iterator.
The function will be called with the iterator lock held.
-}
type IteratorResyncFunction =
    Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorResyncFunction`@.
noIteratorResyncFunction :: Maybe IteratorResyncFunction
noIteratorResyncFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorResyncFunction :: MonadIO m => IteratorResyncFunction -> m (GClosure C_IteratorResyncFunction)
genClosure_IteratorResyncFunction cb = liftIO $ do
    let cb' = wrap_IteratorResyncFunction Nothing cb
    mk_IteratorResyncFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorResyncFunction` into a `C_IteratorResyncFunction`.
wrap_IteratorResyncFunction ::
    Maybe (Ptr (FunPtr C_IteratorResyncFunction)) ->
    IteratorResyncFunction ->
    C_IteratorResyncFunction
wrap_IteratorResyncFunction funptrptr _cb it = do
    B.ManagedPtr.withTransient Gst.Iterator.Iterator it $ \it' -> do
        _cb  it'
        maybeReleaseFunPtr funptrptr


-- callback IteratorNextFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "IteratorResult"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "the result of the operation.", sinceVersion = Nothing}, args = [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the next item", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The function that will be called when the next element of the iterator\nshould be retrieved.\n\nImplementors of a #GstIterator should implement this\nfunction and pass it to the constructor of the custom iterator.\nThe function will be called with the iterator lock held.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorNextFunction =
    Ptr Gst.Iterator.Iterator ->
    Ptr GValue ->
    IO CUInt

-- Args : [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the next item", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "IteratorResult"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorNextFunction :: FunPtr C_IteratorNextFunction -> C_IteratorNextFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorNextFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorNextFunction
    -> Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> GValue
    {- ^ /@result@/: a pointer to hold the next item -}
    -> m Gst.Enums.IteratorResult
    {- ^ __Returns:__ the result of the operation. -}
dynamic_IteratorNextFunction __funPtr it result_ = liftIO $ do
    it' <- unsafeManagedPtrGetPtr it
    result_' <- unsafeManagedPtrGetPtr result_
    result <- (__dynamic_C_IteratorNextFunction __funPtr) it' result_'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr it
    touchManagedPtr result_
    return result'

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

{- |
The function that will be called when the next element of the iterator
should be retrieved.

Implementors of a 'GI.Gst.Structs.Iterator.Iterator' should implement this
function and pass it to the constructor of the custom iterator.
The function will be called with the iterator lock held.
-}
type IteratorNextFunction =
    Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> GValue
    {- ^ /@result@/: a pointer to hold the next item -}
    -> IO Gst.Enums.IteratorResult
    {- ^ __Returns:__ the result of the operation. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorNextFunction`@.
noIteratorNextFunction :: Maybe IteratorNextFunction
noIteratorNextFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorNextFunction :: MonadIO m => IteratorNextFunction -> m (GClosure C_IteratorNextFunction)
genClosure_IteratorNextFunction cb = liftIO $ do
    let cb' = wrap_IteratorNextFunction Nothing cb
    mk_IteratorNextFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorNextFunction` into a `C_IteratorNextFunction`.
wrap_IteratorNextFunction ::
    Maybe (Ptr (FunPtr C_IteratorNextFunction)) ->
    IteratorNextFunction ->
    C_IteratorNextFunction
wrap_IteratorNextFunction funptrptr _cb it result_ = do
    B.ManagedPtr.withTransient Gst.Iterator.Iterator it $ \it' -> do
        B.ManagedPtr.withTransient GValue result_ $ \result_' -> do
            result <- _cb  it' result_'
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback IteratorItemFunction
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "IteratorItem"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "the result of the operation.", sinceVersion = Nothing}, args = [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the item being retrieved.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The function that will be called after the next item of the iterator\nhas been retrieved. This function can be used to skip items or stop\nthe iterator.\n\nThe function will be called with the iterator lock held.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorItemFunction =
    Ptr Gst.Iterator.Iterator ->
    Ptr GValue ->
    IO CUInt

-- Args : [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the item being retrieved.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "IteratorItem"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorItemFunction :: FunPtr C_IteratorItemFunction -> C_IteratorItemFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorItemFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorItemFunction
    -> Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> GValue
    {- ^ /@item@/: the item being retrieved. -}
    -> m Gst.Enums.IteratorItem
    {- ^ __Returns:__ the result of the operation. -}
dynamic_IteratorItemFunction __funPtr it item = liftIO $ do
    it' <- unsafeManagedPtrGetPtr it
    item' <- unsafeManagedPtrGetPtr item
    result <- (__dynamic_C_IteratorItemFunction __funPtr) it' item'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr it
    touchManagedPtr item
    return result'

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

{- |
The function that will be called after the next item of the iterator
has been retrieved. This function can be used to skip items or stop
the iterator.

The function will be called with the iterator lock held.
-}
type IteratorItemFunction =
    Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> GValue
    {- ^ /@item@/: the item being retrieved. -}
    -> IO Gst.Enums.IteratorItem
    {- ^ __Returns:__ the result of the operation. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorItemFunction`@.
noIteratorItemFunction :: Maybe IteratorItemFunction
noIteratorItemFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorItemFunction :: MonadIO m => IteratorItemFunction -> m (GClosure C_IteratorItemFunction)
genClosure_IteratorItemFunction cb = liftIO $ do
    let cb' = wrap_IteratorItemFunction Nothing cb
    mk_IteratorItemFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorItemFunction` into a `C_IteratorItemFunction`.
wrap_IteratorItemFunction ::
    Maybe (Ptr (FunPtr C_IteratorItemFunction)) ->
    IteratorItemFunction ->
    C_IteratorItemFunction
wrap_IteratorItemFunction funptrptr _cb it item = do
    B.ManagedPtr.withTransient Gst.Iterator.Iterator it $ \it' -> do
        B.ManagedPtr.withTransient GValue item $ \item' -> do
            result <- _cb  it' item'
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback IteratorFreeFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function will be called when the iterator is freed.\n\nImplementors of a #GstIterator should implement this\nfunction and pass it to the constructor of the custom iterator.\nThe function will be called with the iterator lock held.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorFreeFunction =
    Ptr Gst.Iterator.Iterator ->
    IO ()

-- Args : [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the iterator", 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_IteratorFreeFunction :: FunPtr C_IteratorFreeFunction -> C_IteratorFreeFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorFreeFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorFreeFunction
    -> Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> m ()
dynamic_IteratorFreeFunction __funPtr it = liftIO $ do
    it' <- unsafeManagedPtrGetPtr it
    (__dynamic_C_IteratorFreeFunction __funPtr) it'
    touchManagedPtr it
    return ()

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

{- |
This function will be called when the iterator is freed.

Implementors of a 'GI.Gst.Structs.Iterator.Iterator' should implement this
function and pass it to the constructor of the custom iterator.
The function will be called with the iterator lock held.
-}
type IteratorFreeFunction =
    Gst.Iterator.Iterator
    {- ^ /@it@/: the iterator -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorFreeFunction`@.
noIteratorFreeFunction :: Maybe IteratorFreeFunction
noIteratorFreeFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorFreeFunction :: MonadIO m => IteratorFreeFunction -> m (GClosure C_IteratorFreeFunction)
genClosure_IteratorFreeFunction cb = liftIO $ do
    let cb' = wrap_IteratorFreeFunction Nothing cb
    mk_IteratorFreeFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorFreeFunction` into a `C_IteratorFreeFunction`.
wrap_IteratorFreeFunction ::
    Maybe (Ptr (FunPtr C_IteratorFreeFunction)) ->
    IteratorFreeFunction ->
    C_IteratorFreeFunction
wrap_IteratorFreeFunction funptrptr _cb it = do
    B.ManagedPtr.withTransient Gst.Iterator.Iterator it $ \it' -> do
        _cb  it'
        maybeReleaseFunPtr funptrptr


-- callback IteratorForeachFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The item", 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 is called by gst_iterator_foreach() for every element.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorForeachFunction =
    Ptr GValue ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The item", 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_IteratorForeachFunction :: FunPtr C_IteratorForeachFunction -> C_IteratorForeachFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorForeachFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorForeachFunction
    -> GValue
    {- ^ /@item@/: The item -}
    -> Ptr ()
    {- ^ /@userData@/: User data -}
    -> m ()
dynamic_IteratorForeachFunction __funPtr item userData = liftIO $ do
    item' <- unsafeManagedPtrGetPtr item
    (__dynamic_C_IteratorForeachFunction __funPtr) item' userData
    touchManagedPtr item
    return ()

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

{- |
A function that is called by 'GI.Gst.Structs.Iterator.iteratorForeach' for every element.
-}
type IteratorForeachFunction =
    GValue
    {- ^ /@item@/: The item -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorForeachFunction`@.
noIteratorForeachFunction :: Maybe IteratorForeachFunction
noIteratorForeachFunction = Nothing

{- |
A function that is called by 'GI.Gst.Structs.Iterator.iteratorForeach' for every element.
-}
type IteratorForeachFunction_WithClosures =
    GValue
    {- ^ /@item@/: The item -}
    -> Ptr ()
    {- ^ /@userData@/: User data -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorForeachFunction_WithClosures`@.
noIteratorForeachFunction_WithClosures :: Maybe IteratorForeachFunction_WithClosures
noIteratorForeachFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_IteratorForeachFunction :: IteratorForeachFunction -> IteratorForeachFunction_WithClosures
drop_closures_IteratorForeachFunction _f item _ = _f item

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorForeachFunction :: MonadIO m => IteratorForeachFunction -> m (GClosure C_IteratorForeachFunction)
genClosure_IteratorForeachFunction cb = liftIO $ do
    let cb' = drop_closures_IteratorForeachFunction cb
    let cb'' = wrap_IteratorForeachFunction Nothing cb'
    mk_IteratorForeachFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorForeachFunction` into a `C_IteratorForeachFunction`.
wrap_IteratorForeachFunction ::
    Maybe (Ptr (FunPtr C_IteratorForeachFunction)) ->
    IteratorForeachFunction_WithClosures ->
    C_IteratorForeachFunction
wrap_IteratorForeachFunction funptrptr _cb item userData = do
    B.ManagedPtr.withTransient GValue item $ \item' -> do
        _cb  item' userData
        maybeReleaseFunPtr funptrptr


-- callback IteratorFoldFunction
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the fold should continue, %FALSE if it should stop.", sinceVersion = Nothing}, args = [Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the item to fold", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ret", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue collecting the result", 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 "data passed to gst_iterator_fold()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function to be passed to gst_iterator_fold().", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorFoldFunction =
    Ptr GValue ->
    Ptr GValue ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "item", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the item to fold", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ret", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue collecting the result", 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 "data passed to gst_iterator_fold()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorFoldFunction :: FunPtr C_IteratorFoldFunction -> C_IteratorFoldFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorFoldFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorFoldFunction
    -> GValue
    {- ^ /@item@/: the item to fold -}
    -> GValue
    {- ^ /@ret@/: a 'GI.GObject.Structs.Value.Value' collecting the result -}
    -> Ptr ()
    {- ^ /@userData@/: data passed to 'GI.Gst.Structs.Iterator.iteratorFold' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the fold should continue, 'False' if it should stop. -}
dynamic_IteratorFoldFunction __funPtr item ret userData = liftIO $ do
    item' <- unsafeManagedPtrGetPtr item
    ret' <- unsafeManagedPtrGetPtr ret
    result <- (__dynamic_C_IteratorFoldFunction __funPtr) item' ret' userData
    let result' = (/= 0) result
    touchManagedPtr item
    touchManagedPtr ret
    return result'

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

{- |
A function to be passed to 'GI.Gst.Structs.Iterator.iteratorFold'.
-}
type IteratorFoldFunction =
    GValue
    {- ^ /@item@/: the item to fold -}
    -> GValue
    {- ^ /@ret@/: a 'GI.GObject.Structs.Value.Value' collecting the result -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the fold should continue, 'False' if it should stop. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorFoldFunction`@.
noIteratorFoldFunction :: Maybe IteratorFoldFunction
noIteratorFoldFunction = Nothing

{- |
A function to be passed to 'GI.Gst.Structs.Iterator.iteratorFold'.
-}
type IteratorFoldFunction_WithClosures =
    GValue
    {- ^ /@item@/: the item to fold -}
    -> GValue
    {- ^ /@ret@/: a 'GI.GObject.Structs.Value.Value' collecting the result -}
    -> Ptr ()
    {- ^ /@userData@/: data passed to 'GI.Gst.Structs.Iterator.iteratorFold' -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the fold should continue, 'False' if it should stop. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorFoldFunction_WithClosures`@.
noIteratorFoldFunction_WithClosures :: Maybe IteratorFoldFunction_WithClosures
noIteratorFoldFunction_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_IteratorFoldFunction :: IteratorFoldFunction -> IteratorFoldFunction_WithClosures
drop_closures_IteratorFoldFunction _f item ret _ = _f item ret

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorFoldFunction :: MonadIO m => IteratorFoldFunction -> m (GClosure C_IteratorFoldFunction)
genClosure_IteratorFoldFunction cb = liftIO $ do
    let cb' = drop_closures_IteratorFoldFunction cb
    let cb'' = wrap_IteratorFoldFunction Nothing cb'
    mk_IteratorFoldFunction cb'' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorFoldFunction` into a `C_IteratorFoldFunction`.
wrap_IteratorFoldFunction ::
    Maybe (Ptr (FunPtr C_IteratorFoldFunction)) ->
    IteratorFoldFunction_WithClosures ->
    C_IteratorFoldFunction
wrap_IteratorFoldFunction funptrptr _cb item ret userData = do
    B.ManagedPtr.withTransient GValue item $ \item' -> do
        B.ManagedPtr.withTransient GValue ret $ \ret' -> do
            result <- _cb  item' ret' userData
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback IteratorCopyFunction
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The original iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "copy", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The copied iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function will be called when creating a copy of @it and should\ncreate a copy of all custom iterator fields or increase their\nreference counts.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorCopyFunction =
    Ptr Gst.Iterator.Iterator ->
    Ptr Gst.Iterator.Iterator ->
    IO ()

-- Args : [Arg {argCName = "it", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The original iterator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "copy", argType = TInterface (Name {namespace = "Gst", name = "Iterator"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The copied iterator", 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_IteratorCopyFunction :: FunPtr C_IteratorCopyFunction -> C_IteratorCopyFunction

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorCopyFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorCopyFunction
    -> Gst.Iterator.Iterator
    {- ^ /@it@/: The original iterator -}
    -> Gst.Iterator.Iterator
    {- ^ /@copy@/: The copied iterator -}
    -> m ()
dynamic_IteratorCopyFunction __funPtr it copy = liftIO $ do
    it' <- unsafeManagedPtrGetPtr it
    copy' <- unsafeManagedPtrGetPtr copy
    (__dynamic_C_IteratorCopyFunction __funPtr) it' copy'
    touchManagedPtr it
    touchManagedPtr copy
    return ()

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

{- |
This function will be called when creating a copy of /@it@/ and should
create a copy of all custom iterator fields or increase their
reference counts.
-}
type IteratorCopyFunction =
    Gst.Iterator.Iterator
    {- ^ /@it@/: The original iterator -}
    -> Gst.Iterator.Iterator
    {- ^ /@copy@/: The copied iterator -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorCopyFunction`@.
noIteratorCopyFunction :: Maybe IteratorCopyFunction
noIteratorCopyFunction = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorCopyFunction :: MonadIO m => IteratorCopyFunction -> m (GClosure C_IteratorCopyFunction)
genClosure_IteratorCopyFunction cb = liftIO $ do
    let cb' = wrap_IteratorCopyFunction Nothing cb
    mk_IteratorCopyFunction cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorCopyFunction` into a `C_IteratorCopyFunction`.
wrap_IteratorCopyFunction ::
    Maybe (Ptr (FunPtr C_IteratorCopyFunction)) ->
    IteratorCopyFunction ->
    C_IteratorCopyFunction
wrap_IteratorCopyFunction funptrptr _cb it copy = do
    B.ManagedPtr.withTransient Gst.Iterator.Iterator it $ \it' -> do
        B.ManagedPtr.withTransient Gst.Iterator.Iterator copy $ \copy' -> do
            _cb  it' copy'
            maybeReleaseFunPtr funptrptr


-- callback ElementForeachPadFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%FALSE to stop iterating pads, %TRUE to continue", sinceVersion = Nothing}, args = [Arg {argCName = "element", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the foreach function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function called for each pad when using gst_element_foreach_sink_pad(),\ngst_element_foreach_src_pad(), or gst_element_foreach_pad().", sinceVersion = Just "1.14"}}
-- | Type for the callback on the (unwrapped) C side.
type C_ElementForeachPadFunc =
    Ptr Gst.Element.Element ->
    Ptr Gst.Pad.Pad ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "element", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the foreach function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ElementForeachPadFunc :: FunPtr C_ElementForeachPadFunc -> C_ElementForeachPadFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ElementForeachPadFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Element.IsElement a, Gst.Pad.IsPad b) =>
    FunPtr C_ElementForeachPadFunc
    -> a
    {- ^ /@element@/: the 'GI.Gst.Objects.Element.Element' -}
    -> b
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to the foreach function -}
    -> m Bool
    {- ^ __Returns:__ 'False' to stop iterating pads, 'True' to continue -}
dynamic_ElementForeachPadFunc __funPtr element pad userData = liftIO $ do
    element' <- unsafeManagedPtrCastPtr element
    pad' <- unsafeManagedPtrCastPtr pad
    result <- (__dynamic_C_ElementForeachPadFunc __funPtr) element' pad' userData
    let result' = (/= 0) result
    touchManagedPtr element
    touchManagedPtr pad
    return result'

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

{- |
Function called for each pad when using 'GI.Gst.Objects.Element.elementForeachSinkPad',
'GI.Gst.Objects.Element.elementForeachSrcPad', or 'GI.Gst.Objects.Element.elementForeachPad'.

/Since: 1.14/
-}
type ElementForeachPadFunc =
    Gst.Element.Element
    {- ^ /@element@/: the 'GI.Gst.Objects.Element.Element' -}
    -> Gst.Pad.Pad
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> IO Bool
    {- ^ __Returns:__ 'False' to stop iterating pads, 'True' to continue -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ElementForeachPadFunc`@.
noElementForeachPadFunc :: Maybe ElementForeachPadFunc
noElementForeachPadFunc = Nothing

{- |
Function called for each pad when using 'GI.Gst.Objects.Element.elementForeachSinkPad',
'GI.Gst.Objects.Element.elementForeachSrcPad', or 'GI.Gst.Objects.Element.elementForeachPad'.

/Since: 1.14/
-}
type ElementForeachPadFunc_WithClosures =
    Gst.Element.Element
    {- ^ /@element@/: the 'GI.Gst.Objects.Element.Element' -}
    -> Gst.Pad.Pad
    {- ^ /@pad@/: a 'GI.Gst.Objects.Pad.Pad' -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to the foreach function -}
    -> IO Bool
    {- ^ __Returns:__ 'False' to stop iterating pads, 'True' to continue -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ElementForeachPadFunc_WithClosures`@.
noElementForeachPadFunc_WithClosures :: Maybe ElementForeachPadFunc_WithClosures
noElementForeachPadFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ElementForeachPadFunc :: ElementForeachPadFunc -> ElementForeachPadFunc_WithClosures
drop_closures_ElementForeachPadFunc _f element pad _ = _f element pad

-- | Wrap the callback into a `GClosure`.
genClosure_ElementForeachPadFunc :: MonadIO m => ElementForeachPadFunc -> m (GClosure C_ElementForeachPadFunc)
genClosure_ElementForeachPadFunc cb = liftIO $ do
    let cb' = drop_closures_ElementForeachPadFunc cb
    let cb'' = wrap_ElementForeachPadFunc Nothing cb'
    mk_ElementForeachPadFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `ElementForeachPadFunc` into a `C_ElementForeachPadFunc`.
wrap_ElementForeachPadFunc ::
    Maybe (Ptr (FunPtr C_ElementForeachPadFunc)) ->
    ElementForeachPadFunc_WithClosures ->
    C_ElementForeachPadFunc
wrap_ElementForeachPadFunc funptrptr _cb element pad userData = do
    element' <- (newObject Gst.Element.Element) element
    pad' <- (newObject Gst.Pad.Pad) pad
    result <- _cb  element' pad' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback ElementCallAsyncFunc
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "element", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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 = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ElementCallAsyncFunc =
    Ptr Gst.Element.Element ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "element", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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 = 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_ElementCallAsyncFunc :: FunPtr C_ElementCallAsyncFunc -> C_ElementCallAsyncFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ElementCallAsyncFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Element.IsElement a) =>
    FunPtr C_ElementCallAsyncFunc
    -> a
    -> Ptr ()
    -> m ()
dynamic_ElementCallAsyncFunc __funPtr element userData = liftIO $ do
    element' <- unsafeManagedPtrCastPtr element
    (__dynamic_C_ElementCallAsyncFunc __funPtr) element' userData
    touchManagedPtr element
    return ()

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

{- |
/No description available in the introspection data./
-}
type ElementCallAsyncFunc =
    Gst.Element.Element
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ElementCallAsyncFunc`@.
noElementCallAsyncFunc :: Maybe ElementCallAsyncFunc
noElementCallAsyncFunc = Nothing

{- |
/No description available in the introspection data./
-}
type ElementCallAsyncFunc_WithClosures =
    Gst.Element.Element
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ElementCallAsyncFunc_WithClosures`@.
noElementCallAsyncFunc_WithClosures :: Maybe ElementCallAsyncFunc_WithClosures
noElementCallAsyncFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ElementCallAsyncFunc :: ElementCallAsyncFunc -> ElementCallAsyncFunc_WithClosures
drop_closures_ElementCallAsyncFunc _f element _ = _f element

-- | Wrap the callback into a `GClosure`.
genClosure_ElementCallAsyncFunc :: MonadIO m => ElementCallAsyncFunc -> m (GClosure C_ElementCallAsyncFunc)
genClosure_ElementCallAsyncFunc cb = liftIO $ do
    let cb' = drop_closures_ElementCallAsyncFunc cb
    let cb'' = wrap_ElementCallAsyncFunc Nothing cb'
    mk_ElementCallAsyncFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `ElementCallAsyncFunc` into a `C_ElementCallAsyncFunc`.
wrap_ElementCallAsyncFunc ::
    Maybe (Ptr (FunPtr C_ElementCallAsyncFunc)) ->
    ElementCallAsyncFunc_WithClosures ->
    C_ElementCallAsyncFunc
wrap_ElementCallAsyncFunc funptrptr _cb element userData = do
    element' <- (newObject Gst.Element.Element) element
    _cb  element' userData
    maybeReleaseFunPtr funptrptr


-- callback DebugFuncPtr
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_DebugFuncPtr =
    IO ()

-- Args : []
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DebugFuncPtr :: FunPtr C_DebugFuncPtr -> C_DebugFuncPtr

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DebugFuncPtr ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DebugFuncPtr
    -> m ()
dynamic_DebugFuncPtr __funPtr = liftIO $ do
    (__dynamic_C_DebugFuncPtr __funPtr)
    return ()

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

{- |
/No description available in the introspection data./
-}
type DebugFuncPtr =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DebugFuncPtr`@.
noDebugFuncPtr :: Maybe DebugFuncPtr
noDebugFuncPtr = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_DebugFuncPtr :: MonadIO m => DebugFuncPtr -> m (GClosure C_DebugFuncPtr)
genClosure_DebugFuncPtr cb = liftIO $ do
    let cb' = wrap_DebugFuncPtr Nothing cb
    mk_DebugFuncPtr cb' >>= B.GClosure.newGClosure


-- | Wrap a `DebugFuncPtr` into a `C_DebugFuncPtr`.
wrap_DebugFuncPtr ::
    Maybe (Ptr (FunPtr C_DebugFuncPtr)) ->
    DebugFuncPtr ->
    C_DebugFuncPtr
wrap_DebugFuncPtr funptrptr _cb = do
    _cb
    maybeReleaseFunPtr funptrptr


-- callback ControlSourceGetValueArray
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the values were successfully calculated.", sinceVersion = Nothing}, args = [Arg {argCName = "self", argType = TInterface (Name {namespace = "Gst", name = "ControlSource"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstControlSource instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "timestamp for which a value should be calculated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time spacing between subsequent values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_values", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "values", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "array to put control-values in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function for returning an array of values for starting at a given timestamp.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ControlSourceGetValueArray =
    Ptr Gst.ControlSource.ControlSource ->
    Word64 ->
    Word64 ->
    Word32 ->
    CDouble ->
    IO CInt

-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Gst", name = "ControlSource"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstControlSource instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "timestamp for which a value should be calculated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time spacing between subsequent values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_values", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "values", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "array to put control-values in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ControlSourceGetValueArray :: FunPtr C_ControlSourceGetValueArray -> C_ControlSourceGetValueArray

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ControlSourceGetValueArray ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.ControlSource.IsControlSource a) =>
    FunPtr C_ControlSourceGetValueArray
    -> a
    {- ^ /@self@/: the 'GI.Gst.Objects.ControlSource.ControlSource' instance -}
    -> Word64
    {- ^ /@timestamp@/: timestamp for which a value should be calculated -}
    -> Word64
    {- ^ /@interval@/: the time spacing between subsequent values -}
    -> Word32
    {- ^ /@nValues@/: the number of values -}
    -> Double
    {- ^ /@values@/: array to put control-values in -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the values were successfully calculated. -}
dynamic_ControlSourceGetValueArray __funPtr self timestamp interval nValues values = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    let values' = realToFrac values
    result <- (__dynamic_C_ControlSourceGetValueArray __funPtr) self' timestamp interval nValues values'
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

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

{- |
Function for returning an array of values for starting at a given timestamp.
-}
type ControlSourceGetValueArray =
    Gst.ControlSource.ControlSource
    {- ^ /@self@/: the 'GI.Gst.Objects.ControlSource.ControlSource' instance -}
    -> Word64
    {- ^ /@timestamp@/: timestamp for which a value should be calculated -}
    -> Word64
    {- ^ /@interval@/: the time spacing between subsequent values -}
    -> Word32
    {- ^ /@nValues@/: the number of values -}
    -> Double
    {- ^ /@values@/: array to put control-values in -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the values were successfully calculated. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ControlSourceGetValueArray`@.
noControlSourceGetValueArray :: Maybe ControlSourceGetValueArray
noControlSourceGetValueArray = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ControlSourceGetValueArray :: MonadIO m => ControlSourceGetValueArray -> m (GClosure C_ControlSourceGetValueArray)
genClosure_ControlSourceGetValueArray cb = liftIO $ do
    let cb' = wrap_ControlSourceGetValueArray Nothing cb
    mk_ControlSourceGetValueArray cb' >>= B.GClosure.newGClosure


-- | Wrap a `ControlSourceGetValueArray` into a `C_ControlSourceGetValueArray`.
wrap_ControlSourceGetValueArray ::
    Maybe (Ptr (FunPtr C_ControlSourceGetValueArray)) ->
    ControlSourceGetValueArray ->
    C_ControlSourceGetValueArray
wrap_ControlSourceGetValueArray funptrptr _cb self timestamp interval nValues values = do
    self' <- (newObject Gst.ControlSource.ControlSource) self
    let values' = realToFrac values
    result <- _cb  self' timestamp interval nValues values'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback ControlSourceGetValue
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the value was successfully calculated.", sinceVersion = Nothing}, args = [Arg {argCName = "self", argType = TInterface (Name {namespace = "Gst", name = "ControlSource"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstControlSource instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "timestamp for which a value should be calculated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value which will be set to the result.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Function for returning a value for a given timestamp.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ControlSourceGetValue =
    Ptr Gst.ControlSource.ControlSource ->
    Word64 ->
    CDouble ->
    IO CInt

-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Gst", name = "ControlSource"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstControlSource instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "timestamp for which a value should be calculated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value which will be set to the result.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ControlSourceGetValue :: FunPtr C_ControlSourceGetValue -> C_ControlSourceGetValue

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ControlSourceGetValue ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.ControlSource.IsControlSource a) =>
    FunPtr C_ControlSourceGetValue
    -> a
    {- ^ /@self@/: the 'GI.Gst.Objects.ControlSource.ControlSource' instance -}
    -> Word64
    {- ^ /@timestamp@/: timestamp for which a value should be calculated -}
    -> Double
    {- ^ /@value@/: a value which will be set to the result. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the value was successfully calculated. -}
dynamic_ControlSourceGetValue __funPtr self timestamp value = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    let value' = realToFrac value
    result <- (__dynamic_C_ControlSourceGetValue __funPtr) self' timestamp value'
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

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

{- |
Function for returning a value for a given timestamp.
-}
type ControlSourceGetValue =
    Gst.ControlSource.ControlSource
    {- ^ /@self@/: the 'GI.Gst.Objects.ControlSource.ControlSource' instance -}
    -> Word64
    {- ^ /@timestamp@/: timestamp for which a value should be calculated -}
    -> Double
    {- ^ /@value@/: a value which will be set to the result. -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the value was successfully calculated. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ControlSourceGetValue`@.
noControlSourceGetValue :: Maybe ControlSourceGetValue
noControlSourceGetValue = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ControlSourceGetValue :: MonadIO m => ControlSourceGetValue -> m (GClosure C_ControlSourceGetValue)
genClosure_ControlSourceGetValue cb = liftIO $ do
    let cb' = wrap_ControlSourceGetValue Nothing cb
    mk_ControlSourceGetValue cb' >>= B.GClosure.newGClosure


-- | Wrap a `ControlSourceGetValue` into a `C_ControlSourceGetValue`.
wrap_ControlSourceGetValue ::
    Maybe (Ptr (FunPtr C_ControlSourceGetValue)) ->
    ControlSourceGetValue ->
    C_ControlSourceGetValue
wrap_ControlSourceGetValue funptrptr _cb self timestamp value = do
    self' <- (newObject Gst.ControlSource.ControlSource) self
    let value' = realToFrac value
    result <- _cb  self' timestamp value'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback ControlBindingConvert
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "binding", argType = TInterface (Name {namespace = "Gst", name = "ControlBinding"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_value", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ControlBindingConvert =
    Ptr Gst.ControlBinding.ControlBinding ->
    CDouble ->
    Ptr GValue ->
    IO ()

-- Args : [Arg {argCName = "binding", argType = TInterface (Name {namespace = "Gst", name = "ControlBinding"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_value", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, 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_ControlBindingConvert :: FunPtr C_ControlBindingConvert -> C_ControlBindingConvert

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ControlBindingConvert ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.ControlBinding.IsControlBinding a) =>
    FunPtr C_ControlBindingConvert
    -> a
    -> Double
    -> GValue
    -> m ()
dynamic_ControlBindingConvert __funPtr binding srcValue destValue = liftIO $ do
    binding' <- unsafeManagedPtrCastPtr binding
    let srcValue' = realToFrac srcValue
    destValue' <- unsafeManagedPtrGetPtr destValue
    (__dynamic_C_ControlBindingConvert __funPtr) binding' srcValue' destValue'
    touchManagedPtr binding
    touchManagedPtr destValue
    return ()

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

{- |
/No description available in the introspection data./
-}
type ControlBindingConvert =
    Gst.ControlBinding.ControlBinding
    -> Double
    -> GValue
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ControlBindingConvert`@.
noControlBindingConvert :: Maybe ControlBindingConvert
noControlBindingConvert = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_ControlBindingConvert :: MonadIO m => ControlBindingConvert -> m (GClosure C_ControlBindingConvert)
genClosure_ControlBindingConvert cb = liftIO $ do
    let cb' = wrap_ControlBindingConvert Nothing cb
    mk_ControlBindingConvert cb' >>= B.GClosure.newGClosure


-- | Wrap a `ControlBindingConvert` into a `C_ControlBindingConvert`.
wrap_ControlBindingConvert ::
    Maybe (Ptr (FunPtr C_ControlBindingConvert)) ->
    ControlBindingConvert ->
    C_ControlBindingConvert
wrap_ControlBindingConvert funptrptr _cb binding srcValue destValue = do
    binding' <- (newObject Gst.ControlBinding.ControlBinding) binding
    let srcValue' = realToFrac srcValue
    B.ManagedPtr.withTransient GValue destValue $ \destValue' -> do
        _cb  binding' srcValue' destValue'
        maybeReleaseFunPtr funptrptr


-- callback ClockCallback
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE or %FALSE (currently unused)", sinceVersion = Nothing}, args = [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The clock that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The time it was triggered", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID that expired", 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 in the gst_clock_id_wait_async() function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The function prototype of the callback.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_ClockCallback =
    Ptr Gst.Clock.Clock ->
    Word64 ->
    Ptr () ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The clock that triggered the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The time it was triggered", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID that expired", 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 in the gst_clock_id_wait_async() 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_ClockCallback :: FunPtr C_ClockCallback -> C_ClockCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ClockCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Clock.IsClock a) =>
    FunPtr C_ClockCallback
    -> a
    {- ^ /@clock@/: The clock that triggered the callback -}
    -> Word64
    {- ^ /@time@/: The time it was triggered -}
    -> Ptr ()
    {- ^ /@id@/: The @/GstClockID/@ that expired -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed in the 'GI.Gst.Objects.Clock.clockIdWaitAsync' function -}
    -> m Bool
    {- ^ __Returns:__ 'True' or 'False' (currently unused) -}
dynamic_ClockCallback __funPtr clock time id userData = liftIO $ do
    clock' <- unsafeManagedPtrCastPtr clock
    result <- (__dynamic_C_ClockCallback __funPtr) clock' time id userData
    let result' = (/= 0) result
    touchManagedPtr clock
    return result'

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

{- |
The function prototype of the callback.
-}
type ClockCallback =
    Gst.Clock.Clock
    {- ^ /@clock@/: The clock that triggered the callback -}
    -> Word64
    {- ^ /@time@/: The time it was triggered -}
    -> Ptr ()
    {- ^ /@id@/: The @/GstClockID/@ that expired -}
    -> IO Bool
    {- ^ __Returns:__ 'True' or 'False' (currently unused) -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClockCallback`@.
noClockCallback :: Maybe ClockCallback
noClockCallback = Nothing

{- |
The function prototype of the callback.
-}
type ClockCallback_WithClosures =
    Gst.Clock.Clock
    {- ^ /@clock@/: The clock that triggered the callback -}
    -> Word64
    {- ^ /@time@/: The time it was triggered -}
    -> Ptr ()
    {- ^ /@id@/: The @/GstClockID/@ that expired -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed in the 'GI.Gst.Objects.Clock.clockIdWaitAsync' function -}
    -> IO Bool
    {- ^ __Returns:__ 'True' or 'False' (currently unused) -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `ClockCallback_WithClosures`@.
noClockCallback_WithClosures :: Maybe ClockCallback_WithClosures
noClockCallback_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ClockCallback :: ClockCallback -> ClockCallback_WithClosures
drop_closures_ClockCallback _f clock time id _ = _f clock time id

-- | Wrap the callback into a `GClosure`.
genClosure_ClockCallback :: MonadIO m => ClockCallback -> m (GClosure C_ClockCallback)
genClosure_ClockCallback cb = liftIO $ do
    let cb' = drop_closures_ClockCallback cb
    let cb'' = wrap_ClockCallback Nothing cb'
    mk_ClockCallback cb'' >>= B.GClosure.newGClosure


-- | Wrap a `ClockCallback` into a `C_ClockCallback`.
wrap_ClockCallback ::
    Maybe (Ptr (FunPtr C_ClockCallback)) ->
    ClockCallback_WithClosures ->
    C_ClockCallback
wrap_ClockCallback funptrptr _cb clock time id userData = do
    clock' <- (newObject Gst.Clock.Clock) clock
    result <- _cb  clock' time id userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback CapsMapFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the map operation should continue, %FALSE if\nthe map operation should stop with %FALSE.", sinceVersion = Nothing}, args = [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCapsFeatures", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStructure", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called in gst_caps_map_in_place(). The function\nmay modify @features and @structure.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_CapsMapFunc =
    Ptr Gst.CapsFeatures.CapsFeatures ->
    Ptr Gst.Structure.Structure ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCapsFeatures", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStructure", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CapsMapFunc :: FunPtr C_CapsMapFunc -> C_CapsMapFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CapsMapFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_CapsMapFunc
    -> Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the map operation should continue, 'False' if
the map operation should stop with 'False'. -}
dynamic_CapsMapFunc __funPtr features structure userData = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    structure' <- unsafeManagedPtrGetPtr structure
    result <- (__dynamic_C_CapsMapFunc __funPtr) features' structure' userData
    let result' = (/= 0) result
    touchManagedPtr features
    touchManagedPtr structure
    return result'

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

{- |
A function that will be called in 'GI.Gst.Structs.Caps.capsMapInPlace'. The function
may modify /@features@/ and /@structure@/.
-}
type CapsMapFunc =
    Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the map operation should continue, 'False' if
the map operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `CapsMapFunc`@.
noCapsMapFunc :: Maybe CapsMapFunc
noCapsMapFunc = Nothing

{- |
A function that will be called in 'GI.Gst.Structs.Caps.capsMapInPlace'. The function
may modify /@features@/ and /@structure@/.
-}
type CapsMapFunc_WithClosures =
    Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the map operation should continue, 'False' if
the map operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `CapsMapFunc_WithClosures`@.
noCapsMapFunc_WithClosures :: Maybe CapsMapFunc_WithClosures
noCapsMapFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CapsMapFunc :: CapsMapFunc -> CapsMapFunc_WithClosures
drop_closures_CapsMapFunc _f features structure _ = _f features structure

-- | Wrap the callback into a `GClosure`.
genClosure_CapsMapFunc :: MonadIO m => CapsMapFunc -> m (GClosure C_CapsMapFunc)
genClosure_CapsMapFunc cb = liftIO $ do
    let cb' = drop_closures_CapsMapFunc cb
    let cb'' = wrap_CapsMapFunc Nothing cb'
    mk_CapsMapFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `CapsMapFunc` into a `C_CapsMapFunc`.
wrap_CapsMapFunc ::
    Maybe (Ptr (FunPtr C_CapsMapFunc)) ->
    CapsMapFunc_WithClosures ->
    C_CapsMapFunc
wrap_CapsMapFunc funptrptr _cb features structure userData = do
    B.ManagedPtr.withTransient Gst.CapsFeatures.CapsFeatures features $ \features' -> do
        B.ManagedPtr.withTransient Gst.Structure.Structure structure $ \structure' -> do
            result <- _cb  features' structure' userData
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback CapsForeachFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the foreach operation should continue, %FALSE if\nthe foreach operation should stop with %FALSE.", sinceVersion = Nothing}, args = [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCapsFeatures", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStructure", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called in gst_caps_foreach(). The function may\nnot modify @features or @structure.", sinceVersion = Just "1.6"}}
-- | Type for the callback on the (unwrapped) C side.
type C_CapsForeachFunc =
    Ptr Gst.CapsFeatures.CapsFeatures ->
    Ptr Gst.Structure.Structure ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCapsFeatures", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStructure", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CapsForeachFunc :: FunPtr C_CapsForeachFunc -> C_CapsForeachFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CapsForeachFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_CapsForeachFunc
    -> Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the foreach operation should continue, 'False' if
the foreach operation should stop with 'False'. -}
dynamic_CapsForeachFunc __funPtr features structure userData = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    structure' <- unsafeManagedPtrGetPtr structure
    result <- (__dynamic_C_CapsForeachFunc __funPtr) features' structure' userData
    let result' = (/= 0) result
    touchManagedPtr features
    touchManagedPtr structure
    return result'

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

{- |
A function that will be called in 'GI.Gst.Structs.Caps.capsForeach'. The function may
not modify /@features@/ or /@structure@/.

/Since: 1.6/
-}
type CapsForeachFunc =
    Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the foreach operation should continue, 'False' if
the foreach operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `CapsForeachFunc`@.
noCapsForeachFunc :: Maybe CapsForeachFunc
noCapsForeachFunc = Nothing

{- |
A function that will be called in 'GI.Gst.Structs.Caps.capsForeach'. The function may
not modify /@features@/ or /@structure@/.

/Since: 1.6/
-}
type CapsForeachFunc_WithClosures =
    Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the foreach operation should continue, 'False' if
the foreach operation should stop with 'False'. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `CapsForeachFunc_WithClosures`@.
noCapsForeachFunc_WithClosures :: Maybe CapsForeachFunc_WithClosures
noCapsForeachFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CapsForeachFunc :: CapsForeachFunc -> CapsForeachFunc_WithClosures
drop_closures_CapsForeachFunc _f features structure _ = _f features structure

-- | Wrap the callback into a `GClosure`.
genClosure_CapsForeachFunc :: MonadIO m => CapsForeachFunc -> m (GClosure C_CapsForeachFunc)
genClosure_CapsForeachFunc cb = liftIO $ do
    let cb' = drop_closures_CapsForeachFunc cb
    let cb'' = wrap_CapsForeachFunc Nothing cb'
    mk_CapsForeachFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `CapsForeachFunc` into a `C_CapsForeachFunc`.
wrap_CapsForeachFunc ::
    Maybe (Ptr (FunPtr C_CapsForeachFunc)) ->
    CapsForeachFunc_WithClosures ->
    C_CapsForeachFunc
wrap_CapsForeachFunc funptrptr _cb features structure userData = do
    B.ManagedPtr.withTransient Gst.CapsFeatures.CapsFeatures features $ \features' -> do
        B.ManagedPtr.withTransient Gst.Structure.Structure structure $ \structure' -> do
            result <- _cb  features' structure' userData
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback CapsFilterMapFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the features and structure should be preserved,\n%FALSE if it should be removed.", sinceVersion = Nothing}, args = [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCapsFeatures", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStructure", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called in gst_caps_filter_and_map_in_place().\nThe function may modify @features and @structure, and both will be\nremoved from the caps if %FALSE is returned.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_CapsFilterMapFunc =
    Ptr Gst.CapsFeatures.CapsFeatures ->
    Ptr Gst.Structure.Structure ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCapsFeatures", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStructure", 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 = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CapsFilterMapFunc :: FunPtr C_CapsFilterMapFunc -> C_CapsFilterMapFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CapsFilterMapFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_CapsFilterMapFunc
    -> Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the features and structure should be preserved,
'False' if it should be removed. -}
dynamic_CapsFilterMapFunc __funPtr features structure userData = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    structure' <- unsafeManagedPtrGetPtr structure
    result <- (__dynamic_C_CapsFilterMapFunc __funPtr) features' structure' userData
    let result' = (/= 0) result
    touchManagedPtr features
    touchManagedPtr structure
    return result'

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

{- |
A function that will be called in 'GI.Gst.Structs.Caps.capsFilterAndMapInPlace'.
The function may modify /@features@/ and /@structure@/, and both will be
removed from the caps if 'False' is returned.
-}
type CapsFilterMapFunc =
    Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the features and structure should be preserved,
'False' if it should be removed. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `CapsFilterMapFunc`@.
noCapsFilterMapFunc :: Maybe CapsFilterMapFunc
noCapsFilterMapFunc = Nothing

{- |
A function that will be called in 'GI.Gst.Structs.Caps.capsFilterAndMapInPlace'.
The function may modify /@features@/ and /@structure@/, and both will be
removed from the caps if 'False' is returned.
-}
type CapsFilterMapFunc_WithClosures =
    Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the 'GI.Gst.Structs.Structure.Structure' -}
    -> Ptr ()
    {- ^ /@userData@/: user data -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the features and structure should be preserved,
'False' if it should be removed. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `CapsFilterMapFunc_WithClosures`@.
noCapsFilterMapFunc_WithClosures :: Maybe CapsFilterMapFunc_WithClosures
noCapsFilterMapFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CapsFilterMapFunc :: CapsFilterMapFunc -> CapsFilterMapFunc_WithClosures
drop_closures_CapsFilterMapFunc _f features structure _ = _f features structure

-- | Wrap the callback into a `GClosure`.
genClosure_CapsFilterMapFunc :: MonadIO m => CapsFilterMapFunc -> m (GClosure C_CapsFilterMapFunc)
genClosure_CapsFilterMapFunc cb = liftIO $ do
    let cb' = drop_closures_CapsFilterMapFunc cb
    let cb'' = wrap_CapsFilterMapFunc Nothing cb'
    mk_CapsFilterMapFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `CapsFilterMapFunc` into a `C_CapsFilterMapFunc`.
wrap_CapsFilterMapFunc ::
    Maybe (Ptr (FunPtr C_CapsFilterMapFunc)) ->
    CapsFilterMapFunc_WithClosures ->
    C_CapsFilterMapFunc
wrap_CapsFilterMapFunc funptrptr _cb features structure userData = do
    B.ManagedPtr.withTransient Gst.CapsFeatures.CapsFeatures features $ \features' -> do
        B.ManagedPtr.withTransient Gst.Structure.Structure structure $ \structure' -> do
            result <- _cb  features' structure' userData
            maybeReleaseFunPtr funptrptr
            let result' = (fromIntegral . fromEnum) result
            return result'


-- callback BusSyncHandler
--          -> Callable {returnType = Just (TInterface (Name {namespace = "Gst", name = "BusSyncReply"})), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "#GstBusSyncReply stating what to do with the message", sinceVersion = Nothing}, args = [Arg {argCName = "bus", argType = TInterface (Name {namespace = "Gst", name = "Bus"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBus that sent the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstMessage", 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 that has been given, when registering the handler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Handler will be invoked synchronously, when a new message has been injected\ninto the bus. This function is mostly used internally. Only one sync handler\ncan be attached to a given bus.\n\nIf the handler returns GST_BUS_DROP, it should unref the message, else the\nmessage should not be unreffed by the sync handler.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_BusSyncHandler =
    Ptr Gst.Bus.Bus ->
    Ptr Gst.Message.Message ->
    Ptr () ->
    IO CUInt

-- Args : [Arg {argCName = "bus", argType = TInterface (Name {namespace = "Gst", name = "Bus"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBus that sent the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstMessage", 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 that has been given, when registering the handler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "BusSyncReply"}))
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_BusSyncHandler :: FunPtr C_BusSyncHandler -> C_BusSyncHandler

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BusSyncHandler ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Bus.IsBus a) =>
    FunPtr C_BusSyncHandler
    -> a
    {- ^ /@bus@/: the 'GI.Gst.Objects.Bus.Bus' that sent the message -}
    -> Gst.Message.Message
    {- ^ /@message@/: the 'GI.Gst.Structs.Message.Message' -}
    -> Ptr ()
    {- ^ /@userData@/: user data that has been given, when registering the handler -}
    -> m Gst.Enums.BusSyncReply
    {- ^ __Returns:__ 'GI.Gst.Enums.BusSyncReply' stating what to do with the message -}
dynamic_BusSyncHandler __funPtr bus message userData = liftIO $ do
    bus' <- unsafeManagedPtrCastPtr bus
    message' <- unsafeManagedPtrGetPtr message
    result <- (__dynamic_C_BusSyncHandler __funPtr) bus' message' userData
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr bus
    touchManagedPtr message
    return result'

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

{- |
Handler will be invoked synchronously, when a new message has been injected
into the bus. This function is mostly used internally. Only one sync handler
can be attached to a given bus.

If the handler returns GST_BUS_DROP, it should unref the message, else the
message should not be unreffed by the sync handler.
-}
type BusSyncHandler =
    Gst.Bus.Bus
    {- ^ /@bus@/: the 'GI.Gst.Objects.Bus.Bus' that sent the message -}
    -> Gst.Message.Message
    {- ^ /@message@/: the 'GI.Gst.Structs.Message.Message' -}
    -> IO Gst.Enums.BusSyncReply
    {- ^ __Returns:__ 'GI.Gst.Enums.BusSyncReply' stating what to do with the message -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusSyncHandler`@.
noBusSyncHandler :: Maybe BusSyncHandler
noBusSyncHandler = Nothing

{- |
Handler will be invoked synchronously, when a new message has been injected
into the bus. This function is mostly used internally. Only one sync handler
can be attached to a given bus.

If the handler returns GST_BUS_DROP, it should unref the message, else the
message should not be unreffed by the sync handler.
-}
type BusSyncHandler_WithClosures =
    Gst.Bus.Bus
    {- ^ /@bus@/: the 'GI.Gst.Objects.Bus.Bus' that sent the message -}
    -> Gst.Message.Message
    {- ^ /@message@/: the 'GI.Gst.Structs.Message.Message' -}
    -> Ptr ()
    {- ^ /@userData@/: user data that has been given, when registering the handler -}
    -> IO Gst.Enums.BusSyncReply
    {- ^ __Returns:__ 'GI.Gst.Enums.BusSyncReply' stating what to do with the message -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusSyncHandler_WithClosures`@.
noBusSyncHandler_WithClosures :: Maybe BusSyncHandler_WithClosures
noBusSyncHandler_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BusSyncHandler :: BusSyncHandler -> BusSyncHandler_WithClosures
drop_closures_BusSyncHandler _f bus message _ = _f bus message

-- | Wrap the callback into a `GClosure`.
genClosure_BusSyncHandler :: MonadIO m => BusSyncHandler -> m (GClosure C_BusSyncHandler)
genClosure_BusSyncHandler cb = liftIO $ do
    let cb' = drop_closures_BusSyncHandler cb
    let cb'' = wrap_BusSyncHandler Nothing cb'
    mk_BusSyncHandler cb'' >>= B.GClosure.newGClosure


-- | Wrap a `BusSyncHandler` into a `C_BusSyncHandler`.
wrap_BusSyncHandler ::
    Maybe (Ptr (FunPtr C_BusSyncHandler)) ->
    BusSyncHandler_WithClosures ->
    C_BusSyncHandler
wrap_BusSyncHandler funptrptr _cb bus message userData = do
    bus' <- (newObject Gst.Bus.Bus) bus
    B.ManagedPtr.withTransient Gst.Message.Message message $ \message' -> do
        result <- _cb  bus' message' userData
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback BusFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%FALSE if the event source should be removed.", sinceVersion = Nothing}, args = [Arg {argCName = "bus", argType = TInterface (Name {namespace = "Gst", name = "Bus"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBus that sent the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstMessage", 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 that has been given, when registering the handler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Specifies the type of function passed to gst_bus_add_watch() or\ngst_bus_add_watch_full(), which is called from the mainloop when a message\nis available on the bus.\n\nThe message passed to the function will be unreffed after execution of this\nfunction so it should not be freed in the function.\n\nNote that this function is used as a GSourceFunc which means that returning\n%FALSE will remove the GSource from the mainloop.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_BusFunc =
    Ptr Gst.Bus.Bus ->
    Ptr Gst.Message.Message ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "bus", argType = TInterface (Name {namespace = "Gst", name = "Bus"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBus that sent the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstMessage", 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 that has been given, when registering the handler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_BusFunc :: FunPtr C_BusFunc -> C_BusFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BusFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Bus.IsBus a) =>
    FunPtr C_BusFunc
    -> a
    {- ^ /@bus@/: the 'GI.Gst.Objects.Bus.Bus' that sent the message -}
    -> Gst.Message.Message
    {- ^ /@message@/: the 'GI.Gst.Structs.Message.Message' -}
    -> Ptr ()
    {- ^ /@userData@/: user data that has been given, when registering the handler -}
    -> m Bool
    {- ^ __Returns:__ 'False' if the event source should be removed. -}
dynamic_BusFunc __funPtr bus message userData = liftIO $ do
    bus' <- unsafeManagedPtrCastPtr bus
    message' <- unsafeManagedPtrGetPtr message
    result <- (__dynamic_C_BusFunc __funPtr) bus' message' userData
    let result' = (/= 0) result
    touchManagedPtr bus
    touchManagedPtr message
    return result'

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

{- |
Specifies the type of function passed to @/gst_bus_add_watch()/@ or
'GI.Gst.Objects.Bus.busAddWatch', which is called from the mainloop when a message
is available on the bus.

The message passed to the function will be unreffed after execution of this
function so it should not be freed in the function.

Note that this function is used as a GSourceFunc which means that returning
'False' will remove the GSource from the mainloop.
-}
type BusFunc =
    Gst.Bus.Bus
    {- ^ /@bus@/: the 'GI.Gst.Objects.Bus.Bus' that sent the message -}
    -> Gst.Message.Message
    {- ^ /@message@/: the 'GI.Gst.Structs.Message.Message' -}
    -> IO Bool
    {- ^ __Returns:__ 'False' if the event source should be removed. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusFunc`@.
noBusFunc :: Maybe BusFunc
noBusFunc = Nothing

{- |
Specifies the type of function passed to @/gst_bus_add_watch()/@ or
'GI.Gst.Objects.Bus.busAddWatch', which is called from the mainloop when a message
is available on the bus.

The message passed to the function will be unreffed after execution of this
function so it should not be freed in the function.

Note that this function is used as a GSourceFunc which means that returning
'False' will remove the GSource from the mainloop.
-}
type BusFunc_WithClosures =
    Gst.Bus.Bus
    {- ^ /@bus@/: the 'GI.Gst.Objects.Bus.Bus' that sent the message -}
    -> Gst.Message.Message
    {- ^ /@message@/: the 'GI.Gst.Structs.Message.Message' -}
    -> Ptr ()
    {- ^ /@userData@/: user data that has been given, when registering the handler -}
    -> IO Bool
    {- ^ __Returns:__ 'False' if the event source should be removed. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusFunc_WithClosures`@.
noBusFunc_WithClosures :: Maybe BusFunc_WithClosures
noBusFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BusFunc :: BusFunc -> BusFunc_WithClosures
drop_closures_BusFunc _f bus message _ = _f bus message

-- | Wrap the callback into a `GClosure`.
genClosure_BusFunc :: MonadIO m => BusFunc -> m (GClosure C_BusFunc)
genClosure_BusFunc cb = liftIO $ do
    let cb' = drop_closures_BusFunc cb
    let cb'' = wrap_BusFunc Nothing cb'
    mk_BusFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `BusFunc` into a `C_BusFunc`.
wrap_BusFunc ::
    Maybe (Ptr (FunPtr C_BusFunc)) ->
    BusFunc_WithClosures ->
    C_BusFunc
wrap_BusFunc funptrptr _cb bus message userData = do
    bus' <- (newObject Gst.Bus.Bus) bus
    B.ManagedPtr.withTransient Gst.Message.Message message $ \message' -> do
        result <- _cb  bus' message' userData
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'


-- callback BufferListFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%FALSE when gst_buffer_list_foreach() should stop", sinceVersion = Nothing}, args = [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index of @buffer", 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_buffer_list_foreach()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called from gst_buffer_list_foreach(). The @buffer\nfield will point to a the reference of the buffer at @idx.\n\nWhen this function returns %TRUE, the next buffer will be\nreturned. When %FALSE is returned, gst_buffer_list_foreach() will return.\n\nWhen @buffer is set to %NULL, the item will be removed from the bufferlist.\nWhen @buffer has been made writable, the new buffer reference can be assigned\nto @buffer. This function is responsible for unreffing the old buffer when\nremoving or modifying.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_BufferListFunc =
    Ptr (Ptr Gst.Buffer.Buffer) ->
    Word32 ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index of @buffer", 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_buffer_list_foreach()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_BufferListFunc :: FunPtr C_BufferListFunc -> C_BufferListFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BufferListFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_BufferListFunc
    -> Word32
    {- ^ /@idx@/: the index of /@buffer@/ -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.Gst.Structs.BufferList.bufferListForeach' -}
    -> m ((Bool, Maybe Gst.Buffer.Buffer))
    {- ^ __Returns:__ 'False' when 'GI.Gst.Structs.BufferList.bufferListForeach' should stop -}
dynamic_BufferListFunc __funPtr idx userData = liftIO $ do
    buffer <- allocMem :: IO (Ptr (Ptr Gst.Buffer.Buffer))
    result <- (__dynamic_C_BufferListFunc __funPtr) buffer idx userData
    let result' = (/= 0) result
    buffer' <- peek buffer
    maybeBuffer' <- convertIfNonNull buffer' $ \buffer'' -> do
        buffer''' <- (wrapBoxed Gst.Buffer.Buffer) buffer''
        return buffer'''
    freeMem buffer
    return (result', maybeBuffer')

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

{- |
A function that will be called from 'GI.Gst.Structs.BufferList.bufferListForeach'. The /@buffer@/
field will point to a the reference of the buffer at /@idx@/.

When this function returns 'True', the next buffer will be
returned. When 'False' is returned, 'GI.Gst.Structs.BufferList.bufferListForeach' will return.

When /@buffer@/ is set to 'Nothing', the item will be removed from the bufferlist.
When /@buffer@/ has been made writable, the new buffer reference can be assigned
to /@buffer@/. This function is responsible for unreffing the old buffer when
removing or modifying.
-}
type BufferListFunc =
    Word32
    {- ^ /@idx@/: the index of /@buffer@/ -}
    -> IO ((Bool, Maybe Gst.Buffer.Buffer))
    {- ^ __Returns:__ 'False' when 'GI.Gst.Structs.BufferList.bufferListForeach' should stop -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BufferListFunc`@.
noBufferListFunc :: Maybe BufferListFunc
noBufferListFunc = Nothing

{- |
A function that will be called from 'GI.Gst.Structs.BufferList.bufferListForeach'. The /@buffer@/
field will point to a the reference of the buffer at /@idx@/.

When this function returns 'True', the next buffer will be
returned. When 'False' is returned, 'GI.Gst.Structs.BufferList.bufferListForeach' will return.

When /@buffer@/ is set to 'Nothing', the item will be removed from the bufferlist.
When /@buffer@/ has been made writable, the new buffer reference can be assigned
to /@buffer@/. This function is responsible for unreffing the old buffer when
removing or modifying.
-}
type BufferListFunc_WithClosures =
    Word32
    {- ^ /@idx@/: the index of /@buffer@/ -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.Gst.Structs.BufferList.bufferListForeach' -}
    -> IO ((Bool, Maybe Gst.Buffer.Buffer))
    {- ^ __Returns:__ 'False' when 'GI.Gst.Structs.BufferList.bufferListForeach' should stop -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BufferListFunc_WithClosures`@.
noBufferListFunc_WithClosures :: Maybe BufferListFunc_WithClosures
noBufferListFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BufferListFunc :: BufferListFunc -> BufferListFunc_WithClosures
drop_closures_BufferListFunc _f idx _ = _f idx

-- | Wrap the callback into a `GClosure`.
genClosure_BufferListFunc :: MonadIO m => BufferListFunc -> m (GClosure C_BufferListFunc)
genClosure_BufferListFunc cb = liftIO $ do
    let cb' = drop_closures_BufferListFunc cb
    let cb'' = wrap_BufferListFunc Nothing cb'
    mk_BufferListFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `BufferListFunc` into a `C_BufferListFunc`.
wrap_BufferListFunc ::
    Maybe (Ptr (FunPtr C_BufferListFunc)) ->
    BufferListFunc_WithClosures ->
    C_BufferListFunc
wrap_BufferListFunc funptrptr _cb buffer idx userData = do
    (result, outbuffer) <- _cb  idx userData
    outbuffer' <- case outbuffer of
        Nothing -> return nullPtr
        Just outbuffer' -> do
            outbuffer'' <- B.ManagedPtr.disownBoxed outbuffer'
            return outbuffer''
    poke buffer outbuffer'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback BufferForeachMetaFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%FALSE when gst_buffer_foreach_meta() should stop", sinceVersion = Nothing}, args = [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a pointer to a #GstMeta", 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_buffer_foreach_meta()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A function that will be called from gst_buffer_foreach_meta(). The @meta\nfield will point to a the reference of the meta.\n\n@buffer should not be modified from this callback.\n\nWhen this function returns %TRUE, the next meta will be\nreturned. When %FALSE is returned, gst_buffer_foreach_meta() will return.\n\nWhen @meta is set to %NULL, the item will be removed from the buffer.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_BufferForeachMetaFunc =
    Ptr Gst.Buffer.Buffer ->
    Ptr (Ptr Gst.Meta.Meta) ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a pointer to a #GstMeta", 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_buffer_foreach_meta()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_BufferForeachMetaFunc :: FunPtr C_BufferForeachMetaFunc -> C_BufferForeachMetaFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_BufferForeachMetaFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_BufferForeachMetaFunc
    -> Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.Gst.Structs.Buffer.bufferForeachMeta' -}
    -> m ((Bool, Maybe Gst.Meta.Meta))
    {- ^ __Returns:__ 'False' when 'GI.Gst.Structs.Buffer.bufferForeachMeta' should stop -}
dynamic_BufferForeachMetaFunc __funPtr buffer userData = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    meta <- allocMem :: IO (Ptr (Ptr Gst.Meta.Meta))
    result <- (__dynamic_C_BufferForeachMetaFunc __funPtr) buffer' meta userData
    let result' = (/= 0) result
    meta' <- peek meta
    maybeMeta' <- convertIfNonNull meta' $ \meta'' -> do
        meta''' <- (wrapPtr Gst.Meta.Meta) meta''
        return meta'''
    touchManagedPtr buffer
    freeMem meta
    return (result', maybeMeta')

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

{- |
A function that will be called from 'GI.Gst.Structs.Buffer.bufferForeachMeta'. The /@meta@/
field will point to a the reference of the meta.

/@buffer@/ should not be modified from this callback.

When this function returns 'True', the next meta will be
returned. When 'False' is returned, 'GI.Gst.Structs.Buffer.bufferForeachMeta' will return.

When /@meta@/ is set to 'Nothing', the item will be removed from the buffer.
-}
type BufferForeachMetaFunc =
    Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> IO ((Bool, Maybe Gst.Meta.Meta))
    {- ^ __Returns:__ 'False' when 'GI.Gst.Structs.Buffer.bufferForeachMeta' should stop -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BufferForeachMetaFunc`@.
noBufferForeachMetaFunc :: Maybe BufferForeachMetaFunc
noBufferForeachMetaFunc = Nothing

{- |
A function that will be called from 'GI.Gst.Structs.Buffer.bufferForeachMeta'. The /@meta@/
field will point to a the reference of the meta.

/@buffer@/ should not be modified from this callback.

When this function returns 'True', the next meta will be
returned. When 'False' is returned, 'GI.Gst.Structs.Buffer.bufferForeachMeta' will return.

When /@meta@/ is set to 'Nothing', the item will be removed from the buffer.
-}
type BufferForeachMetaFunc_WithClosures =
    Gst.Buffer.Buffer
    {- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to 'GI.Gst.Structs.Buffer.bufferForeachMeta' -}
    -> IO ((Bool, Maybe Gst.Meta.Meta))
    {- ^ __Returns:__ 'False' when 'GI.Gst.Structs.Buffer.bufferForeachMeta' should stop -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `BufferForeachMetaFunc_WithClosures`@.
noBufferForeachMetaFunc_WithClosures :: Maybe BufferForeachMetaFunc_WithClosures
noBufferForeachMetaFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_BufferForeachMetaFunc :: BufferForeachMetaFunc -> BufferForeachMetaFunc_WithClosures
drop_closures_BufferForeachMetaFunc _f buffer _ = _f buffer

-- | Wrap the callback into a `GClosure`.
genClosure_BufferForeachMetaFunc :: MonadIO m => BufferForeachMetaFunc -> m (GClosure C_BufferForeachMetaFunc)
genClosure_BufferForeachMetaFunc cb = liftIO $ do
    let cb' = drop_closures_BufferForeachMetaFunc cb
    let cb'' = wrap_BufferForeachMetaFunc Nothing cb'
    mk_BufferForeachMetaFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `BufferForeachMetaFunc` into a `C_BufferForeachMetaFunc`.
wrap_BufferForeachMetaFunc ::
    Maybe (Ptr (FunPtr C_BufferForeachMetaFunc)) ->
    BufferForeachMetaFunc_WithClosures ->
    C_BufferForeachMetaFunc
wrap_BufferForeachMetaFunc funptrptr _cb buffer meta userData = do
    B.ManagedPtr.withTransient Gst.Buffer.Buffer buffer $ \buffer' -> do
        (result, outmeta) <- _cb  buffer' userData
        outmeta' <- case outmeta of
            Nothing -> return nullPtr
            Just outmeta' -> do
                outmeta'' <- unsafeManagedPtrGetPtr outmeta'
                return outmeta''
        poke meta outmeta'
        maybeReleaseFunPtr funptrptr
        let result' = (fromIntegral . fromEnum) result
        return result'