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

'GI.Gst.Objects.ElementFactory.ElementFactory' is used to create instances of elements. A
GstElementFactory can be added to a 'GI.Gst.Objects.Plugin.Plugin' as it is also a
'GI.Gst.Objects.PluginFeature.PluginFeature'.

Use the 'GI.Gst.Objects.ElementFactory.elementFactoryFind' and 'GI.Gst.Objects.ElementFactory.elementFactoryCreate'
functions to create element instances or use 'GI.Gst.Objects.ElementFactory.elementFactoryMake' as a
convenient shortcut.

The following code example shows you how to create a GstFileSrc element.

== Using an element factory

=== /C code/
>
>  #include <gst/gst.h>
>
>  GstElement *src;
>  GstElementFactory *srcfactory;
>
>  gst_init (&argc, &argv);
>
>  srcfactory = gst_element_factory_find ("filesrc");
>  g_return_if_fail (srcfactory != NULL);
>  src = gst_element_factory_create (srcfactory, "src");
>  g_return_if_fail (src != NULL);
>  ...

-}

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

module GI.Gst.Objects.ElementFactory
    (

-- * Exported types
    ElementFactory(..)                      ,
    IsElementFactory                        ,
    toElementFactory                        ,
    noElementFactory                        ,


 -- * Methods
-- ** canSinkAllCaps #method:canSinkAllCaps#

#if ENABLE_OVERLOADING
    ElementFactoryCanSinkAllCapsMethodInfo  ,
#endif
    elementFactoryCanSinkAllCaps            ,


-- ** canSinkAnyCaps #method:canSinkAnyCaps#

#if ENABLE_OVERLOADING
    ElementFactoryCanSinkAnyCapsMethodInfo  ,
#endif
    elementFactoryCanSinkAnyCaps            ,


-- ** canSrcAllCaps #method:canSrcAllCaps#

#if ENABLE_OVERLOADING
    ElementFactoryCanSrcAllCapsMethodInfo   ,
#endif
    elementFactoryCanSrcAllCaps             ,


-- ** canSrcAnyCaps #method:canSrcAnyCaps#

#if ENABLE_OVERLOADING
    ElementFactoryCanSrcAnyCapsMethodInfo   ,
#endif
    elementFactoryCanSrcAnyCaps             ,


-- ** create #method:create#

#if ENABLE_OVERLOADING
    ElementFactoryCreateMethodInfo          ,
#endif
    elementFactoryCreate                    ,


-- ** find #method:find#

    elementFactoryFind                      ,


-- ** getElementType #method:getElementType#

#if ENABLE_OVERLOADING
    ElementFactoryGetElementTypeMethodInfo  ,
#endif
    elementFactoryGetElementType            ,


-- ** getMetadata #method:getMetadata#

#if ENABLE_OVERLOADING
    ElementFactoryGetMetadataMethodInfo     ,
#endif
    elementFactoryGetMetadata               ,


-- ** getMetadataKeys #method:getMetadataKeys#

#if ENABLE_OVERLOADING
    ElementFactoryGetMetadataKeysMethodInfo ,
#endif
    elementFactoryGetMetadataKeys           ,


-- ** getNumPadTemplates #method:getNumPadTemplates#

#if ENABLE_OVERLOADING
    ElementFactoryGetNumPadTemplatesMethodInfo,
#endif
    elementFactoryGetNumPadTemplates        ,


-- ** getStaticPadTemplates #method:getStaticPadTemplates#

#if ENABLE_OVERLOADING
    ElementFactoryGetStaticPadTemplatesMethodInfo,
#endif
    elementFactoryGetStaticPadTemplates     ,


-- ** getUriProtocols #method:getUriProtocols#

#if ENABLE_OVERLOADING
    ElementFactoryGetUriProtocolsMethodInfo ,
#endif
    elementFactoryGetUriProtocols           ,


-- ** getUriType #method:getUriType#

#if ENABLE_OVERLOADING
    ElementFactoryGetUriTypeMethodInfo      ,
#endif
    elementFactoryGetUriType                ,


-- ** hasInterface #method:hasInterface#

#if ENABLE_OVERLOADING
    ElementFactoryHasInterfaceMethodInfo    ,
#endif
    elementFactoryHasInterface              ,


-- ** listFilter #method:listFilter#

    elementFactoryListFilter                ,


-- ** listGetElements #method:listGetElements#

    elementFactoryListGetElements           ,


-- ** listIsType #method:listIsType#

#if ENABLE_OVERLOADING
    ElementFactoryListIsTypeMethodInfo      ,
#endif
    elementFactoryListIsType                ,


-- ** make #method:make#

    elementFactoryMake                      ,




    ) where

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

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

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
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.PluginFeature as Gst.PluginFeature
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.StaticPadTemplate as Gst.StaticPadTemplate

