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

'GI.Gst.Objects.Bin.Bin' is an element that can contain other 'GI.Gst.Objects.Element.Element', allowing them to be
managed as a group.
Pads from the child elements can be ghosted to the bin, see 'GI.Gst.Objects.GhostPad.GhostPad'.
This makes the bin look like any other elements and enables creation of
higher-level abstraction elements.

A new 'GI.Gst.Objects.Bin.Bin' is created with 'GI.Gst.Objects.Bin.binNew'. Use a 'GI.Gst.Objects.Pipeline.Pipeline' instead if you
want to create a toplevel bin because a normal bin doesn\'t have a bus or
handle clock distribution of its own.

After the bin has been created you will typically add elements to it with
'GI.Gst.Objects.Bin.binAdd'. You can remove elements with 'GI.Gst.Objects.Bin.binRemove'.

An element can be retrieved from a bin with 'GI.Gst.Objects.Bin.binGetByName', using the
elements name. 'GI.Gst.Objects.Bin.binGetByNameRecurseUp' is mainly used for internal
purposes and will query the parent bins when the element is not found in the
current bin.

An iterator of elements in a bin can be retrieved with
'GI.Gst.Objects.Bin.binIterateElements'. Various other iterators exist to retrieve the
elements in a bin.

'GI.Gst.Objects.Object.objectUnref' is used to drop your reference to the bin.

The 'GI.Gst.Objects.Bin.Bin'::@/element-added/@ signal is fired whenever a new element is added to
the bin. Likewise the 'GI.Gst.Objects.Bin.Bin'::@/element-removed/@ signal is fired whenever an
element is removed from the bin.

== Notes

A 'GI.Gst.Objects.Bin.Bin' internally intercepts every 'GI.Gst.Structs.Message.Message' posted by its children and
implements the following default behaviour for each of them:

* GST_MESSAGE_EOS: This message is only posted by sinks in the PLAYING
state. If all sinks posted the EOS message, this bin will post and EOS
message upwards.

* GST_MESSAGE_SEGMENT_START: Just collected and never forwarded upwards.
The messages are used to decide when all elements have completed playback
of their segment.

* GST_MESSAGE_SEGMENT_DONE: Is posted by 'GI.Gst.Objects.Bin.Bin' when all elements that posted
a SEGMENT_START have posted a SEGMENT_DONE.

* GST_MESSAGE_DURATION_CHANGED: Is posted by an element that detected a change
in the stream duration. The default bin behaviour is to clear any
cached duration values so that the next duration query will perform
a full duration recalculation. The duration change is posted to the
application so that it can refetch the new duration with a duration
query. Note that these messages can be posted before the bin is
prerolled, in which case the duration query might fail.

* GST_MESSAGE_CLOCK_LOST: This message is posted by an element when it
can no longer provide a clock. The default bin behaviour is to
check if the lost clock was the one provided by the bin. If so and
the bin is currently in the PLAYING state, the message is forwarded to
the bin parent.
This message is also generated when a clock provider is removed from
the bin. If this message is received by the application, it should
PAUSE the pipeline and set it back to PLAYING to force a new clock
distribution.

* GST_MESSAGE_CLOCK_PROVIDE: This message is generated when an element
can provide a clock. This mostly happens when a new clock
provider is added to the bin. The default behaviour of the bin is to
mark the currently selected clock as dirty, which will perform a clock
recalculation the next time the bin is asked to provide a clock.
This message is never sent tot the application but is forwarded to
the parent of the bin.

* OTHERS: posted upwards.

A 'GI.Gst.Objects.Bin.Bin' implements the following default behaviour for answering to a
'GI.Gst.Structs.Query.Query':

* GST_QUERY_DURATION:If the query has been asked before with the same format
and the bin is a toplevel bin (ie. has no parent),
use the cached previous value. If no previous value was cached, the
query is sent to all sink elements in the bin and the MAXIMUM of all
values is returned. If the bin is a toplevel bin the value is cached.
If no sinks are available in the bin, the query fails.

* GST_QUERY_POSITION:The query is sent to all sink elements in the bin and the
MAXIMUM of all values is returned. If no sinks are available in the bin,
the query fails.

* OTHERS:the query is forwarded to all sink elements, the result
of the first sink that answers the query successfully is returned. If no
sink is in the bin, the query fails.

A 'GI.Gst.Objects.Bin.Bin' will by default forward any event sent to it to all sink
(@/GST_EVENT_TYPE_DOWNSTREAM/@) or source (@/GST_EVENT_TYPE_UPSTREAM/@) elements
depending on the event type.
If all the elements return 'True', the bin will also return 'True', else 'False'
is returned. If no elements of the required type are in the bin, the event
handler will return 'True'.
-}

