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

A collection of 'GI.Gst.Objects.Stream.Stream' that are available.

A 'GI.Gst.Objects.StreamCollection.StreamCollection' will be provided by elements that can make those
streams available. Applications can use the collection to show the user
what streams are available by using @/gst_stream_collection_get_stream/@()

Once posted, a 'GI.Gst.Objects.StreamCollection.StreamCollection' is immutable. Updates are made by sending
a new 'GI.Gst.Objects.StreamCollection.StreamCollection' message, which may or may not share some of
the 'GI.Gst.Objects.Stream.Stream' objects from the collection it replaces. The receiver can check
the sender of a stream collection message to know which collection is
obsoleted.

Several elements in a pipeline can provide 'GI.Gst.Objects.StreamCollection.StreamCollection'.

Applications can activate streams from a collection by using the
@/GST_EVENT_SELECT_STREAMS/@ event on a pipeline, bin or element.

/Since: 1.10/
-}

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

module GI.Gst.Objects.StreamCollection
    (

-- * Exported types
    StreamCollection(..)                    ,
    IsStreamCollection                      ,
    toStreamCollection                      ,
    noStreamCollection                      ,


 -- * Methods
-- ** addStream #method:addStream#

#if ENABLE_OVERLOADING
    StreamCollectionAddStreamMethodInfo     ,
#endif
    streamCollectionAddStream               ,


-- ** getSize #method:getSize#

#if ENABLE_OVERLOADING
    StreamCollectionGetSizeMethodInfo       ,
#endif
    streamCollectionGetSize                 ,


-- ** getStream #method:getStream#

#if ENABLE_OVERLOADING
    StreamCollectionGetStreamMethodInfo     ,
#endif
    streamCollectionGetStream               ,


-- ** getUpstreamId #method:getUpstreamId#

#if ENABLE_OVERLOADING
    StreamCollectionGetUpstreamIdMethodInfo ,
#endif
    streamCollectionGetUpstreamId           ,


-- ** new #method:new#

    streamCollectionNew                     ,




 -- * Properties
-- ** upstreamId #attr:upstreamId#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    StreamCollectionUpstreamIdPropertyInfo  ,
#endif
    clearStreamCollectionUpstreamId         ,
    constructStreamCollectionUpstreamId     ,
    getStreamCollectionUpstreamId           ,
    setStreamCollectionUpstreamId           ,
#if ENABLE_OVERLOADING
    streamCollectionUpstreamId              ,
#endif




 -- * Signals
-- ** streamNotify #signal:streamNotify#

    C_StreamCollectionStreamNotifyCallback  ,
    StreamCollectionStreamNotifyCallback    ,
#if ENABLE_OVERLOADING
    StreamCollectionStreamNotifySignalInfo  ,
#endif
    afterStreamCollectionStreamNotify       ,
    genClosure_StreamCollectionStreamNotify ,
    mk_StreamCollectionStreamNotifyCallback ,
    noStreamCollectionStreamNotifyCallback  ,
    onStreamCollectionStreamNotify          ,
    wrap_StreamCollectionStreamNotifyCallback,




    ) 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.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Stream as Gst.Stream

-- | Memory-managed wrapper type.
newtype StreamCollection = StreamCollection (ManagedPtr StreamCollection)
foreign import ccall "gst_stream_collection_get_type"
    c_gst_stream_collection_get_type :: IO GType

instance GObject StreamCollection where
    gobjectType = c_gst_stream_collection_get_type


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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `StreamCollection`.
noStreamCollection :: Maybe StreamCollection
noStreamCollection = Nothing