-- | Memory-managed wrapper type.
newtype ElementFactory = ElementFactory (ManagedPtr ElementFactory)
foreign import ccall "gst_element_factory_get_type"
    c_gst_element_factory_get_type :: IO GType

instance GObject ElementFactory where
    gobjectType = c_gst_element_factory_get_type


-- | Type class for types which can be safely cast to `ElementFactory`, for instance with `toElementFactory`.
class (GObject o, O.IsDescendantOf ElementFactory o) => IsElementFactory o
instance (GObject o, O.IsDescendantOf ElementFactory o) => IsElementFactory o

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

-- | Cast to `ElementFactory`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toElementFactory :: (MonadIO m, IsElementFactory o) => o -> m ElementFactory
toElementFactory = liftIO . unsafeCastTo ElementFactory

-- | A convenience alias for `Nothing` :: `Maybe` `ElementFactory`.
noElementFactory :: Maybe ElementFactory
noElementFactory = Nothing

#if ENABLE_OVERLOADING
type family ResolveElementFactoryMethod (t :: Symbol) (o :: *) :: * where
    ResolveElementFactoryMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveElementFactoryMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveElementFactoryMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveElementFactoryMethod "canSinkAllCaps" o = ElementFactoryCanSinkAllCapsMethodInfo
    ResolveElementFactoryMethod "canSinkAnyCaps" o = ElementFactoryCanSinkAnyCapsMethodInfo
    ResolveElementFactoryMethod "canSrcAllCaps" o = ElementFactoryCanSrcAllCapsMethodInfo
    ResolveElementFactoryMethod "canSrcAnyCaps" o = ElementFactoryCanSrcAnyCapsMethodInfo
    ResolveElementFactoryMethod "checkVersion" o = Gst.PluginFeature.PluginFeatureCheckVersionMethodInfo
    ResolveElementFactoryMethod "create" o = ElementFactoryCreateMethodInfo
    ResolveElementFactoryMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveElementFactoryMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveElementFactoryMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveElementFactoryMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveElementFactoryMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveElementFactoryMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveElementFactoryMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveElementFactoryMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveElementFactoryMethod "hasInterface" o = ElementFactoryHasInterfaceMethodInfo
    ResolveElementFactoryMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveElementFactoryMethod "listIsType" o = ElementFactoryListIsTypeMethodInfo
    ResolveElementFactoryMethod "load" o = Gst.PluginFeature.PluginFeatureLoadMethodInfo
    ResolveElementFactoryMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveElementFactoryMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveElementFactoryMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveElementFactoryMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveElementFactoryMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveElementFactoryMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveElementFactoryMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveElementFactoryMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveElementFactoryMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveElementFactoryMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveElementFactoryMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveElementFactoryMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveElementFactoryMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveElementFactoryMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveElementFactoryMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveElementFactoryMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveElementFactoryMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveElementFactoryMethod "getElementType" o = ElementFactoryGetElementTypeMethodInfo
    ResolveElementFactoryMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveElementFactoryMethod "getMetadata" o = ElementFactoryGetMetadataMethodInfo
    ResolveElementFactoryMethod "getMetadataKeys" o = ElementFactoryGetMetadataKeysMethodInfo
    ResolveElementFactoryMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveElementFactoryMethod "getNumPadTemplates" o = ElementFactoryGetNumPadTemplatesMethodInfo
    ResolveElementFactoryMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveElementFactoryMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveElementFactoryMethod "getPlugin" o = Gst.PluginFeature.PluginFeatureGetPluginMethodInfo
    ResolveElementFactoryMethod "getPluginName" o = Gst.PluginFeature.PluginFeatureGetPluginNameMethodInfo
    ResolveElementFactoryMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveElementFactoryMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveElementFactoryMethod "getRank" o = Gst.PluginFeature.PluginFeatureGetRankMethodInfo
    ResolveElementFactoryMethod "getStaticPadTemplates" o = ElementFactoryGetStaticPadTemplatesMethodInfo
    ResolveElementFactoryMethod "getUriProtocols" o = ElementFactoryGetUriProtocolsMethodInfo
    ResolveElementFactoryMethod "getUriType" o = ElementFactoryGetUriTypeMethodInfo
    ResolveElementFactoryMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveElementFactoryMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveElementFactoryMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveElementFactoryMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveElementFactoryMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveElementFactoryMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveElementFactoryMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveElementFactoryMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveElementFactoryMethod "setRank" o = Gst.PluginFeature.PluginFeatureSetRankMethodInfo
    ResolveElementFactoryMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveElementFactoryMethod t ElementFactory, O.MethodInfo info ElementFactory p) => OL.IsLabel t (ElementFactory -> 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

#if ENABLE_OVERLOADING
instance O.HasAttributeList ElementFactory
type instance O.AttributeList ElementFactory = ElementFactoryAttributeList
type ElementFactoryAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type instance O.SignalList ElementFactory = ElementFactorySignalList
type ElementFactorySignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method ElementFactory::can_sink_all_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "factory to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the caps 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_element_factory_can_sink_all_caps" gst_element_factory_can_sink_all_caps ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CInt

{- |
Checks if the factory can sink all possible capabilities.
-}
elementFactoryCanSinkAllCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: factory to query -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: the caps to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the caps are fully compatible. -}
elementFactoryCanSinkAllCaps factory caps = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    caps' <- unsafeManagedPtrGetPtr caps
    result <- gst_element_factory_can_sink_all_caps factory' caps'
    let result' = (/= 0) result
    touchManagedPtr factory
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryCanSinkAllCapsMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m Bool), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryCanSinkAllCapsMethodInfo a signature where
    overloadedMethod _ = elementFactoryCanSinkAllCaps