module GI.Gst.Objects.Bin
    ( 

-- * Exported types
    Bin(..)                                 ,
    IsBin                                   ,
    toBin                                   ,
    noBin                                   ,


 -- * Methods
-- ** add #method:add#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinAddMethodInfo                        ,
#endif
    binAdd                                  ,


-- ** findUnlinkedPad #method:findUnlinkedPad#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinFindUnlinkedPadMethodInfo            ,
#endif
    binFindUnlinkedPad                      ,


-- ** getByInterface #method:getByInterface#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinGetByInterfaceMethodInfo             ,
#endif
    binGetByInterface                       ,


-- ** getByName #method:getByName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinGetByNameMethodInfo                  ,
#endif
    binGetByName                            ,


-- ** getByNameRecurseUp #method:getByNameRecurseUp#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinGetByNameRecurseUpMethodInfo         ,
#endif
    binGetByNameRecurseUp                   ,


-- ** getSuppressedFlags #method:getSuppressedFlags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinGetSuppressedFlagsMethodInfo         ,
#endif
    binGetSuppressedFlags                   ,


-- ** iterateAllByInterface #method:iterateAllByInterface#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinIterateAllByInterfaceMethodInfo      ,
#endif
    binIterateAllByInterface                ,


-- ** iterateElements #method:iterateElements#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinIterateElementsMethodInfo            ,
#endif
    binIterateElements                      ,


-- ** iterateRecurse #method:iterateRecurse#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinIterateRecurseMethodInfo             ,
#endif
    binIterateRecurse                       ,


-- ** iterateSinks #method:iterateSinks#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinIterateSinksMethodInfo               ,
#endif
    binIterateSinks                         ,


-- ** iterateSorted #method:iterateSorted#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinIterateSortedMethodInfo              ,
#endif
    binIterateSorted                        ,


-- ** iterateSources #method:iterateSources#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinIterateSourcesMethodInfo             ,
#endif
    binIterateSources                       ,


-- ** new #method:new#
    binNew                                  ,


-- ** recalculateLatency #method:recalculateLatency#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinRecalculateLatencyMethodInfo         ,
#endif
    binRecalculateLatency                   ,


-- ** remove #method:remove#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinRemoveMethodInfo                     ,
#endif
    binRemove                               ,


-- ** setSuppressedFlags #method:setSuppressedFlags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinSetSuppressedFlagsMethodInfo         ,
#endif
    binSetSuppressedFlags                   ,


-- ** syncChildrenStates #method:syncChildrenStates#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinSyncChildrenStatesMethodInfo         ,
#endif
    binSyncChildrenStates                   ,




 -- * Properties
-- ** asyncHandling #attr:asyncHandling#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinAsyncHandlingPropertyInfo            ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    binAsyncHandling                        ,
#endif
    constructBinAsyncHandling               ,
    getBinAsyncHandling                     ,
    setBinAsyncHandling                     ,


-- ** messageForward #attr:messageForward#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinMessageForwardPropertyInfo           ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    binMessageForward                       ,
#endif
    constructBinMessageForward              ,
    getBinMessageForward                    ,
    setBinMessageForward                    ,




 -- * Signals
-- ** deepElementAdded #signal:deepElementAdded#
    BinDeepElementAddedCallback             ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinDeepElementAddedSignalInfo           ,
#endif
    C_BinDeepElementAddedCallback           ,
    afterBinDeepElementAdded                ,
    genClosure_BinDeepElementAdded          ,
    mk_BinDeepElementAddedCallback          ,
    noBinDeepElementAddedCallback           ,
    onBinDeepElementAdded                   ,
    wrap_BinDeepElementAddedCallback        ,


-- ** deepElementRemoved #signal:deepElementRemoved#
    BinDeepElementRemovedCallback           ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinDeepElementRemovedSignalInfo         ,
#endif
    C_BinDeepElementRemovedCallback         ,
    afterBinDeepElementRemoved              ,
    genClosure_BinDeepElementRemoved        ,
    mk_BinDeepElementRemovedCallback        ,
    noBinDeepElementRemovedCallback         ,
    onBinDeepElementRemoved                 ,
    wrap_BinDeepElementRemovedCallback      ,


-- ** doLatency #signal:doLatency#
    BinDoLatencyCallback                    ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinDoLatencySignalInfo                  ,
#endif
    C_BinDoLatencyCallback                  ,
    afterBinDoLatency                       ,
    genClosure_BinDoLatency                 ,
    mk_BinDoLatencyCallback                 ,
    noBinDoLatencyCallback                  ,
    onBinDoLatency                          ,
    wrap_BinDoLatencyCallback               ,


-- ** elementAdded #signal:elementAdded#
    BinElementAddedCallback                 ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinElementAddedSignalInfo               ,
#endif
    C_BinElementAddedCallback               ,
    afterBinElementAdded                    ,
    genClosure_BinElementAdded              ,
    mk_BinElementAddedCallback              ,
    noBinElementAddedCallback               ,
    onBinElementAdded                       ,
    wrap_BinElementAddedCallback            ,


-- ** elementRemoved #signal:elementRemoved#
    BinElementRemovedCallback               ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    BinElementRemovedSignalInfo             ,
#endif
    C_BinElementRemovedCallback             ,
    afterBinElementRemoved                  ,
    genClosure_BinElementRemoved            ,
    mk_BinElementRemovedCallback            ,
    noBinElementRemovedCallback             ,
    onBinElementRemoved                     ,
    wrap_BinElementRemovedCallback          ,




    ) where

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

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

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Interfaces.ChildProxy as Gst.ChildProxy
import {-# SOURCE #-} qualified GI.Gst.Objects.Element as Gst.Element
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Pad as Gst.Pad
import {-# SOURCE #-} qualified GI.Gst.Structs.Iterator as Gst.Iterator

newtype Bin = Bin (ManagedPtr Bin)
foreign import ccall "gst_bin_get_type"
    c_gst_bin_get_type :: IO GType

instance GObject Bin where
    gobjectType _ = c_gst_bin_get_type
    

class GObject o => IsBin o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Bin a) =>
    IsBin a
#endif
instance IsBin Bin
instance Gst.Element.IsElement Bin
instance Gst.Object.IsObject Bin
instance GObject.Object.IsObject Bin
instance Gst.ChildProxy.IsChildProxy Bin

toBin :: (MonadIO m, IsBin o) => o -> m Bin
toBin = liftIO . unsafeCastTo Bin

noBin :: Maybe Bin
noBin = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveBinMethod (t :: Symbol) (o :: *) :: * where
    ResolveBinMethod "abortState" o = Gst.Element.ElementAbortStateMethodInfo
    ResolveBinMethod "add" o = BinAddMethodInfo
    ResolveBinMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveBinMethod "addPad" o = Gst.Element.ElementAddPadMethodInfo
    ResolveBinMethod "addPropertyDeepNotifyWatch" o = Gst.Element.ElementAddPropertyDeepNotifyWatchMethodInfo
    ResolveBinMethod "addPropertyNotifyWatch" o = Gst.Element.ElementAddPropertyNotifyWatchMethodInfo
    ResolveBinMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveBinMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveBinMethod "callAsync" o = Gst.Element.ElementCallAsyncMethodInfo
    ResolveBinMethod "changeState" o = Gst.Element.ElementChangeStateMethodInfo
    ResolveBinMethod "childAdded" o = Gst.ChildProxy.ChildProxyChildAddedMethodInfo
    ResolveBinMethod "childRemoved" o = Gst.ChildProxy.ChildProxyChildRemovedMethodInfo
    ResolveBinMethod "continueState" o = Gst.Element.ElementContinueStateMethodInfo
    ResolveBinMethod "createAllPads" o = Gst.Element.ElementCreateAllPadsMethodInfo
    ResolveBinMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveBinMethod "findUnlinkedPad" o = BinFindUnlinkedPadMethodInfo
    ResolveBinMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveBinMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveBinMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveBinMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveBinMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveBinMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveBinMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveBinMethod "isLockedState" o = Gst.Element.ElementIsLockedStateMethodInfo
    ResolveBinMethod "iterateAllByInterface" o = BinIterateAllByInterfaceMethodInfo
    ResolveBinMethod "iterateElements" o = BinIterateElementsMethodInfo
    ResolveBinMethod "iteratePads" o = Gst.Element.ElementIteratePadsMethodInfo
    ResolveBinMethod "iterateRecurse" o = BinIterateRecurseMethodInfo
    ResolveBinMethod "iterateSinkPads" o = Gst.Element.ElementIterateSinkPadsMethodInfo
    ResolveBinMethod "iterateSinks" o = BinIterateSinksMethodInfo
    ResolveBinMethod "iterateSorted" o = BinIterateSortedMethodInfo
    ResolveBinMethod "iterateSources" o = BinIterateSourcesMethodInfo
    ResolveBinMethod "iterateSrcPads" o = Gst.Element.ElementIterateSrcPadsMethodInfo
    ResolveBinMethod "link" o = Gst.Element.ElementLinkMethodInfo
    ResolveBinMethod "linkFiltered" o = Gst.Element.ElementLinkFilteredMethodInfo
    ResolveBinMethod "linkPads" o = Gst.Element.ElementLinkPadsMethodInfo
    ResolveBinMethod "linkPadsFiltered" o = Gst.Element.ElementLinkPadsFilteredMethodInfo
    ResolveBinMethod "linkPadsFull" o = Gst.Element.ElementLinkPadsFullMethodInfo
    ResolveBinMethod "lookup" o = Gst.ChildProxy.ChildProxyLookupMethodInfo
    ResolveBinMethod "lostState" o = Gst.Element.ElementLostStateMethodInfo
    ResolveBinMethod "messageFull" o = Gst.Element.ElementMessageFullMethodInfo
    ResolveBinMethod "messageFullWithDetails" o = Gst.Element.ElementMessageFullWithDetailsMethodInfo
    ResolveBinMethod "noMorePads" o = Gst.Element.ElementNoMorePadsMethodInfo
    ResolveBinMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveBinMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveBinMethod "postMessage" o = Gst.Element.ElementPostMessageMethodInfo
    ResolveBinMethod "provideClock" o = Gst.Element.ElementProvideClockMethodInfo
    ResolveBinMethod "query" o = Gst.Element.ElementQueryMethodInfo
    ResolveBinMethod "queryConvert" o = Gst.Element.ElementQueryConvertMethodInfo
    ResolveBinMethod "queryDuration" o = Gst.Element.ElementQueryDurationMethodInfo
    ResolveBinMethod "queryPosition" o = Gst.Element.ElementQueryPositionMethodInfo
    ResolveBinMethod "recalculateLatency" o = BinRecalculateLatencyMethodInfo
    ResolveBinMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveBinMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveBinMethod "releaseRequestPad" o = Gst.Element.ElementReleaseRequestPadMethodInfo
    ResolveBinMethod "remove" o = BinRemoveMethodInfo
    ResolveBinMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveBinMethod "removePad" o = Gst.Element.ElementRemovePadMethodInfo
    ResolveBinMethod "removePropertyNotifyWatch" o = Gst.Element.ElementRemovePropertyNotifyWatchMethodInfo
    ResolveBinMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveBinMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveBinMethod "requestPad" o = Gst.Element.ElementRequestPadMethodInfo
    ResolveBinMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveBinMethod "seek" o = Gst.Element.ElementSeekMethodInfo
    ResolveBinMethod "seekSimple" o = Gst.Element.ElementSeekSimpleMethodInfo
    ResolveBinMethod "sendEvent" o = Gst.Element.ElementSendEventMethodInfo
    ResolveBinMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveBinMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveBinMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveBinMethod "syncChildrenStates" o = BinSyncChildrenStatesMethodInfo
    ResolveBinMethod "syncStateWithParent" o = Gst.Element.ElementSyncStateWithParentMethodInfo
    ResolveBinMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveBinMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveBinMethod "unlink" o = Gst.Element.ElementUnlinkMethodInfo
    ResolveBinMethod "unlinkPads" o = Gst.Element.ElementUnlinkPadsMethodInfo
    ResolveBinMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveBinMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveBinMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveBinMethod "getBaseTime" o = Gst.Element.ElementGetBaseTimeMethodInfo
    ResolveBinMethod "getBus" o = Gst.Element.ElementGetBusMethodInfo
    ResolveBinMethod "getByInterface" o = BinGetByInterfaceMethodInfo
    ResolveBinMethod "getByName" o = BinGetByNameMethodInfo
    ResolveBinMethod "getByNameRecurseUp" o = BinGetByNameRecurseUpMethodInfo
    ResolveBinMethod "getChildByIndex" o = Gst.ChildProxy.ChildProxyGetChildByIndexMethodInfo
    ResolveBinMethod "getChildByName" o = Gst.ChildProxy.ChildProxyGetChildByNameMethodInfo
    ResolveBinMethod "getChildrenCount" o = Gst.ChildProxy.ChildProxyGetChildrenCountMethodInfo
    ResolveBinMethod "getClock" o = Gst.Element.ElementGetClockMethodInfo
    ResolveBinMethod "getCompatiblePad" o = Gst.Element.ElementGetCompatiblePadMethodInfo
    ResolveBinMethod "getCompatiblePadTemplate" o = Gst.Element.ElementGetCompatiblePadTemplateMethodInfo
    ResolveBinMethod "getContext" o = Gst.Element.ElementGetContextMethodInfo
    ResolveBinMethod "getContextUnlocked" o = Gst.Element.ElementGetContextUnlockedMethodInfo
    ResolveBinMethod "getContexts" o = Gst.Element.ElementGetContextsMethodInfo
    ResolveBinMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveBinMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveBinMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveBinMethod "getFactory" o = Gst.Element.ElementGetFactoryMethodInfo
    ResolveBinMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveBinMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveBinMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveBinMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveBinMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveBinMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveBinMethod "getRequestPad" o = Gst.Element.ElementGetRequestPadMethodInfo
    ResolveBinMethod "getStartTime" o = Gst.Element.ElementGetStartTimeMethodInfo
    ResolveBinMethod "getState" o = Gst.Element.ElementGetStateMethodInfo
    ResolveBinMethod "getStaticPad" o = Gst.Element.ElementGetStaticPadMethodInfo
    ResolveBinMethod "getSuppressedFlags" o = BinGetSuppressedFlagsMethodInfo
    ResolveBinMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveBinMethod "setBaseTime" o = Gst.Element.ElementSetBaseTimeMethodInfo
    ResolveBinMethod "setBus" o = Gst.Element.ElementSetBusMethodInfo
    ResolveBinMethod "setClock" o = Gst.Element.ElementSetClockMethodInfo
    ResolveBinMethod "setContext" o = Gst.Element.ElementSetContextMethodInfo
    ResolveBinMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveBinMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveBinMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveBinMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveBinMethod "setLockedState" o = Gst.Element.ElementSetLockedStateMethodInfo
    ResolveBinMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveBinMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveBinMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveBinMethod "setStartTime" o = Gst.Element.ElementSetStartTimeMethodInfo
    ResolveBinMethod "setState" o = Gst.Element.ElementSetStateMethodInfo
    ResolveBinMethod "setSuppressedFlags" o = BinSetSuppressedFlagsMethodInfo
    ResolveBinMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBinMethod t Bin, O.MethodInfo info Bin p) => O.IsLabelProxy t (Bin -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveBinMethod t Bin, O.MethodInfo info Bin p) => O.IsLabel t (Bin -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- signal Bin::deep-element-added
type BinDeepElementAddedCallback =
    Bin ->
    Gst.Element.Element ->
    IO ()

noBinDeepElementAddedCallback :: Maybe BinDeepElementAddedCallback
noBinDeepElementAddedCallback = Nothing

type C_BinDeepElementAddedCallback =
    Ptr () ->                               -- object
    Ptr Bin ->
    Ptr Gst.Element.Element ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BinDeepElementAddedCallback :: C_BinDeepElementAddedCallback -> IO (FunPtr C_BinDeepElementAddedCallback)

genClosure_BinDeepElementAdded :: BinDeepElementAddedCallback -> IO Closure
genClosure_BinDeepElementAdded cb = do
    let cb' = wrap_BinDeepElementAddedCallback cb
    mk_BinDeepElementAddedCallback cb' >>= newCClosure


wrap_BinDeepElementAddedCallback ::
    BinDeepElementAddedCallback ->
    Ptr () ->
    Ptr Bin ->
    Ptr Gst.Element.Element ->
    Ptr () ->
    IO ()
wrap_BinDeepElementAddedCallback _cb _ subBin element _ = do
    subBin' <- (newObject Bin) subBin
    element' <- (newObject Gst.Element.Element) element
    _cb  subBin' element'


onBinDeepElementAdded :: (IsBin a, MonadIO m) => a -> BinDeepElementAddedCallback -> m SignalHandlerId
onBinDeepElementAdded obj cb = liftIO $ do
    let cb' = wrap_BinDeepElementAddedCallback cb
    cb'' <- mk_BinDeepElementAddedCallback cb'
    connectSignalFunPtr obj "deep-element-added" cb'' SignalConnectBefore

afterBinDeepElementAdded :: (IsBin a, MonadIO m) => a -> BinDeepElementAddedCallback -> m SignalHandlerId
afterBinDeepElementAdded obj cb = liftIO $ do
    let cb' = wrap_BinDeepElementAddedCallback cb
    cb'' <- mk_BinDeepElementAddedCallback cb'
    connectSignalFunPtr obj "deep-element-added" cb'' SignalConnectAfter


-- signal Bin::deep-element-removed
type BinDeepElementRemovedCallback =
    Bin ->
    Gst.Element.Element ->
    IO ()

noBinDeepElementRemovedCallback :: Maybe BinDeepElementRemovedCallback
noBinDeepElementRemovedCallback = Nothing

type C_BinDeepElementRemovedCallback =
    Ptr () ->                               -- object
    Ptr Bin ->
    Ptr Gst.Element.Element ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BinDeepElementRemovedCallback :: C_BinDeepElementRemovedCallback -> IO (FunPtr C_BinDeepElementRemovedCallback)

genClosure_BinDeepElementRemoved :: BinDeepElementRemovedCallback -> IO Closure
genClosure_BinDeepElementRemoved cb = do
    let cb' = wrap_BinDeepElementRemovedCallback cb
    mk_BinDeepElementRemovedCallback cb' >>= newCClosure


wrap_BinDeepElementRemovedCallback ::
    BinDeepElementRemovedCallback ->
    Ptr () ->
    Ptr Bin ->
    Ptr Gst.Element.Element ->
    Ptr () ->
    IO ()
wrap_BinDeepElementRemovedCallback _cb _ subBin element _ = do
    subBin' <- (newObject Bin) subBin
    element' <- (newObject Gst.Element.Element) element
    _cb  subBin' element'


onBinDeepElementRemoved :: (IsBin a, MonadIO m) => a -> BinDeepElementRemovedCallback -> m SignalHandlerId
onBinDeepElementRemoved obj cb = liftIO $ do
    let cb' = wrap_BinDeepElementRemovedCallback cb
    cb'' <- mk_BinDeepElementRemovedCallback cb'
    connectSignalFunPtr obj "deep-element-removed" cb'' SignalConnectBefore

afterBinDeepElementRemoved :: (IsBin a, MonadIO m) => a -> BinDeepElementRemovedCallback -> m SignalHandlerId
afterBinDeepElementRemoved obj cb = liftIO $ do
    let cb' = wrap_BinDeepElementRemovedCallback cb
    cb'' <- mk_BinDeepElementRemovedCallback cb'
    connectSignalFunPtr obj "deep-element-removed" cb'' SignalConnectAfter


-- signal Bin::do-latency
type BinDoLatencyCallback =
    IO Bool

noBinDoLatencyCallback :: Maybe BinDoLatencyCallback
noBinDoLatencyCallback = Nothing

type C_BinDoLatencyCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO CInt

foreign import ccall "wrapper"
    mk_BinDoLatencyCallback :: C_BinDoLatencyCallback -> IO (FunPtr C_BinDoLatencyCallback)

genClosure_BinDoLatency :: BinDoLatencyCallback -> IO Closure
genClosure_BinDoLatency cb = do
    let cb' = wrap_BinDoLatencyCallback cb
    mk_BinDoLatencyCallback cb' >>= newCClosure


wrap_BinDoLatencyCallback ::
    BinDoLatencyCallback ->
    Ptr () ->
    Ptr () ->
    IO CInt
wrap_BinDoLatencyCallback _cb _ _ = do
    result <- _cb 
    let result' = (fromIntegral . fromEnum) result
    return result'


onBinDoLatency :: (IsBin a, MonadIO m) => a -> BinDoLatencyCallback -> m SignalHandlerId
onBinDoLatency obj cb = liftIO $ do
    let cb' = wrap_BinDoLatencyCallback cb
    cb'' <- mk_BinDoLatencyCallback cb'
    connectSignalFunPtr obj "do-latency" cb'' SignalConnectBefore

afterBinDoLatency :: (IsBin a, MonadIO m) => a -> BinDoLatencyCallback -> m SignalHandlerId
afterBinDoLatency obj cb = liftIO $ do
    let cb' = wrap_BinDoLatencyCallback cb
    cb'' <- mk_BinDoLatencyCallback cb'
    connectSignalFunPtr obj "do-latency" cb'' SignalConnectAfter


-- signal Bin::element-added
type BinElementAddedCallback =
    Gst.Element.Element ->
    IO ()

noBinElementAddedCallback :: Maybe BinElementAddedCallback
noBinElementAddedCallback = Nothing

type C_BinElementAddedCallback =
    Ptr () ->                               -- object
    Ptr Gst.Element.Element ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BinElementAddedCallback :: C_BinElementAddedCallback -> IO (FunPtr C_BinElementAddedCallback)

genClosure_BinElementAdded :: BinElementAddedCallback -> IO Closure
genClosure_BinElementAdded cb = do
    let cb' = wrap_BinElementAddedCallback cb
    mk_BinElementAddedCallback cb' >>= newCClosure


wrap_BinElementAddedCallback ::
    BinElementAddedCallback ->
    Ptr () ->
    Ptr Gst.Element.Element ->
    Ptr () ->
    IO ()
wrap_BinElementAddedCallback _cb _ element _ = do
    element' <- (newObject Gst.Element.Element) element
    _cb  element'


onBinElementAdded :: (IsBin a, MonadIO m) => a -> BinElementAddedCallback -> m SignalHandlerId
onBinElementAdded obj cb = liftIO $ do
    let cb' = wrap_BinElementAddedCallback cb
    cb'' <- mk_BinElementAddedCallback cb'
    connectSignalFunPtr obj "element-added" cb'' SignalConnectBefore

afterBinElementAdded :: (IsBin a, MonadIO m) => a -> BinElementAddedCallback -> m SignalHandlerId
afterBinElementAdded obj cb = liftIO $ do
    let cb' = wrap_BinElementAddedCallback cb
    cb'' <- mk_BinElementAddedCallback cb'
    connectSignalFunPtr obj "element-added" cb'' SignalConnectAfter


-- signal Bin::element-removed
type BinElementRemovedCallback =
    Gst.Element.Element ->
    IO ()

noBinElementRemovedCallback :: Maybe BinElementRemovedCallback
noBinElementRemovedCallback = Nothing

type C_BinElementRemovedCallback =
    Ptr () ->                               -- object
    Ptr Gst.Element.Element ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BinElementRemovedCallback :: C_BinElementRemovedCallback -> IO (FunPtr C_BinElementRemovedCallback)

genClosure_BinElementRemoved :: BinElementRemovedCallback -> IO Closure
genClosure_BinElementRemoved cb = do
    let cb' = wrap_BinElementRemovedCallback cb
    mk_BinElementRemovedCallback cb' >>= newCClosure


wrap_BinElementRemovedCallback ::
    BinElementRemovedCallback ->
    Ptr () ->
    Ptr Gst.Element.Element ->
    Ptr () ->
    IO ()
wrap_BinElementRemovedCallback _cb _ element _ = do
    element' <- (newObject Gst.Element.Element) element
    _cb  element'


onBinElementRemoved :: (IsBin a, MonadIO m) => a -> BinElementRemovedCallback -> m SignalHandlerId
onBinElementRemoved obj cb = liftIO $ do
    let cb' = wrap_BinElementRemovedCallback cb
    cb'' <- mk_BinElementRemovedCallback cb'
    connectSignalFunPtr obj "element-removed" cb'' SignalConnectBefore

afterBinElementRemoved :: (IsBin a, MonadIO m) => a -> BinElementRemovedCallback -> m SignalHandlerId
afterBinElementRemoved obj cb = liftIO $ do
    let cb' = wrap_BinElementRemovedCallback cb
    cb'' <- mk_BinElementRemovedCallback cb'
    connectSignalFunPtr obj "element-removed" cb'' SignalConnectAfter


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

getBinAsyncHandling :: (MonadIO m, IsBin o) => o -> m Bool
getBinAsyncHandling obj = liftIO $ getObjectPropertyBool obj "async-handling"

setBinAsyncHandling :: (MonadIO m, IsBin o) => o -> Bool -> m ()
setBinAsyncHandling obj val = liftIO $ setObjectPropertyBool obj "async-handling" val

constructBinAsyncHandling :: (IsBin o) => Bool -> IO (GValueConstruct o)
constructBinAsyncHandling val = constructObjectPropertyBool "async-handling" val

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinAsyncHandlingPropertyInfo
instance AttrInfo BinAsyncHandlingPropertyInfo where
    type AttrAllowedOps BinAsyncHandlingPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint BinAsyncHandlingPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint BinAsyncHandlingPropertyInfo = IsBin
    type AttrGetType BinAsyncHandlingPropertyInfo = Bool
    type AttrLabel BinAsyncHandlingPropertyInfo = "async-handling"
    type AttrOrigin BinAsyncHandlingPropertyInfo = Bin
    attrGet _ = getBinAsyncHandling
    attrSet _ = setBinAsyncHandling
    attrConstruct _ = constructBinAsyncHandling
    attrClear _ = undefined
#endif

-- VVV Prop "message-forward"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getBinMessageForward :: (MonadIO m, IsBin o) => o -> m Bool
getBinMessageForward obj = liftIO $ getObjectPropertyBool obj "message-forward"

setBinMessageForward :: (MonadIO m, IsBin o) => o -> Bool -> m ()
setBinMessageForward obj val = liftIO $ setObjectPropertyBool obj "message-forward" val

constructBinMessageForward :: (IsBin o) => Bool -> IO (GValueConstruct o)
constructBinMessageForward val = constructObjectPropertyBool "message-forward" val

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinMessageForwardPropertyInfo
instance AttrInfo BinMessageForwardPropertyInfo where
    type AttrAllowedOps BinMessageForwardPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint BinMessageForwardPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint BinMessageForwardPropertyInfo = IsBin
    type AttrGetType BinMessageForwardPropertyInfo = Bool
    type AttrLabel BinMessageForwardPropertyInfo = "message-forward"
    type AttrOrigin BinMessageForwardPropertyInfo = Bin
    attrGet _ = getBinMessageForward
    attrSet _ = setBinMessageForward
    attrConstruct _ = constructBinMessageForward
    attrClear _ = undefined
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Bin
type instance O.AttributeList Bin = BinAttributeList
type BinAttributeList = ('[ '("asyncHandling", BinAsyncHandlingPropertyInfo), '("messageForward", BinMessageForwardPropertyInfo), '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
binAsyncHandling :: AttrLabelProxy "asyncHandling"
binAsyncHandling = AttrLabelProxy

binMessageForward :: AttrLabelProxy "messageForward"
binMessageForward = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinDeepElementAddedSignalInfo
instance SignalInfo BinDeepElementAddedSignalInfo where
    type HaskellCallbackType BinDeepElementAddedSignalInfo = BinDeepElementAddedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BinDeepElementAddedCallback cb
        cb'' <- mk_BinDeepElementAddedCallback cb'
        connectSignalFunPtr obj "deep-element-added" cb'' connectMode

data BinDeepElementRemovedSignalInfo
instance SignalInfo BinDeepElementRemovedSignalInfo where
    type HaskellCallbackType BinDeepElementRemovedSignalInfo = BinDeepElementRemovedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BinDeepElementRemovedCallback cb
        cb'' <- mk_BinDeepElementRemovedCallback cb'
        connectSignalFunPtr obj "deep-element-removed" cb'' connectMode

data BinDoLatencySignalInfo
instance SignalInfo BinDoLatencySignalInfo where
    type HaskellCallbackType BinDoLatencySignalInfo = BinDoLatencyCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BinDoLatencyCallback cb
        cb'' <- mk_BinDoLatencyCallback cb'
        connectSignalFunPtr obj "do-latency" cb'' connectMode

data BinElementAddedSignalInfo
instance SignalInfo BinElementAddedSignalInfo where
    type HaskellCallbackType BinElementAddedSignalInfo = BinElementAddedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BinElementAddedCallback cb
        cb'' <- mk_BinElementAddedCallback cb'
        connectSignalFunPtr obj "element-added" cb'' connectMode

data BinElementRemovedSignalInfo
instance SignalInfo BinElementRemovedSignalInfo where
    type HaskellCallbackType BinElementRemovedSignalInfo = BinElementRemovedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BinElementRemovedCallback cb
        cb'' <- mk_BinElementRemovedCallback cb'
        connectSignalFunPtr obj "element-removed" cb'' connectMode

type instance O.SignalList Bin = BinSignalList
type BinSignalList = ('[ '("childAdded", Gst.ChildProxy.ChildProxyChildAddedSignalInfo), '("childRemoved", Gst.ChildProxy.ChildProxyChildRemovedSignalInfo), '("deepElementAdded", BinDeepElementAddedSignalInfo), '("deepElementRemoved", BinDeepElementRemovedSignalInfo), '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("doLatency", BinDoLatencySignalInfo), '("elementAdded", BinElementAddedSignalInfo), '("elementRemoved", BinElementRemovedSignalInfo), '("noMorePads", Gst.Element.ElementNoMorePadsSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("padAdded", Gst.Element.ElementPadAddedSignalInfo), '("padRemoved", Gst.Element.ElementPadRemovedSignalInfo)] :: [(Symbol, *)])

#endif

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

foreign import ccall "gst_bin_new" gst_bin_new :: 
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Bin)

