{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.Gst.Objects.Bus.Bus' is an object responsible for delivering t'GI.Gst.Structs.Message.Message' packets in
-- a first-in first-out way from the streaming threads (see t'GI.Gst.Objects.Task.Task') to the
-- application.
-- 
-- Since the application typically only wants to deal with delivery of these
-- messages from one thread, the GstBus will marshall the messages between
-- different threads. This is important since the actual streaming of media
-- is done in another thread than the application.
-- 
-- The GstBus provides support for t'GI.GLib.Structs.Source.Source' based notifications. This makes it
-- possible to handle the delivery in the glib mainloop.
-- 
-- The t'GI.GLib.Structs.Source.Source' callback function 'GI.Gst.Objects.Bus.busAsyncSignalFunc' can be used to
-- convert all bus messages into signal emissions.
-- 
-- A message is posted on the bus with the 'GI.Gst.Objects.Bus.busPost' method. With the
-- 'GI.Gst.Objects.Bus.busPeek' and 'GI.Gst.Objects.Bus.busPop' methods one can look at or retrieve a
-- previously posted message.
-- 
-- The bus can be polled with the 'GI.Gst.Objects.Bus.busPoll' method. This methods blocks
-- up to the specified timeout value until one of the specified messages types
-- is posted on the bus. The application can then 'GI.Gst.Objects.Bus.busPop' the messages
-- from the bus to handle them.
-- Alternatively the application can register an asynchronous bus function
-- using 'GI.Gst.Objects.Bus.busAddWatch' or @/gst_bus_add_watch()/@. This function will
-- install a t'GI.GLib.Structs.Source.Source' in the default glib main loop and will deliver messages
-- a short while after they have been posted. Note that the main loop should
-- be running for the asynchronous callbacks.
-- 
-- It is also possible to get messages from the bus without any thread
-- marshalling with the 'GI.Gst.Objects.Bus.busSetSyncHandler' method. This makes it
-- possible to react to a message in the same thread that posted the
-- message on the bus. This should only be used if the application is able
-- to deal with messages from different threads.
-- 
-- Every t'GI.Gst.Objects.Pipeline.Pipeline' has one bus.
-- 
-- Note that a t'GI.Gst.Objects.Pipeline.Pipeline' will set its bus into flushing state when changing
-- from READY to NULL state.

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

module GI.Gst.Objects.Bus
    ( 

-- * Exported types
    Bus(..)                                 ,
    IsBus                                   ,
    toBus                                   ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addControlBinding]("GI.Gst.Objects.Object#g:method:addControlBinding"), [addSignalWatch]("GI.Gst.Objects.Bus#g:method:addSignalWatch"), [addSignalWatchFull]("GI.Gst.Objects.Bus#g:method:addSignalWatchFull"), [addWatch]("GI.Gst.Objects.Bus#g:method:addWatch"), [asyncSignalFunc]("GI.Gst.Objects.Bus#g:method:asyncSignalFunc"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [createWatch]("GI.Gst.Objects.Bus#g:method:createWatch"), [defaultError]("GI.Gst.Objects.Object#g:method:defaultError"), [disableSyncMessageEmission]("GI.Gst.Objects.Bus#g:method:disableSyncMessageEmission"), [enableSyncMessageEmission]("GI.Gst.Objects.Bus#g:method:enableSyncMessageEmission"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasActiveControlBindings]("GI.Gst.Objects.Object#g:method:hasActiveControlBindings"), [hasAncestor]("GI.Gst.Objects.Object#g:method:hasAncestor"), [hasAsAncestor]("GI.Gst.Objects.Object#g:method:hasAsAncestor"), [hasAsParent]("GI.Gst.Objects.Object#g:method:hasAsParent"), [havePending]("GI.Gst.Objects.Bus#g:method:havePending"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [peek]("GI.Gst.Objects.Bus#g:method:peek"), [poll]("GI.Gst.Objects.Bus#g:method:poll"), [pop]("GI.Gst.Objects.Bus#g:method:pop"), [popFiltered]("GI.Gst.Objects.Bus#g:method:popFiltered"), [post]("GI.Gst.Objects.Bus#g:method:post"), [ref]("GI.Gst.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [removeControlBinding]("GI.Gst.Objects.Object#g:method:removeControlBinding"), [removeSignalWatch]("GI.Gst.Objects.Bus#g:method:removeSignalWatch"), [removeWatch]("GI.Gst.Objects.Bus#g:method:removeWatch"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [suggestNextSync]("GI.Gst.Objects.Object#g:method:suggestNextSync"), [syncSignalHandler]("GI.Gst.Objects.Bus#g:method:syncSignalHandler"), [syncValues]("GI.Gst.Objects.Object#g:method:syncValues"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [timedPop]("GI.Gst.Objects.Bus#g:method:timedPop"), [timedPopFiltered]("GI.Gst.Objects.Bus#g:method:timedPopFiltered"), [unparent]("GI.Gst.Objects.Object#g:method:unparent"), [unref]("GI.Gst.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getControlBinding]("GI.Gst.Objects.Object#g:method:getControlBinding"), [getControlRate]("GI.Gst.Objects.Object#g:method:getControlRate"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getGValueArray]("GI.Gst.Objects.Object#g:method:getGValueArray"), [getName]("GI.Gst.Objects.Object#g:method:getName"), [getParent]("GI.Gst.Objects.Object#g:method:getParent"), [getPathString]("GI.Gst.Objects.Object#g:method:getPathString"), [getPollfd]("GI.Gst.Objects.Bus#g:method:getPollfd"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getValue]("GI.Gst.Objects.Object#g:method:getValue").
-- 
-- ==== Setters
-- [setControlBindingDisabled]("GI.Gst.Objects.Object#g:method:setControlBindingDisabled"), [setControlBindingsDisabled]("GI.Gst.Objects.Object#g:method:setControlBindingsDisabled"), [setControlRate]("GI.Gst.Objects.Object#g:method:setControlRate"), [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setFlushing]("GI.Gst.Objects.Bus#g:method:setFlushing"), [setName]("GI.Gst.Objects.Object#g:method:setName"), [setParent]("GI.Gst.Objects.Object#g:method:setParent"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setSyncHandler]("GI.Gst.Objects.Bus#g:method:setSyncHandler").

#if defined(ENABLE_OVERLOADING)
    ResolveBusMethod                        ,
#endif

-- ** addSignalWatch #method:addSignalWatch#

#if defined(ENABLE_OVERLOADING)
    BusAddSignalWatchMethodInfo             ,
#endif
    busAddSignalWatch                       ,


-- ** addSignalWatchFull #method:addSignalWatchFull#

#if defined(ENABLE_OVERLOADING)
    BusAddSignalWatchFullMethodInfo         ,
#endif
    busAddSignalWatchFull                   ,


-- ** addWatch #method:addWatch#

#if defined(ENABLE_OVERLOADING)
    BusAddWatchMethodInfo                   ,
#endif
    busAddWatch                             ,


-- ** asyncSignalFunc #method:asyncSignalFunc#

#if defined(ENABLE_OVERLOADING)
    BusAsyncSignalFuncMethodInfo            ,
#endif
    busAsyncSignalFunc                      ,


-- ** createWatch #method:createWatch#

#if defined(ENABLE_OVERLOADING)
    BusCreateWatchMethodInfo                ,
#endif
    busCreateWatch                          ,


-- ** disableSyncMessageEmission #method:disableSyncMessageEmission#

#if defined(ENABLE_OVERLOADING)
    BusDisableSyncMessageEmissionMethodInfo ,
#endif
    busDisableSyncMessageEmission           ,


-- ** enableSyncMessageEmission #method:enableSyncMessageEmission#

#if defined(ENABLE_OVERLOADING)
    BusEnableSyncMessageEmissionMethodInfo  ,
#endif
    busEnableSyncMessageEmission            ,


-- ** getPollfd #method:getPollfd#

#if defined(ENABLE_OVERLOADING)
    BusGetPollfdMethodInfo                  ,
#endif
    busGetPollfd                            ,


-- ** havePending #method:havePending#

#if defined(ENABLE_OVERLOADING)
    BusHavePendingMethodInfo                ,
#endif
    busHavePending                          ,


-- ** new #method:new#

    busNew                                  ,


-- ** peek #method:peek#

#if defined(ENABLE_OVERLOADING)
    BusPeekMethodInfo                       ,
#endif
    busPeek                                 ,


-- ** poll #method:poll#

#if defined(ENABLE_OVERLOADING)
    BusPollMethodInfo                       ,
#endif
    busPoll                                 ,


-- ** pop #method:pop#

#if defined(ENABLE_OVERLOADING)
    BusPopMethodInfo                        ,
#endif
    busPop                                  ,


-- ** popFiltered #method:popFiltered#

#if defined(ENABLE_OVERLOADING)
    BusPopFilteredMethodInfo                ,
#endif
    busPopFiltered                          ,


-- ** post #method:post#

#if defined(ENABLE_OVERLOADING)
    BusPostMethodInfo                       ,
#endif
    busPost                                 ,


-- ** removeSignalWatch #method:removeSignalWatch#

#if defined(ENABLE_OVERLOADING)
    BusRemoveSignalWatchMethodInfo          ,
#endif
    busRemoveSignalWatch                    ,


-- ** removeWatch #method:removeWatch#

#if defined(ENABLE_OVERLOADING)
    BusRemoveWatchMethodInfo                ,
#endif
    busRemoveWatch                          ,


-- ** setFlushing #method:setFlushing#

#if defined(ENABLE_OVERLOADING)
    BusSetFlushingMethodInfo                ,
#endif
    busSetFlushing                          ,


-- ** setSyncHandler #method:setSyncHandler#

#if defined(ENABLE_OVERLOADING)
    BusSetSyncHandlerMethodInfo             ,
#endif
    busSetSyncHandler                       ,


-- ** syncSignalHandler #method:syncSignalHandler#

#if defined(ENABLE_OVERLOADING)
    BusSyncSignalHandlerMethodInfo          ,
#endif
    busSyncSignalHandler                    ,


-- ** timedPop #method:timedPop#

#if defined(ENABLE_OVERLOADING)
    BusTimedPopMethodInfo                   ,
#endif
    busTimedPop                             ,


-- ** timedPopFiltered #method:timedPopFiltered#

#if defined(ENABLE_OVERLOADING)
    BusTimedPopFilteredMethodInfo           ,
#endif
    busTimedPopFiltered                     ,




 -- * Properties


-- ** enableAsync #attr:enableAsync#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    BusEnableAsyncPropertyInfo              ,
#endif
#if defined(ENABLE_OVERLOADING)
    busEnableAsync                          ,
#endif
    constructBusEnableAsync                 ,




 -- * Signals


-- ** message #signal:message#

    BusMessageCallback                      ,
#if defined(ENABLE_OVERLOADING)
    BusMessageSignalInfo                    ,
#endif
    C_BusMessageCallback                    ,
    afterBusMessage                         ,
    genClosure_BusMessage                   ,
    mk_BusMessageCallback                   ,
    noBusMessageCallback                    ,
    onBusMessage                            ,
    wrap_BusMessageCallback                 ,


-- ** syncMessage #signal:syncMessage#

    BusSyncMessageCallback                  ,
#if defined(ENABLE_OVERLOADING)
    BusSyncMessageSignalInfo                ,
#endif
    C_BusSyncMessageCallback                ,
    afterBusSyncMessage                     ,
    genClosure_BusSyncMessage               ,
    mk_BusSyncMessageCallback               ,
    noBusSyncMessageCallback                ,
    onBusSyncMessage                        ,
    wrap_BusSyncMessageCallback             ,




    ) where

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

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gst.Callbacks as Gst.Callbacks
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Structs.Message as Gst.Message

-- | Memory-managed wrapper type.
newtype Bus = Bus (SP.ManagedPtr Bus)
    deriving (Bus -> Bus -> Bool
(Bus -> Bus -> Bool) -> (Bus -> Bus -> Bool) -> Eq Bus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bus -> Bus -> Bool
$c/= :: Bus -> Bus -> Bool
== :: Bus -> Bus -> Bool
$c== :: Bus -> Bus -> Bool
Eq)

instance SP.ManagedPtrNewtype Bus where
    toManagedPtr :: Bus -> ManagedPtr Bus
toManagedPtr (Bus ManagedPtr Bus
p) = ManagedPtr Bus
p

foreign import ccall "gst_bus_get_type"
    c_gst_bus_get_type :: IO B.Types.GType

instance B.Types.TypedObject Bus where
    glibType :: IO GType
glibType = IO GType
c_gst_bus_get_type

instance B.Types.GObject Bus

-- | Type class for types which can be safely cast to `Bus`, for instance with `toBus`.
class (SP.GObject o, O.IsDescendantOf Bus o) => IsBus o
instance (SP.GObject o, O.IsDescendantOf Bus o) => IsBus o

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

-- | Cast to `Bus`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toBus :: (MIO.MonadIO m, IsBus o) => o -> m Bus
toBus :: forall (m :: * -> *) o. (MonadIO m, IsBus o) => o -> m Bus
toBus = IO Bus -> m Bus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Bus -> m Bus) -> (o -> IO Bus) -> o -> m Bus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Bus -> Bus) -> o -> IO Bus
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Bus -> Bus
Bus

-- | Convert 'Bus' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Bus) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gst_bus_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Bus -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Bus
P.Nothing = Ptr GValue -> Ptr Bus -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Bus
forall a. Ptr a
FP.nullPtr :: FP.Ptr Bus)
    gvalueSet_ Ptr GValue
