gi-gst-1.0.18: GI/Gst/Objects/BufferPool.hs
{- |
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 'GI.Gst.Objects.BufferPool.BufferPool' is an object that can be used to pre-allocate and recycle
buffers of the same size and with the same properties.
A 'GI.Gst.Objects.BufferPool.BufferPool' is created with 'GI.Gst.Objects.BufferPool.bufferPoolNew'.
Once a pool is created, it needs to be configured. A call to
'GI.Gst.Objects.BufferPool.bufferPoolGetConfig' returns the current configuration structure from
the pool. With 'GI.Gst.Objects.BufferPool.bufferPoolConfigSetParams' and
'GI.Gst.Objects.BufferPool.bufferPoolConfigSetAllocator' the bufferpool parameters and
allocator can be configured. Other properties can be configured in the pool
depending on the pool implementation.
A bufferpool can have extra options that can be enabled with
'GI.Gst.Objects.BufferPool.bufferPoolConfigAddOption'. The available options can be retrieved
with 'GI.Gst.Objects.BufferPool.bufferPoolGetOptions'. Some options allow for additional
configuration properties to be set.
After the configuration structure has been configured,
'GI.Gst.Objects.BufferPool.bufferPoolSetConfig' updates the configuration in the pool. This can
fail when the configuration structure is not accepted.
After the a pool has been configured, it can be activated with
'GI.Gst.Objects.BufferPool.bufferPoolSetActive'. This will preallocate the configured resources
in the pool.
When the pool is active, 'GI.Gst.Objects.BufferPool.bufferPoolAcquireBuffer' can be used to
retrieve a buffer from the pool.
Buffers allocated from a bufferpool will automatically be returned to the
pool with 'GI.Gst.Objects.BufferPool.bufferPoolReleaseBuffer' when their refcount drops to 0.
The bufferpool can be deactivated again with 'GI.Gst.Objects.BufferPool.bufferPoolSetActive'.
All further 'GI.Gst.Objects.BufferPool.bufferPoolAcquireBuffer' calls will return an error. When
all buffers are returned to the pool they will be freed.
Use 'GI.Gst.Objects.Object.objectUnref' to release the reference to a bufferpool. If the
refcount of the pool reaches 0, the pool will be freed.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gst.Objects.BufferPool
(
-- * Exported types
BufferPool(..) ,
IsBufferPool ,
toBufferPool ,
noBufferPool ,
-- * Methods
-- ** acquireBuffer #method:acquireBuffer#
#if ENABLE_OVERLOADING
BufferPoolAcquireBufferMethodInfo ,
#endif
bufferPoolAcquireBuffer ,
-- ** configAddOption #method:configAddOption#
bufferPoolConfigAddOption ,
-- ** configGetAllocator #method:configGetAllocator#
bufferPoolConfigGetAllocator ,
-- ** configGetOption #method:configGetOption#
bufferPoolConfigGetOption ,
-- ** configGetParams #method:configGetParams#
bufferPoolConfigGetParams ,
-- ** configHasOption #method:configHasOption#
bufferPoolConfigHasOption ,
-- ** configNOptions #method:configNOptions#
bufferPoolConfigNOptions ,
-- ** configSetAllocator #method:configSetAllocator#
bufferPoolConfigSetAllocator ,
-- ** configSetParams #method:configSetParams#
bufferPoolConfigSetParams ,
-- ** configValidateParams #method:configValidateParams#
bufferPoolConfigValidateParams ,
-- ** getConfig #method:getConfig#
#if ENABLE_OVERLOADING
BufferPoolGetConfigMethodInfo ,
#endif
bufferPoolGetConfig ,
-- ** getOptions #method:getOptions#
#if ENABLE_OVERLOADING
BufferPoolGetOptionsMethodInfo ,
#endif
bufferPoolGetOptions ,
-- ** hasOption #method:hasOption#
#if ENABLE_OVERLOADING
BufferPoolHasOptionMethodInfo ,
#endif
bufferPoolHasOption ,
-- ** isActive #method:isActive#
#if ENABLE_OVERLOADING
BufferPoolIsActiveMethodInfo ,
#endif
bufferPoolIsActive ,
-- ** new #method:new#
bufferPoolNew ,
-- ** releaseBuffer #method:releaseBuffer#
#if ENABLE_OVERLOADING
BufferPoolReleaseBufferMethodInfo ,
#endif
bufferPoolReleaseBuffer ,
-- ** setActive #method:setActive#
#if ENABLE_OVERLOADING
BufferPoolSetActiveMethodInfo ,
#endif
bufferPoolSetActive ,
-- ** setConfig #method:setConfig#
#if ENABLE_OVERLOADING
BufferPoolSetConfigMethodInfo ,
#endif
bufferPoolSetConfig ,
-- ** setFlushing #method:setFlushing#
#if ENABLE_OVERLOADING
BufferPoolSetFlushingMethodInfo ,
#endif
bufferPoolSetFlushing ,
) 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.Allocator as Gst.Allocator
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Structs.AllocationParams as Gst.AllocationParams
import {-# SOURCE #-} qualified GI.Gst.Structs.Buffer as Gst.Buffer
import {-# SOURCE #-} qualified GI.Gst.Structs.BufferPoolAcquireParams as Gst.BufferPoolAcquireParams
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.Structure as Gst.Structure
-- | Memory-managed wrapper type.
newtype BufferPool = BufferPool (ManagedPtr BufferPool)
foreign import ccall "gst_buffer_pool_get_type"
c_gst_buffer_pool_get_type :: IO GType
instance GObject BufferPool where
gobjectType = c_gst_buffer_pool_get_type
-- | Type class for types which can be safely cast to `BufferPool`, for instance with `toBufferPool`.
class (GObject o, O.IsDescendantOf BufferPool o) => IsBufferPool o
instance (GObject o, O.IsDescendantOf BufferPool o) => IsBufferPool o
instance O.HasParentTypes BufferPool
type instance O.ParentTypes BufferPool = '[Gst.Object.Object, GObject.Object.Object]
-- | Cast to `BufferPool`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toBufferPool :: (MonadIO m, IsBufferPool o) => o -> m BufferPool
toBufferPool = liftIO . unsafeCastTo BufferPool
-- | A convenience alias for `Nothing` :: `Maybe` `BufferPool`.
noBufferPool :: Maybe BufferPool
noBufferPool = Nothing
#if ENABLE_OVERLOADING
type family ResolveBufferPoolMethod (t :: Symbol) (o :: *) :: * where
ResolveBufferPoolMethod "acquireBuffer" o = BufferPoolAcquireBufferMethodInfo
ResolveBufferPoolMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
ResolveBufferPoolMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveBufferPoolMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveBufferPoolMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
ResolveBufferPoolMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveBufferPoolMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveBufferPoolMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveBufferPoolMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
ResolveBufferPoolMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
ResolveBufferPoolMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
ResolveBufferPoolMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
ResolveBufferPoolMethod "hasOption" o = BufferPoolHasOptionMethodInfo
ResolveBufferPoolMethod "isActive" o = BufferPoolIsActiveMethodInfo
ResolveBufferPoolMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveBufferPoolMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveBufferPoolMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveBufferPoolMethod "ref" o = Gst.Object.ObjectRefMethodInfo
ResolveBufferPoolMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveBufferPoolMethod "releaseBuffer" o = BufferPoolReleaseBufferMethodInfo
ResolveBufferPoolMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
ResolveBufferPoolMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveBufferPoolMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveBufferPoolMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveBufferPoolMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
ResolveBufferPoolMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
ResolveBufferPoolMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveBufferPoolMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
ResolveBufferPoolMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
ResolveBufferPoolMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveBufferPoolMethod "getConfig" o = BufferPoolGetConfigMethodInfo
ResolveBufferPoolMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
ResolveBufferPoolMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
ResolveBufferPoolMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveBufferPoolMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
ResolveBufferPoolMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
ResolveBufferPoolMethod "getOptions" o = BufferPoolGetOptionsMethodInfo
ResolveBufferPoolMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
ResolveBufferPoolMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
ResolveBufferPoolMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveBufferPoolMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveBufferPoolMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
ResolveBufferPoolMethod "setActive" o = BufferPoolSetActiveMethodInfo
ResolveBufferPoolMethod "setConfig" o = BufferPoolSetConfigMethodInfo
ResolveBufferPoolMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
ResolveBufferPoolMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
ResolveBufferPoolMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
ResolveBufferPoolMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveBufferPoolMethod "setFlushing" o = BufferPoolSetFlushingMethodInfo
ResolveBufferPoolMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
ResolveBufferPoolMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
ResolveBufferPoolMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveBufferPoolMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveBufferPoolMethod t BufferPool, O.MethodInfo info BufferPool p) => OL.IsLabel t (BufferPool -> 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 BufferPool
type instance O.AttributeList BufferPool = BufferPoolAttributeList
type BufferPoolAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList BufferPool = BufferPoolSignalList
type BufferPoolSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method BufferPool::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "BufferPool"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_new" gst_buffer_pool_new ::
IO (Ptr BufferPool)
{- |
Creates a new 'GI.Gst.Objects.BufferPool.BufferPool' instance.
-}
bufferPoolNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m BufferPool
{- ^ __Returns:__ a new 'GI.Gst.Objects.BufferPool.BufferPool' instance -}
bufferPoolNew = liftIO $ do
result <- gst_buffer_pool_new
checkUnexpectedReturnNULL "bufferPoolNew" result
result' <- (wrapObject BufferPool) result
return result'
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::acquire_buffer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location for a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "BufferPoolAcquireParams"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "parameters.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_acquire_buffer" gst_buffer_pool_acquire_buffer ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
Ptr (Ptr Gst.Buffer.Buffer) -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.BufferPoolAcquireParams.BufferPoolAcquireParams -> -- params : TInterface (Name {namespace = "Gst", name = "BufferPoolAcquireParams"})
IO CInt
{- |
Acquire a buffer from /@pool@/. /@buffer@/ should point to a memory location that
can hold a pointer to the new buffer.
/@params@/ can be 'Nothing' or contain optional parameters to influence the
allocation.
-}
bufferPoolAcquireBuffer ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> Maybe (Gst.BufferPoolAcquireParams.BufferPoolAcquireParams)
{- ^ /@params@/: parameters. -}
-> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))
{- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' such as 'GI.Gst.Enums.FlowReturnFlushing' when the pool is
inactive. -}
bufferPoolAcquireBuffer pool params = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
buffer <- allocMem :: IO (Ptr (Ptr Gst.Buffer.Buffer))
maybeParams <- case params of
Nothing -> return nullPtr
Just jParams -> do
jParams' <- unsafeManagedPtrGetPtr jParams
return jParams'
result <- gst_buffer_pool_acquire_buffer pool' buffer maybeParams
let result' = (toEnum . fromIntegral) result
buffer' <- peek buffer
buffer'' <- (wrapBoxed Gst.Buffer.Buffer) buffer'
touchManagedPtr pool
whenJust params touchManagedPtr
freeMem buffer
return (result', buffer'')
#if ENABLE_OVERLOADING
data BufferPoolAcquireBufferMethodInfo
instance (signature ~ (Maybe (Gst.BufferPoolAcquireParams.BufferPoolAcquireParams) -> m ((Gst.Enums.FlowReturn, Gst.Buffer.Buffer))), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolAcquireBufferMethodInfo a signature where
overloadedMethod _ = bufferPoolAcquireBuffer
#endif
-- method BufferPool::get_config
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_get_config" gst_buffer_pool_get_config ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
IO (Ptr Gst.Structure.Structure)
{- |
Get a copy of the current configuration of the pool. This configuration
can either be modified and used for the 'GI.Gst.Objects.BufferPool.bufferPoolSetConfig' call
or it must be freed after usage.
-}
bufferPoolGetConfig ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> m Gst.Structure.Structure
{- ^ __Returns:__ a copy of the current configuration of /@pool@/. use
'GI.Gst.Structs.Structure.structureFree' after usage or 'GI.Gst.Objects.BufferPool.bufferPoolSetConfig'. -}
bufferPoolGetConfig pool = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
result <- gst_buffer_pool_get_config pool'
checkUnexpectedReturnNULL "bufferPoolGetConfig" result
result' <- (wrapBoxed Gst.Structure.Structure) result
touchManagedPtr pool
return result'
#if ENABLE_OVERLOADING
data BufferPoolGetConfigMethodInfo
instance (signature ~ (m Gst.Structure.Structure), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolGetConfigMethodInfo a signature where
overloadedMethod _ = bufferPoolGetConfig
#endif
-- method BufferPool::get_options
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", 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_buffer_pool_get_options" gst_buffer_pool_get_options ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
IO (Ptr CString)
{- |
Get a 'Nothing' terminated array of string with supported bufferpool options for
/@pool@/. An option would typically be enabled with
'GI.Gst.Objects.BufferPool.bufferPoolConfigAddOption'.
-}
bufferPoolGetOptions ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> m [T.Text]
{- ^ __Returns:__ a 'Nothing' terminated array
of strings. -}
bufferPoolGetOptions pool = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
result <- gst_buffer_pool_get_options pool'
checkUnexpectedReturnNULL "bufferPoolGetOptions" result
result' <- unpackZeroTerminatedUTF8CArray result
touchManagedPtr pool
return result'
#if ENABLE_OVERLOADING
data BufferPoolGetOptionsMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolGetOptionsMethodInfo a signature where
overloadedMethod _ = bufferPoolGetOptions
#endif
-- method BufferPool::has_option
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "option", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an option", 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_buffer_pool_has_option" gst_buffer_pool_has_option ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
CString -> -- option : TBasicType TUTF8
IO CInt
{- |
Check if the bufferpool supports /@option@/.
-}
bufferPoolHasOption ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> T.Text
{- ^ /@option@/: an option -}
-> m Bool
{- ^ __Returns:__ 'True' if the buffer pool contains /@option@/. -}
bufferPoolHasOption pool option = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
option' <- textToCString option
result <- gst_buffer_pool_has_option pool' option'
let result' = (/= 0) result
touchManagedPtr pool
freeMem option'
return result'
#if ENABLE_OVERLOADING
data BufferPoolHasOptionMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolHasOptionMethodInfo a signature where
overloadedMethod _ = bufferPoolHasOption
#endif
-- method BufferPool::is_active
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", 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_buffer_pool_is_active" gst_buffer_pool_is_active ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
IO CInt
{- |
Check if /@pool@/ is active. A pool can be activated with the
'GI.Gst.Objects.BufferPool.bufferPoolSetActive' call.
-}
bufferPoolIsActive ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> m Bool
{- ^ __Returns:__ 'True' when the pool is active. -}
bufferPoolIsActive pool = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
result <- gst_buffer_pool_is_active pool'
let result' = (/= 0) result
touchManagedPtr pool
return result'
#if ENABLE_OVERLOADING
data BufferPoolIsActiveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolIsActiveMethodInfo a signature where
overloadedMethod _ = bufferPoolIsActive
#endif
-- method BufferPool::release_buffer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_release_buffer" gst_buffer_pool_release_buffer ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
Ptr Gst.Buffer.Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO ()
{- |
Release /@buffer@/ to /@pool@/. /@buffer@/ should have previously been allocated from
/@pool@/ with 'GI.Gst.Objects.BufferPool.bufferPoolAcquireBuffer'.
This function is usually called automatically when the last ref on /@buffer@/
disappears.
-}
bufferPoolReleaseBuffer ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> Gst.Buffer.Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> m ()
bufferPoolReleaseBuffer pool buffer = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
buffer' <- B.ManagedPtr.disownBoxed buffer
gst_buffer_pool_release_buffer pool' buffer'
touchManagedPtr pool
touchManagedPtr buffer
return ()
#if ENABLE_OVERLOADING
data BufferPoolReleaseBufferMethodInfo
instance (signature ~ (Gst.Buffer.Buffer -> m ()), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolReleaseBufferMethodInfo a signature where
overloadedMethod _ = bufferPoolReleaseBuffer
#endif
-- method BufferPool::set_active
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new active state", 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_buffer_pool_set_active" gst_buffer_pool_set_active ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
CInt -> -- active : TBasicType TBoolean
IO CInt
{- |
Control the active state of /@pool@/. When the pool is inactive, new calls to
'GI.Gst.Objects.BufferPool.bufferPoolAcquireBuffer' will return with 'GI.Gst.Enums.FlowReturnFlushing'.
Activating the bufferpool will preallocate all resources in the pool based on
the configuration of the pool.
Deactivating will free the resources again when there are no outstanding
buffers. When there are outstanding buffers, they will be freed as soon as
they are all returned to the pool.
-}
bufferPoolSetActive ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> Bool
{- ^ /@active@/: the new active state -}
-> m Bool
{- ^ __Returns:__ 'False' when the pool was not configured or when preallocation of the
buffers failed. -}
bufferPoolSetActive pool active = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
let active' = (fromIntegral . fromEnum) active
result <- gst_buffer_pool_set_active pool' active'
let result' = (/= 0) result
touchManagedPtr pool
return result'
#if ENABLE_OVERLOADING
data BufferPoolSetActiveMethodInfo
instance (signature ~ (Bool -> m Bool), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolSetActiveMethodInfo a signature where
overloadedMethod _ = bufferPoolSetActive
#endif
-- method BufferPool::set_config
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", 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_buffer_pool_set_config" gst_buffer_pool_set_config ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
IO CInt
{- |
Set the configuration of the pool. If the pool is already configured, and
the configuration haven\'t change, this function will return 'True'. If the
pool is active, this method will return 'False' and active configuration
will remain. Buffers allocated form this pool must be returned or else this
function will do nothing and return 'False'.
/@config@/ is a 'GI.Gst.Structs.Structure.Structure' that contains the configuration parameters for
the pool. A default and mandatory set of parameters can be configured with
'GI.Gst.Objects.BufferPool.bufferPoolConfigSetParams', 'GI.Gst.Objects.BufferPool.bufferPoolConfigSetAllocator'
and 'GI.Gst.Objects.BufferPool.bufferPoolConfigAddOption'.
If the parameters in /@config@/ can not be set exactly, this function returns
'False' and will try to update as much state as possible. The new state can
then be retrieved and refined with 'GI.Gst.Objects.BufferPool.bufferPoolGetConfig'.
This function takes ownership of /@config@/.
-}
bufferPoolSetConfig ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Structs.Structure.Structure' -}
-> m Bool
{- ^ __Returns:__ 'True' when the configuration could be set. -}
bufferPoolSetConfig pool config = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
config' <- B.ManagedPtr.disownBoxed config
result <- gst_buffer_pool_set_config pool' config'
let result' = (/= 0) result
touchManagedPtr pool
touchManagedPtr config
return result'
#if ENABLE_OVERLOADING
data BufferPoolSetConfigMethodInfo
instance (signature ~ (Gst.Structure.Structure -> m Bool), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolSetConfigMethodInfo a signature where
overloadedMethod _ = bufferPoolSetConfig
#endif
-- method BufferPool::set_flushing
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flushing", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether to start or stop flushing", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_set_flushing" gst_buffer_pool_set_flushing ::
Ptr BufferPool -> -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
CInt -> -- flushing : TBasicType TBoolean
IO ()
{- |
Enable or disable the flushing state of a /@pool@/ without freeing or
allocating buffers.
/Since: 1.4/
-}
bufferPoolSetFlushing ::
(B.CallStack.HasCallStack, MonadIO m, IsBufferPool a) =>
a
{- ^ /@pool@/: a 'GI.Gst.Objects.BufferPool.BufferPool' -}
-> Bool
{- ^ /@flushing@/: whether to start or stop flushing -}
-> m ()
bufferPoolSetFlushing pool flushing = liftIO $ do
pool' <- unsafeManagedPtrCastPtr pool
let flushing' = (fromIntegral . fromEnum) flushing
gst_buffer_pool_set_flushing pool' flushing'
touchManagedPtr pool
return ()
#if ENABLE_OVERLOADING
data BufferPoolSetFlushingMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsBufferPool a) => O.MethodInfo BufferPoolSetFlushingMethodInfo a signature where
overloadedMethod _ = bufferPoolSetFlushing
#endif
-- method BufferPool::config_add_option
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "option", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an option to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_config_add_option" gst_buffer_pool_config_add_option ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
CString -> -- option : TBasicType TUTF8
IO ()
{- |
Enabled the option in /@config@/. This will instruct the /@bufferpool@/ to enable
the specified option on the buffers that it allocates.
The supported options by /@pool@/ can be retrieved with 'GI.Gst.Objects.BufferPool.bufferPoolGetOptions'.
-}
bufferPoolConfigAddOption ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> T.Text
{- ^ /@option@/: an option to add -}
-> m ()
bufferPoolConfigAddOption config option = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
option' <- textToCString option
gst_buffer_pool_config_add_option config' option'
touchManagedPtr config
freeMem option'
return ()
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_get_allocator
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allocator", argType = TInterface (Name {namespace = "Gst", name = "Allocator"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAllocator, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "AllocationParams"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstAllocationParams, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_config_get_allocator" gst_buffer_pool_config_get_allocator ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
Ptr (Ptr Gst.Allocator.Allocator) -> -- allocator : TInterface (Name {namespace = "Gst", name = "Allocator"})
Ptr Gst.AllocationParams.AllocationParams -> -- params : TInterface (Name {namespace = "Gst", name = "AllocationParams"})
IO CInt
{- |
Get the /@allocator@/ and /@params@/ from /@config@/.
-}
bufferPoolConfigGetAllocator ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> m ((Bool, Gst.Allocator.Allocator, Gst.AllocationParams.AllocationParams))
{- ^ __Returns:__ 'True', if the values are set. -}
bufferPoolConfigGetAllocator config = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
allocator <- allocMem :: IO (Ptr (Ptr Gst.Allocator.Allocator))
params <- callocBoxedBytes 64 :: IO (Ptr Gst.AllocationParams.AllocationParams)
result <- gst_buffer_pool_config_get_allocator config' allocator params
let result' = (/= 0) result
allocator' <- peek allocator
allocator'' <- (newObject Gst.Allocator.Allocator) allocator'
params' <- (wrapBoxed Gst.AllocationParams.AllocationParams) params
touchManagedPtr config
freeMem allocator
return (result', allocator'', params')
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_get_option
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", 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 "position in the option array to read", 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_buffer_pool_config_get_option" gst_buffer_pool_config_get_option ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
Word32 -> -- index : TBasicType TUInt
IO CString
{- |
Parse an available /@config@/ and get the option at /@index@/ of the options API
array.
-}
bufferPoolConfigGetOption ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> Word32
{- ^ /@index@/: position in the option array to read -}
-> m T.Text
{- ^ __Returns:__ a @/gchar/@ of the option at /@index@/. -}
bufferPoolConfigGetOption config index = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
result <- gst_buffer_pool_config_get_option config' index
checkUnexpectedReturnNULL "bufferPoolConfigGetOption" result
result' <- cstringToText result
touchManagedPtr config
return result'
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_get_params
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the caps of buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of each buffer, not including prefix and padding", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "min_buffers", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum amount of buffers to allocate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "max_buffers", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum amount of buffers to allocate or 0 for unlimited.", 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_buffer_pool_config_get_params" gst_buffer_pool_config_get_params ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
Ptr (Ptr Gst.Caps.Caps) -> -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
Ptr Word32 -> -- size : TBasicType TUInt
Ptr Word32 -> -- min_buffers : TBasicType TUInt
Ptr Word32 -> -- max_buffers : TBasicType TUInt
IO CInt
{- |
Get the configuration values from /@config@/.
-}
bufferPoolConfigGetParams ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> m ((Bool, Gst.Caps.Caps, Word32, Word32, Word32))
{- ^ __Returns:__ 'True' if all parameters could be fetched. -}
bufferPoolConfigGetParams config = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
caps <- allocMem :: IO (Ptr (Ptr Gst.Caps.Caps))
size <- allocMem :: IO (Ptr Word32)
minBuffers <- allocMem :: IO (Ptr Word32)
maxBuffers <- allocMem :: IO (Ptr Word32)
result <- gst_buffer_pool_config_get_params config' caps size minBuffers maxBuffers
let result' = (/= 0) result
caps' <- peek caps
caps'' <- (newBoxed Gst.Caps.Caps) caps'
size' <- peek size
minBuffers' <- peek minBuffers
maxBuffers' <- peek maxBuffers
touchManagedPtr config
freeMem caps
freeMem size
freeMem minBuffers
freeMem maxBuffers
return (result', caps'', size', minBuffers', maxBuffers')
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_has_option
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "option", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an option", 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_buffer_pool_config_has_option" gst_buffer_pool_config_has_option ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
CString -> -- option : TBasicType TUTF8
IO CInt
{- |
Check if /@config@/ contains /@option@/.
-}
bufferPoolConfigHasOption ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> T.Text
{- ^ /@option@/: an option -}
-> m Bool
{- ^ __Returns:__ 'True' if the options array contains /@option@/. -}
bufferPoolConfigHasOption config option = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
option' <- textToCString option
result <- gst_buffer_pool_config_has_option config' option'
let result' = (/= 0) result
touchManagedPtr config
freeMem option'
return result'
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_n_options
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", 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_buffer_pool_config_n_options" gst_buffer_pool_config_n_options ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
IO Word32
{- |
Retrieve the number of values currently stored in the options array of the
/@config@/ structure.
-}
bufferPoolConfigNOptions ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> m Word32
{- ^ __Returns:__ the options array size as a @/guint/@. -}
bufferPoolConfigNOptions config = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
result <- gst_buffer_pool_config_n_options config'
touchManagedPtr config
return result
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_set_allocator
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allocator", argType = TInterface (Name {namespace = "Gst", name = "Allocator"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstAllocator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "AllocationParams"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "#GstAllocationParams", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_config_set_allocator" gst_buffer_pool_config_set_allocator ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
Ptr Gst.Allocator.Allocator -> -- allocator : TInterface (Name {namespace = "Gst", name = "Allocator"})
Ptr Gst.AllocationParams.AllocationParams -> -- params : TInterface (Name {namespace = "Gst", name = "AllocationParams"})
IO ()
{- |
Set the /@allocator@/ and /@params@/ on /@config@/.
One of /@allocator@/ and /@params@/ can be 'Nothing', but not both. When /@allocator@/
is 'Nothing', the default allocator of the pool will use the values in /@param@/
to perform its allocation. When /@param@/ is 'Nothing', the pool will use the
provided /@allocator@/ with its default 'GI.Gst.Structs.AllocationParams.AllocationParams'.
A call to 'GI.Gst.Objects.BufferPool.bufferPoolSetConfig' can update the allocator and params
with the values that it is able to do. Some pools are, for example, not able
to operate with different allocators or cannot allocate with the values
specified in /@params@/. Use 'GI.Gst.Objects.BufferPool.bufferPoolGetConfig' to get the currently
used values.
-}
bufferPoolConfigSetAllocator ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Allocator.IsAllocator a) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> Maybe (a)
{- ^ /@allocator@/: a 'GI.Gst.Objects.Allocator.Allocator' -}
-> Maybe (Gst.AllocationParams.AllocationParams)
{- ^ /@params@/: 'GI.Gst.Structs.AllocationParams.AllocationParams' -}
-> m ()
bufferPoolConfigSetAllocator config allocator params = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
maybeAllocator <- case allocator of
Nothing -> return nullPtr
Just jAllocator -> do
jAllocator' <- unsafeManagedPtrCastPtr jAllocator
return jAllocator'
maybeParams <- case params of
Nothing -> return nullPtr
Just jParams -> do
jParams' <- unsafeManagedPtrGetPtr jParams
return jParams'
gst_buffer_pool_config_set_allocator config' maybeAllocator maybeParams
touchManagedPtr config
whenJust allocator touchManagedPtr
whenJust params touchManagedPtr
return ()
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_set_params
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", 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 "caps for the buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of each buffer, not including prefix and padding", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum amount of buffers to allocate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum amount of buffers to allocate or 0 for unlimited.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_pool_config_set_params" gst_buffer_pool_config_set_params ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
Ptr Gst.Caps.Caps -> -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
Word32 -> -- size : TBasicType TUInt
Word32 -> -- min_buffers : TBasicType TUInt
Word32 -> -- max_buffers : TBasicType TUInt
IO ()
{- |
Configure /@config@/ with the given parameters.
-}
bufferPoolConfigSetParams ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> Gst.Caps.Caps
{- ^ /@caps@/: caps for the buffers -}
-> Word32
{- ^ /@size@/: the size of each buffer, not including prefix and padding -}
-> Word32
{- ^ /@minBuffers@/: the minimum amount of buffers to allocate. -}
-> Word32
{- ^ /@maxBuffers@/: the maximum amount of buffers to allocate or 0 for unlimited. -}
-> m ()
bufferPoolConfigSetParams config caps size minBuffers maxBuffers = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
caps' <- unsafeManagedPtrGetPtr caps
gst_buffer_pool_config_set_params config' caps' size minBuffers maxBuffers
touchManagedPtr config
touchManagedPtr caps
return ()
#if ENABLE_OVERLOADING
#endif
-- method BufferPool::config_validate_params
-- method type : MemberFunction
-- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferPool configuration", 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 excepted caps of buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the expected size of each buffer, not including prefix and padding", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the expected minimum amount of buffers to allocate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the expect maximum amount of buffers to allocate or 0 for unlimited.", 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_buffer_pool_config_validate_params" gst_buffer_pool_config_validate_params ::
Ptr Gst.Structure.Structure -> -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
Ptr Gst.Caps.Caps -> -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
Word32 -> -- size : TBasicType TUInt
Word32 -> -- min_buffers : TBasicType TUInt
Word32 -> -- max_buffers : TBasicType TUInt
IO CInt
{- |
Validate that changes made to /@config@/ are still valid in the context of the
expected parameters. This function is a helper that can be used to validate
changes made by a pool to a config when 'GI.Gst.Objects.BufferPool.bufferPoolSetConfig'
returns 'False'. This expects that /@caps@/ haven\'t changed and that
/@minBuffers@/ aren\'t lower then what we initially expected.
This does not check if options or allocator parameters are still valid,
won\'t check if size have changed, since changing the size is valid to adapt
padding.
/Since: 1.4/
-}
bufferPoolConfigValidateParams ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Structure.Structure
{- ^ /@config@/: a 'GI.Gst.Objects.BufferPool.BufferPool' configuration -}
-> Gst.Caps.Caps
{- ^ /@caps@/: the excepted caps of buffers -}
-> Word32
{- ^ /@size@/: the expected size of each buffer, not including prefix and padding -}
-> Word32
{- ^ /@minBuffers@/: the expected minimum amount of buffers to allocate. -}
-> Word32
{- ^ /@maxBuffers@/: the expect maximum amount of buffers to allocate or 0 for unlimited. -}
-> m Bool
{- ^ __Returns:__ 'True', if the parameters are valid in this context. -}
bufferPoolConfigValidateParams config caps size minBuffers maxBuffers = liftIO $ do
config' <- unsafeManagedPtrGetPtr config
caps' <- unsafeManagedPtrGetPtr caps
result <- gst_buffer_pool_config_validate_params config' caps' size minBuffers maxBuffers
let result' = (/= 0) result
touchManagedPtr config
touchManagedPtr caps
return result'
#if ENABLE_OVERLOADING
#endif