{- |
Creates a new bin with the given name.
-}
binNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@name@/: the name of the new bin -}
    -> m Bin
    {- ^ __Returns:__ a new 'GI.Gst.Objects.Bin.Bin' -}
binNew name = liftIO $ do
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    result <- gst_bin_new maybeName
    checkUnexpectedReturnNULL "binNew" result
    result' <- (newObject Bin) result
    freeMem maybeName
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Bin::add
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "element", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstElement to add", 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_bin_add" gst_bin_add :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    IO CInt

{- |
Adds the given element to the bin.  Sets the element\'s parent, and thus
takes ownership of the element. An element can only be added to one bin.

If the element\'s pads are linked to other pads, the pads will be unlinked
before the element is added to the bin.

> When you add an element to an already-running pipeline, you will have to
> take care to set the state of the newly-added element to the desired
> state (usually PLAYING or PAUSED, same you set the pipeline to originally)
> with 'GI.Gst.Objects.Element.elementSetState', or use 'GI.Gst.Objects.Element.elementSyncStateWithParent'.
> The bin or pipeline will not take care of this for you.

MT safe.
-}
binAdd ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a, Gst.Element.IsElement b) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> b
    {- ^ /@element@/: the 'GI.Gst.Objects.Element.Element' to add -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the element could be added, 'False' if
the bin does not want to accept the element. -}
binAdd bin element = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    element' <- unsafeManagedPtrCastPtr element
    result <- gst_bin_add bin' element'
    let result' = (/= 0) result
    touchManagedPtr bin
    touchManagedPtr element
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinAddMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsBin a, Gst.Element.IsElement b) => O.MethodInfo BinAddMethodInfo a signature where
    overloadedMethod _ = binAdd