gv (P.Just Bus
obj) = Bus -> (Ptr Bus -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Bus
obj (Ptr GValue -> Ptr Bus -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Bus)
gvalueGet_ Ptr GValue
gv = do
        Ptr Bus
ptr <- Ptr GValue -> IO (Ptr Bus)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Bus)
        if Ptr Bus
ptr Ptr Bus -> Ptr Bus -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Bus
forall a. Ptr a
FP.nullPtr
        then Bus -> Maybe Bus
forall a. a -> Maybe a
P.Just (Bus -> Maybe Bus) -> IO Bus -> IO (Maybe Bus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Bus -> Bus) -> Ptr Bus -> IO Bus
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Bus -> Bus
Bus Ptr Bus
ptr
        else Maybe Bus -> IO (Maybe Bus)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Bus
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveBusMethod (t :: Symbol) (o :: *) :: * where
    ResolveBusMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveBusMethod "addSignalWatch" o = BusAddSignalWatchMethodInfo
    ResolveBusMethod "addSignalWatchFull" o = BusAddSignalWatchFullMethodInfo
    ResolveBusMethod "addWatch" o = BusAddWatchMethodInfo
    ResolveBusMethod "asyncSignalFunc" o = BusAsyncSignalFuncMethodInfo
    ResolveBusMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveBusMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveBusMethod "createWatch" o = BusCreateWatchMethodInfo
    ResolveBusMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveBusMethod "disableSyncMessageEmission" o = BusDisableSyncMessageEmissionMethodInfo
    ResolveBusMethod "enableSyncMessageEmission" o = BusEnableSyncMessageEmissionMethodInfo
    ResolveBusMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveBusMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveBusMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveBusMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveBusMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveBusMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveBusMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveBusMethod "havePending" o = BusHavePendingMethodInfo
    ResolveBusMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveBusMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveBusMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveBusMethod "peek" o = BusPeekMethodInfo
    ResolveBusMethod "poll" o = BusPollMethodInfo
    ResolveBusMethod "pop" o = BusPopMethodInfo
    ResolveBusMethod "popFiltered" o = BusPopFilteredMethodInfo
    ResolveBusMethod "post" o = BusPostMethodInfo
    ResolveBusMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveBusMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveBusMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveBusMethod "removeSignalWatch" o = BusRemoveSignalWatchMethodInfo
    ResolveBusMethod "removeWatch" o = BusRemoveWatchMethodInfo
    ResolveBusMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveBusMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveBusMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveBusMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveBusMethod "syncSignalHandler" o = BusSyncSignalHandlerMethodInfo
    ResolveBusMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveBusMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveBusMethod "timedPop" o = BusTimedPopMethodInfo
    ResolveBusMethod "timedPopFiltered" o = BusTimedPopFilteredMethodInfo
    ResolveBusMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveBusMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveBusMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveBusMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveBusMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveBusMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveBusMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveBusMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveBusMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveBusMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveBusMethod "getPollfd" o = BusGetPollfdMethodInfo
    ResolveBusMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveBusMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveBusMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveBusMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveBusMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveBusMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveBusMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveBusMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveBusMethod "setFlushing" o = BusSetFlushingMethodInfo
    ResolveBusMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveBusMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveBusMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveBusMethod "setSyncHandler" o = BusSetSyncHandlerMethodInfo
    ResolveBusMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBusMethod t Bus, O.OverloadedMethod info Bus p) => OL.IsLabel t (Bus -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveBusMethod t Bus, O.OverloadedMethod info Bus p, R.HasField t Bus p) => R.HasField t Bus p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveBusMethod t Bus, O.OverloadedMethodInfo info Bus) => OL.IsLabel t (O.MethodProxy info Bus) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- signal Bus::message