#if ENABLE_OVERLOADING
type family ResolveStreamCollectionMethod (t :: Symbol) (o :: *) :: * where
    ResolveStreamCollectionMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveStreamCollectionMethod "addStream" o = StreamCollectionAddStreamMethodInfo
    ResolveStreamCollectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveStreamCollectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveStreamCollectionMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveStreamCollectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveStreamCollectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveStreamCollectionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveStreamCollectionMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveStreamCollectionMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveStreamCollectionMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveStreamCollectionMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveStreamCollectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveStreamCollectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveStreamCollectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveStreamCollectionMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveStreamCollectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveStreamCollectionMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveStreamCollectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveStreamCollectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveStreamCollectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveStreamCollectionMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveStreamCollectionMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveStreamCollectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveStreamCollectionMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveStreamCollectionMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveStreamCollectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveStreamCollectionMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveStreamCollectionMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveStreamCollectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveStreamCollectionMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveStreamCollectionMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveStreamCollectionMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveStreamCollectionMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveStreamCollectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveStreamCollectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveStreamCollectionMethod "getSize" o = StreamCollectionGetSizeMethodInfo
    ResolveStreamCollectionMethod "getStream" o = StreamCollectionGetStreamMethodInfo
    ResolveStreamCollectionMethod "getUpstreamId" o = StreamCollectionGetUpstreamIdMethodInfo
    ResolveStreamCollectionMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveStreamCollectionMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveStreamCollectionMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveStreamCollectionMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveStreamCollectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveStreamCollectionMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveStreamCollectionMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveStreamCollectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveStreamCollectionMethod l o = O.MethodResolutionFailed l o

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

-- signal StreamCollection::stream-notify
{- |
/No description available in the introspection data./
-}
type StreamCollectionStreamNotifyCallback =
    Gst.Stream.Stream
    -> GParamSpec
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `StreamCollectionStreamNotifyCallback`@.
noStreamCollectionStreamNotifyCallback :: Maybe StreamCollectionStreamNotifyCallback
noStreamCollectionStreamNotifyCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_StreamCollectionStreamNotify :: MonadIO m => StreamCollectionStreamNotifyCallback -> m (GClosure C_StreamCollectionStreamNotifyCallback)
genClosure_StreamCollectionStreamNotify cb = liftIO $ do
    let cb' = wrap_StreamCollectionStreamNotifyCallback cb
    mk_StreamCollectionStreamNotifyCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `StreamCollectionStreamNotifyCallback` into a `C_StreamCollectionStreamNotifyCallback`.
wrap_StreamCollectionStreamNotifyCallback ::
    StreamCollectionStreamNotifyCallback ->
    C_StreamCollectionStreamNotifyCallback
wrap_StreamCollectionStreamNotifyCallback _cb _ object p0 _ = do
    object' <- (newObject Gst.Stream.Stream) object
    p0' <- B.GParamSpec.newGParamSpecFromPtr p0
    _cb  object' p0'


{- |
Connect a signal handler for the “@stream-notify@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' streamCollection #streamNotify callback
@
-}
onStreamCollectionStreamNotify :: (IsStreamCollection a, MonadIO m) => a -> StreamCollectionStreamNotifyCallback -> m SignalHandlerId
onStreamCollectionStreamNotify obj cb = liftIO $ do
    let cb' = wrap_StreamCollectionStreamNotifyCallback cb
    cb'' <- mk_StreamCollectionStreamNotifyCallback cb'
    connectSignalFunPtr obj "stream-notify" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@stream-notify@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' streamCollection #streamNotify callback
@
-}
afterStreamCollectionStreamNotify :: (IsStreamCollection a, MonadIO m) => a -> StreamCollectionStreamNotifyCallback -> m SignalHandlerId
afterStreamCollectionStreamNotify obj cb = liftIO $ do
    let cb' = wrap_StreamCollectionStreamNotifyCallback cb
    cb'' <- mk_StreamCollectionStreamNotifyCallback cb'
    connectSignalFunPtr obj "stream-notify" cb'' SignalConnectAfter


-- VVV Prop "upstream-id"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@upstream-id@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' streamCollection #upstreamId
@
-}
getStreamCollectionUpstreamId :: (MonadIO m, IsStreamCollection o) => o -> m T.Text
getStreamCollectionUpstreamId obj = liftIO $ checkUnexpectedNothing "getStreamCollectionUpstreamId" $ B.Properties.getObjectPropertyString obj "upstream-id"

{- |
Set the value of the “@upstream-id@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' streamCollection [ #upstreamId 'Data.GI.Base.Attributes.:=' value ]
@
-}
setStreamCollectionUpstreamId :: (MonadIO m, IsStreamCollection o) => o -> T.Text -> m ()
setStreamCollectionUpstreamId obj val = liftIO $ B.Properties.setObjectPropertyString obj "upstream-id" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@upstream-id@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructStreamCollectionUpstreamId :: (IsStreamCollection o) => T.Text -> IO (GValueConstruct o)
constructStreamCollectionUpstreamId val = B.Properties.constructObjectPropertyString "upstream-id" (Just val)