#endif

-- method Bin::find_unlinked_pad
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "bin in which to look for elements with unlinked pads", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "direction", argType = TInterface (Name {namespace = "Gst", name = "PadDirection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether to look for an unlinked source or sink pad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Pad"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_bin_find_unlinked_pad" gst_bin_find_unlinked_pad :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "Gst", name = "PadDirection"})
    IO (Ptr Gst.Pad.Pad)

{- |
Recursively looks for elements with an unlinked pad of the given
direction within the specified bin and returns an unlinked pad
if one is found, or 'Nothing' otherwise. If a pad is found, the caller
owns a reference to it and should use 'GI.Gst.Objects.Object.objectUnref' on the
pad when it is not needed any longer.
-}
binFindUnlinkedPad ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: bin in which to look for elements with unlinked pads -}
    -> Gst.Enums.PadDirection
    {- ^ /@direction@/: whether to look for an unlinked source or sink pad -}
    -> m (Maybe Gst.Pad.Pad)
    {- ^ __Returns:__ unlinked pad of the given
direction, 'Nothing'. -}
binFindUnlinkedPad bin direction = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    let direction' = (fromIntegral . fromEnum) direction
    result <- gst_bin_find_unlinked_pad bin' direction'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Pad.Pad) result'
        return result''
    touchManagedPtr bin
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinFindUnlinkedPadMethodInfo
instance (signature ~ (Gst.Enums.PadDirection -> m (Maybe Gst.Pad.Pad)), MonadIO m, IsBin a) => O.MethodInfo BinFindUnlinkedPadMethodInfo a signature where
    overloadedMethod _ = binFindUnlinkedPad