#endif

-- method ElementFactory::can_sink_any_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "factory to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the caps 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_element_factory_can_sink_any_caps" gst_element_factory_can_sink_any_caps ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CInt

{- |
Checks if the factory can sink any possible capability.
-}
elementFactoryCanSinkAnyCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: factory to query -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: the caps to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the caps have a common subset. -}
elementFactoryCanSinkAnyCaps factory caps = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    caps' <- unsafeManagedPtrGetPtr caps
    result <- gst_element_factory_can_sink_any_caps factory' caps'
    let result' = (/= 0) result
    touchManagedPtr factory
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryCanSinkAnyCapsMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m Bool), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryCanSinkAnyCapsMethodInfo a signature where
    overloadedMethod _ = elementFactoryCanSinkAnyCaps

#endif

-- method ElementFactory::can_src_all_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "factory to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the caps 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_element_factory_can_src_all_caps" gst_element_factory_can_src_all_caps ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CInt

{- |
Checks if the factory can src all possible capabilities.
-}
elementFactoryCanSrcAllCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: factory to query -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: the caps to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the caps are fully compatible. -}
elementFactoryCanSrcAllCaps factory caps = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    caps' <- unsafeManagedPtrGetPtr caps
    result <- gst_element_factory_can_src_all_caps factory' caps'
    let result' = (/= 0) result
    touchManagedPtr factory
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryCanSrcAllCapsMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m Bool), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryCanSrcAllCapsMethodInfo a signature where
    overloadedMethod _ = elementFactoryCanSrcAllCaps

#endif

-- method ElementFactory::can_src_any_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "factory to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the caps 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_element_factory_can_src_any_caps" gst_element_factory_can_src_any_caps ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CInt

