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

A high-level object representing a single stream. It might be backed, or
not, by an actual flow of data in a pipeline ('GI.Gst.Objects.Pad.Pad').

A 'GI.Gst.Objects.Stream.Stream' does not care about data changes (such as decoding, encoding,
parsing,...) as long as the underlying data flow corresponds to the same
high-level flow (ex: a certain audio track).

A 'GI.Gst.Objects.Stream.Stream' contains all the information pertinent to a stream, such as
stream-id, tags, caps, type, ...

Elements can subclass a 'GI.Gst.Objects.Stream.Stream' for internal usage (to contain information
pertinent to streams of data).
-}

module GI.Gst.Objects.Stream
    ( 

-- * Exported types
    Stream(..)                              ,
    IsStream                                ,
    toStream                                ,
    noStream                                ,


 -- * Methods
-- ** getCaps #method:getCaps#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamGetCapsMethodInfo                 ,
#endif
    streamGetCaps                           ,


-- ** getStreamFlags #method:getStreamFlags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamGetStreamFlagsMethodInfo          ,
#endif
    streamGetStreamFlags                    ,


-- ** getStreamId #method:getStreamId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamGetStreamIdMethodInfo             ,
#endif
    streamGetStreamId                       ,


-- ** getStreamType #method:getStreamType#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamGetStreamTypeMethodInfo           ,
#endif
    streamGetStreamType                     ,


-- ** getTags #method:getTags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamGetTagsMethodInfo                 ,
#endif
    streamGetTags                           ,


-- ** new #method:new#
    streamNew                               ,


-- ** setCaps #method:setCaps#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamSetCapsMethodInfo                 ,
#endif
    streamSetCaps                           ,


-- ** setStreamFlags #method:setStreamFlags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamSetStreamFlagsMethodInfo          ,
#endif
    streamSetStreamFlags                    ,


-- ** setStreamType #method:setStreamType#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamSetStreamTypeMethodInfo           ,
#endif
    streamSetStreamType                     ,


-- ** setTags #method:setTags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamSetTagsMethodInfo                 ,
#endif
    streamSetTags                           ,




 -- * Properties
-- ** caps #attr:caps#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamCapsPropertyInfo                  ,
#endif
    clearStreamCaps                         ,
    constructStreamCaps                     ,
    getStreamCaps                           ,
    setStreamCaps                           ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    streamCaps                              ,
#endif


-- ** streamFlags #attr:streamFlags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamStreamFlagsPropertyInfo           ,
#endif
    constructStreamStreamFlags              ,
    getStreamStreamFlags                    ,
    setStreamStreamFlags                    ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    streamStreamFlags                       ,
#endif


-- ** streamId #attr:streamId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamStreamIdPropertyInfo              ,
#endif
    constructStreamStreamId                 ,
    getStreamStreamId                       ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    streamStreamId                          ,
#endif


-- ** streamType #attr:streamType#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamStreamTypePropertyInfo            ,
#endif
    constructStreamStreamType               ,
    getStreamStreamType                     ,
    setStreamStreamType                     ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    streamStreamType                        ,
#endif


-- ** tags #attr:tags#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    StreamTagsPropertyInfo                  ,
#endif
    clearStreamTags                         ,
    constructStreamTags                     ,
    getStreamTags                           ,
    setStreamTags                           ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    streamTags                              ,
#endif




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

newtype Stream = Stream (ManagedPtr Stream)
foreign import ccall "gst_stream_get_type"
    c_gst_stream_get_type :: IO GType

instance GObject Stream where
    gobjectType _ = c_gst_stream_get_type
    

class GObject o => IsStream o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Stream a) =>
    IsStream a
#endif
instance IsStream Stream
instance Gst.Object.IsObject Stream
instance GObject.Object.IsObject Stream

toStream :: (MonadIO m, IsStream o) => o -> m Stream
toStream = liftIO . unsafeCastTo Stream