#endif

-- method Bin::get_by_interface
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iface", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of an interface", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_bin_get_by_interface" gst_bin_get_by_interface :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CGType ->                               -- iface : TBasicType TGType
    IO (Ptr Gst.Element.Element)

{- |
Looks for an element inside the bin that implements the given
interface. If such an element is found, it returns the element.
You can cast this element to the given interface afterwards.  If you want
all elements that implement the interface, use
'GI.Gst.Objects.Bin.binIterateAllByInterface'. This function recurses into child bins.

MT safe.  Caller owns returned reference.
-}
binGetByInterface ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> GType
    {- ^ /@iface@/: the 'GType' of an interface -}
    -> m Gst.Element.Element
    {- ^ __Returns:__ A 'GI.Gst.Objects.Element.Element' inside the bin implementing the interface -}
binGetByInterface bin iface = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    let iface' = gtypeToCGType iface
    result <- gst_bin_get_by_interface bin' iface'
    checkUnexpectedReturnNULL "binGetByInterface" result
    result' <- (wrapObject Gst.Element.Element) result
    touchManagedPtr bin
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinGetByInterfaceMethodInfo
instance (signature ~ (GType -> m Gst.Element.Element), MonadIO m, IsBin a) => O.MethodInfo BinGetByInterfaceMethodInfo a signature where
    overloadedMethod _ = binGetByInterface