{- |
Checks if the factory can src any possible capability.
-}
elementFactoryCanSrcAnyCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: factory to query -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: the caps to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the caps have a common subset. -}
elementFactoryCanSrcAnyCaps factory caps = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    caps' <- unsafeManagedPtrGetPtr caps
    result <- gst_element_factory_can_src_any_caps factory' caps'
    let result' = (/= 0) result
    touchManagedPtr factory
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryCanSrcAnyCapsMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m Bool), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryCanSrcAnyCapsMethodInfo a signature where
    overloadedMethod _ = elementFactoryCanSrcAnyCaps

#endif

-- method ElementFactory::create
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "factory to instantiate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "name of new element, or %NULL to automatically create\n   a unique name", 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_element_factory_create" gst_element_factory_create ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gst.Element.Element)

{- |
Create a new element of the type defined by the given elementfactory.
It will be given the name supplied, since all elements require a name as
their first argument.
-}
elementFactoryCreate ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: factory to instantiate -}
    -> Maybe (T.Text)
    {- ^ /@name@/: name of new element, or 'Nothing' to automatically create
   a unique name -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ new 'GI.Gst.Objects.Element.Element' or 'Nothing'
    if the element couldn\'t be created -}
elementFactoryCreate factory name = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    result <- gst_element_factory_create factory' maybeName
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gst.Element.Element) result'
        return result''
    touchManagedPtr factory
    freeMem maybeName
    return maybeResult

#if ENABLE_OVERLOADING
data ElementFactoryCreateMethodInfo
instance (signature ~ (Maybe (T.Text) -> m (Maybe Gst.Element.Element)), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryCreateMethodInfo a signature where
    overloadedMethod _ = elementFactoryCreate

#endif

-- method ElementFactory::get_element_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "factory to get managed #GType from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "gst_element_factory_get_element_type" gst_element_factory_get_element_type ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    IO CGType

{- |
Get the 'GType' for elements managed by this factory. The type can
only be retrieved if the element factory is loaded, which can be
assured with 'GI.Gst.Objects.PluginFeature.pluginFeatureLoad'.
-}
elementFactoryGetElementType ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: factory to get managed 'GType' from -}
    -> m GType
    {- ^ __Returns:__ the 'GType' for elements managed by this factory or 0 if
the factory is not loaded. -}
elementFactoryGetElementType factory = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    result <- gst_element_factory_get_element_type factory'
    let result' = GType result
    touchManagedPtr factory
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryGetElementTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryGetElementTypeMethodInfo a signature where
    overloadedMethod _ = elementFactoryGetElementType

#endif

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

foreign import ccall "gst_element_factory_get_metadata" gst_element_factory_get_metadata ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    CString ->                              -- key : TBasicType TUTF8
    IO CString

{- |
Get the metadata on /@factory@/ with /@key@/.
-}
elementFactoryGetMetadata ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the metadata with /@key@/ on /@factory@/ or 'Nothing'
when there was no metadata with the given /@key@/. -}
elementFactoryGetMetadata factory key = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    key' <- textToCString key
    result <- gst_element_factory_get_metadata factory' key'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr factory
    freeMem key'
    return maybeResult