{- |
Set the value of the “@upstream-id@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #upstreamId
@
-}
clearStreamCollectionUpstreamId :: (MonadIO m, IsStreamCollection o) => o -> m ()
clearStreamCollectionUpstreamId obj = liftIO $ B.Properties.setObjectPropertyString obj "upstream-id" (Nothing :: Maybe T.Text)

#if ENABLE_OVERLOADING
data StreamCollectionUpstreamIdPropertyInfo
instance AttrInfo StreamCollectionUpstreamIdPropertyInfo where
    type AttrAllowedOps StreamCollectionUpstreamIdPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StreamCollectionUpstreamIdPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint StreamCollectionUpstreamIdPropertyInfo = IsStreamCollection
    type AttrGetType StreamCollectionUpstreamIdPropertyInfo = T.Text
    type AttrLabel StreamCollectionUpstreamIdPropertyInfo = "upstream-id"
    type AttrOrigin StreamCollectionUpstreamIdPropertyInfo = StreamCollection
    attrGet _ = getStreamCollectionUpstreamId
    attrSet _ = setStreamCollectionUpstreamId
    attrConstruct _ = constructStreamCollectionUpstreamId
    attrClear _ = clearStreamCollectionUpstreamId
#endif

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

#if ENABLE_OVERLOADING
streamCollectionUpstreamId :: AttrLabelProxy "upstreamId"
streamCollectionUpstreamId = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data StreamCollectionStreamNotifySignalInfo
instance SignalInfo StreamCollectionStreamNotifySignalInfo where
    type HaskellCallbackType StreamCollectionStreamNotifySignalInfo = StreamCollectionStreamNotifyCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_StreamCollectionStreamNotifyCallback cb
        cb'' <- mk_StreamCollectionStreamNotifyCallback cb'
        connectSignalFunPtr obj "stream-notify" cb'' connectMode

type instance O.SignalList StreamCollection = StreamCollectionSignalList
type StreamCollectionSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("streamNotify", StreamCollectionStreamNotifySignalInfo)] :: [(Symbol, *)])

#endif

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

foreign import ccall "gst_stream_collection_new" gst_stream_collection_new ::
    CString ->                              -- upstream_id : TBasicType TUTF8
    IO (Ptr StreamCollection)

{- |
Create a new 'GI.Gst.Objects.StreamCollection.StreamCollection'.

/Since: 1.10/
-}
streamCollectionNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@upstreamId@/: The stream id of the parent stream -}
    -> m StreamCollection
    {- ^ __Returns:__ The new 'GI.Gst.Objects.StreamCollection.StreamCollection'. -}
streamCollectionNew upstreamId = liftIO $ do
    maybeUpstreamId <- case upstreamId of
        Nothing -> return nullPtr
        Just jUpstreamId -> do
            jUpstreamId' <- textToCString jUpstreamId
            return jUpstreamId'
    result <- gst_stream_collection_new maybeUpstreamId
    checkUnexpectedReturnNULL "streamCollectionNew" result
    result' <- (wrapObject StreamCollection) result
    freeMem maybeUpstreamId
    return result'

#if ENABLE_OVERLOADING
#endif

-- method StreamCollection::add_stream
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStreamCollection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gst", name = "Stream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStream to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_collection_add_stream" gst_stream_collection_add_stream ::
    Ptr StreamCollection ->                 -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    Ptr Gst.Stream.Stream ->                -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    IO CInt

{- |
Add the given /@stream@/ to the /@collection@/.

/Since: 1.10/
-}
streamCollectionAddStream ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamCollection a, Gst.Stream.IsStream b) =>
    a
    {- ^ /@collection@/: a 'GI.Gst.Objects.StreamCollection.StreamCollection' -}
    -> b
    {- ^ /@stream@/: the 'GI.Gst.Objects.Stream.Stream' to add -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@stream@/ was properly added, else 'False' -}