#endif

-- method Bin::get_by_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the element name to search for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_bin_get_by_name" gst_bin_get_by_name :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gst.Element.Element)

{- |
Gets the element with the given name from a bin. This
function recurses into child bins.

Returns 'Nothing' if no element with the given name is found in the bin.

MT safe.  Caller owns returned reference.
-}
binGetByName ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> T.Text
    {- ^ /@name@/: the element name to search for -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ the 'GI.Gst.Objects.Element.Element' with the given
name, or 'Nothing' -}
binGetByName bin name = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    name' <- textToCString name
    result <- gst_bin_get_by_name bin' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Element.Element) result'
        return result''
    touchManagedPtr bin
    freeMem name'
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinGetByNameMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gst.Element.Element)), MonadIO m, IsBin a) => O.MethodInfo BinGetByNameMethodInfo a signature where
    overloadedMethod _ = binGetByName

#endif

-- method Bin::get_by_name_recurse_up
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the element name to search for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_bin_get_by_name_recurse_up" gst_bin_get_by_name_recurse_up :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gst.Element.Element)

{- |
Gets the element with the given name from this bin. If the
element is not found, a recursion is performed on the parent bin.

Returns 'Nothing' if:

* no element with the given name is found in the bin


MT safe.  Caller owns returned reference.
-}
binGetByNameRecurseUp ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> T.Text
    {- ^ /@name@/: the element name to search for -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ the 'GI.Gst.Objects.Element.Element' with the given
name, or 'Nothing' -}
binGetByNameRecurseUp bin name = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    name' <- textToCString name
    result <- gst_bin_get_by_name_recurse_up bin' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Element.Element) result'
        return result''
    touchManagedPtr bin
    freeMem name'
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinGetByNameRecurseUpMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gst.Element.Element)), MonadIO m, IsBin a) => O.MethodInfo BinGetByNameRecurseUpMethodInfo a signature where
    overloadedMethod _ = binGetByNameRecurseUp