-- | A message has been posted on the bus. This signal is emitted from a
-- GSource added to the mainloop. this signal will only be emitted when
-- there is a mainloop running.
type BusMessageCallback =
    Gst.Message.Message
    -- ^ /@message@/: the message that has been posted asynchronously
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusMessageCallback`@.
noBusMessageCallback :: Maybe BusMessageCallback
noBusMessageCallback :: Maybe BusMessageCallback
noBusMessageCallback = Maybe BusMessageCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_BusMessage :: MonadIO m => BusMessageCallback -> m (GClosure C_BusMessageCallback)
genClosure_BusMessage :: forall (m :: * -> *).
MonadIO m =>
BusMessageCallback -> m (GClosure C_BusMessageCallback)
genClosure_BusMessage BusMessageCallback
cb = IO (GClosure C_BusMessageCallback)
-> m (GClosure C_BusMessageCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BusMessageCallback)
 -> m (GClosure C_BusMessageCallback))
-> IO (GClosure C_BusMessageCallback)
-> m (GClosure C_BusMessageCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_BusMessageCallback
cb' = BusMessageCallback -> C_BusMessageCallback
wrap_BusMessageCallback BusMessageCallback
cb
    C_BusMessageCallback -> IO (FunPtr C_BusMessageCallback)
mk_BusMessageCallback C_BusMessageCallback
cb' IO (FunPtr C_BusMessageCallback)
-> (FunPtr C_BusMessageCallback
    -> IO (GClosure C_BusMessageCallback))
-> IO (GClosure C_BusMessageCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BusMessageCallback -> IO (GClosure C_BusMessageCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `BusMessageCallback` into a `C_BusMessageCallback`.
wrap_BusMessageCallback ::
    BusMessageCallback ->
    C_BusMessageCallback
wrap_BusMessageCallback :: BusMessageCallback -> C_BusMessageCallback
wrap_BusMessageCallback BusMessageCallback
_cb Ptr ()
_ Ptr Message
message Ptr ()
_ = do
    (ManagedPtr Message -> Message)
-> Ptr Message -> BusMessageCallback -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr Message -> Message
Gst.Message.Message Ptr Message
message (BusMessageCallback -> IO ()) -> BusMessageCallback -> IO ()
forall a b. (a -> b) -> a -> b
$ \Message
message' -> do
        BusMessageCallback
_cb  Message
message'


-- | Connect a signal handler for the [message](#signal:message) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' bus #message callback
-- @
-- 
-- This signal admits a optional parameter @detail@.
-- If it's not @Nothing@, we will connect to “@message::detail@” instead.
-- 
onBusMessage :: (IsBus a, MonadIO m) => a -> P.Maybe T.Text -> BusMessageCallback -> m SignalHandlerId
onBusMessage :: forall a (m :: * -> *).
(IsBus a, MonadIO m) =>
a -> Maybe Text -> BusMessageCallback -> m SignalHandlerId
onBusMessage a
obj Maybe Text
detail BusMessageCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_BusMessageCallback
cb' = BusMessageCallback -> C_BusMessageCallback
wrap_BusMessageCallback BusMessageCallback
cb
    FunPtr C_BusMessageCallback
cb'' <- C_BusMessageCallback -> IO (FunPtr C_BusMessageCallback)
mk_BusMessageCallback C_BusMessageCallback
cb'
    a
-> Text
-> FunPtr C_BusMessageCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"message" FunPtr C_BusMessageCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
detail

-- | Connect a signal handler for the [message](#signal:message) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' bus #message callback
-- @
-- 
-- This signal admits a optional parameter @detail@.
-- If it's not @Nothing@, we will connect to “@message::detail@” instead.
-- 
afterBusMessage :: (IsBus a, MonadIO m) => a -> P.Maybe T.Text -> BusMessageCallback -> m SignalHandlerId
afterBusMessage :: forall a (m :: * -> *).
(IsBus a, MonadIO m) =>
a -> Maybe Text -> BusMessageCallback -> m SignalHandlerId
afterBusMessage a
obj Maybe Text
detail BusMessageCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_BusMessageCallback
cb' = BusMessageCallback -> C_BusMessageCallback
wrap_BusMessageCallback BusMessageCallback
cb
    FunPtr C_BusMessageCallback
cb'' <- C_BusMessageCallback -> IO (FunPtr C_BusMessageCallback)
mk_BusMessageCallback C_BusMessageCallback
cb'
    a
-> Text
-> FunPtr C_BusMessageCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"message" FunPtr C_BusMessageCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
detail


#if defined(ENABLE_OVERLOADING)
data BusMessageSignalInfo
instance SignalInfo BusMessageSignalInfo where
    type HaskellCallbackType BusMessageSignalInfo = BusMessageCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_BusMessageCallback cb
        cb'' <- mk_BusMessageCallback cb'
        connectSignalFunPtr obj "message" cb'' connectMode detail

#endif

-- signal Bus::sync-message
-- | A message has been posted on the bus. This signal is emitted from the
-- thread that posted the message so one has to be careful with locking.
-- 
-- This signal will not be emitted by default, you have to call
-- 'GI.Gst.Objects.Bus.busEnableSyncMessageEmission' before.
type BusSyncMessageCallback =
    Gst.Message.Message
    -- ^ /@message@/: the message that has been posted synchronously
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `BusSyncMessageCallback`@.
noBusSyncMessageCallback :: Maybe BusSyncMessageCallback
noBusSyncMessageCallback :: Maybe BusMessageCallback
noBusSyncMessageCallback = Maybe BusMessageCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_BusSyncMessage :: MonadIO m => BusSyncMessageCallback -> m (GClosure C_BusSyncMessageCallback)
genClosure_BusSyncMessage :: forall (m :: * -> *).
MonadIO m =>
BusMessageCallback -> m (GClosure C_BusMessageCallback)
genClosure_BusSyncMessage BusMessageCallback
cb = IO (GClosure C_BusMessageCallback)
-> m (GClosure C_BusMessageCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BusMessageCallback)
 -> m (GClosure C_BusMessageCallback))
-> IO (GClosure C_BusMessageCallback)
-> m (GClosure C_BusMessageCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_BusMessageCallback
cb' = BusMessageCallback -> C_BusMessageCallback
wrap_BusSyncMessageCallback BusMessageCallback
cb
    C_BusMessageCallback -> IO (FunPtr C_BusMessageCallback)
mk_BusSyncMessageCallback C_BusMessageCallback
cb' IO (FunPtr C_BusMessageCallback)
-> (FunPtr C_BusMessageCallback
    -> IO (GClosure C_BusMessageCallback))
-> IO (GClosure C_BusMessageCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BusMessageCallback -> IO (GClosure C_BusMessageCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `BusSyncMessageCallback` into a `C_BusSyncMessageCallback`.
wrap_BusSyncMessageCallback ::
    BusSyncMessageCallback ->
    C_BusSyncMessageCallback
wrap_BusSyncMessageCallback :: BusMessageCallback -> C_BusMessageCallback
wrap_BusSyncMessageCallback BusMessageCallback
_cb Ptr ()
_ Ptr Message
message Ptr ()
_ = do
    (ManagedPtr Message -> Message)
-> Ptr Message -> BusMessageCallback -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr Message -> Message
Gst.Message.Message Ptr Message
message (BusMessageCallback -> IO ()) -> BusMessageCallback -> IO ()
forall a b. (a -> b) -> a -> b
$ \Message
message' -> do
        BusMessageCallback
_cb  Message
message'


-- | Connect a signal handler for the [syncMessage](#signal:syncMessage) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' bus #syncMessage callback
-- @
-- 
-- This signal admits a optional parameter @detail@.
-- If it's not @Nothing@, we will connect to “@sync-message::detail@” instead.
-- 
onBusSyncMessage :: (IsBus a, MonadIO m) => a -> P.Maybe T.Text -> BusSyncMessageCallback -> m SignalHandlerId
onBusSyncMessage :: forall a (m :: * -> *).
(IsBus a, MonadIO m) =>
a -> Maybe Text -> BusMessageCallback -> m SignalHandlerId
onBusSyncMessage a
obj Maybe Text
detail BusMessageCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_BusMessageCallback
cb' = BusMessageCallback -> C_BusMessageCallback
wrap_BusSyncMessageCallback BusMessageCallback
cb
    FunPtr C_BusMessageCallback
cb'' <- C_BusMessageCallback -> IO (FunPtr C_BusMessageCallback)
mk_BusSyncMessageCallback C_BusMessageCallback
cb'
    a
-> Text
-> FunPtr C_BusMessageCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"sync-message" FunPtr C_BusMessageCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
detail

-- | Connect a signal handler for the [syncMessage](#signal:syncMessage) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' bus #syncMessage callback
-- @
-- 
-- This signal admits a optional parameter @detail@.
-- If it's not @Nothing@, we will connect to “@sync-message::detail@” instead.
-- 
afterBusSyncMessage :: (IsBus a, MonadIO m) => a -> P.Maybe T.Text -> BusSyncMessageCallback -> m SignalHandlerId
afterBusSyncMessage :: forall a (m :: * -> *).
(IsBus a, MonadIO m) =>
a -> Maybe Text -> BusMessageCallback -> m SignalHandlerId
afterBusSyncMessage a
obj Maybe Text
detail BusMessageCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_BusMessageCallback
cb' = BusMessageCallback -> C_BusMessageCallback
wrap_BusSyncMessageCallback BusMessageCallback
cb
    FunPtr C_BusMessageCallback
cb'' <- C_BusMessageCallback -> IO (FunPtr C_BusMessageCallback)
mk_BusSyncMessageCallback C_BusMessageCallback
cb'
    a
-> Text
-> FunPtr C_BusMessageCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"sync-message" FunPtr C_BusMessageCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
detail


#if defined(ENABLE_OVERLOADING)
data BusSyncMessageSignalInfo
instance SignalInfo BusSyncMessageSignalInfo where
    type HaskellCallbackType BusSyncMessageSignalInfo = BusSyncMessageCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_BusSyncMessageCallback cb
        cb'' <- mk_BusSyncMessageCallback cb'
        connectSignalFunPtr obj "sync-message" cb'' connectMode detail

#endif

-- VVV Prop "enable-async"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Construct a `GValueConstruct` with valid value for the “@enable-async@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructBusEnableAsync :: (IsBus o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructBusEnableAsync :: forall o (m :: * -> *).
(IsBus o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructBusEnableAsync Bool
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"enable-async" Bool
val

#if defined(ENABLE_OVERLOADING)
data BusEnableAsyncPropertyInfo
instance AttrInfo BusEnableAsyncPropertyInfo where
    type AttrAllowedOps BusEnableAsyncPropertyInfo = '[ 'AttrConstruct]
    type AttrBaseTypeConstraint BusEnableAsyncPropertyInfo = IsBus
    type AttrSetTypeConstraint BusEnableAsyncPropertyInfo = (~) Bool
    type AttrTransferTypeConstraint BusEnableAsyncPropertyInfo = (~) Bool
    type AttrTransferType BusEnableAsyncPropertyInfo = Bool
    type AttrGetType BusEnableAsyncPropertyInfo = ()
    type AttrLabel BusEnableAsyncPropertyInfo = "enable-async"
    type AttrOrigin BusEnableAsyncPropertyInfo = Bus
    attrGet = undefined
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructBusEnableAsync
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Bus
type instance O.AttributeList Bus = BusAttributeList
type BusAttributeList = ('[ '("enableAsync", BusEnableAsyncPropertyInfo), '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
busEnableAsync :: AttrLabelProxy "enableAsync"
busEnableAsync = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Bus = BusSignalList
type BusSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("message", BusMessageSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("syncMessage", BusSyncMessageSignalInfo)] :: [(Symbol, *)])

#endif

-- method Bus::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Bus" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_new" gst_bus_new :: 
    IO (Ptr Bus)

-- | Creates a new t'GI.Gst.Objects.Bus.Bus' instance.
busNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bus
    -- ^ __Returns:__ a new t'GI.Gst.Objects.Bus.Bus' instance
busNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Bus
busNew  = IO Bus -> m Bus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bus -> m Bus) -> IO Bus -> m Bus
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
result <- IO (Ptr Bus)
gst_bus_new
    Text -> Ptr Bus -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"busNew" Ptr Bus
result
    Bus
result' <- ((ManagedPtr Bus -> Bus) -> Ptr Bus -> IO Bus
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Bus -> Bus
Bus) Ptr Bus
result
    Bus -> IO Bus
forall (m :: * -> *) a. Monad m => a -> m a
return Bus
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Bus::add_signal_watch
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GstBus on which you want to receive the \"message\" signal"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_add_signal_watch" gst_bus_add_signal_watch :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO ()

-- | Adds a bus signal watch to the default main context with the default priority
-- ('GI.GLib.Constants.PRIORITY_DEFAULT'). It is also possible to use a non-default
-- main context set up using 'GI.GLib.Structs.MainContext.mainContextPushThreadDefault' (before
-- one had to create a bus watch source and attach it to the desired main
-- context \'manually\').
-- 
-- After calling this statement, the bus will emit the \"message\" signal for each
-- message posted on the bus.
-- 
-- This function may be called multiple times. To clean up, the caller is
-- responsible for calling 'GI.Gst.Objects.Bus.busRemoveSignalWatch' as many times as this
-- function is called.
-- 
-- MT safe.
busAddSignalWatch ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' on which you want to receive the \"message\" signal
    -> m ()
busAddSignalWatch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m ()
busAddSignalWatch a
bus = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Bus -> IO ()
gst_bus_add_signal_watch Ptr Bus
bus'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BusAddSignalWatchMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBus a) => O.OverloadedMethod BusAddSignalWatchMethodInfo a signature where
    overloadedMethod = busAddSignalWatch

instance O.OverloadedMethodInfo BusAddSignalWatchMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busAddSignalWatch",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busAddSignalWatch"
        }


#endif

-- method Bus::add_signal_watch_full
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GstBus on which you want to receive the \"message\" signal"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The priority of the watch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_add_signal_watch_full" gst_bus_add_signal_watch_full :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Int32 ->                                -- priority : TBasicType TInt
    IO ()

-- | Adds a bus signal watch to the default main context with the given /@priority@/
-- (e.g. 'GI.GLib.Constants.PRIORITY_DEFAULT'). It is also possible to use a non-default main
-- context set up using 'GI.GLib.Structs.MainContext.mainContextPushThreadDefault'
-- (before one had to create a bus watch source and attach it to the desired
-- main context \'manually\').
-- 
-- After calling this statement, the bus will emit the \"message\" signal for each
-- message posted on the bus when the main loop is running.
-- 
-- This function may be called multiple times. To clean up, the caller is
-- responsible for calling 'GI.Gst.Objects.Bus.busRemoveSignalWatch' as many times as this
-- function is called.
-- 
-- There can only be a single bus watch per bus, you must remove any signal
-- watch before you can set another type of watch.
-- 
-- MT safe.
busAddSignalWatchFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' on which you want to receive the \"message\" signal
    -> Int32
    -- ^ /@priority@/: The priority of the watch.
    -> m ()
busAddSignalWatchFull :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Int32 -> m ()
busAddSignalWatchFull a
bus Int32
priority = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Bus -> Int32 -> IO ()
gst_bus_add_signal_watch_full Ptr Bus
bus' Int32
priority
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BusAddSignalWatchFullMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsBus a) => O.OverloadedMethod BusAddSignalWatchFullMethodInfo a signature where
    overloadedMethod = busAddSignalWatchFull

instance O.OverloadedMethodInfo BusAddSignalWatchFullMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busAddSignalWatchFull",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busAddSignalWatchFull"
        }


#endif

-- method Bus::add_watch
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to create the watch for."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The priority of the watch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "func"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "BusFunc" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A function to call when a message is received."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 3
--           , argDestroy = 4
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user data passed to @func."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "notify"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the function to call when the source is removed."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_add_watch_full" gst_bus_add_watch_full :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Int32 ->                                -- priority : TBasicType TInt
    FunPtr Gst.Callbacks.C_BusFunc ->       -- func : TInterface (Name {namespace = "Gst", name = "BusFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO Word32

-- | Adds a bus watch to the default main context with the given /@priority@/ (e.g.
-- 'GI.GLib.Constants.PRIORITY_DEFAULT'). It is also possible to use a non-default  main
-- context set up using 'GI.GLib.Structs.MainContext.mainContextPushThreadDefault' (before
-- one had to create a bus watch source and attach it to the desired main
-- context \'manually\').
-- 
-- This function is used to receive asynchronous messages in the main loop.
-- There can only be a single bus watch per bus, you must remove it before you
-- can set a new one.
-- 
-- The bus watch will only work if a GLib main loop is being run.
-- 
-- When /@func@/ is called, the message belongs to the caller; if you want to
-- keep a copy of it, call @/gst_message_ref()/@ before leaving /@func@/.
-- 
-- The watch can be removed using 'GI.Gst.Objects.Bus.busRemoveWatch' or by returning 'P.False'
-- from /@func@/. If the watch was added to the default main context it is also
-- possible to remove the watch using 'GI.GLib.Functions.sourceRemove'.
-- 
-- The bus watch will take its own reference to the /@bus@/, so it is safe to unref
-- /@bus@/ using 'GI.Gst.Objects.Object.objectUnref' after setting the bus watch.
-- 
-- MT safe.
busAddWatch ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to create the watch for.
    -> Int32
    -- ^ /@priority@/: The priority of the watch.
    -> Gst.Callbacks.BusFunc
    -- ^ /@func@/: A function to call when a message is received.
    -> m Word32
    -- ^ __Returns:__ The event source id or 0 if /@bus@/ already got an event source.
busAddWatch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Int32 -> BusFunc -> m Word32
busAddWatch a
bus Int32
priority BusFunc
func = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    FunPtr C_BusFunc
func' <- C_BusFunc -> IO (FunPtr C_BusFunc)
Gst.Callbacks.mk_BusFunc (Maybe (Ptr (FunPtr C_BusFunc)) -> BusFunc_WithClosures -> C_BusFunc
Gst.Callbacks.wrap_BusFunc Maybe (Ptr (FunPtr C_BusFunc))
forall a. Maybe a
Nothing (BusFunc -> BusFunc_WithClosures
Gst.Callbacks.drop_closures_BusFunc BusFunc
func))
    let userData :: Ptr ()
userData = FunPtr C_BusFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_BusFunc
func'
    let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
    Word32
result <- Ptr Bus
-> Int32
-> FunPtr C_BusFunc
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO Word32
gst_bus_add_watch_full Ptr Bus
bus' Int32
priority FunPtr C_BusFunc
func' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
notify
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

#if defined(ENABLE_OVERLOADING)
data BusAddWatchMethodInfo
instance (signature ~ (Int32 -> Gst.Callbacks.BusFunc -> m Word32), MonadIO m, IsBus a) => O.OverloadedMethod BusAddWatchMethodInfo a signature where
    overloadedMethod = busAddWatch

instance O.OverloadedMethodInfo BusAddWatchMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busAddWatch",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busAddWatch"
        }


#endif

-- method Bus::async_signal_func
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus" , 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 received"
--                 , 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 "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 "gst_bus_async_signal_func" gst_bus_async_signal_func :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Ptr Gst.Message.Message ->              -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO CInt

-- | A helper t'GI.Gst.Callbacks.BusFunc' that can be used to convert all asynchronous messages
-- into signals.
busAsyncSignalFunc ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus'
    -> Gst.Message.Message
    -- ^ /@message@/: the t'GI.Gst.Structs.Message.Message' received
    -> Ptr ()
    -- ^ /@data@/: user data
    -> m Bool
    -- ^ __Returns:__ 'P.True'
busAsyncSignalFunc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Message -> Ptr () -> m Bool
busAsyncSignalFunc a
bus Message
message Ptr ()
data_ = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Message
message' <- Message -> IO (Ptr Message)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Message
message
    CInt
result <- C_BusFunc
gst_bus_async_signal_func Ptr Bus
bus' Ptr Message
message' Ptr ()
data_
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    BusMessageCallback
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Message
message
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data BusAsyncSignalFuncMethodInfo
instance (signature ~ (Gst.Message.Message -> Ptr () -> m Bool), MonadIO m, IsBus a) => O.OverloadedMethod BusAsyncSignalFuncMethodInfo a signature where
    overloadedMethod = busAsyncSignalFunc

instance O.OverloadedMethodInfo BusAsyncSignalFuncMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busAsyncSignalFunc",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busAsyncSignalFunc"
        }


#endif

-- method Bus::create_watch
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to create the watch for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "Source" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_create_watch" gst_bus_create_watch :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO (Ptr GLib.Source.Source)

-- | Create watch for this bus. The GSource will be dispatched whenever
-- a message is on the bus. After the GSource is dispatched, the
-- message is popped off the bus and unreffed.
busCreateWatch ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to create the watch for
    -> m (Maybe GLib.Source.Source)
    -- ^ __Returns:__ a t'GI.GLib.Structs.Source.Source' that can be added to a mainloop.
busCreateWatch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m (Maybe Source)
busCreateWatch a
bus = IO (Maybe Source) -> m (Maybe Source)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Source) -> m (Maybe Source))
-> IO (Maybe Source) -> m (Maybe Source)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Source
result <- Ptr Bus -> IO (Ptr Source)
gst_bus_create_watch Ptr Bus
bus'
    Maybe Source
maybeResult <- Ptr Source -> (Ptr Source -> IO Source) -> IO (Maybe Source)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Source
result ((Ptr Source -> IO Source) -> IO (Maybe Source))
-> (Ptr Source -> IO Source) -> IO (Maybe Source)
forall a b. (a -> b) -> a -> b
$ \Ptr Source
result' -> do
        Source
result'' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Source -> Source
GLib.Source.Source) Ptr Source
result'
        Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Maybe Source -> IO (Maybe Source)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Source
maybeResult

#if defined(ENABLE_OVERLOADING)
data BusCreateWatchMethodInfo
instance (signature ~ (m (Maybe GLib.Source.Source)), MonadIO m, IsBus a) => O.OverloadedMethod BusCreateWatchMethodInfo a signature where
    overloadedMethod = busCreateWatch

instance O.OverloadedMethodInfo BusCreateWatchMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busCreateWatch",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busCreateWatch"
        }


#endif

-- method Bus::disable_sync_message_emission
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GstBus on which you previously called\ngst_bus_enable_sync_message_emission()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_disable_sync_message_emission" gst_bus_disable_sync_message_emission :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO ()

-- | Instructs GStreamer to stop emitting the \"sync-message\" signal for this bus.
-- See 'GI.Gst.Objects.Bus.busEnableSyncMessageEmission' for more information.
-- 
-- In the event that multiple pieces of code have called
-- 'GI.Gst.Objects.Bus.busEnableSyncMessageEmission', the sync-message emissions will only
-- be stopped after all calls to 'GI.Gst.Objects.Bus.busEnableSyncMessageEmission' were
-- \"cancelled\" by calling this function. In this way the semantics are exactly
-- the same as 'GI.Gst.Objects.Object.objectRef' that which calls enable should also call
-- disable.
-- 
-- MT safe.
busDisableSyncMessageEmission ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' on which you previously called
    -- 'GI.Gst.Objects.Bus.busEnableSyncMessageEmission'
    -> m ()
busDisableSyncMessageEmission :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m ()
busDisableSyncMessageEmission a
bus = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Bus -> IO ()
gst_bus_disable_sync_message_emission Ptr Bus
bus'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BusDisableSyncMessageEmissionMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBus a) => O.OverloadedMethod BusDisableSyncMessageEmissionMethodInfo a signature where
    overloadedMethod = busDisableSyncMessageEmission

instance O.OverloadedMethodInfo BusDisableSyncMessageEmissionMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busDisableSyncMessageEmission",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busDisableSyncMessageEmission"
        }


#endif

-- method Bus::enable_sync_message_emission
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GstBus on which you want to receive the \"sync-message\" signal"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_enable_sync_message_emission" gst_bus_enable_sync_message_emission :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO ()

-- | Instructs GStreamer to emit the \"sync-message\" signal after running the bus\'s
-- sync handler. This function is here so that code can ensure that they can
-- synchronously receive messages without having to affect what the bin\'s sync
-- handler is.
-- 
-- This function may be called multiple times. To clean up, the caller is
-- responsible for calling 'GI.Gst.Objects.Bus.busDisableSyncMessageEmission' as many times
-- as this function is called.
-- 
-- While this function looks similar to 'GI.Gst.Objects.Bus.busAddSignalWatch', it is not
-- exactly the same -- this function enables *synchronous* emission of
-- signals when messages arrive; 'GI.Gst.Objects.Bus.busAddSignalWatch' adds an idle callback
-- to pop messages off the bus *asynchronously*. The sync-message signal
-- comes from the thread of whatever object posted the message; the \"message\"
-- signal is marshalled to the main thread via the main loop.
-- 
-- MT safe.
busEnableSyncMessageEmission ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' on which you want to receive the \"sync-message\" signal
    -> m ()
busEnableSyncMessageEmission :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m ()
busEnableSyncMessageEmission a
bus = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Bus -> IO ()
gst_bus_enable_sync_message_emission Ptr Bus
bus'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BusEnableSyncMessageEmissionMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBus a) => O.OverloadedMethod BusEnableSyncMessageEmissionMethodInfo a signature where
    overloadedMethod = busEnableSyncMessageEmission

instance O.OverloadedMethodInfo BusEnableSyncMessageEmissionMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busEnableSyncMessageEmission",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busEnableSyncMessageEmission"
        }


#endif

-- method Bus::get_pollfd
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GstBus" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "fd"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "PollFD" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A GPollFD to fill" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_get_pollfd" gst_bus_get_pollfd :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Ptr GLib.PollFD.PollFD ->               -- fd : TInterface (Name {namespace = "GLib", name = "PollFD"})
    IO ()

-- | Gets the file descriptor from the bus which can be used to get notified about
-- messages being available with functions like 'GI.GLib.Functions.poll', and allows integration
-- into other event loops based on file descriptors.
-- Whenever a message is available, the POLLIN \/ 'GI.GLib.Flags.IOConditionIn' event is set.
-- 
-- Warning: NEVER read or write anything to the returned fd but only use it
-- for getting notifications via 'GI.GLib.Functions.poll' or similar and then use the normal
-- GstBus API, e.g. 'GI.Gst.Objects.Bus.busPop'.
-- 
-- /Since: 1.14/
busGetPollfd ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: A t'GI.Gst.Objects.Bus.Bus'
    -> m (GLib.PollFD.PollFD)
busGetPollfd :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m PollFD
busGetPollfd a
bus = IO PollFD -> m PollFD
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO PollFD -> m PollFD) -> IO PollFD -> m PollFD
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr PollFD
fd <- Int -> IO (Ptr PollFD)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
8 :: IO (Ptr GLib.PollFD.PollFD)
    Ptr Bus -> Ptr PollFD -> IO ()
gst_bus_get_pollfd Ptr Bus
bus' Ptr PollFD
fd
    PollFD
fd' <- ((ManagedPtr PollFD -> PollFD) -> Ptr PollFD -> IO PollFD
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr PollFD -> PollFD
GLib.PollFD.PollFD) Ptr PollFD
fd
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    PollFD -> IO PollFD
forall (m :: * -> *) a. Monad m => a -> m a
return PollFD
fd'

#if defined(ENABLE_OVERLOADING)
data BusGetPollfdMethodInfo
instance (signature ~ (m (GLib.PollFD.PollFD)), MonadIO m, IsBus a) => O.OverloadedMethod BusGetPollfdMethodInfo a signature where
    overloadedMethod = busGetPollfd

instance O.OverloadedMethodInfo BusGetPollfdMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busGetPollfd",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busGetPollfd"
        }


#endif

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

foreign import ccall "gst_bus_have_pending" gst_bus_have_pending :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO CInt

-- | Check if there are pending messages on the bus that
-- should be handled.
busHavePending ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to check
    -> m Bool
    -- ^ __Returns:__ 'P.True' if there are messages on the bus to be handled, 'P.False'
    -- otherwise.
    -- 
    -- MT safe.
busHavePending :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m Bool
busHavePending a
bus = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    CInt
result <- Ptr Bus -> IO CInt
gst_bus_have_pending Ptr Bus
bus'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data BusHavePendingMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBus a) => O.OverloadedMethod BusHavePendingMethodInfo a signature where
    overloadedMethod = busHavePending

instance O.OverloadedMethodInfo BusHavePendingMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busHavePending",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busHavePending"
        }


#endif

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

foreign import ccall "gst_bus_peek" gst_bus_peek :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO (Ptr Gst.Message.Message)

-- | Peek the message on the top of the bus\' queue. The message will remain
-- on the bus\' message queue. A reference is returned, and needs to be unreffed
-- by the caller.
busPeek ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus'
    -> m (Maybe Gst.Message.Message)
    -- ^ __Returns:__ the t'GI.Gst.Structs.Message.Message' that is on the
    --     bus, or 'P.Nothing' if the bus is empty.
    -- 
    -- MT safe.
busPeek :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m (Maybe Message)
busPeek a
bus = IO (Maybe Message) -> m (Maybe Message)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Message) -> m (Maybe Message))
-> IO (Maybe Message) -> m (Maybe Message)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Message
result <- Ptr Bus -> IO (Ptr Message)
gst_bus_peek Ptr Bus
bus'
    Maybe Message
maybeResult <- Ptr Message -> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Message
result ((Ptr Message -> IO Message) -> IO (Maybe Message))
-> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. (a -> b) -> a -> b
$ \Ptr Message
result' -> do
        Message
result'' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result'
        Message -> IO Message
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Maybe Message -> IO (Maybe Message)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Message
maybeResult

#if defined(ENABLE_OVERLOADING)
data BusPeekMethodInfo
instance (signature ~ (m (Maybe Gst.Message.Message)), MonadIO m, IsBus a) => O.OverloadedMethod BusPeekMethodInfo a signature where
    overloadedMethod = busPeek

instance O.OverloadedMethodInfo BusPeekMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busPeek",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busPeek"
        }


#endif

-- method Bus::poll
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "events"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "MessageType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a mask of #GstMessageType, representing the set of message types to\npoll for (note special handling of extended message types below)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "timeout"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the poll timeout, as a #GstClockTime, or #GST_CLOCK_TIME_NONE to poll\nindefinitely."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_poll" gst_bus_poll :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    CUInt ->                                -- events : TInterface (Name {namespace = "Gst", name = "MessageType"})
    Word64 ->                               -- timeout : TBasicType TUInt64
    IO (Ptr Gst.Message.Message)

-- | Poll the bus for messages. Will block while waiting for messages to come.
-- You can specify a maximum time to poll with the /@timeout@/ parameter. If
-- /@timeout@/ is negative, this function will block indefinitely.
-- 
-- All messages not in /@events@/ will be popped off the bus and will be ignored.
-- It is not possible to use message enums beyond @/GST_MESSAGE_EXTENDED/@ in the
-- /@events@/ mask
-- 
-- Because poll is implemented using the \"message\" signal enabled by
-- 'GI.Gst.Objects.Bus.busAddSignalWatch', calling 'GI.Gst.Objects.Bus.busPoll' will cause the \"message\"
-- signal to be emitted for every message that poll sees. Thus a \"message\"
-- signal handler will see the same messages that this function sees -- neither
-- will steal messages from the other.
-- 
-- This function will run a main loop from the default main context when
-- polling.
-- 
-- You should never use this function, since it is pure evil. This is
-- especially true for GUI applications based on Gtk+ or Qt, but also for any
-- other non-trivial application that uses the GLib main loop. As this function
-- runs a GLib main loop, any callback attached to the default GLib main
-- context may be invoked. This could be timeouts, GUI events, I\/O events etc.;
-- even if 'GI.Gst.Objects.Bus.busPoll' is called with a 0 timeout. Any of these callbacks
-- may do things you do not expect, e.g. destroy the main application window or
-- some other resource; change other application state; display a dialog and
-- run another main loop until the user clicks it away. In short, using this
-- function may add a lot of complexity to your code through unexpected
-- re-entrancy and unexpected changes to your application\'s state.
-- 
-- For 0 timeouts use 'GI.Gst.Objects.Bus.busPopFiltered' instead of this function; for
-- other short timeouts use 'GI.Gst.Objects.Bus.busTimedPopFiltered'; everything else is
-- better handled by setting up an asynchronous bus watch and doing things
-- from there.
busPoll ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus'
    -> [Gst.Flags.MessageType]
    -- ^ /@events@/: a mask of t'GI.Gst.Flags.MessageType', representing the set of message types to
    -- poll for (note special handling of extended message types below)
    -> Word64
    -- ^ /@timeout@/: the poll timeout, as a @/GstClockTime/@, or 'GI.Gst.Constants.CLOCK_TIME_NONE' to poll
    -- indefinitely.
    -> m (Maybe Gst.Message.Message)
    -- ^ __Returns:__ the message that was received,
    --     or 'P.Nothing' if the poll timed out. The message is taken from the
    --     bus and needs to be unreffed with @/gst_message_unref()/@ after
    --     usage.
busPoll :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> [MessageType] -> Word64 -> m (Maybe Message)
busPoll a
bus [MessageType]
events Word64
timeout = IO (Maybe Message) -> m (Maybe Message)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Message) -> m (Maybe Message))
-> IO (Maybe Message) -> m (Maybe Message)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    let events' :: CUInt
events' = [MessageType] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MessageType]
events
    Ptr Message
result <- Ptr Bus -> CUInt -> Word64 -> IO (Ptr Message)
gst_bus_poll Ptr Bus
bus' CUInt
events' Word64
timeout
    Maybe Message
maybeResult <- Ptr Message -> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Message
result ((Ptr Message -> IO Message) -> IO (Maybe Message))
-> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. (a -> b) -> a -> b
$ \Ptr Message
result' -> do
        Message
result'' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result'
        Message -> IO Message
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Maybe Message -> IO (Maybe Message)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Message
maybeResult

#if defined(ENABLE_OVERLOADING)
data BusPollMethodInfo
instance (signature ~ ([Gst.Flags.MessageType] -> Word64 -> m (Maybe Gst.Message.Message)), MonadIO m, IsBus a) => O.OverloadedMethod BusPollMethodInfo a signature where
    overloadedMethod = busPoll

instance O.OverloadedMethodInfo BusPollMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busPoll",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busPoll"
        }


#endif

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

foreign import ccall "gst_bus_pop" gst_bus_pop :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO (Ptr Gst.Message.Message)

-- | Get a message from the bus.
busPop ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to pop
    -> m (Maybe Gst.Message.Message)
    -- ^ __Returns:__ the t'GI.Gst.Structs.Message.Message' that is on the
    --     bus, or 'P.Nothing' if the bus is empty. The message is taken from
    --     the bus and needs to be unreffed with @/gst_message_unref()/@ after
    --     usage.
    -- 
    -- MT safe.
busPop :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m (Maybe Message)
busPop a
bus = IO (Maybe Message) -> m (Maybe Message)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Message) -> m (Maybe Message))
-> IO (Maybe Message) -> m (Maybe Message)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Message
result <- Ptr Bus -> IO (Ptr Message)
gst_bus_pop Ptr Bus
bus'
    Maybe Message
maybeResult <- Ptr Message -> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Message
result ((Ptr Message -> IO Message) -> IO (Maybe Message))
-> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. (a -> b) -> a -> b
$ \Ptr Message
result' -> do
        Message
result'' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result'
        Message -> IO Message
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Maybe Message -> IO (Maybe Message)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Message
maybeResult

#if defined(ENABLE_OVERLOADING)
data BusPopMethodInfo
instance (signature ~ (m (Maybe Gst.Message.Message)), MonadIO m, IsBus a) => O.OverloadedMethod BusPopMethodInfo a signature where
    overloadedMethod = busPop

instance O.OverloadedMethodInfo BusPopMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busPop",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busPop"
        }


#endif

-- method Bus::pop_filtered
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to pop" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "types"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "MessageType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "message types to take into account"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_pop_filtered" gst_bus_pop_filtered :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    CUInt ->                                -- types : TInterface (Name {namespace = "Gst", name = "MessageType"})
    IO (Ptr Gst.Message.Message)

-- | Get a message matching /@type@/ from the bus.  Will discard all messages on
-- the bus that do not match /@type@/ and that have been posted before the first
-- message that does match /@type@/.  If there is no message matching /@type@/ on
-- the bus, all messages will be discarded. It is not possible to use message
-- enums beyond @/GST_MESSAGE_EXTENDED/@ in the /@events@/ mask.
busPopFiltered ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to pop
    -> [Gst.Flags.MessageType]
    -- ^ /@types@/: message types to take into account
    -> m (Maybe Gst.Message.Message)
    -- ^ __Returns:__ the next t'GI.Gst.Structs.Message.Message' matching
    --     /@type@/ that is on the bus, or 'P.Nothing' if the bus is empty or there
    --     is no message matching /@type@/. The message is taken from the bus
    --     and needs to be unreffed with @/gst_message_unref()/@ after usage.
    -- 
    -- MT safe.
busPopFiltered :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> [MessageType] -> m (Maybe Message)
busPopFiltered a
bus [MessageType]
types = IO (Maybe Message) -> m (Maybe Message)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Message) -> m (Maybe Message))
-> IO (Maybe Message) -> m (Maybe Message)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    let types' :: CUInt
types' = [MessageType] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MessageType]
types
    Ptr Message
result <- Ptr Bus -> CUInt -> IO (Ptr Message)
gst_bus_pop_filtered Ptr Bus
bus' CUInt
types'
    Maybe Message
maybeResult <- Ptr Message -> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Message
result ((Ptr Message -> IO Message) -> IO (Maybe Message))
-> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. (a -> b) -> a -> b
$ \Ptr Message
result' -> do
        Message
result'' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result'
        Message -> IO Message
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Maybe Message -> IO (Maybe Message)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Message
maybeResult

#if defined(ENABLE_OVERLOADING)
data BusPopFilteredMethodInfo
instance (signature ~ ([Gst.Flags.MessageType] -> m (Maybe Gst.Message.Message)), MonadIO m, IsBus a) => O.OverloadedMethod BusPopFilteredMethodInfo a signature where
    overloadedMethod = busPopFiltered

instance O.OverloadedMethodInfo BusPopFilteredMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busPopFiltered",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busPopFiltered"
        }


#endif

-- method Bus::post
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to post on"
--                 , 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 to post"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_post" gst_bus_post :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Ptr Gst.Message.Message ->              -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO CInt

-- | Post a message on the given bus. Ownership of the message
-- is taken by the bus.
busPost ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to post on
    -> Gst.Message.Message
    -- ^ /@message@/: the t'GI.Gst.Structs.Message.Message' to post
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the message could be posted, 'P.False' if the bus is flushing.
    -- 
    -- MT safe.
busPost :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Message -> m Bool
busPost a
bus Message
message = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Message
message' <- Message -> IO (Ptr Message)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Message
message
    CInt
result <- Ptr Bus -> Ptr Message -> IO CInt
gst_bus_post Ptr Bus
bus' Ptr Message
message'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    BusMessageCallback
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Message
message
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data BusPostMethodInfo
instance (signature ~ (Gst.Message.Message -> m Bool), MonadIO m, IsBus a) => O.OverloadedMethod BusPostMethodInfo a signature where
    overloadedMethod = busPost

instance O.OverloadedMethodInfo BusPostMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busPost",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busPost"
        }


#endif

-- method Bus::remove_signal_watch
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GstBus you previously added a signal watch to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_remove_signal_watch" gst_bus_remove_signal_watch :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO ()

-- | Removes a signal watch previously added with 'GI.Gst.Objects.Bus.busAddSignalWatch'.
-- 
-- MT safe.
busRemoveSignalWatch ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' you previously added a signal watch to
    -> m ()
busRemoveSignalWatch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m ()
busRemoveSignalWatch a
bus = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Bus -> IO ()
gst_bus_remove_signal_watch Ptr Bus
bus'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BusRemoveSignalWatchMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBus a) => O.OverloadedMethod BusRemoveSignalWatchMethodInfo a signature where
    overloadedMethod = busRemoveSignalWatch

instance O.OverloadedMethodInfo BusRemoveSignalWatchMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busRemoveSignalWatch",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busRemoveSignalWatch"
        }


#endif

-- method Bus::remove_watch
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to remove the watch from."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_remove_watch" gst_bus_remove_watch :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    IO CInt

-- | Removes an installed bus watch from /@bus@/.
-- 
-- /Since: 1.6/
busRemoveWatch ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to remove the watch from.
    -> m Bool
    -- ^ __Returns:__ 'P.True' on success or 'P.False' if /@bus@/ has no event source.
busRemoveWatch :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> m Bool
busRemoveWatch a
bus = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    CInt
result <- Ptr Bus -> IO CInt
gst_bus_remove_watch Ptr Bus
bus'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data BusRemoveWatchMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBus a) => O.OverloadedMethod BusRemoveWatchMethodInfo a signature where
    overloadedMethod = busRemoveWatch

instance O.OverloadedMethodInfo BusRemoveWatchMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busRemoveWatch",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busRemoveWatch"
        }


#endif

-- method Bus::set_flushing
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flushing"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether or not to flush the bus"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_set_flushing" gst_bus_set_flushing :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    CInt ->                                 -- flushing : TBasicType TBoolean
    IO ()

-- | If /@flushing@/, flush out and unref any messages queued in the bus. Releases
-- references to the message origin objects. Will flush future messages until
-- 'GI.Gst.Objects.Bus.busSetFlushing' sets /@flushing@/ to 'P.False'.
-- 
-- MT safe.
busSetFlushing ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus'
    -> Bool
    -- ^ /@flushing@/: whether or not to flush the bus
    -> m ()
busSetFlushing :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Bool -> m ()
busSetFlushing a
bus Bool
flushing = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    let flushing' :: CInt
flushing' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
flushing
    Ptr Bus -> CInt -> IO ()
gst_bus_set_flushing Ptr Bus
bus' CInt
flushing'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BusSetFlushingMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsBus a) => O.OverloadedMethod BusSetFlushingMethodInfo a signature where
    overloadedMethod = busSetFlushing

instance O.OverloadedMethodInfo BusSetFlushingMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busSetFlushing",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busSetFlushing"
        }


#endif

-- method Bus::set_sync_handler
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to install the handler on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "func"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "BusSyncHandler" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The handler function to install"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 2
--           , argDestroy = 3
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "User data that will be sent to the handler function."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "notify"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "called when @user_data becomes unused"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_set_sync_handler" gst_bus_set_sync_handler :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    FunPtr Gst.Callbacks.C_BusSyncHandler -> -- func : TInterface (Name {namespace = "Gst", name = "BusSyncHandler"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

-- | Sets the synchronous handler on the bus. The function will be called
-- every time a new message is posted on the bus. Note that the function
-- will be called in the same thread context as the posting object. This
-- function is usually only called by the creator of the bus. Applications
-- should handle messages asynchronously using the gst_bus watch and poll
-- functions.
-- 
-- Before 1.16.3 it was not possible to replace an existing handler and
-- clearing an existing handler with 'P.Nothing' was not thread-safe.
busSetSyncHandler ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to install the handler on
    -> Maybe (Gst.Callbacks.BusSyncHandler)
    -- ^ /@func@/: The handler function to install
    -> m ()
busSetSyncHandler :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Maybe BusSyncHandler -> m ()
busSetSyncHandler a
bus Maybe BusSyncHandler
func = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    FunPtr C_BusSyncHandler
maybeFunc <- case Maybe BusSyncHandler
func of
        Maybe BusSyncHandler
Nothing -> FunPtr C_BusSyncHandler -> IO (FunPtr C_BusSyncHandler)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_BusSyncHandler
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just BusSyncHandler
jFunc -> do
            FunPtr C_BusSyncHandler
jFunc' <- C_BusSyncHandler -> IO (FunPtr C_BusSyncHandler)
Gst.Callbacks.mk_BusSyncHandler (Maybe (Ptr (FunPtr C_BusSyncHandler))
-> BusSyncHandler_WithClosures -> C_BusSyncHandler
Gst.Callbacks.wrap_BusSyncHandler Maybe (Ptr (FunPtr C_BusSyncHandler))
forall a. Maybe a
Nothing (BusSyncHandler -> BusSyncHandler_WithClosures
Gst.Callbacks.drop_closures_BusSyncHandler BusSyncHandler
jFunc))
            FunPtr C_BusSyncHandler -> IO (FunPtr C_BusSyncHandler)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_BusSyncHandler
jFunc'
    let userData :: Ptr ()
userData = FunPtr C_BusSyncHandler -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_BusSyncHandler
maybeFunc
    let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
    Ptr Bus
-> FunPtr C_BusSyncHandler
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO ()
gst_bus_set_sync_handler Ptr Bus
bus' FunPtr C_BusSyncHandler
maybeFunc Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
notify
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BusSetSyncHandlerMethodInfo
instance (signature ~ (Maybe (Gst.Callbacks.BusSyncHandler) -> m ()), MonadIO m, IsBus a) => O.OverloadedMethod BusSetSyncHandlerMethodInfo a signature where
    overloadedMethod = busSetSyncHandler

instance O.OverloadedMethodInfo BusSetSyncHandlerMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busSetSyncHandler",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busSetSyncHandler"
        }


#endif

-- method Bus::sync_signal_handler
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus" , 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 received"
--                 , 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 "user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gst" , name = "BusSyncReply" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_sync_signal_handler" gst_bus_sync_signal_handler :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Ptr Gst.Message.Message ->              -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO CUInt

-- | A helper GstBusSyncHandler that can be used to convert all synchronous
-- messages into signals.
busSyncSignalHandler ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus'
    -> Gst.Message.Message
    -- ^ /@message@/: the t'GI.Gst.Structs.Message.Message' received
    -> Ptr ()
    -- ^ /@data@/: user data
    -> m Gst.Enums.BusSyncReply
    -- ^ __Returns:__ GST_BUS_PASS
busSyncSignalHandler :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Message -> Ptr () -> m BusSyncReply
busSyncSignalHandler a
bus Message
message Ptr ()
data_ = IO BusSyncReply -> m BusSyncReply
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO BusSyncReply -> m BusSyncReply)
-> IO BusSyncReply -> m BusSyncReply
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Message
message' <- Message -> IO (Ptr Message)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Message
message
    CUInt
result <- C_BusSyncHandler
gst_bus_sync_signal_handler Ptr Bus
bus' Ptr Message
message' Ptr ()
data_
    let result' :: BusSyncReply
result' = (Int -> BusSyncReply
forall a. Enum a => Int -> a
toEnum (Int -> BusSyncReply) -> (CUInt -> Int) -> CUInt -> BusSyncReply
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    BusMessageCallback
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Message
message
    BusSyncReply -> IO BusSyncReply
forall (m :: * -> *) a. Monad m => a -> m a
return BusSyncReply
result'

#if defined(ENABLE_OVERLOADING)
data BusSyncSignalHandlerMethodInfo
instance (signature ~ (Gst.Message.Message -> Ptr () -> m Gst.Enums.BusSyncReply), MonadIO m, IsBus a) => O.OverloadedMethod BusSyncSignalHandlerMethodInfo a signature where
    overloadedMethod = busSyncSignalHandler

instance O.OverloadedMethodInfo BusSyncSignalHandlerMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busSyncSignalHandler",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busSyncSignalHandler"
        }


#endif

-- method Bus::timed_pop
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to pop" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "timeout"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a timeout" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_timed_pop" gst_bus_timed_pop :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Word64 ->                               -- timeout : TBasicType TUInt64
    IO (Ptr Gst.Message.Message)

-- | Get a message from the bus, waiting up to the specified timeout.
-- 
-- If /@timeout@/ is 0, this function behaves like 'GI.Gst.Objects.Bus.busPop'. If /@timeout@/ is
-- 'GI.Gst.Constants.CLOCK_TIME_NONE', this function will block forever until a message was
-- posted on the bus.
busTimedPop ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to pop
    -> Word64
    -- ^ /@timeout@/: a timeout
    -> m (Maybe Gst.Message.Message)
    -- ^ __Returns:__ the t'GI.Gst.Structs.Message.Message' that is on the
    --     bus after the specified timeout or 'P.Nothing' if the bus is empty
    --     after the timeout expired.  The message is taken from the bus
    --     and needs to be unreffed with @/gst_message_unref()/@ after usage.
    -- 
    -- MT safe.
busTimedPop :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Word64 -> m (Maybe Message)
busTimedPop a
bus Word64
timeout = IO (Maybe Message) -> m (Maybe Message)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Message) -> m (Maybe Message))
-> IO (Maybe Message) -> m (Maybe Message)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    Ptr Message
result <- Ptr Bus -> Word64 -> IO (Ptr Message)
gst_bus_timed_pop Ptr Bus
bus' Word64
timeout
    Maybe Message
maybeResult <- Ptr Message -> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Message
result ((Ptr Message -> IO Message) -> IO (Maybe Message))
-> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. (a -> b) -> a -> b
$ \Ptr Message
result' -> do
        Message
result'' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result'
        Message -> IO Message
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Maybe Message -> IO (Maybe Message)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Message
maybeResult

#if defined(ENABLE_OVERLOADING)
data BusTimedPopMethodInfo
instance (signature ~ (Word64 -> m (Maybe Gst.Message.Message)), MonadIO m, IsBus a) => O.OverloadedMethod BusTimedPopMethodInfo a signature where
    overloadedMethod = busTimedPop

instance O.OverloadedMethodInfo BusTimedPopMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busTimedPop",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busTimedPop"
        }


#endif

-- method Bus::timed_pop_filtered
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "bus"
--           , argType = TInterface Name { namespace = "Gst" , name = "Bus" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstBus to pop from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "timeout"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a timeout in nanoseconds, or GST_CLOCK_TIME_NONE to wait forever"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "types"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "MessageType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "message types to take into account, GST_MESSAGE_ANY for any type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_bus_timed_pop_filtered" gst_bus_timed_pop_filtered :: 
    Ptr Bus ->                              -- bus : TInterface (Name {namespace = "Gst", name = "Bus"})
    Word64 ->                               -- timeout : TBasicType TUInt64
    CUInt ->                                -- types : TInterface (Name {namespace = "Gst", name = "MessageType"})
    IO (Ptr Gst.Message.Message)

-- | Get a message from the bus whose type matches the message type mask /@types@/,
-- waiting up to the specified timeout (and discarding any messages that do not
-- match the mask provided).
-- 
-- If /@timeout@/ is 0, this function behaves like 'GI.Gst.Objects.Bus.busPopFiltered'. If
-- /@timeout@/ is 'GI.Gst.Constants.CLOCK_TIME_NONE', this function will block forever until a
-- matching message was posted on the bus.
busTimedPopFiltered ::
    (B.CallStack.HasCallStack, MonadIO m, IsBus a) =>
    a
    -- ^ /@bus@/: a t'GI.Gst.Objects.Bus.Bus' to pop from
    -> Word64
    -- ^ /@timeout@/: a timeout in nanoseconds, or GST_CLOCK_TIME_NONE to wait forever
    -> [Gst.Flags.MessageType]
    -- ^ /@types@/: message types to take into account, GST_MESSAGE_ANY for any type
    -> m (Maybe Gst.Message.Message)
    -- ^ __Returns:__ a t'GI.Gst.Structs.Message.Message' matching the
    --     filter in /@types@/, or 'P.Nothing' if no matching message was found on
    --     the bus until the timeout expired. The message is taken from
    --     the bus and needs to be unreffed with @/gst_message_unref()/@ after
    --     usage.
    -- 
    -- MT safe.
busTimedPopFiltered :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBus a) =>
a -> Word64 -> [MessageType] -> m (Maybe Message)
busTimedPopFiltered a
bus Word64
timeout [MessageType]
types = IO (Maybe Message) -> m (Maybe Message)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Message) -> m (Maybe Message))
-> IO (Maybe Message) -> m (Maybe Message)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Bus
bus' <- a -> IO (Ptr Bus)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
bus
    let types' :: CUInt
types' = [MessageType] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MessageType]
types
    Ptr Message
result <- Ptr Bus -> Word64 -> CUInt -> IO (Ptr Message)
gst_bus_timed_pop_filtered Ptr Bus
bus' Word64
timeout CUInt
types'
    Maybe Message
maybeResult <- Ptr Message -> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Message
result ((Ptr Message -> IO Message) -> IO (Maybe Message))
-> (Ptr Message -> IO Message) -> IO (Maybe Message)
forall a b. (a -> b) -> a -> b
$ \Ptr Message
result' -> do
        Message
result'' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result'
        Message -> IO Message
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
bus
    Maybe Message -> IO (Maybe Message)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Message
maybeResult

#if defined(ENABLE_OVERLOADING)
data BusTimedPopFilteredMethodInfo
instance (signature ~ (Word64 -> [Gst.Flags.MessageType] -> m (Maybe Gst.Message.Message)), MonadIO m, IsBus a) => O.OverloadedMethod BusTimedPopFilteredMethodInfo a signature where
    overloadedMethod = busTimedPopFiltered

instance O.OverloadedMethodInfo BusTimedPopFilteredMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gst.Objects.Bus.busTimedPopFiltered",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Objects-Bus.html#v:busTimedPopFiltered"
        }


#endif