noStream :: Maybe Stream
noStream = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveStreamMethod (t :: Symbol) (o :: *) :: * where
    ResolveStreamMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveStreamMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveStreamMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveStreamMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveStreamMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveStreamMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveStreamMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveStreamMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveStreamMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveStreamMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveStreamMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveStreamMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveStreamMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveStreamMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveStreamMethod "getCaps" o = StreamGetCapsMethodInfo
    ResolveStreamMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveStreamMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveStreamMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveStreamMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveStreamMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveStreamMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveStreamMethod "getStreamFlags" o = StreamGetStreamFlagsMethodInfo
    ResolveStreamMethod "getStreamId" o = StreamGetStreamIdMethodInfo
    ResolveStreamMethod "getStreamType" o = StreamGetStreamTypeMethodInfo
    ResolveStreamMethod "getTags" o = StreamGetTagsMethodInfo
    ResolveStreamMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveStreamMethod "setCaps" o = StreamSetCapsMethodInfo
    ResolveStreamMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveStreamMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveStreamMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveStreamMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveStreamMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveStreamMethod "setStreamFlags" o = StreamSetStreamFlagsMethodInfo
    ResolveStreamMethod "setStreamType" o = StreamSetStreamTypeMethodInfo
    ResolveStreamMethod "setTags" o = StreamSetTagsMethodInfo
    ResolveStreamMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveStreamMethod t Stream, O.MethodInfo info Stream p) => O.IsLabel t (Stream -> 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

-- VVV Prop "caps"
   -- Type: TInterface (Name {namespace = "Gst", name = "Caps"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Just True)

getStreamCaps :: (MonadIO m, IsStream o) => o -> m (Maybe Gst.Caps.Caps)
getStreamCaps obj = liftIO $ getObjectPropertyBoxed obj "caps" Gst.Caps.Caps

setStreamCaps :: (MonadIO m, IsStream o) => o -> Gst.Caps.Caps -> m ()
setStreamCaps obj val = liftIO $ setObjectPropertyBoxed obj "caps" (Just val)

constructStreamCaps :: (IsStream o) => Gst.Caps.Caps -> IO (GValueConstruct o)
constructStreamCaps val = constructObjectPropertyBoxed "caps" (Just val)

clearStreamCaps :: (MonadIO m, IsStream o) => o -> m ()
clearStreamCaps obj = liftIO $ setObjectPropertyBoxed obj "caps" (Nothing :: Maybe Gst.Caps.Caps)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamCapsPropertyInfo
instance AttrInfo StreamCapsPropertyInfo where
    type AttrAllowedOps StreamCapsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StreamCapsPropertyInfo = (~) Gst.Caps.Caps
    type AttrBaseTypeConstraint StreamCapsPropertyInfo = IsStream
    type AttrGetType StreamCapsPropertyInfo = (Maybe Gst.Caps.Caps)
    type AttrLabel StreamCapsPropertyInfo = "caps"
    type AttrOrigin StreamCapsPropertyInfo = Stream
    attrGet _ = getStreamCaps
    attrSet _ = setStreamCaps
    attrConstruct _ = constructStreamCaps
    attrClear _ = clearStreamCaps
#endif

-- VVV Prop "stream-flags"
   -- Type: TInterface (Name {namespace = "Gst", name = "StreamFlags"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

getStreamStreamFlags :: (MonadIO m, IsStream o) => o -> m [Gst.Flags.StreamFlags]
getStreamStreamFlags obj = liftIO $ getObjectPropertyFlags obj "stream-flags"

setStreamStreamFlags :: (MonadIO m, IsStream o) => o -> [Gst.Flags.StreamFlags] -> m ()
setStreamStreamFlags obj val = liftIO $ setObjectPropertyFlags obj "stream-flags" val

constructStreamStreamFlags :: (IsStream o) => [Gst.Flags.StreamFlags] -> IO (GValueConstruct o)
constructStreamStreamFlags val = constructObjectPropertyFlags "stream-flags" val

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamStreamFlagsPropertyInfo
instance AttrInfo StreamStreamFlagsPropertyInfo where
    type AttrAllowedOps StreamStreamFlagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint StreamStreamFlagsPropertyInfo = (~) [Gst.Flags.StreamFlags]
    type AttrBaseTypeConstraint StreamStreamFlagsPropertyInfo = IsStream
    type AttrGetType StreamStreamFlagsPropertyInfo = [Gst.Flags.StreamFlags]
    type AttrLabel StreamStreamFlagsPropertyInfo = "stream-flags"
    type AttrOrigin StreamStreamFlagsPropertyInfo = Stream
    attrGet _ = getStreamStreamFlags
    attrSet _ = setStreamStreamFlags
    attrConstruct _ = constructStreamStreamFlags
    attrClear _ = undefined
#endif

-- VVV Prop "stream-id"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just True,Nothing)

getStreamStreamId :: (MonadIO m, IsStream o) => o -> m (Maybe T.Text)
getStreamStreamId obj = liftIO $ getObjectPropertyString obj "stream-id"

constructStreamStreamId :: (IsStream o) => T.Text -> IO (GValueConstruct o)
constructStreamStreamId val = constructObjectPropertyString "stream-id" (Just val)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamStreamIdPropertyInfo
instance AttrInfo StreamStreamIdPropertyInfo where
    type AttrAllowedOps StreamStreamIdPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StreamStreamIdPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint StreamStreamIdPropertyInfo = IsStream
    type AttrGetType StreamStreamIdPropertyInfo = (Maybe T.Text)
    type AttrLabel StreamStreamIdPropertyInfo = "stream-id"
    type AttrOrigin StreamStreamIdPropertyInfo = Stream
    attrGet _ = getStreamStreamId
    attrSet _ = undefined
    attrConstruct _ = constructStreamStreamId
    attrClear _ = undefined
#endif

-- VVV Prop "stream-type"
   -- Type: TInterface (Name {namespace = "Gst", name = "StreamType"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

getStreamStreamType :: (MonadIO m, IsStream o) => o -> m [Gst.Flags.StreamType]
getStreamStreamType obj = liftIO $ getObjectPropertyFlags obj "stream-type"

setStreamStreamType :: (MonadIO m, IsStream o) => o -> [Gst.Flags.StreamType] -> m ()
setStreamStreamType obj val = liftIO $ setObjectPropertyFlags obj "stream-type" val

constructStreamStreamType :: (IsStream o) => [Gst.Flags.StreamType] -> IO (GValueConstruct o)
constructStreamStreamType val = constructObjectPropertyFlags "stream-type" val

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamStreamTypePropertyInfo
instance AttrInfo StreamStreamTypePropertyInfo where
    type AttrAllowedOps StreamStreamTypePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint StreamStreamTypePropertyInfo = (~) [Gst.Flags.StreamType]
    type AttrBaseTypeConstraint StreamStreamTypePropertyInfo = IsStream
    type AttrGetType StreamStreamTypePropertyInfo = [Gst.Flags.StreamType]
    type AttrLabel StreamStreamTypePropertyInfo = "stream-type"
    type AttrOrigin StreamStreamTypePropertyInfo = Stream
    attrGet _ = getStreamStreamType
    attrSet _ = setStreamStreamType
    attrConstruct _ = constructStreamStreamType
    attrClear _ = undefined
#endif

-- VVV Prop "tags"
   -- Type: TInterface (Name {namespace = "Gst", name = "TagList"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Just True)

getStreamTags :: (MonadIO m, IsStream o) => o -> m (Maybe Gst.TagList.TagList)
getStreamTags obj = liftIO $ getObjectPropertyBoxed obj "tags" Gst.TagList.TagList

setStreamTags :: (MonadIO m, IsStream o) => o -> Gst.TagList.TagList -> m ()
setStreamTags obj val = liftIO $ setObjectPropertyBoxed obj "tags" (Just val)

constructStreamTags :: (IsStream o) => Gst.TagList.TagList -> IO (GValueConstruct o)
constructStreamTags val = constructObjectPropertyBoxed "tags" (Just val)

clearStreamTags :: (MonadIO m, IsStream o) => o -> m ()
clearStreamTags obj = liftIO $ setObjectPropertyBoxed obj "tags" (Nothing :: Maybe Gst.TagList.TagList)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamTagsPropertyInfo
instance AttrInfo StreamTagsPropertyInfo where
    type AttrAllowedOps StreamTagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StreamTagsPropertyInfo = (~) Gst.TagList.TagList
    type AttrBaseTypeConstraint StreamTagsPropertyInfo = IsStream
    type AttrGetType StreamTagsPropertyInfo = (Maybe Gst.TagList.TagList)
    type AttrLabel StreamTagsPropertyInfo = "tags"
    type AttrOrigin StreamTagsPropertyInfo = Stream
    attrGet _ = getStreamTags
    attrSet _ = setStreamTags
    attrConstruct _ = constructStreamTags
    attrClear _ = clearStreamTags
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Stream
type instance O.AttributeList Stream = StreamAttributeList
type StreamAttributeList = ('[ '("caps", StreamCapsPropertyInfo), '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("streamFlags", StreamStreamFlagsPropertyInfo), '("streamId", StreamStreamIdPropertyInfo), '("streamType", StreamStreamTypePropertyInfo), '("tags", StreamTagsPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
streamCaps :: AttrLabelProxy "caps"
streamCaps = AttrLabelProxy

streamStreamFlags :: AttrLabelProxy "streamFlags"
streamStreamFlags = AttrLabelProxy

streamStreamId :: AttrLabelProxy "streamId"
streamStreamId = AttrLabelProxy

streamStreamType :: AttrLabelProxy "streamType"
streamStreamType = AttrLabelProxy

streamTags :: AttrLabelProxy "tags"
streamTags = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type instance O.SignalList Stream = StreamSignalList
type StreamSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Stream::new
-- method type : Constructor
-- Args : [Arg {argCName = "stream_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the id for the new stream. If %NULL,\na new one will be automatically generated", 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 = True, argDoc = Documentation {rawDocText = Just "the #GstCaps of the stream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "StreamType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStreamType of the stream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "StreamFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstStreamFlags of the stream", 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_new" gst_stream_new :: 
    CString ->                              -- stream_id : TBasicType TUTF8
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "StreamType"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "StreamFlags"})
    IO (Ptr Stream)

{- |
Create a new 'GI.Gst.Objects.Stream.Stream' for the given /@streamId@/, /@caps@/, /@type@/
and /@flags@/

@since 1.10
-}
streamNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@streamId@/: the id for the new stream. If 'Nothing',
a new one will be automatically generated -}
    -> Maybe (Gst.Caps.Caps)
    {- ^ /@caps@/: the 'GI.Gst.Structs.Caps.Caps' of the stream -}
    -> [Gst.Flags.StreamType]
    {- ^ /@type@/: the 'GI.Gst.Flags.StreamType' of the stream -}
    -> [Gst.Flags.StreamFlags]
    {- ^ /@flags@/: the 'GI.Gst.Flags.StreamFlags' of the stream -}
    -> m Stream
    {- ^ __Returns:__ The new 'GI.Gst.Objects.Stream.Stream' -}
streamNew streamId caps type_ flags = liftIO $ do
    maybeStreamId <- case streamId of
        Nothing -> return nullPtr
        Just jStreamId -> do
            jStreamId' <- textToCString jStreamId
            return jStreamId'
    maybeCaps <- case caps of
        Nothing -> return nullPtr
        Just jCaps -> do
            jCaps' <- unsafeManagedPtrGetPtr jCaps
            return jCaps'
    let type_' = gflagsToWord type_
    let flags' = gflagsToWord flags
    result <- gst_stream_new maybeStreamId maybeCaps type_' flags'
    checkUnexpectedReturnNULL "streamNew" result
    result' <- (newObject Stream) result
    whenJust caps touchManagedPtr
    freeMem maybeStreamId
    return result'

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

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

foreign import ccall "gst_stream_get_caps" gst_stream_get_caps :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    IO (Ptr Gst.Caps.Caps)

{- |
Retrieve the caps for /@stream@/, if any

@since 1.10
-}
streamGetCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> m (Maybe Gst.Caps.Caps)
    {- ^ __Returns:__ The 'GI.Gst.Structs.Caps.Caps' for /@stream@/ -}
streamGetCaps stream = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    result <- gst_stream_get_caps stream'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.Caps.Caps) result'
        return result''
    touchManagedPtr stream
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamGetCapsMethodInfo
instance (signature ~ (m (Maybe Gst.Caps.Caps)), MonadIO m, IsStream a) => O.MethodInfo StreamGetCapsMethodInfo a signature where
    overloadedMethod _ = streamGetCaps

#endif

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

foreign import ccall "gst_stream_get_stream_flags" gst_stream_get_stream_flags :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    IO CUInt

{- |
Retrieve the current stream flags for /@stream@/

@since 1.10
-}
streamGetStreamFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> m [Gst.Flags.StreamFlags]
    {- ^ __Returns:__ The 'GI.Gst.Flags.StreamFlags' for /@stream@/ -}
streamGetStreamFlags stream = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    result <- gst_stream_get_stream_flags stream'
    let result' = wordToGFlags result
    touchManagedPtr stream
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamGetStreamFlagsMethodInfo
instance (signature ~ (m [Gst.Flags.StreamFlags]), MonadIO m, IsStream a) => O.MethodInfo StreamGetStreamFlagsMethodInfo a signature where
    overloadedMethod _ = streamGetStreamFlags

#endif

-- method Stream::get_stream_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gst", name = "Stream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStream", 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_get_stream_id" gst_stream_get_stream_id :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    IO CString

{- |
Returns the stream ID of /@stream@/.

@since 1.10
-}
streamGetStreamId ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the stream ID of /@stream@/. Only valid
during the lifetime of /@stream@/. -}
streamGetStreamId stream = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    result <- gst_stream_get_stream_id stream'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr stream
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamGetStreamIdMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsStream a) => O.MethodInfo StreamGetStreamIdMethodInfo a signature where
    overloadedMethod _ = streamGetStreamId

#endif

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

foreign import ccall "gst_stream_get_stream_type" gst_stream_get_stream_type :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    IO CUInt

{- |
Retrieve the stream type for /@stream@/

@since 1.10
-}
streamGetStreamType ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> m [Gst.Flags.StreamType]
    {- ^ __Returns:__ The 'GI.Gst.Flags.StreamType' for /@stream@/ -}
streamGetStreamType stream = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    result <- gst_stream_get_stream_type stream'
    let result' = wordToGFlags result
    touchManagedPtr stream
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamGetStreamTypeMethodInfo
instance (signature ~ (m [Gst.Flags.StreamType]), MonadIO m, IsStream a) => O.MethodInfo StreamGetStreamTypeMethodInfo a signature where
    overloadedMethod _ = streamGetStreamType

#endif

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

foreign import ccall "gst_stream_get_tags" gst_stream_get_tags :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    IO (Ptr Gst.TagList.TagList)

{- |
Retrieve the tags for /@stream@/, if any

@since 1.10
-}
streamGetTags ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> m (Maybe Gst.TagList.TagList)
    {- ^ __Returns:__ The 'GI.Gst.Structs.TagList.TagList' for /@stream@/ -}
streamGetTags stream = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    result <- gst_stream_get_tags stream'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Gst.TagList.TagList) result'
        return result''
    touchManagedPtr stream
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamGetTagsMethodInfo
instance (signature ~ (m (Maybe Gst.TagList.TagList)), MonadIO m, IsStream a) => O.MethodInfo StreamGetTagsMethodInfo a signature where
    overloadedMethod _ = streamGetTags

#endif

-- method Stream::set_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gst", name = "Stream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStream", 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 = True, argDoc = Documentation {rawDocText = Just "a #GstCaps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_set_caps" gst_stream_set_caps :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO ()

{- |
Set the caps for the 'GI.Gst.Objects.Stream.Stream'

@since 1.10
-}
streamSetCaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> Maybe (Gst.Caps.Caps)
    {- ^ /@caps@/: a 'GI.Gst.Structs.Caps.Caps' -}
    -> m ()
streamSetCaps stream caps = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    maybeCaps <- case caps of
        Nothing -> return nullPtr
        Just jCaps -> do
            jCaps' <- unsafeManagedPtrGetPtr jCaps
            return jCaps'
    gst_stream_set_caps stream' maybeCaps
    touchManagedPtr stream
    whenJust caps touchManagedPtr
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamSetCapsMethodInfo
instance (signature ~ (Maybe (Gst.Caps.Caps) -> m ()), MonadIO m, IsStream a) => O.MethodInfo StreamSetCapsMethodInfo a signature where
    overloadedMethod _ = streamSetCaps

#endif

-- method Stream::set_stream_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gst", name = "Stream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "StreamFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the flags to set on @stream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_set_stream_flags" gst_stream_set_stream_flags :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "StreamFlags"})
    IO ()

{- |
Set the /@flags@/ for the /@stream@/.

@since 1.10
-}
streamSetStreamFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> [Gst.Flags.StreamFlags]
    {- ^ /@flags@/: the flags to set on /@stream@/ -}
    -> m ()
streamSetStreamFlags stream flags = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    let flags' = gflagsToWord flags
    gst_stream_set_stream_flags stream' flags'
    touchManagedPtr stream
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamSetStreamFlagsMethodInfo
instance (signature ~ ([Gst.Flags.StreamFlags] -> m ()), MonadIO m, IsStream a) => O.MethodInfo StreamSetStreamFlagsMethodInfo a signature where
    overloadedMethod _ = streamSetStreamFlags

#endif

-- method Stream::set_stream_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gst", name = "Stream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stream_type", argType = TInterface (Name {namespace = "Gst", name = "StreamType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type to set on @stream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_set_stream_type" gst_stream_set_stream_type :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    CUInt ->                                -- stream_type : TInterface (Name {namespace = "Gst", name = "StreamType"})
    IO ()

{- |
Set the stream type of /@stream@/

@since 1.10
-}
streamSetStreamType ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> [Gst.Flags.StreamType]
    {- ^ /@streamType@/: the type to set on /@stream@/ -}
    -> m ()
streamSetStreamType stream streamType = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    let streamType' = gflagsToWord streamType
    gst_stream_set_stream_type stream' streamType'
    touchManagedPtr stream
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamSetStreamTypeMethodInfo
instance (signature ~ ([Gst.Flags.StreamType] -> m ()), MonadIO m, IsStream a) => O.MethodInfo StreamSetStreamTypeMethodInfo a signature where
    overloadedMethod _ = streamSetStreamType

#endif

-- method Stream::set_tags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gst", name = "Stream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tags", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstTagList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_set_tags" gst_stream_set_tags :: 
    Ptr Stream ->                           -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    Ptr Gst.TagList.TagList ->              -- tags : TInterface (Name {namespace = "Gst", name = "TagList"})
    IO ()

{- |
Set the tags for the 'GI.Gst.Objects.Stream.Stream'

@since 1.10
-}
streamSetTags ::
    (B.CallStack.HasCallStack, MonadIO m, IsStream a) =>
    a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' -}
    -> Maybe (Gst.TagList.TagList)
    {- ^ /@tags@/: a 'GI.Gst.Structs.TagList.TagList' -}
    -> m ()
streamSetTags stream tags = liftIO $ do
    stream' <- unsafeManagedPtrCastPtr stream
    maybeTags <- case tags of
        Nothing -> return nullPtr
        Just jTags -> do
            jTags' <- unsafeManagedPtrGetPtr jTags
            return jTags'
    gst_stream_set_tags stream' maybeTags
    touchManagedPtr stream
    whenJust tags touchManagedPtr
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data StreamSetTagsMethodInfo
instance (signature ~ (Maybe (Gst.TagList.TagList) -> m ()), MonadIO m, IsStream a) => O.MethodInfo StreamSetTagsMethodInfo a signature where
    overloadedMethod _ = streamSetTags

#endif