#endif

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

foreign import ccall "gst_bin_get_suppressed_flags" gst_bin_get_suppressed_flags :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO CUInt

{- |
Return the suppressed flags of the bin.

MT safe.

@since 1.10
-}
binGetSuppressedFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m [Gst.Flags.ElementFlags]
    {- ^ __Returns:__ the bin\'s suppressed 'GI.Gst.Flags.ElementFlags'. -}
binGetSuppressedFlags bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_get_suppressed_flags bin'
    let result' = wordToGFlags result
    touchManagedPtr bin
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinGetSuppressedFlagsMethodInfo
instance (signature ~ (m [Gst.Flags.ElementFlags]), MonadIO m, IsBin a) => O.MethodInfo BinGetSuppressedFlagsMethodInfo a signature where
    overloadedMethod _ = binGetSuppressedFlags

#endif

-- method Bin::iterate_all_by_interface
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iface", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of an interface", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Iterator"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_bin_iterate_all_by_interface" gst_bin_iterate_all_by_interface :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CGType ->                               -- iface : TBasicType TGType
    IO (Ptr Gst.Iterator.Iterator)

{- |
Looks for all elements inside the bin that implements the given
interface. You can safely cast all returned elements to the given interface.
The function recurses inside child bins. The iterator will yield a series
of 'GI.Gst.Objects.Element.Element' that should be unreffed after use.

MT safe.  Caller owns returned value.
-}
binIterateAllByInterface ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> GType
    {- ^ /@iface@/: the 'GType' of an interface -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Element.Element'
    for all elements in the bin implementing the given interface,
    or 'Nothing' -}
binIterateAllByInterface bin iface = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    let iface' = gtypeToCGType iface
    result <- gst_bin_iterate_all_by_interface bin' iface'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr bin
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinIterateAllByInterfaceMethodInfo
instance (signature ~ (GType -> m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsBin a) => O.MethodInfo BinIterateAllByInterfaceMethodInfo a signature where
    overloadedMethod _ = binIterateAllByInterface

#endif

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

foreign import ccall "gst_bin_iterate_elements" gst_bin_iterate_elements :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO (Ptr Gst.Iterator.Iterator)

{- |
Gets an iterator for the elements in this bin.

MT safe.  Caller owns returned value.
-}
binIterateElements ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Element.Element',
or 'Nothing' -}
binIterateElements bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_iterate_elements bin'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr bin
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinIterateElementsMethodInfo
instance (signature ~ (m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsBin a) => O.MethodInfo BinIterateElementsMethodInfo a signature where
    overloadedMethod _ = binIterateElements

#endif

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

foreign import ccall "gst_bin_iterate_recurse" gst_bin_iterate_recurse :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO (Ptr Gst.Iterator.Iterator)

{- |
Gets an iterator for the elements in this bin.
This iterator recurses into GstBin children.

MT safe.  Caller owns returned value.
-}
binIterateRecurse ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Element.Element',
or 'Nothing' -}
binIterateRecurse bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_iterate_recurse bin'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr bin
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinIterateRecurseMethodInfo
instance (signature ~ (m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsBin a) => O.MethodInfo BinIterateRecurseMethodInfo a signature where
    overloadedMethod _ = binIterateRecurse

#endif

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

foreign import ccall "gst_bin_iterate_sinks" gst_bin_iterate_sinks :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO (Ptr Gst.Iterator.Iterator)

{- |
Gets an iterator for all elements in the bin that have the
@/GST_ELEMENT_FLAG_SINK/@ flag set.

MT safe.  Caller owns returned value.
-}
binIterateSinks ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Element.Element',
or 'Nothing' -}
binIterateSinks bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_iterate_sinks bin'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr bin
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinIterateSinksMethodInfo
instance (signature ~ (m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsBin a) => O.MethodInfo BinIterateSinksMethodInfo a signature where
    overloadedMethod _ = binIterateSinks

#endif

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

foreign import ccall "gst_bin_iterate_sorted" gst_bin_iterate_sorted :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO (Ptr Gst.Iterator.Iterator)

{- |
Gets an iterator for the elements in this bin in topologically
sorted order. This means that the elements are returned from
the most downstream elements (sinks) to the sources.

This function is used internally to perform the state changes
of the bin elements and for clock selection.

MT safe.  Caller owns returned value.
-}
binIterateSorted ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Element.Element',
or 'Nothing' -}
binIterateSorted bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_iterate_sorted bin'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr bin
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinIterateSortedMethodInfo
instance (signature ~ (m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsBin a) => O.MethodInfo BinIterateSortedMethodInfo a signature where
    overloadedMethod _ = binIterateSorted

#endif

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

foreign import ccall "gst_bin_iterate_sources" gst_bin_iterate_sources :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO (Ptr Gst.Iterator.Iterator)

{- |
Gets an iterator for all elements in the bin that have the
@/GST_ELEMENT_FLAG_SOURCE/@ flag set.

MT safe.  Caller owns returned value.
-}
binIterateSources ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m (Maybe Gst.Iterator.Iterator)
    {- ^ __Returns:__ a 'GI.Gst.Structs.Iterator.Iterator' of 'GI.Gst.Objects.Element.Element',
or 'Nothing' -}
binIterateSources bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_iterate_sources bin'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Iterator.Iterator) result'
        return result''
    touchManagedPtr bin
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinIterateSourcesMethodInfo
instance (signature ~ (m (Maybe Gst.Iterator.Iterator)), MonadIO m, IsBin a) => O.MethodInfo BinIterateSourcesMethodInfo a signature where
    overloadedMethod _ = binIterateSources

#endif

-- method Bin::recalculate_latency
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", 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_bin_recalculate_latency" gst_bin_recalculate_latency :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO CInt

{- |
Query /@bin@/ for the current latency using and reconfigures this latency to all the
elements with a LATENCY event.

This method is typically called on the pipeline when a @/GST_MESSAGE_LATENCY/@
is posted on the bus.

This function simply emits the \'do-latency\' signal so any custom latency
calculations will be performed.
-}
binRecalculateLatency ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the latency could be queried and reconfigured. -}
binRecalculateLatency bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_recalculate_latency bin'
    let result' = (/= 0) result
    touchManagedPtr bin
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinRecalculateLatencyMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBin a) => O.MethodInfo BinRecalculateLatencyMethodInfo a signature where
    overloadedMethod _ = binRecalculateLatency