streamCollectionAddStream collection stream = liftIO $ do
    collection' <- unsafeManagedPtrCastPtr collection
    stream' <- B.ManagedPtr.disownObject stream
    result <- gst_stream_collection_add_stream collection' stream'
    let result' = (/= 0) result
    touchManagedPtr collection
    touchManagedPtr stream
    return result'

#if ENABLE_OVERLOADING
data StreamCollectionAddStreamMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsStreamCollection a, Gst.Stream.IsStream b) => O.MethodInfo StreamCollectionAddStreamMethodInfo a signature where
    overloadedMethod _ = streamCollectionAddStream

#endif

-- method StreamCollection::get_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStreamCollection", 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_stream_collection_get_size" gst_stream_collection_get_size ::
    Ptr StreamCollection ->                 -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    IO Word32

{- |
Get the number of streams this collection contains

/Since: 1.10/
-}
streamCollectionGetSize ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamCollection a) =>
    a
    {- ^ /@collection@/: a 'GI.Gst.Objects.StreamCollection.StreamCollection' -}
    -> m Word32
    {- ^ __Returns:__ The number of streams that /@collection@/ contains -}
streamCollectionGetSize collection = liftIO $ do
    collection' <- unsafeManagedPtrCastPtr collection
    result <- gst_stream_collection_get_size collection'
    touchManagedPtr collection
    return result

#if ENABLE_OVERLOADING
data StreamCollectionGetSizeMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsStreamCollection a) => O.MethodInfo StreamCollectionGetSizeMethodInfo a signature where
    overloadedMethod _ = streamCollectionGetSize

#endif

-- method StreamCollection::get_stream
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStreamCollection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Index of the stream to retrieve", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Stream"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_collection_get_stream" gst_stream_collection_get_stream ::
    Ptr StreamCollection ->                 -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    Word32 ->                               -- index : TBasicType TUInt
    IO (Ptr Gst.Stream.Stream)

{- |
Retrieve the 'GI.Gst.Objects.Stream.Stream' with index /@index@/ from the collection.

The caller should not modify the returned 'GI.Gst.Objects.Stream.Stream'

/Since: 1.10/
-}
streamCollectionGetStream ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamCollection a) =>
    a
    {- ^ /@collection@/: a 'GI.Gst.Objects.StreamCollection.StreamCollection' -}
    -> Word32
    {- ^ /@index@/: Index of the stream to retrieve -}
    -> m (Maybe Gst.Stream.Stream)
    {- ^ __Returns:__ A 'GI.Gst.Objects.Stream.Stream' -}
streamCollectionGetStream collection index = liftIO $ do
    collection' <- unsafeManagedPtrCastPtr collection
    result <- gst_stream_collection_get_stream collection' index
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gst.Stream.Stream) result'
        return result''
    touchManagedPtr collection
    return maybeResult

#if ENABLE_OVERLOADING
data StreamCollectionGetStreamMethodInfo
instance (signature ~ (Word32 -> m (Maybe Gst.Stream.Stream)), MonadIO m, IsStreamCollection a) => O.MethodInfo StreamCollectionGetStreamMethodInfo a signature where
    overloadedMethod _ = streamCollectionGetStream

#endif

-- method StreamCollection::get_upstream_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStreamCollection", 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_stream_collection_get_upstream_id" gst_stream_collection_get_upstream_id ::
    Ptr StreamCollection ->                 -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    IO CString

{- |
Returns the upstream id of the /@collection@/.

/Since: 1.10/
-}
streamCollectionGetUpstreamId ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamCollection a) =>
    a
    {- ^ /@collection@/: a 'GI.Gst.Objects.StreamCollection.StreamCollection' -}
    -> m T.Text
    {- ^ __Returns:__ The upstream id -}
streamCollectionGetUpstreamId collection = liftIO $ do
    collection' <- unsafeManagedPtrCastPtr collection
    result <- gst_stream_collection_get_upstream_id collection'
    checkUnexpectedReturnNULL "streamCollectionGetUpstreamId" result
    result' <- cstringToText result
    touchManagedPtr collection
    return result'

#if ENABLE_OVERLOADING
data StreamCollectionGetUpstreamIdMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsStreamCollection a) => O.MethodInfo StreamCollectionGetUpstreamIdMethodInfo a signature where
    overloadedMethod _ = streamCollectionGetUpstreamId

#endif