#if ENABLE_OVERLOADING
data ElementFactoryGetMetadataMethodInfo
instance (signature ~ (T.Text -> m (Maybe T.Text)), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryGetMetadataMethodInfo a signature where
    overloadedMethod _ = elementFactoryGetMetadata

#endif

-- method ElementFactory::get_metadata_keys
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstElementFactory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_element_factory_get_metadata_keys" gst_element_factory_get_metadata_keys ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    IO (Ptr CString)

{- |
Get the available keys for the metadata on /@factory@/.
-}
elementFactoryGetMetadataKeys ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> m (Maybe [T.Text])
    {- ^ __Returns:__ 
a 'Nothing'-terminated array of key strings, or 'Nothing' when there is no
metadata. Free with 'GI.GLib.Functions.strfreev' when no longer needed. -}
elementFactoryGetMetadataKeys factory = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    result <- gst_element_factory_get_metadata_keys factory'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- unpackZeroTerminatedUTF8CArray result'
        mapZeroTerminatedCArray freeMem result'
        freeMem result'
        return result''
    touchManagedPtr factory
    return maybeResult

#if ENABLE_OVERLOADING
data ElementFactoryGetMetadataKeysMethodInfo
instance (signature ~ (m (Maybe [T.Text])), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryGetMetadataKeysMethodInfo a signature where
    overloadedMethod _ = elementFactoryGetMetadataKeys

#endif

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

foreign import ccall "gst_element_factory_get_num_pad_templates" gst_element_factory_get_num_pad_templates ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    IO Word32

{- |
Gets the number of pad_templates in this factory.
-}
elementFactoryGetNumPadTemplates ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> m Word32
    {- ^ __Returns:__ the number of pad_templates -}
elementFactoryGetNumPadTemplates factory = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    result <- gst_element_factory_get_num_pad_templates factory'
    touchManagedPtr factory
    return result

#if ENABLE_OVERLOADING
data ElementFactoryGetNumPadTemplatesMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryGetNumPadTemplatesMethodInfo a signature where
    overloadedMethod _ = elementFactoryGetNumPadTemplates

#endif

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

foreign import ccall "gst_element_factory_get_static_pad_templates" gst_element_factory_get_static_pad_templates ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    IO (Ptr (GList (Ptr Gst.StaticPadTemplate.StaticPadTemplate)))

{- |
Gets the 'GI.GLib.Structs.List.List' of 'GI.Gst.Structs.StaticPadTemplate.StaticPadTemplate' for this factory.
-}
elementFactoryGetStaticPadTemplates ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> m [Gst.StaticPadTemplate.StaticPadTemplate]
    {- ^ __Returns:__ the
    static pad templates -}
elementFactoryGetStaticPadTemplates factory = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    result <- gst_element_factory_get_static_pad_templates factory'
    result' <- unpackGList result
    result'' <- mapM (newPtr Gst.StaticPadTemplate.StaticPadTemplate) result'
    touchManagedPtr factory
    return result''

#if ENABLE_OVERLOADING
data ElementFactoryGetStaticPadTemplatesMethodInfo
instance (signature ~ (m [Gst.StaticPadTemplate.StaticPadTemplate]), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryGetStaticPadTemplatesMethodInfo a signature where
    overloadedMethod _ = elementFactoryGetStaticPadTemplates

#endif

-- method ElementFactory::get_uri_protocols
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstElementFactory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_element_factory_get_uri_protocols" gst_element_factory_get_uri_protocols ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    IO (Ptr CString)

{- |
Gets a 'Nothing'-terminated array of protocols this element supports or 'Nothing' if
no protocols are supported. You may not change the contents of the returned
array, as it is still owned by the element factory. Use @/g_strdupv()/@ to
make a copy of the protocol string array if you need to.
-}
elementFactoryGetUriProtocols ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> m [T.Text]
    {- ^ __Returns:__ the supported protocols
    or 'Nothing' -}
elementFactoryGetUriProtocols factory = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    result <- gst_element_factory_get_uri_protocols factory'
    checkUnexpectedReturnNULL "elementFactoryGetUriProtocols" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr factory
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryGetUriProtocolsMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryGetUriProtocolsMethodInfo a signature where
    overloadedMethod _ = elementFactoryGetUriProtocols

#endif

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

foreign import ccall "gst_element_factory_get_uri_type" gst_element_factory_get_uri_type ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    IO CUInt

{- |
Gets the type of URIs the element supports or @/GST_URI_UNKNOWN/@ if none.
-}
elementFactoryGetUriType ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> m Gst.Enums.URIType
    {- ^ __Returns:__ type of URIs this element supports -}
elementFactoryGetUriType factory = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    result <- gst_element_factory_get_uri_type factory'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr factory
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryGetUriTypeMethodInfo
instance (signature ~ (m Gst.Enums.URIType), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryGetUriTypeMethodInfo a signature where
    overloadedMethod _ = elementFactoryGetUriType

#endif

-- method ElementFactory::has_interface
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstElementFactory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interfacename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an interface name", 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_element_factory_has_interface" gst_element_factory_has_interface ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    CString ->                              -- interfacename : TBasicType TUTF8
    IO CInt

{- |
Check if /@factory@/ implements the interface with name /@interfacename@/.
-}
elementFactoryHasInterface ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> T.Text
    {- ^ /@interfacename@/: an interface name -}
    -> m Bool
    {- ^ __Returns:__ 'True' when /@factory@/ implement the interface. -}
elementFactoryHasInterface factory interfacename = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    interfacename' <- textToCString interfacename
    result <- gst_element_factory_has_interface factory' interfacename'
    let result' = (/= 0) result
    touchManagedPtr factory
    freeMem interfacename'
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryHasInterfaceMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryHasInterfaceMethodInfo a signature where
    overloadedMethod _ = elementFactoryHasInterface

#endif

-- method ElementFactory::list_is_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "factory", argType = TInterface (Name {namespace = "Gst", name = "ElementFactory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstElementFactory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstElementFactoryListType", 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_element_factory_list_is_type" gst_element_factory_list_is_type ::
    Ptr ElementFactory ->                   -- factory : TInterface (Name {namespace = "Gst", name = "ElementFactory"})
    Word64 ->                               -- type : TBasicType TUInt64
    IO CInt

{- |
Check if /@factory@/ is of the given types.
-}
elementFactoryListIsType ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    a
    {- ^ /@factory@/: a 'GI.Gst.Objects.ElementFactory.ElementFactory' -}
    -> Word64
    {- ^ /@type@/: a @/GstElementFactoryListType/@ -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@factory@/ is of /@type@/. -}
elementFactoryListIsType factory type_ = liftIO $ do
    factory' <- unsafeManagedPtrCastPtr factory
    result <- gst_element_factory_list_is_type factory' type_
    let result' = (/= 0) result
    touchManagedPtr factory
    return result'

#if ENABLE_OVERLOADING
data ElementFactoryListIsTypeMethodInfo
instance (signature ~ (Word64 -> m Bool), MonadIO m, IsElementFactory a) => O.MethodInfo ElementFactoryListIsTypeMethodInfo a signature where
    overloadedMethod _ = elementFactoryListIsType

#endif

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

foreign import ccall "gst_element_factory_find" gst_element_factory_find ::
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr ElementFactory)

{- |
Search for an element factory of the given name. Refs the returned
element factory; caller is responsible for unreffing.
-}
elementFactoryFind ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: name of factory to find -}
    -> m (Maybe ElementFactory)
    {- ^ __Returns:__ 'GI.Gst.Objects.ElementFactory.ElementFactory' if found,
'Nothing' otherwise -}
elementFactoryFind name = liftIO $ do
    name' <- textToCString name
    result <- gst_element_factory_find name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject ElementFactory) result'
        return result''
    freeMem name'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method ElementFactory::list_filter
-- method type : MemberFunction
-- Args : [Arg {argCName = "list", argType = TGList (TInterface (Name {namespace = "Gst", name = "ElementFactory"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GList of\n    #GstElementFactory to filter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCaps", 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 "a #GstPadDirection to filter on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "subsetonly", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether to filter on caps subsets or not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "ElementFactory"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_element_factory_list_filter" gst_element_factory_list_filter ::
    Ptr (GList (Ptr ElementFactory)) ->     -- list : TGList (TInterface (Name {namespace = "Gst", name = "ElementFactory"}))
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "Gst", name = "PadDirection"})
    CInt ->                                 -- subsetonly : TBasicType TBoolean
    IO (Ptr (GList (Ptr ElementFactory)))

{- |
Filter out all the elementfactories in /@list@/ that can handle /@caps@/ in
the given direction.

If /@subsetonly@/ is 'True', then only the elements whose pads templates
are a complete superset of /@caps@/ will be returned. Else any element
whose pad templates caps can intersect with /@caps@/ will be returned.
-}
elementFactoryListFilter ::
    (B.CallStack.HasCallStack, MonadIO m, IsElementFactory a) =>
    [a]
    {- ^ /@list@/: a 'GI.GLib.Structs.List.List' of
    'GI.Gst.Objects.ElementFactory.ElementFactory' to filter -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: a 'GI.Gst.Structs.Caps.Caps' -}
    -> Gst.Enums.PadDirection
    {- ^ /@direction@/: a 'GI.Gst.Enums.PadDirection' to filter on -}
    -> Bool
    {- ^ /@subsetonly@/: whether to filter on caps subsets or not. -}
    -> m [ElementFactory]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
    'GI.Gst.Objects.ElementFactory.ElementFactory' elements that match the given requisites.
    Use @/gst_plugin_feature_list_free/@ after usage. -}
elementFactoryListFilter list caps direction subsetonly = liftIO $ do
    list' <- mapM unsafeManagedPtrCastPtr list
    list'' <- packGList list'
    caps' <- unsafeManagedPtrGetPtr caps
    let direction' = (fromIntegral . fromEnum) direction
    let subsetonly' = (fromIntegral . fromEnum) subsetonly
    result <- gst_element_factory_list_filter list'' caps' direction' subsetonly'
    result' <- unpackGList result
    result'' <- mapM (wrapObject ElementFactory) result'
    g_list_free result
    mapM_ touchManagedPtr list
    touchManagedPtr caps
    g_list_free list''
    return result''

#if ENABLE_OVERLOADING
#endif

-- method ElementFactory::list_get_elements
-- method type : MemberFunction
-- Args : [Arg {argCName = "type", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstElementFactoryListType", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minrank", argType = TInterface (Name {namespace = "Gst", name = "Rank"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Minimum rank", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "ElementFactory"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_element_factory_list_get_elements" gst_element_factory_list_get_elements ::
    Word64 ->                               -- type : TBasicType TUInt64
    CUInt ->                                -- minrank : TInterface (Name {namespace = "Gst", name = "Rank"})
    IO (Ptr (GList (Ptr ElementFactory)))

{- |
Get a list of factories that match the given /@type@/. Only elements
with a rank greater or equal to /@minrank@/ will be returned.
The list of factories is returned by decreasing rank.
-}
elementFactoryListGetElements ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@type@/: a @/GstElementFactoryListType/@ -}
    -> Gst.Enums.Rank
    {- ^ /@minrank@/: Minimum rank -}
    -> m [ElementFactory]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
    'GI.Gst.Objects.ElementFactory.ElementFactory' elements. Use 'GI.Gst.Objects.PluginFeature.pluginFeatureListFree' after
    usage. -}
elementFactoryListGetElements type_ minrank = liftIO $ do
    let minrank' = (fromIntegral . fromEnum) minrank
    result <- gst_element_factory_list_get_elements type_ minrank'
    result' <- unpackGList result
    result'' <- mapM (wrapObject ElementFactory) result'
    g_list_free result
    return result''

#if ENABLE_OVERLOADING
#endif

-- method ElementFactory::make
-- method type : MemberFunction
-- Args : [Arg {argCName = "factoryname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a named factory to instantiate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "name of new element, or %NULL to automatically create\n   a unique name", 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_element_factory_make" gst_element_factory_make ::
    CString ->                              -- factoryname : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gst.Element.Element)

{- |
Create a new element of the type defined by the given element factory.
If name is 'Nothing', then the element will receive a guaranteed unique name,
consisting of the element factory name and a number.
If name is given, it will be given the name supplied.
-}
elementFactoryMake ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@factoryname@/: a named factory to instantiate -}
    -> Maybe (T.Text)
    {- ^ /@name@/: name of new element, or 'Nothing' to automatically create
   a unique name -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ new 'GI.Gst.Objects.Element.Element' or 'Nothing'
if unable to create element -}
elementFactoryMake factoryname name = liftIO $ do
    factoryname' <- textToCString factoryname
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    result <- gst_element_factory_make factoryname' maybeName
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gst.Element.Element) result'
        return result''
    freeMem factoryname'
    freeMem maybeName
    return maybeResult

#if ENABLE_OVERLOADING
#endif