#endif

-- method Bin::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "element", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstElement to remove", 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_bin_remove" gst_bin_remove :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    IO CInt

{- |
Removes the element from the bin, unparenting it as well.
Unparenting the element means that the element will be dereferenced,
so if the bin holds the only reference to the element, the element
will be freed in the process of removing it from the bin.  If you
want the element to still exist after removing, you need to call
'GI.Gst.Objects.Object.objectRef' before removing it from the bin.

If the element\'s pads are linked to other pads, the pads will be unlinked
before the element is removed from the bin.

MT safe.
-}
binRemove ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a, Gst.Element.IsElement b) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> b
    {- ^ /@element@/: the 'GI.Gst.Objects.Element.Element' to remove -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the element could be removed, 'False' if
the bin does not want to remove the element. -}
binRemove bin element = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    element' <- unsafeManagedPtrCastPtr element
    result <- gst_bin_remove bin' element'
    let result' = (/= 0) result
    touchManagedPtr bin
    touchManagedPtr element
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinRemoveMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsBin a, Gst.Element.IsElement b) => O.MethodInfo BinRemoveMethodInfo a signature where
    overloadedMethod _ = binRemove

#endif

-- method Bin::set_suppressed_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "ElementFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstElementFlags to suppress", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_bin_set_suppressed_flags" gst_bin_set_suppressed_flags :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "ElementFlags"})
    IO ()

{- |
Suppress the given flags on the bin. 'GI.Gst.Flags.ElementFlags' of a
child element are propagated when it is added to the bin.
When suppressed flags are set, those specified flags will
not be propagated to the bin.

MT safe.

@since 1.10
-}
binSetSuppressedFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> [Gst.Flags.ElementFlags]
    {- ^ /@flags@/: the 'GI.Gst.Flags.ElementFlags' to suppress -}
    -> m ()
binSetSuppressedFlags bin flags = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    let flags' = gflagsToWord flags
    gst_bin_set_suppressed_flags bin' flags'
    touchManagedPtr bin
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinSetSuppressedFlagsMethodInfo
instance (signature ~ ([Gst.Flags.ElementFlags] -> m ()), MonadIO m, IsBin a) => O.MethodInfo BinSetSuppressedFlagsMethodInfo a signature where
    overloadedMethod _ = binSetSuppressedFlags

#endif

-- method Bin::sync_children_states
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBin", 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_bin_sync_children_states" gst_bin_sync_children_states :: 
    Ptr Bin ->                              -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    IO CInt

{- |
Synchronizes the state of every child of /@bin@/ with the state
of /@bin@/. See also 'GI.Gst.Objects.Element.elementSyncStateWithParent'.

@since 1.6
-}
binSyncChildrenStates ::
    (B.CallStack.HasCallStack, MonadIO m, IsBin a) =>
    a
    {- ^ /@bin@/: a 'GI.Gst.Objects.Bin.Bin' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if syncing the state was successful for all children,
 otherwise 'False'. -}
binSyncChildrenStates bin = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    result <- gst_bin_sync_children_states bin'
    let result' = (/= 0) result
    touchManagedPtr bin
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data BinSyncChildrenStatesMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBin a) => O.MethodInfo BinSyncChildrenStatesMethodInfo a signature where
    overloadedMethod _ = binSyncChildrenStates

#endif