gi-gst-1.0.18: GI/Gst/Structs/Buffer.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)
Buffers are the basic unit of data transfer in GStreamer. They contain the
timing and offset along with other arbitrary metadata that is associated
with the 'GI.Gst.Structs.Memory.Memory' blocks that the buffer contains.
Buffers are usually created with 'GI.Gst.Structs.Buffer.bufferNew'. After a buffer has been
created one will typically allocate memory for it and add it to the buffer.
The following example creates a buffer that can hold a given video frame
with a given width, height and bits per plane.
=== /C code/
>
> GstBuffer *buffer;
> GstMemory *memory;
> gint size, width, height, bpp;
> ...
> size = width * height * bpp;
> buffer = gst_buffer_new ();
> memory = gst_allocator_alloc (NULL, size, NULL);
> gst_buffer_insert_memory (buffer, -1, memory);
> ...
Alternatively, use 'GI.Gst.Structs.Buffer.bufferNewAllocate' to create a buffer with
preallocated data of a given size.
Buffers can contain a list of 'GI.Gst.Structs.Memory.Memory' objects. You can retrieve how many
memory objects with 'GI.Gst.Structs.Buffer.bufferNMemory' and you can get a pointer
to memory with 'GI.Gst.Structs.Buffer.bufferPeekMemory'
A buffer will usually have timestamps, and a duration, but neither of these
are guaranteed (they may be set to 'GI.Gst.Constants.CLOCK_TIME_NONE'). Whenever a
meaningful value can be given for these, they should be set. The timestamps
and duration are measured in nanoseconds (they are @/GstClockTime/@ values).
The buffer DTS refers to the timestamp when the buffer should be decoded and
is usually monotonically increasing. The buffer PTS refers to the timestamp when
the buffer content should be presented to the user and is not always
monotonically increasing.
A buffer can also have one or both of a start and an end offset. These are
media-type specific. For video buffers, the start offset will generally be
the frame number. For audio buffers, it will be the number of samples
produced so far. For compressed data, it could be the byte offset in a
source or destination file. Likewise, the end offset will be the offset of
the end of the buffer. These can only be meaningfully interpreted if you
know the media type of the buffer (the preceding CAPS event). Either or both
can be set to 'GI.Gst.Constants.BUFFER_OFFSET_NONE'.
@/gst_buffer_ref()/@ is used to increase the refcount of a buffer. This must be
done when you want to keep a handle to the buffer after pushing it to the
next element. The buffer refcount determines the writability of the buffer, a
buffer is only writable when the refcount is exactly 1, i.e. when the caller
has the only reference to the buffer.
To efficiently create a smaller buffer out of an existing one, you can
use 'GI.Gst.Structs.Buffer.bufferCopyRegion'. This method tries to share the memory objects
between the two buffers.
If a plug-in wants to modify the buffer data or metadata in-place, it should
first obtain a buffer that is safe to modify by using
@/gst_buffer_make_writable()/@. This function is optimized so that a copy will
only be made when it is necessary.
Several flags of the buffer can be set and unset with the
@/GST_BUFFER_FLAG_SET()/@ and @/GST_BUFFER_FLAG_UNSET()/@ macros. Use
@/GST_BUFFER_FLAG_IS_SET()/@ to test if a certain 'GI.Gst.Flags.BufferFlags' flag is set.
Buffers can be efficiently merged into a larger buffer with
'GI.Gst.Structs.Buffer.bufferAppend'. Copying of memory will only be done when absolutely
needed.
Arbitrary extra metadata can be set on a buffer with 'GI.Gst.Structs.Buffer.bufferAddMeta'.
Metadata can be retrieved with 'GI.Gst.Structs.Buffer.bufferGetMeta'. See also 'GI.Gst.Structs.Meta.Meta'
An element should either unref the buffer or push it out on a src pad
using 'GI.Gst.Objects.Pad.padPush' (see 'GI.Gst.Objects.Pad.Pad').
Buffers are usually freed by unreffing them with @/gst_buffer_unref()/@. When
the refcount drops to 0, any memory and metadata pointed to by the buffer is
unreffed as well. Buffers allocated from a 'GI.Gst.Objects.BufferPool.BufferPool' will be returned to
the pool when the refcount drops to 0.
The 'GI.Gst.Structs.ParentBufferMeta.ParentBufferMeta' is a meta which can be attached to a 'GI.Gst.Structs.Buffer.Buffer'
to hold a reference to another buffer that is only released when the child
'GI.Gst.Structs.Buffer.Buffer' is released.
Typically, 'GI.Gst.Structs.ParentBufferMeta.ParentBufferMeta' is used when the child buffer is directly
using the 'GI.Gst.Structs.Memory.Memory' of the parent buffer, and wants to prevent the parent
buffer from being returned to a buffer pool until the 'GI.Gst.Structs.Memory.Memory' is available
for re-use. (Since 1.6)
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gst.Structs.Buffer
(
-- * Exported types
Buffer(..) ,
newZeroBuffer ,
noBuffer ,
-- * Methods
-- ** addMeta #method:addMeta#
#if ENABLE_OVERLOADING
BufferAddMetaMethodInfo ,
#endif
bufferAddMeta ,
-- ** addParentBufferMeta #method:addParentBufferMeta#
#if ENABLE_OVERLOADING
BufferAddParentBufferMetaMethodInfo ,
#endif
bufferAddParentBufferMeta ,
-- ** addProtectionMeta #method:addProtectionMeta#
#if ENABLE_OVERLOADING
BufferAddProtectionMetaMethodInfo ,
#endif
bufferAddProtectionMeta ,
-- ** addReferenceTimestampMeta #method:addReferenceTimestampMeta#
#if ENABLE_OVERLOADING
BufferAddReferenceTimestampMetaMethodInfo,
#endif
bufferAddReferenceTimestampMeta ,
-- ** append #method:append#
#if ENABLE_OVERLOADING
BufferAppendMethodInfo ,
#endif
bufferAppend ,
-- ** appendMemory #method:appendMemory#
#if ENABLE_OVERLOADING
BufferAppendMemoryMethodInfo ,
#endif
bufferAppendMemory ,
-- ** appendRegion #method:appendRegion#
#if ENABLE_OVERLOADING
BufferAppendRegionMethodInfo ,
#endif
bufferAppendRegion ,
-- ** copyDeep #method:copyDeep#
#if ENABLE_OVERLOADING
BufferCopyDeepMethodInfo ,
#endif
bufferCopyDeep ,
-- ** copyInto #method:copyInto#
#if ENABLE_OVERLOADING
BufferCopyIntoMethodInfo ,
#endif
bufferCopyInto ,
-- ** copyRegion #method:copyRegion#
#if ENABLE_OVERLOADING
BufferCopyRegionMethodInfo ,
#endif
bufferCopyRegion ,
-- ** extract #method:extract#
#if ENABLE_OVERLOADING
BufferExtractMethodInfo ,
#endif
bufferExtract ,
-- ** extractDup #method:extractDup#
#if ENABLE_OVERLOADING
BufferExtractDupMethodInfo ,
#endif
bufferExtractDup ,
-- ** fill #method:fill#
#if ENABLE_OVERLOADING
BufferFillMethodInfo ,
#endif
bufferFill ,
-- ** findMemory #method:findMemory#
#if ENABLE_OVERLOADING
BufferFindMemoryMethodInfo ,
#endif
bufferFindMemory ,
-- ** foreachMeta #method:foreachMeta#
#if ENABLE_OVERLOADING
BufferForeachMetaMethodInfo ,
#endif
bufferForeachMeta ,
-- ** getAllMemory #method:getAllMemory#
#if ENABLE_OVERLOADING
BufferGetAllMemoryMethodInfo ,
#endif
bufferGetAllMemory ,
-- ** getFlags #method:getFlags#
#if ENABLE_OVERLOADING
BufferGetFlagsMethodInfo ,
#endif
bufferGetFlags ,
-- ** getMaxMemory #method:getMaxMemory#
bufferGetMaxMemory ,
-- ** getMemory #method:getMemory#
#if ENABLE_OVERLOADING
BufferGetMemoryMethodInfo ,
#endif
bufferGetMemory ,
-- ** getMemoryRange #method:getMemoryRange#
#if ENABLE_OVERLOADING
BufferGetMemoryRangeMethodInfo ,
#endif
bufferGetMemoryRange ,
-- ** getMeta #method:getMeta#
#if ENABLE_OVERLOADING
BufferGetMetaMethodInfo ,
#endif
bufferGetMeta ,
-- ** getNMeta #method:getNMeta#
#if ENABLE_OVERLOADING
BufferGetNMetaMethodInfo ,
#endif
bufferGetNMeta ,
-- ** getReferenceTimestampMeta #method:getReferenceTimestampMeta#
#if ENABLE_OVERLOADING
BufferGetReferenceTimestampMetaMethodInfo,
#endif
bufferGetReferenceTimestampMeta ,
-- ** getSize #method:getSize#
#if ENABLE_OVERLOADING
BufferGetSizeMethodInfo ,
#endif
bufferGetSize ,
-- ** getSizes #method:getSizes#
#if ENABLE_OVERLOADING
BufferGetSizesMethodInfo ,
#endif
bufferGetSizes ,
-- ** getSizesRange #method:getSizesRange#
#if ENABLE_OVERLOADING
BufferGetSizesRangeMethodInfo ,
#endif
bufferGetSizesRange ,
-- ** hasFlags #method:hasFlags#
#if ENABLE_OVERLOADING
BufferHasFlagsMethodInfo ,
#endif
bufferHasFlags ,
-- ** insertMemory #method:insertMemory#
#if ENABLE_OVERLOADING
BufferInsertMemoryMethodInfo ,
#endif
bufferInsertMemory ,
-- ** isAllMemoryWritable #method:isAllMemoryWritable#
#if ENABLE_OVERLOADING
BufferIsAllMemoryWritableMethodInfo ,
#endif
bufferIsAllMemoryWritable ,
-- ** isMemoryRangeWritable #method:isMemoryRangeWritable#
#if ENABLE_OVERLOADING
BufferIsMemoryRangeWritableMethodInfo ,
#endif
bufferIsMemoryRangeWritable ,
-- ** map #method:map#
#if ENABLE_OVERLOADING
BufferMapMethodInfo ,
#endif
bufferMap ,
-- ** mapRange #method:mapRange#
#if ENABLE_OVERLOADING
BufferMapRangeMethodInfo ,
#endif
bufferMapRange ,
-- ** memcmp #method:memcmp#
#if ENABLE_OVERLOADING
BufferMemcmpMethodInfo ,
#endif
bufferMemcmp ,
-- ** memset #method:memset#
#if ENABLE_OVERLOADING
BufferMemsetMethodInfo ,
#endif
bufferMemset ,
-- ** nMemory #method:nMemory#
#if ENABLE_OVERLOADING
BufferNMemoryMethodInfo ,
#endif
bufferNMemory ,
-- ** new #method:new#
bufferNew ,
-- ** newAllocate #method:newAllocate#
bufferNewAllocate ,
-- ** newWrapped #method:newWrapped#
bufferNewWrapped ,
-- ** newWrappedBytes #method:newWrappedBytes#
bufferNewWrappedBytes ,
-- ** newWrappedFull #method:newWrappedFull#
bufferNewWrappedFull ,
-- ** peekMemory #method:peekMemory#
#if ENABLE_OVERLOADING
BufferPeekMemoryMethodInfo ,
#endif
bufferPeekMemory ,
-- ** prependMemory #method:prependMemory#
#if ENABLE_OVERLOADING
BufferPrependMemoryMethodInfo ,
#endif
bufferPrependMemory ,
-- ** removeAllMemory #method:removeAllMemory#
#if ENABLE_OVERLOADING
BufferRemoveAllMemoryMethodInfo ,
#endif
bufferRemoveAllMemory ,
-- ** removeMemory #method:removeMemory#
#if ENABLE_OVERLOADING
BufferRemoveMemoryMethodInfo ,
#endif
bufferRemoveMemory ,
-- ** removeMemoryRange #method:removeMemoryRange#
#if ENABLE_OVERLOADING
BufferRemoveMemoryRangeMethodInfo ,
#endif
bufferRemoveMemoryRange ,
-- ** removeMeta #method:removeMeta#
#if ENABLE_OVERLOADING
BufferRemoveMetaMethodInfo ,
#endif
bufferRemoveMeta ,
-- ** replaceAllMemory #method:replaceAllMemory#
#if ENABLE_OVERLOADING
BufferReplaceAllMemoryMethodInfo ,
#endif
bufferReplaceAllMemory ,
-- ** replaceMemory #method:replaceMemory#
#if ENABLE_OVERLOADING
BufferReplaceMemoryMethodInfo ,
#endif
bufferReplaceMemory ,
-- ** replaceMemoryRange #method:replaceMemoryRange#
#if ENABLE_OVERLOADING
BufferReplaceMemoryRangeMethodInfo ,
#endif
bufferReplaceMemoryRange ,
-- ** resize #method:resize#
#if ENABLE_OVERLOADING
BufferResizeMethodInfo ,
#endif
bufferResize ,
-- ** resizeRange #method:resizeRange#
#if ENABLE_OVERLOADING
BufferResizeRangeMethodInfo ,
#endif
bufferResizeRange ,
-- ** setFlags #method:setFlags#
#if ENABLE_OVERLOADING
BufferSetFlagsMethodInfo ,
#endif
bufferSetFlags ,
-- ** setSize #method:setSize#
#if ENABLE_OVERLOADING
BufferSetSizeMethodInfo ,
#endif
bufferSetSize ,
-- ** unmap #method:unmap#
#if ENABLE_OVERLOADING
BufferUnmapMethodInfo ,
#endif
bufferUnmap ,
-- ** unsetFlags #method:unsetFlags#
#if ENABLE_OVERLOADING
BufferUnsetFlagsMethodInfo ,
#endif
bufferUnsetFlags ,
-- * Properties
-- ** dts #attr:dts#
{- | decoding timestamp of the buffer, can be 'GI.Gst.Constants.CLOCK_TIME_NONE' when the
dts is not known or relevant. The dts contains the timestamp when the
media should be processed.
-}
#if ENABLE_OVERLOADING
buffer_dts ,
#endif
getBufferDts ,
setBufferDts ,
-- ** duration #attr:duration#
{- | duration in time of the buffer data, can be 'GI.Gst.Constants.CLOCK_TIME_NONE'
when the duration is not known or relevant.
-}
#if ENABLE_OVERLOADING
buffer_duration ,
#endif
getBufferDuration ,
setBufferDuration ,
-- ** miniObject #attr:miniObject#
{- | the parent structure
-}
#if ENABLE_OVERLOADING
buffer_miniObject ,
#endif
getBufferMiniObject ,
-- ** offset #attr:offset#
{- | a media specific offset for the buffer data.
For video frames, this is the frame number of this buffer.
For audio samples, this is the offset of the first sample in this buffer.
For file data or compressed data this is the byte offset of the first
byte in this buffer.
-}
#if ENABLE_OVERLOADING
buffer_offset ,
#endif
getBufferOffset ,
setBufferOffset ,
-- ** offsetEnd #attr:offsetEnd#
{- | the last offset contained in this buffer. It has the same
format as /@offset@/.
-}
#if ENABLE_OVERLOADING
buffer_offsetEnd ,
#endif
getBufferOffsetEnd ,
setBufferOffsetEnd ,
-- ** pool #attr:pool#
{- | pointer to the pool owner of the buffer
-}
#if ENABLE_OVERLOADING
buffer_pool ,
#endif
clearBufferPool ,
getBufferPool ,
setBufferPool ,
-- ** pts #attr:pts#
{- | presentation timestamp of the buffer, can be 'GI.Gst.Constants.CLOCK_TIME_NONE' when the
pts is not known or relevant. The pts contains the timestamp when the
media should be presented to the user.
-}
#if ENABLE_OVERLOADING
buffer_pts ,
#endif
getBufferPts ,
setBufferPts ,
) 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.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.Gst.Callbacks as Gst.Callbacks
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Objects.Allocator as Gst.Allocator
import {-# SOURCE #-} qualified GI.Gst.Objects.BufferPool as Gst.BufferPool
import {-# SOURCE #-} qualified GI.Gst.Structs.AllocationParams as Gst.AllocationParams
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.MapInfo as Gst.MapInfo
import {-# SOURCE #-} qualified GI.Gst.Structs.Memory as Gst.Memory
import {-# SOURCE #-} qualified GI.Gst.Structs.Meta as Gst.Meta
import {-# SOURCE #-} qualified GI.Gst.Structs.MetaInfo as Gst.MetaInfo
import {-# SOURCE #-} qualified GI.Gst.Structs.MiniObject as Gst.MiniObject
import {-# SOURCE #-} qualified GI.Gst.Structs.ParentBufferMeta as Gst.ParentBufferMeta
import {-# SOURCE #-} qualified GI.Gst.Structs.ProtectionMeta as Gst.ProtectionMeta
import {-# SOURCE #-} qualified GI.Gst.Structs.ReferenceTimestampMeta as Gst.ReferenceTimestampMeta
import {-# SOURCE #-} qualified GI.Gst.Structs.Structure as Gst.Structure
-- | Memory-managed wrapper type.
newtype Buffer = Buffer (ManagedPtr Buffer)
foreign import ccall "gst_buffer_get_type" c_gst_buffer_get_type ::
IO GType
instance BoxedObject Buffer where
boxedType _ = c_gst_buffer_get_type
-- | Construct a `Buffer` struct initialized to zero.
newZeroBuffer :: MonadIO m => m Buffer
newZeroBuffer = liftIO $ callocBoxedBytes 112 >>= wrapBoxed Buffer
instance tag ~ 'AttrSet => Constructible Buffer tag where
new _ attrs = do
o <- newZeroBuffer
GI.Attributes.set o attrs
return o
-- | A convenience alias for `Nothing` :: `Maybe` `Buffer`.
noBuffer :: Maybe Buffer
noBuffer = Nothing
{- |
Get the value of the “@mini_object@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' buffer #miniObject
@
-}
getBufferMiniObject :: MonadIO m => Buffer -> m Gst.MiniObject.MiniObject
getBufferMiniObject s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 0 :: (Ptr Gst.MiniObject.MiniObject)
val' <- (newPtr Gst.MiniObject.MiniObject) val
return val'
#if ENABLE_OVERLOADING
data BufferMiniObjectFieldInfo
instance AttrInfo BufferMiniObjectFieldInfo where
type AttrAllowedOps BufferMiniObjectFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint BufferMiniObjectFieldInfo = (~) (Ptr Gst.MiniObject.MiniObject)
type AttrBaseTypeConstraint BufferMiniObjectFieldInfo = (~) Buffer
type AttrGetType BufferMiniObjectFieldInfo = Gst.MiniObject.MiniObject
type AttrLabel BufferMiniObjectFieldInfo = "mini_object"
type AttrOrigin BufferMiniObjectFieldInfo = Buffer
attrGet _ = getBufferMiniObject
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
buffer_miniObject :: AttrLabelProxy "miniObject"
buffer_miniObject = AttrLabelProxy
#endif
{- |
Get the value of the “@pool@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' buffer #pool
@
-}
getBufferPool :: MonadIO m => Buffer -> m (Maybe Gst.BufferPool.BufferPool)
getBufferPool s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 64) :: IO (Ptr Gst.BufferPool.BufferPool)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- (newObject Gst.BufferPool.BufferPool) val'
return val''
return result
{- |
Set the value of the “@pool@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' buffer [ #pool 'Data.GI.Base.Attributes.:=' value ]
@
-}
setBufferPool :: MonadIO m => Buffer -> Ptr Gst.BufferPool.BufferPool -> m ()
setBufferPool s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 64) (val :: Ptr Gst.BufferPool.BufferPool)
{- |
Set the value of the “@pool@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #pool
@
-}
clearBufferPool :: MonadIO m => Buffer -> m ()
clearBufferPool s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 64) (FP.nullPtr :: Ptr Gst.BufferPool.BufferPool)
#if ENABLE_OVERLOADING
data BufferPoolFieldInfo
instance AttrInfo BufferPoolFieldInfo where
type AttrAllowedOps BufferPoolFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint BufferPoolFieldInfo = (~) (Ptr Gst.BufferPool.BufferPool)
type AttrBaseTypeConstraint BufferPoolFieldInfo = (~) Buffer
type AttrGetType BufferPoolFieldInfo = Maybe Gst.BufferPool.BufferPool
type AttrLabel BufferPoolFieldInfo = "pool"
type AttrOrigin BufferPoolFieldInfo = Buffer
attrGet _ = getBufferPool
attrSet _ = setBufferPool
attrConstruct = undefined
attrClear _ = clearBufferPool
buffer_pool :: AttrLabelProxy "pool"
buffer_pool = AttrLabelProxy
#endif
{- |
Get the value of the “@pts@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' buffer #pts
@
-}
getBufferPts :: MonadIO m => Buffer -> m Word64
getBufferPts s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 72) :: IO Word64
return val
{- |
Set the value of the “@pts@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' buffer [ #pts 'Data.GI.Base.Attributes.:=' value ]
@
-}
setBufferPts :: MonadIO m => Buffer -> Word64 -> m ()
setBufferPts s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 72) (val :: Word64)
#if ENABLE_OVERLOADING
data BufferPtsFieldInfo
instance AttrInfo BufferPtsFieldInfo where
type AttrAllowedOps BufferPtsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BufferPtsFieldInfo = (~) Word64
type AttrBaseTypeConstraint BufferPtsFieldInfo = (~) Buffer
type AttrGetType BufferPtsFieldInfo = Word64
type AttrLabel BufferPtsFieldInfo = "pts"
type AttrOrigin BufferPtsFieldInfo = Buffer
attrGet _ = getBufferPts
attrSet _ = setBufferPts
attrConstruct = undefined
attrClear _ = undefined
buffer_pts :: AttrLabelProxy "pts"
buffer_pts = AttrLabelProxy
#endif
{- |
Get the value of the “@dts@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' buffer #dts
@
-}
getBufferDts :: MonadIO m => Buffer -> m Word64
getBufferDts s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 80) :: IO Word64
return val
{- |
Set the value of the “@dts@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' buffer [ #dts 'Data.GI.Base.Attributes.:=' value ]
@
-}
setBufferDts :: MonadIO m => Buffer -> Word64 -> m ()
setBufferDts s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 80) (val :: Word64)
#if ENABLE_OVERLOADING
data BufferDtsFieldInfo
instance AttrInfo BufferDtsFieldInfo where
type AttrAllowedOps BufferDtsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BufferDtsFieldInfo = (~) Word64
type AttrBaseTypeConstraint BufferDtsFieldInfo = (~) Buffer
type AttrGetType BufferDtsFieldInfo = Word64
type AttrLabel BufferDtsFieldInfo = "dts"
type AttrOrigin BufferDtsFieldInfo = Buffer
attrGet _ = getBufferDts
attrSet _ = setBufferDts
attrConstruct = undefined
attrClear _ = undefined
buffer_dts :: AttrLabelProxy "dts"
buffer_dts = AttrLabelProxy
#endif
{- |
Get the value of the “@duration@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' buffer #duration
@
-}
getBufferDuration :: MonadIO m => Buffer -> m Word64
getBufferDuration s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 88) :: IO Word64
return val
{- |
Set the value of the “@duration@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' buffer [ #duration 'Data.GI.Base.Attributes.:=' value ]
@
-}
setBufferDuration :: MonadIO m => Buffer -> Word64 -> m ()
setBufferDuration s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 88) (val :: Word64)
#if ENABLE_OVERLOADING
data BufferDurationFieldInfo
instance AttrInfo BufferDurationFieldInfo where
type AttrAllowedOps BufferDurationFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BufferDurationFieldInfo = (~) Word64
type AttrBaseTypeConstraint BufferDurationFieldInfo = (~) Buffer
type AttrGetType BufferDurationFieldInfo = Word64
type AttrLabel BufferDurationFieldInfo = "duration"
type AttrOrigin BufferDurationFieldInfo = Buffer
attrGet _ = getBufferDuration
attrSet _ = setBufferDuration
attrConstruct = undefined
attrClear _ = undefined
buffer_duration :: AttrLabelProxy "duration"
buffer_duration = AttrLabelProxy
#endif
{- |
Get the value of the “@offset@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' buffer #offset
@
-}
getBufferOffset :: MonadIO m => Buffer -> m Word64
getBufferOffset s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 96) :: IO Word64
return val
{- |
Set the value of the “@offset@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' buffer [ #offset 'Data.GI.Base.Attributes.:=' value ]
@
-}
setBufferOffset :: MonadIO m => Buffer -> Word64 -> m ()
setBufferOffset s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 96) (val :: Word64)
#if ENABLE_OVERLOADING
data BufferOffsetFieldInfo
instance AttrInfo BufferOffsetFieldInfo where
type AttrAllowedOps BufferOffsetFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BufferOffsetFieldInfo = (~) Word64
type AttrBaseTypeConstraint BufferOffsetFieldInfo = (~) Buffer
type AttrGetType BufferOffsetFieldInfo = Word64
type AttrLabel BufferOffsetFieldInfo = "offset"
type AttrOrigin BufferOffsetFieldInfo = Buffer
attrGet _ = getBufferOffset
attrSet _ = setBufferOffset
attrConstruct = undefined
attrClear _ = undefined
buffer_offset :: AttrLabelProxy "offset"
buffer_offset = AttrLabelProxy
#endif
{- |
Get the value of the “@offset_end@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' buffer #offsetEnd
@
-}
getBufferOffsetEnd :: MonadIO m => Buffer -> m Word64
getBufferOffsetEnd s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 104) :: IO Word64
return val
{- |
Set the value of the “@offset_end@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' buffer [ #offsetEnd 'Data.GI.Base.Attributes.:=' value ]
@
-}
setBufferOffsetEnd :: MonadIO m => Buffer -> Word64 -> m ()
setBufferOffsetEnd s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 104) (val :: Word64)
#if ENABLE_OVERLOADING
data BufferOffsetEndFieldInfo
instance AttrInfo BufferOffsetEndFieldInfo where
type AttrAllowedOps BufferOffsetEndFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BufferOffsetEndFieldInfo = (~) Word64
type AttrBaseTypeConstraint BufferOffsetEndFieldInfo = (~) Buffer
type AttrGetType BufferOffsetEndFieldInfo = Word64
type AttrLabel BufferOffsetEndFieldInfo = "offset_end"
type AttrOrigin BufferOffsetEndFieldInfo = Buffer
attrGet _ = getBufferOffsetEnd
attrSet _ = setBufferOffsetEnd
attrConstruct = undefined
attrClear _ = undefined
buffer_offsetEnd :: AttrLabelProxy "offsetEnd"
buffer_offsetEnd = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Buffer
type instance O.AttributeList Buffer = BufferAttributeList
type BufferAttributeList = ('[ '("miniObject", BufferMiniObjectFieldInfo), '("pool", BufferPoolFieldInfo), '("pts", BufferPtsFieldInfo), '("dts", BufferDtsFieldInfo), '("duration", BufferDurationFieldInfo), '("offset", BufferOffsetFieldInfo), '("offsetEnd", BufferOffsetEndFieldInfo)] :: [(Symbol, *)])
#endif
-- method Buffer::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_new" gst_buffer_new ::
IO (Ptr Buffer)
{- |
Creates a newly allocated buffer without any data.
MT safe.
-}
bufferNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Buffer
{- ^ __Returns:__ the new 'GI.Gst.Structs.Buffer.Buffer'. -}
bufferNew = liftIO $ do
result <- gst_buffer_new
checkUnexpectedReturnNULL "bufferNew" result
result' <- (wrapBoxed Buffer) result
return result'
#if ENABLE_OVERLOADING
#endif
-- method Buffer::new_allocate
-- method type : Constructor
-- Args : [Arg {argCName = "allocator", argType = TInterface (Name {namespace = "Gst", name = "Allocator"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GstAllocator to use, or %NULL to use the\n default allocator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size in bytes of the new buffer's data.", 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 "optional parameters", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_new_allocate" gst_buffer_new_allocate ::
Ptr Gst.Allocator.Allocator -> -- allocator : TInterface (Name {namespace = "Gst", name = "Allocator"})
Word64 -> -- size : TBasicType TUInt64
Ptr Gst.AllocationParams.AllocationParams -> -- params : TInterface (Name {namespace = "Gst", name = "AllocationParams"})
IO (Ptr Buffer)
{- |
Tries to create a newly allocated buffer with data of the given size and
extra parameters from /@allocator@/. If the requested amount of memory can\'t be
allocated, 'Nothing' will be returned. The allocated buffer memory is not cleared.
When /@allocator@/ is 'Nothing', the default memory allocator will be used.
Note that when /@size@/ == 0, the buffer will not have memory associated with it.
MT safe.
-}
bufferNewAllocate ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Allocator.IsAllocator a) =>
Maybe (a)
{- ^ /@allocator@/: the 'GI.Gst.Objects.Allocator.Allocator' to use, or 'Nothing' to use the
default allocator -}
-> Word64
{- ^ /@size@/: the size in bytes of the new buffer\'s data. -}
-> Maybe (Gst.AllocationParams.AllocationParams)
{- ^ /@params@/: optional parameters -}
-> m (Maybe Buffer)
{- ^ __Returns:__ a new 'GI.Gst.Structs.Buffer.Buffer', or 'Nothing' if
the memory couldn\'t be allocated. -}
bufferNewAllocate allocator size params = liftIO $ do
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'
result <- gst_buffer_new_allocate maybeAllocator size maybeParams
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Buffer) result'
return result''
whenJust allocator touchManagedPtr
whenJust params touchManagedPtr
return maybeResult
#if ENABLE_OVERLOADING
#endif
-- method Buffer::new_wrapped
-- method type : Constructor
-- Args : [Arg {argCName = "data", argType = TCArray False (-1) 1 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "data to wrap", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "allocated size of @data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "allocated size of @data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_new_wrapped" gst_buffer_new_wrapped ::
Ptr Word8 -> -- data : TCArray False (-1) 1 (TBasicType TUInt8)
Word64 -> -- size : TBasicType TUInt64
IO (Ptr Buffer)
{- |
Creates a new buffer that wraps the given /@data@/. The memory will be freed
with g_free and will be marked writable.
MT safe.
-}
bufferNewWrapped ::
(B.CallStack.HasCallStack, MonadIO m) =>
ByteString
{- ^ /@data@/: data to wrap -}
-> m Buffer
{- ^ __Returns:__ a new 'GI.Gst.Structs.Buffer.Buffer' -}
bufferNewWrapped data_ = liftIO $ do
let size = fromIntegral $ B.length data_
data_' <- packByteString data_
result <- gst_buffer_new_wrapped data_' size
checkUnexpectedReturnNULL "bufferNewWrapped" result
result' <- (wrapBoxed Buffer) result
return result'
#if ENABLE_OVERLOADING
#endif
-- method Buffer::new_wrapped_bytes
-- method type : Constructor
-- Args : [Arg {argCName = "bytes", argType = TInterface (Name {namespace = "GLib", name = "Bytes"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBytes to wrap", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_new_wrapped_bytes" gst_buffer_new_wrapped_bytes ::
Ptr GLib.Bytes.Bytes -> -- bytes : TInterface (Name {namespace = "GLib", name = "Bytes"})
IO (Ptr Buffer)
{- |
Creates a new 'GI.Gst.Structs.Buffer.Buffer' that wraps the given /@bytes@/. The data inside
/@bytes@/ cannot be 'Nothing' and the resulting buffer will be marked as read only.
MT safe.
/Since: 1.16/
-}
bufferNewWrappedBytes ::
(B.CallStack.HasCallStack, MonadIO m) =>
GLib.Bytes.Bytes
{- ^ /@bytes@/: a 'GI.GLib.Structs.Bytes.Bytes' to wrap -}
-> m Buffer
{- ^ __Returns:__ a new 'GI.Gst.Structs.Buffer.Buffer' wrapping /@bytes@/ -}
bufferNewWrappedBytes bytes = liftIO $ do
bytes' <- unsafeManagedPtrGetPtr bytes
result <- gst_buffer_new_wrapped_bytes bytes'
checkUnexpectedReturnNULL "bufferNewWrappedBytes" result
result' <- (wrapBoxed Buffer) result
touchManagedPtr bytes
return result'
#if ENABLE_OVERLOADING
#endif
-- method Buffer::new_wrapped_full
-- method type : Constructor
-- Args : [Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "MemoryFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstMemoryFlags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "data to wrap", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "maxsize", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "allocated size of @data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "offset in @data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size of valid data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user_data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "called with @user_data when the memory is freed", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size of valid data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_new_wrapped_full" gst_buffer_new_wrapped_full ::
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "MemoryFlags"})
Ptr Word8 -> -- data : TCArray False (-1) 4 (TBasicType TUInt8)
Word64 -> -- maxsize : TBasicType TUInt64
Word64 -> -- offset : TBasicType TUInt64
Word64 -> -- size : TBasicType TUInt64
Ptr () -> -- user_data : TBasicType TPtr
FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
IO (Ptr Buffer)
{- |
Allocate a new buffer that wraps the given memory. /@data@/ must point to
/@maxsize@/ of memory, the wrapped buffer will have the region from /@offset@/ and
/@size@/ visible.
When the buffer is destroyed, /@notify@/ will be called with /@userData@/.
The prefix\/padding must be filled with 0 if /@flags@/ contains
@/GST_MEMORY_FLAG_ZERO_PREFIXED/@ and @/GST_MEMORY_FLAG_ZERO_PADDED/@ respectively.
-}
bufferNewWrappedFull ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Gst.Flags.MemoryFlags]
{- ^ /@flags@/: 'GI.Gst.Flags.MemoryFlags' -}
-> ByteString
{- ^ /@data@/: data to wrap -}
-> Word64
{- ^ /@maxsize@/: allocated size of /@data@/ -}
-> Word64
{- ^ /@offset@/: offset in /@data@/ -}
-> Maybe (GLib.Callbacks.DestroyNotify)
{- ^ /@notify@/: called with /@userData@/ when the memory is freed -}
-> m Buffer
{- ^ __Returns:__ a new 'GI.Gst.Structs.Buffer.Buffer' -}
bufferNewWrappedFull flags data_ maxsize offset notify = liftIO $ do
let size = fromIntegral $ B.length data_
let flags' = gflagsToWord flags
data_' <- packByteString data_
maybeNotify <- case notify of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jNotify -> do
ptrnotify <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
jNotify' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrnotify) jNotify)
poke ptrnotify jNotify'
return jNotify'
let userData = nullPtr
result <- gst_buffer_new_wrapped_full flags' data_' maxsize offset size userData maybeNotify
checkUnexpectedReturnNULL "bufferNewWrappedFull" result
result' <- (wrapBoxed Buffer) result
freeMem data_'
return result'
#if ENABLE_OVERLOADING
#endif
-- method Buffer::add_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MetaInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMetaInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "params for @info", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Meta"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_add_meta" gst_buffer_add_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.MetaInfo.MetaInfo -> -- info : TInterface (Name {namespace = "Gst", name = "MetaInfo"})
Ptr () -> -- params : TBasicType TPtr
IO (Ptr Gst.Meta.Meta)
{- |
Add metadata for /@info@/ to /@buffer@/ using the parameters in /@params@/.
-}
bufferAddMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> Gst.MetaInfo.MetaInfo
{- ^ /@info@/: a 'GI.Gst.Structs.MetaInfo.MetaInfo' -}
-> Ptr ()
{- ^ /@params@/: params for /@info@/ -}
-> m (Maybe Gst.Meta.Meta)
{- ^ __Returns:__ the metadata for the api in /@info@/ on /@buffer@/. -}
bufferAddMeta buffer info params = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
info' <- unsafeManagedPtrGetPtr info
result <- gst_buffer_add_meta buffer' info' params
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newPtr Gst.Meta.Meta) result'
return result''
touchManagedPtr buffer
touchManagedPtr info
return maybeResult
#if ENABLE_OVERLOADING
data BufferAddMetaMethodInfo
instance (signature ~ (Gst.MetaInfo.MetaInfo -> Ptr () -> m (Maybe Gst.Meta.Meta)), MonadIO m) => O.MethodInfo BufferAddMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferAddMeta
#endif
-- method Buffer::add_parent_buffer_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "ref", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer to ref", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "ParentBufferMeta"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_add_parent_buffer_meta" gst_buffer_add_parent_buffer_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Buffer -> -- ref : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO (Ptr Gst.ParentBufferMeta.ParentBufferMeta)
{- |
Add a 'GI.Gst.Structs.ParentBufferMeta.ParentBufferMeta' to /@buffer@/ that holds a reference on
/@ref@/ until the buffer is freed.
/Since: 1.6/
-}
bufferAddParentBufferMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> Buffer
{- ^ /@ref@/: a 'GI.Gst.Structs.Buffer.Buffer' to ref -}
-> m (Maybe Gst.ParentBufferMeta.ParentBufferMeta)
{- ^ __Returns:__ The 'GI.Gst.Structs.ParentBufferMeta.ParentBufferMeta' that was added to the buffer -}
bufferAddParentBufferMeta buffer ref = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
ref' <- unsafeManagedPtrGetPtr ref
result <- gst_buffer_add_parent_buffer_meta buffer' ref'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newPtr Gst.ParentBufferMeta.ParentBufferMeta) result'
return result''
touchManagedPtr buffer
touchManagedPtr ref
return maybeResult
#if ENABLE_OVERLOADING
data BufferAddParentBufferMetaMethodInfo
instance (signature ~ (Buffer -> m (Maybe Gst.ParentBufferMeta.ParentBufferMeta)), MonadIO m) => O.MethodInfo BufferAddParentBufferMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferAddParentBufferMeta
#endif
-- method Buffer::add_protection_meta
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstBuffer holding an encrypted sample, to which protection\n metadata should be added.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure holding cryptographic\n information relating to the sample contained in @buffer. This\n function takes ownership of @info.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "ProtectionMeta"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_add_protection_meta" gst_buffer_add_protection_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.Structure.Structure -> -- info : TInterface (Name {namespace = "Gst", name = "Structure"})
IO (Ptr Gst.ProtectionMeta.ProtectionMeta)
{- |
Attaches protection metadata to a 'GI.Gst.Structs.Buffer.Buffer'.
/Since: 1.6/
-}
bufferAddProtectionMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: 'GI.Gst.Structs.Buffer.Buffer' holding an encrypted sample, to which protection
metadata should be added. -}
-> Gst.Structure.Structure
{- ^ /@info@/: a 'GI.Gst.Structs.Structure.Structure' holding cryptographic
information relating to the sample contained in /@buffer@/. This
function takes ownership of /@info@/. -}
-> m Gst.ProtectionMeta.ProtectionMeta
{- ^ __Returns:__ a pointer to the added 'GI.Gst.Structs.ProtectionMeta.ProtectionMeta' if successful; 'Nothing' if
unsuccessful. -}
bufferAddProtectionMeta buffer info = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
info' <- B.ManagedPtr.disownBoxed info
result <- gst_buffer_add_protection_meta buffer' info'
checkUnexpectedReturnNULL "bufferAddProtectionMeta" result
result' <- (newPtr Gst.ProtectionMeta.ProtectionMeta) result
touchManagedPtr buffer
touchManagedPtr info
return result'
#if ENABLE_OVERLOADING
data BufferAddProtectionMetaMethodInfo
instance (signature ~ (Gst.Structure.Structure -> m Gst.ProtectionMeta.ProtectionMeta), MonadIO m) => O.MethodInfo BufferAddProtectionMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferAddProtectionMeta
#endif
-- method Buffer::add_reference_timestamp_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "reference", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "identifier for the timestamp reference.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "timestamp", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "duration", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "duration, or %GST_CLOCK_TIME_NONE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "ReferenceTimestampMeta"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_add_reference_timestamp_meta" gst_buffer_add_reference_timestamp_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.Caps.Caps -> -- reference : TInterface (Name {namespace = "Gst", name = "Caps"})
Word64 -> -- timestamp : TBasicType TUInt64
Word64 -> -- duration : TBasicType TUInt64
IO (Ptr Gst.ReferenceTimestampMeta.ReferenceTimestampMeta)
{- |
Add a 'GI.Gst.Structs.ReferenceTimestampMeta.ReferenceTimestampMeta' to /@buffer@/ that holds a /@timestamp@/ and
optionally /@duration@/ based on a specific timestamp /@reference@/. See the
documentation of 'GI.Gst.Structs.ReferenceTimestampMeta.ReferenceTimestampMeta' for details.
/Since: 1.14/
-}
bufferAddReferenceTimestampMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> Gst.Caps.Caps
{- ^ /@reference@/: identifier for the timestamp reference. -}
-> Word64
{- ^ /@timestamp@/: timestamp -}
-> Word64
{- ^ /@duration@/: duration, or 'GI.Gst.Constants.CLOCK_TIME_NONE' -}
-> m (Maybe Gst.ReferenceTimestampMeta.ReferenceTimestampMeta)
{- ^ __Returns:__ The 'GI.Gst.Structs.ReferenceTimestampMeta.ReferenceTimestampMeta' that was added to the buffer -}
bufferAddReferenceTimestampMeta buffer reference timestamp duration = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
reference' <- unsafeManagedPtrGetPtr reference
result <- gst_buffer_add_reference_timestamp_meta buffer' reference' timestamp duration
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newPtr Gst.ReferenceTimestampMeta.ReferenceTimestampMeta) result'
return result''
touchManagedPtr buffer
touchManagedPtr reference
return maybeResult
#if ENABLE_OVERLOADING
data BufferAddReferenceTimestampMetaMethodInfo
instance (signature ~ (Gst.Caps.Caps -> Word64 -> Word64 -> m (Maybe Gst.ReferenceTimestampMeta.ReferenceTimestampMeta)), MonadIO m) => O.MethodInfo BufferAddReferenceTimestampMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferAddReferenceTimestampMeta
#endif
-- method Buffer::append
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buf1", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first source #GstBuffer to append.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "buf2", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second source #GstBuffer to append.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_append" gst_buffer_append ::
Ptr Buffer -> -- buf1 : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Buffer -> -- buf2 : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO (Ptr Buffer)
{- |
Append all the memory from /@buf2@/ to /@buf1@/. The result buffer will contain a
concatenation of the memory of /@buf1@/ and /@buf2@/.
-}
bufferAppend ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buf1@/: the first source 'GI.Gst.Structs.Buffer.Buffer' to append. -}
-> Buffer
{- ^ /@buf2@/: the second source 'GI.Gst.Structs.Buffer.Buffer' to append. -}
-> m Buffer
{- ^ __Returns:__ the new 'GI.Gst.Structs.Buffer.Buffer' that contains the memory
of the two source buffers. -}
bufferAppend buf1 buf2 = liftIO $ do
buf1' <- B.ManagedPtr.disownBoxed buf1
buf2' <- B.ManagedPtr.disownBoxed buf2
result <- gst_buffer_append buf1' buf2'
checkUnexpectedReturnNULL "bufferAppend" result
result' <- (wrapBoxed Buffer) result
touchManagedPtr buf1
touchManagedPtr buf2
return result'
#if ENABLE_OVERLOADING
data BufferAppendMethodInfo
instance (signature ~ (Buffer -> m Buffer), MonadIO m) => O.MethodInfo BufferAppendMethodInfo Buffer signature where
overloadedMethod _ = bufferAppend
#endif
-- method Buffer::append_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory.", 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_append_memory" gst_buffer_append_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.Memory.Memory -> -- mem : TInterface (Name {namespace = "Gst", name = "Memory"})
IO ()
{- |
Append the memory block /@mem@/ to /@buffer@/. This function takes
ownership of /@mem@/ and thus doesn\'t increase its refcount.
This function is identical to 'GI.Gst.Structs.Buffer.bufferInsertMemory' with an index of -1.
See 'GI.Gst.Structs.Buffer.bufferInsertMemory' for more details.
-}
bufferAppendMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Gst.Memory.Memory
{- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory'. -}
-> m ()
bufferAppendMemory buffer mem = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
mem' <- B.ManagedPtr.disownBoxed mem
gst_buffer_append_memory buffer' mem'
touchManagedPtr buffer
touchManagedPtr mem
return ()
#if ENABLE_OVERLOADING
data BufferAppendMemoryMethodInfo
instance (signature ~ (Gst.Memory.Memory -> m ()), MonadIO m) => O.MethodInfo BufferAppendMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferAppendMemory
#endif
-- method Buffer::append_region
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buf1", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first source #GstBuffer to append.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "buf2", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second source #GstBuffer to append.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset in @buf2", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size or -1 of @buf2", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_append_region" gst_buffer_append_region ::
Ptr Buffer -> -- buf1 : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Buffer -> -- buf2 : TInterface (Name {namespace = "Gst", name = "Buffer"})
Int64 -> -- offset : TBasicType TInt64
Int64 -> -- size : TBasicType TInt64
IO (Ptr Buffer)
{- |
Append /@size@/ bytes at /@offset@/ from /@buf2@/ to /@buf1@/. The result buffer will
contain a concatenation of the memory of /@buf1@/ and the requested region of
/@buf2@/.
-}
bufferAppendRegion ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buf1@/: the first source 'GI.Gst.Structs.Buffer.Buffer' to append. -}
-> Buffer
{- ^ /@buf2@/: the second source 'GI.Gst.Structs.Buffer.Buffer' to append. -}
-> Int64
{- ^ /@offset@/: the offset in /@buf2@/ -}
-> Int64
{- ^ /@size@/: the size or -1 of /@buf2@/ -}
-> m Buffer
{- ^ __Returns:__ the new 'GI.Gst.Structs.Buffer.Buffer' that contains the memory
of the two source buffers. -}
bufferAppendRegion buf1 buf2 offset size = liftIO $ do
buf1' <- B.ManagedPtr.disownBoxed buf1
buf2' <- B.ManagedPtr.disownBoxed buf2
result <- gst_buffer_append_region buf1' buf2' offset size
checkUnexpectedReturnNULL "bufferAppendRegion" result
result' <- (wrapBoxed Buffer) result
touchManagedPtr buf1
touchManagedPtr buf2
return result'
#if ENABLE_OVERLOADING
data BufferAppendRegionMethodInfo
instance (signature ~ (Buffer -> Int64 -> Int64 -> m Buffer), MonadIO m) => O.MethodInfo BufferAppendRegionMethodInfo Buffer signature where
overloadedMethod _ = bufferAppendRegion
#endif
-- method Buffer::copy_deep
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buf", 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 = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_copy_deep" gst_buffer_copy_deep ::
Ptr Buffer -> -- buf : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO (Ptr Buffer)
{- |
Create a copy of the given buffer. This will make a newly allocated
copy of the data the source buffer contains.
/Since: 1.6/
-}
bufferCopyDeep ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buf@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> m Buffer
{- ^ __Returns:__ a new copy of /@buf@/. -}
bufferCopyDeep buf = liftIO $ do
buf' <- unsafeManagedPtrGetPtr buf
result <- gst_buffer_copy_deep buf'
checkUnexpectedReturnNULL "bufferCopyDeep" result
result' <- (wrapBoxed Buffer) result
touchManagedPtr buf
return result'
#if ENABLE_OVERLOADING
data BufferCopyDeepMethodInfo
instance (signature ~ (m Buffer), MonadIO m) => O.MethodInfo BufferCopyDeepMethodInfo Buffer signature where
overloadedMethod _ = bufferCopyDeep
#endif
-- method Buffer::copy_into
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a destination #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a source #GstBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "BufferCopyFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags indicating what metadata fields should be copied.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "offset to copy from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "total size to copy. If -1, all data is copied.", 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_copy_into" gst_buffer_copy_into ::
Ptr Buffer -> -- dest : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Buffer -> -- src : TInterface (Name {namespace = "Gst", name = "Buffer"})
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "BufferCopyFlags"})
Word64 -> -- offset : TBasicType TUInt64
Word64 -> -- size : TBasicType TUInt64
IO CInt
{- |
Copies the information from /@src@/ into /@dest@/.
If /@dest@/ already contains memory and /@flags@/ contains GST_BUFFER_COPY_MEMORY,
the memory from /@src@/ will be appended to /@dest@/.
/@flags@/ indicate which fields will be copied.
-}
bufferCopyInto ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@dest@/: a destination 'GI.Gst.Structs.Buffer.Buffer' -}
-> Buffer
{- ^ /@src@/: a source 'GI.Gst.Structs.Buffer.Buffer' -}
-> [Gst.Flags.BufferCopyFlags]
{- ^ /@flags@/: flags indicating what metadata fields should be copied. -}
-> Word64
{- ^ /@offset@/: offset to copy from -}
-> Word64
{- ^ /@size@/: total size to copy. If -1, all data is copied. -}
-> m Bool
{- ^ __Returns:__ 'True' if the copying succeeded, 'False' otherwise. -}
bufferCopyInto dest src flags offset size = liftIO $ do
dest' <- unsafeManagedPtrGetPtr dest
src' <- unsafeManagedPtrGetPtr src
let flags' = gflagsToWord flags
result <- gst_buffer_copy_into dest' src' flags' offset size
let result' = (/= 0) result
touchManagedPtr dest
touchManagedPtr src
return result'
#if ENABLE_OVERLOADING
data BufferCopyIntoMethodInfo
instance (signature ~ (Buffer -> [Gst.Flags.BufferCopyFlags] -> Word64 -> Word64 -> m Bool), MonadIO m) => O.MethodInfo BufferCopyIntoMethodInfo Buffer signature where
overloadedMethod _ = bufferCopyInto
#endif
-- method Buffer::copy_region
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "parent", 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 = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "BufferCopyFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferCopyFlags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset into parent #GstBuffer at which the new sub-buffer\n begins.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of the new #GstBuffer sub-buffer, in bytes. If -1, all\n data is copied.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_copy_region" gst_buffer_copy_region ::
Ptr Buffer -> -- parent : TInterface (Name {namespace = "Gst", name = "Buffer"})
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "BufferCopyFlags"})
Word64 -> -- offset : TBasicType TUInt64
Word64 -> -- size : TBasicType TUInt64
IO (Ptr Buffer)
{- |
Creates a sub-buffer from /@parent@/ at /@offset@/ and /@size@/.
This sub-buffer uses the actual memory space of the parent buffer.
This function will copy the offset and timestamp fields when the
offset is 0. If not, they will be set to 'GI.Gst.Constants.CLOCK_TIME_NONE' and
'GI.Gst.Constants.BUFFER_OFFSET_NONE'.
If /@offset@/ equals 0 and /@size@/ equals the total size of /@buffer@/, the
duration and offset end fields are also copied. If not they will be set
to 'GI.Gst.Constants.CLOCK_TIME_NONE' and 'GI.Gst.Constants.BUFFER_OFFSET_NONE'.
MT safe.
-}
bufferCopyRegion ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@parent@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> [Gst.Flags.BufferCopyFlags]
{- ^ /@flags@/: the 'GI.Gst.Flags.BufferCopyFlags' -}
-> Word64
{- ^ /@offset@/: the offset into parent 'GI.Gst.Structs.Buffer.Buffer' at which the new sub-buffer
begins. -}
-> Word64
{- ^ /@size@/: the size of the new 'GI.Gst.Structs.Buffer.Buffer' sub-buffer, in bytes. If -1, all
data is copied. -}
-> m Buffer
{- ^ __Returns:__ the new 'GI.Gst.Structs.Buffer.Buffer' or 'Nothing' if the arguments were
invalid. -}
bufferCopyRegion parent flags offset size = liftIO $ do
parent' <- unsafeManagedPtrGetPtr parent
let flags' = gflagsToWord flags
result <- gst_buffer_copy_region parent' flags' offset size
checkUnexpectedReturnNULL "bufferCopyRegion" result
result' <- (wrapBoxed Buffer) result
touchManagedPtr parent
return result'
#if ENABLE_OVERLOADING
data BufferCopyRegionMethodInfo
instance (signature ~ ([Gst.Flags.BufferCopyFlags] -> Word64 -> Word64 -> m Buffer), MonadIO m) => O.MethodInfo BufferCopyRegionMethodInfo Buffer signature where
overloadedMethod _ = bufferCopyRegion
#endif
-- method Buffer::extract
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset to extract", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest", argType = TCArray False (-1) 3 (TBasicType TUInt8), direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "\n the destination address", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to extract", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to extract", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_extract" gst_buffer_extract ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word64 -> -- offset : TBasicType TUInt64
Ptr Word8 -> -- dest : TCArray False (-1) 3 (TBasicType TUInt8)
Word64 -> -- size : TBasicType TUInt64
IO Word64
{- |
Copy /@size@/ bytes starting from /@offset@/ in /@buffer@/ to /@dest@/.
-}
bufferExtract ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word64
{- ^ /@offset@/: the offset to extract -}
-> Maybe (ByteString)
{- ^ /@dest@/:
the destination address -}
-> m ((Word64, Maybe ByteString))
{- ^ __Returns:__ The amount of bytes extracted. This value can be lower than /@size@/
when /@buffer@/ did not contain enough data. -}
bufferExtract buffer offset dest = liftIO $ do
let size = case dest of
Nothing -> 0
Just jDest -> fromIntegral $ B.length jDest
buffer' <- unsafeManagedPtrGetPtr buffer
maybeDest <- case dest of
Nothing -> return nullPtr
Just jDest -> do
jDest' <- packByteString jDest
return jDest'
result <- gst_buffer_extract buffer' offset maybeDest size
maybeMaybeDest <- convertIfNonNull maybeDest $ \maybeDest' -> do
maybeDest'' <- (unpackByteStringWithLength size) maybeDest'
return maybeDest''
touchManagedPtr buffer
return (result, maybeMaybeDest)
#if ENABLE_OVERLOADING
data BufferExtractMethodInfo
instance (signature ~ (Word64 -> Maybe (ByteString) -> m ((Word64, Maybe ByteString))), MonadIO m) => O.MethodInfo BufferExtractMethodInfo Buffer signature where
overloadedMethod _ = bufferExtract
#endif
-- method Buffer::extract_dup
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset to extract", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to extract", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer where\n the destination array will be written. Might be %NULL if the size is 0.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "dest_size", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A location where the size of @dest can be written", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "dest_size", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A location where the size of @dest can be written", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_extract_dup" gst_buffer_extract_dup ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word64 -> -- offset : TBasicType TUInt64
Word64 -> -- size : TBasicType TUInt64
Ptr (Ptr Word8) -> -- dest : TCArray False (-1) 4 (TBasicType TUInt8)
Ptr Word64 -> -- dest_size : TBasicType TUInt64
IO ()
{- |
Extracts a copy of at most /@size@/ bytes the data at /@offset@/ into
newly-allocated memory. /@dest@/ must be freed using 'GI.GLib.Functions.free' when done.
/Since: 1.0.10/
-}
bufferExtractDup ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> Word64
{- ^ /@offset@/: the offset to extract -}
-> Word64
{- ^ /@size@/: the size to extract -}
-> m (ByteString)
bufferExtractDup buffer offset size = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
dest <- allocMem :: IO (Ptr (Ptr Word8))
destSize <- allocMem :: IO (Ptr Word64)
gst_buffer_extract_dup buffer' offset size dest destSize
destSize' <- peek destSize
dest' <- peek dest
dest'' <- (unpackByteStringWithLength destSize') dest'
freeMem dest'
touchManagedPtr buffer
freeMem dest
freeMem destSize
return dest''
#if ENABLE_OVERLOADING
data BufferExtractDupMethodInfo
instance (signature ~ (Word64 -> Word64 -> m (ByteString)), MonadIO m) => O.MethodInfo BufferExtractDupMethodInfo Buffer signature where
overloadedMethod _ = bufferExtractDup
#endif
-- method Buffer::fill
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TCArray False (-1) 3 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source address", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_fill" gst_buffer_fill ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word64 -> -- offset : TBasicType TUInt64
Ptr Word8 -> -- src : TCArray False (-1) 3 (TBasicType TUInt8)
Word64 -> -- size : TBasicType TUInt64
IO Word64
{- |
Copy /@size@/ bytes from /@src@/ to /@buffer@/ at /@offset@/.
-}
bufferFill ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word64
{- ^ /@offset@/: the offset to fill -}
-> ByteString
{- ^ /@src@/: the source address -}
-> m Word64
{- ^ __Returns:__ The amount of bytes copied. This value can be lower than /@size@/
when /@buffer@/ did not contain enough data. -}
bufferFill buffer offset src = liftIO $ do
let size = fromIntegral $ B.length src
buffer' <- unsafeManagedPtrGetPtr buffer
src' <- packByteString src
result <- gst_buffer_fill buffer' offset src' size
touchManagedPtr buffer
freeMem src'
return result
#if ENABLE_OVERLOADING
data BufferFillMethodInfo
instance (signature ~ (Word64 -> ByteString -> m Word64), MonadIO m) => O.MethodInfo BufferFillMethodInfo Buffer signature where
overloadedMethod _ = bufferFill
#endif
-- method Buffer::find_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a size", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "length", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to length", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "skip", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to skip", 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_find_memory" gst_buffer_find_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word64 -> -- offset : TBasicType TUInt64
Word64 -> -- size : TBasicType TUInt64
Ptr Word32 -> -- idx : TBasicType TUInt
Ptr Word32 -> -- length : TBasicType TUInt
Ptr Word64 -> -- skip : TBasicType TUInt64
IO CInt
{- |
Find the memory blocks that span /@size@/ bytes starting from /@offset@/
in /@buffer@/.
When this function returns 'True', /@idx@/ will contain the index of the first
memory block where the byte for /@offset@/ can be found and /@length@/ contains the
number of memory blocks containing the /@size@/ remaining bytes. /@skip@/ contains
the number of bytes to skip in the memory block at /@idx@/ to get to the byte
for /@offset@/.
/@size@/ can be -1 to get all the memory blocks after /@idx@/.
-}
bufferFindMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word64
{- ^ /@offset@/: an offset -}
-> Word64
{- ^ /@size@/: a size -}
-> m ((Bool, Word32, Word32, Word64))
{- ^ __Returns:__ 'True' when /@size@/ bytes starting from /@offset@/ could be found in
/@buffer@/ and /@idx@/, /@length@/ and /@skip@/ will be filled. -}
bufferFindMemory buffer offset size = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
idx <- allocMem :: IO (Ptr Word32)
length_ <- allocMem :: IO (Ptr Word32)
skip <- allocMem :: IO (Ptr Word64)
result <- gst_buffer_find_memory buffer' offset size idx length_ skip
let result' = (/= 0) result
idx' <- peek idx
length_' <- peek length_
skip' <- peek skip
touchManagedPtr buffer
freeMem idx
freeMem length_
freeMem skip
return (result', idx', length_', skip')
#if ENABLE_OVERLOADING
data BufferFindMemoryMethodInfo
instance (signature ~ (Word64 -> Word64 -> m ((Bool, Word32, Word32, Word64))), MonadIO m) => O.MethodInfo BufferFindMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferFindMemory
#endif
-- method Buffer::foreach_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "BufferForeachMetaFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBufferForeachMetaFunc to call", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @func", 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_foreach_meta" gst_buffer_foreach_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
FunPtr Gst.Callbacks.C_BufferForeachMetaFunc -> -- func : TInterface (Name {namespace = "Gst", name = "BufferForeachMetaFunc"})
Ptr () -> -- user_data : TBasicType TPtr
IO CInt
{- |
Call /@func@/ with /@userData@/ for each meta in /@buffer@/.
/@func@/ can modify the passed meta pointer or its contents. The return value
of /@func@/ define if this function returns or if the remaining metadata items
in the buffer should be skipped.
-}
bufferForeachMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> Gst.Callbacks.BufferForeachMetaFunc
{- ^ /@func@/: a 'GI.Gst.Callbacks.BufferForeachMetaFunc' to call -}
-> m Bool
{- ^ __Returns:__ 'False' when /@func@/ returned 'False' for one of the metadata. -}
bufferForeachMeta buffer func = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
func' <- Gst.Callbacks.mk_BufferForeachMetaFunc (Gst.Callbacks.wrap_BufferForeachMetaFunc Nothing (Gst.Callbacks.drop_closures_BufferForeachMetaFunc func))
let userData = nullPtr
result <- gst_buffer_foreach_meta buffer' func' userData
let result' = (/= 0) result
safeFreeFunPtr $ castFunPtrToPtr func'
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferForeachMetaMethodInfo
instance (signature ~ (Gst.Callbacks.BufferForeachMetaFunc -> m Bool), MonadIO m) => O.MethodInfo BufferForeachMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferForeachMeta
#endif
-- method Buffer::get_all_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Memory"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_all_memory" gst_buffer_get_all_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO (Ptr Gst.Memory.Memory)
{- |
Get all the memory block in /@buffer@/. The memory blocks will be merged
into one large 'GI.Gst.Structs.Memory.Memory'.
-}
bufferGetAllMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> m (Maybe Gst.Memory.Memory)
{- ^ __Returns:__ a 'GI.Gst.Structs.Memory.Memory' that contains the merged memory.
Use gst_memory_unref () after usage. -}
bufferGetAllMemory buffer = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_get_all_memory buffer'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Gst.Memory.Memory) result'
return result''
touchManagedPtr buffer
return maybeResult
#if ENABLE_OVERLOADING
data BufferGetAllMemoryMethodInfo
instance (signature ~ (m (Maybe Gst.Memory.Memory)), MonadIO m) => O.MethodInfo BufferGetAllMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferGetAllMemory
#endif
-- method Buffer::get_flags
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "BufferFlags"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_flags" gst_buffer_get_flags ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO CUInt
{- |
Get the 'GI.Gst.Flags.BufferFlags' flags set on this buffer.
/Since: 1.10/
-}
bufferGetFlags ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> m [Gst.Flags.BufferFlags]
{- ^ __Returns:__ the flags set on this buffer. -}
bufferGetFlags buffer = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_get_flags buffer'
let result' = wordToGFlags result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferGetFlagsMethodInfo
instance (signature ~ (m [Gst.Flags.BufferFlags]), MonadIO m) => O.MethodInfo BufferGetFlagsMethodInfo Buffer signature where
overloadedMethod _ = bufferGetFlags
#endif
-- method Buffer::get_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Memory"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_memory" gst_buffer_get_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
IO (Ptr Gst.Memory.Memory)
{- |
Get the memory block at index /@idx@/ in /@buffer@/.
-}
bufferGetMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> m (Maybe Gst.Memory.Memory)
{- ^ __Returns:__ a 'GI.Gst.Structs.Memory.Memory' that contains the data of the
memory block at /@idx@/. Use gst_memory_unref () after usage. -}
bufferGetMemory buffer idx = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_get_memory buffer' idx
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Gst.Memory.Memory) result'
return result''
touchManagedPtr buffer
return maybeResult
#if ENABLE_OVERLOADING
data BufferGetMemoryMethodInfo
instance (signature ~ (Word32 -> m (Maybe Gst.Memory.Memory)), MonadIO m) => O.MethodInfo BufferGetMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferGetMemory
#endif
-- method Buffer::get_memory_range
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a length", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Memory"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_memory_range" gst_buffer_get_memory_range ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Int32 -> -- length : TBasicType TInt
IO (Ptr Gst.Memory.Memory)
{- |
Get /@length@/ memory blocks in /@buffer@/ starting at /@idx@/. The memory blocks will
be merged into one large 'GI.Gst.Structs.Memory.Memory'.
If /@length@/ is -1, all memory starting from /@idx@/ is merged.
-}
bufferGetMemoryRange ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Int32
{- ^ /@length@/: a length -}
-> m (Maybe Gst.Memory.Memory)
{- ^ __Returns:__ a 'GI.Gst.Structs.Memory.Memory' that contains the merged data of /@length@/
blocks starting at /@idx@/. Use gst_memory_unref () after usage. -}
bufferGetMemoryRange buffer idx length_ = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_get_memory_range buffer' idx length_
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Gst.Memory.Memory) result'
return result''
touchManagedPtr buffer
return maybeResult
#if ENABLE_OVERLOADING
data BufferGetMemoryRangeMethodInfo
instance (signature ~ (Word32 -> Int32 -> m (Maybe Gst.Memory.Memory)), MonadIO m) => O.MethodInfo BufferGetMemoryRangeMethodInfo Buffer signature where
overloadedMethod _ = bufferGetMemoryRange
#endif
-- method Buffer::get_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "api", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of an API", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Meta"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_meta" gst_buffer_get_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
CGType -> -- api : TBasicType TGType
IO (Ptr Gst.Meta.Meta)
{- |
Get the metadata for /@api@/ on buffer. When there is no such metadata, 'Nothing' is
returned. If multiple metadata with the given /@api@/ are attached to this
buffer only the first one is returned. To handle multiple metadata with a
given API use @/gst_buffer_iterate_meta()/@ or 'GI.Gst.Structs.Buffer.bufferForeachMeta' instead
and check the meta->info.api member for the API type.
-}
bufferGetMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> GType
{- ^ /@api@/: the 'GType' of an API -}
-> m (Maybe Gst.Meta.Meta)
{- ^ __Returns:__ the metadata for /@api@/ on
/@buffer@/. -}
bufferGetMeta buffer api = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
let api' = gtypeToCGType api
result <- gst_buffer_get_meta buffer' api'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newPtr Gst.Meta.Meta) result'
return result''
touchManagedPtr buffer
return maybeResult
#if ENABLE_OVERLOADING
data BufferGetMetaMethodInfo
instance (signature ~ (GType -> m (Maybe Gst.Meta.Meta)), MonadIO m) => O.MethodInfo BufferGetMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferGetMeta
#endif
-- method Buffer::get_n_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "api_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType of an API", 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_get_n_meta" gst_buffer_get_n_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
CGType -> -- api_type : TBasicType TGType
IO Word32
{- |
/No description available in the introspection data./
/Since: 1.14/
-}
bufferGetNMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> GType
{- ^ /@apiType@/: the 'GType' of an API -}
-> m Word32
{- ^ __Returns:__ number of metas of type /@apiType@/ on /@buffer@/. -}
bufferGetNMeta buffer apiType = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
let apiType' = gtypeToCGType apiType
result <- gst_buffer_get_n_meta buffer' apiType'
touchManagedPtr buffer
return result
#if ENABLE_OVERLOADING
data BufferGetNMetaMethodInfo
instance (signature ~ (GType -> m Word32), MonadIO m) => O.MethodInfo BufferGetNMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferGetNMeta
#endif
-- method Buffer::get_reference_timestamp_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "reference", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a reference #GstCaps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "ReferenceTimestampMeta"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_reference_timestamp_meta" gst_buffer_get_reference_timestamp_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.Caps.Caps -> -- reference : TInterface (Name {namespace = "Gst", name = "Caps"})
IO (Ptr Gst.ReferenceTimestampMeta.ReferenceTimestampMeta)
{- |
Find the first 'GI.Gst.Structs.ReferenceTimestampMeta.ReferenceTimestampMeta' on /@buffer@/ that conforms to
/@reference@/. Conformance is tested by checking if the meta\'s reference is a
subset of /@reference@/.
Buffers can contain multiple 'GI.Gst.Structs.ReferenceTimestampMeta.ReferenceTimestampMeta' metadata items.
/Since: 1.14/
-}
bufferGetReferenceTimestampMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> Maybe (Gst.Caps.Caps)
{- ^ /@reference@/: a reference 'GI.Gst.Structs.Caps.Caps' -}
-> m (Maybe Gst.ReferenceTimestampMeta.ReferenceTimestampMeta)
{- ^ __Returns:__ the 'GI.Gst.Structs.ReferenceTimestampMeta.ReferenceTimestampMeta' or 'Nothing' when there
is no such metadata on /@buffer@/. -}
bufferGetReferenceTimestampMeta buffer reference = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
maybeReference <- case reference of
Nothing -> return nullPtr
Just jReference -> do
jReference' <- unsafeManagedPtrGetPtr jReference
return jReference'
result <- gst_buffer_get_reference_timestamp_meta buffer' maybeReference
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newPtr Gst.ReferenceTimestampMeta.ReferenceTimestampMeta) result'
return result''
touchManagedPtr buffer
whenJust reference touchManagedPtr
return maybeResult
#if ENABLE_OVERLOADING
data BufferGetReferenceTimestampMetaMethodInfo
instance (signature ~ (Maybe (Gst.Caps.Caps) -> m (Maybe Gst.ReferenceTimestampMeta.ReferenceTimestampMeta)), MonadIO m) => O.MethodInfo BufferGetReferenceTimestampMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferGetReferenceTimestampMeta
#endif
-- method Buffer::get_size
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_size" gst_buffer_get_size ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO Word64
{- |
Get the total size of the memory blocks in /@buffer@/.
-}
bufferGetSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> m Word64
{- ^ __Returns:__ total size of the memory blocks in /@buffer@/. -}
bufferGetSize buffer = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_get_size buffer'
touchManagedPtr buffer
return result
#if ENABLE_OVERLOADING
data BufferGetSizeMethodInfo
instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo BufferGetSizeMethodInfo Buffer signature where
overloadedMethod _ = bufferGetSize
#endif
-- method Buffer::get_sizes
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "maxsize", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the maxsize", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_sizes" gst_buffer_get_sizes ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Word64 -> -- offset : TBasicType TUInt64
Ptr Word64 -> -- maxsize : TBasicType TUInt64
IO Word64
{- |
Get the total size of the memory blocks in /@b@/.
When not 'Nothing', /@offset@/ will contain the offset of the data in the
first memory block in /@buffer@/ and /@maxsize@/ will contain the sum of
the size and /@offset@/ and the amount of extra padding on the last
memory block. /@offset@/ and /@maxsize@/ can be used to resize the
buffer memory blocks with 'GI.Gst.Structs.Buffer.bufferResize'.
-}
bufferGetSizes ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> m ((Word64, Word64, Word64))
{- ^ __Returns:__ total size of the memory blocks in /@buffer@/. -}
bufferGetSizes buffer = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
offset <- allocMem :: IO (Ptr Word64)
maxsize <- allocMem :: IO (Ptr Word64)
result <- gst_buffer_get_sizes buffer' offset maxsize
offset' <- peek offset
maxsize' <- peek maxsize
touchManagedPtr buffer
freeMem offset
freeMem maxsize
return (result, offset', maxsize')
#if ENABLE_OVERLOADING
data BufferGetSizesMethodInfo
instance (signature ~ (m ((Word64, Word64, Word64))), MonadIO m) => O.MethodInfo BufferGetSizesMethodInfo Buffer signature where
overloadedMethod _ = bufferGetSizes
#endif
-- method Buffer::get_sizes_range
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a length", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the offset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "maxsize", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the maxsize", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_sizes_range" gst_buffer_get_sizes_range ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Int32 -> -- length : TBasicType TInt
Ptr Word64 -> -- offset : TBasicType TUInt64
Ptr Word64 -> -- maxsize : TBasicType TUInt64
IO Word64
{- |
Get the total size of /@length@/ memory blocks stating from /@idx@/ in /@buffer@/.
When not 'Nothing', /@offset@/ will contain the offset of the data in the
memory block in /@buffer@/ at /@idx@/ and /@maxsize@/ will contain the sum of the size
and /@offset@/ and the amount of extra padding on the memory block at /@idx@/ +
/@length@/ -1.
/@offset@/ and /@maxsize@/ can be used to resize the buffer memory blocks with
'GI.Gst.Structs.Buffer.bufferResizeRange'.
-}
bufferGetSizesRange ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Int32
{- ^ /@length@/: a length -}
-> m ((Word64, Word64, Word64))
{- ^ __Returns:__ total size of /@length@/ memory blocks starting at /@idx@/ in /@buffer@/. -}
bufferGetSizesRange buffer idx length_ = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
offset <- allocMem :: IO (Ptr Word64)
maxsize <- allocMem :: IO (Ptr Word64)
result <- gst_buffer_get_sizes_range buffer' idx length_ offset maxsize
offset' <- peek offset
maxsize' <- peek maxsize
touchManagedPtr buffer
freeMem offset
freeMem maxsize
return (result, offset', maxsize')
#if ENABLE_OVERLOADING
data BufferGetSizesRangeMethodInfo
instance (signature ~ (Word32 -> Int32 -> m ((Word64, Word64, Word64))), MonadIO m) => O.MethodInfo BufferGetSizesRangeMethodInfo Buffer signature where
overloadedMethod _ = bufferGetSizesRange
#endif
-- method Buffer::has_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "BufferFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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_has_flags" gst_buffer_has_flags ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "BufferFlags"})
IO CInt
{- |
/No description available in the introspection data./
-}
bufferHasFlags ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
-> [Gst.Flags.BufferFlags]
-> m Bool
bufferHasFlags buffer flags = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
let flags' = gflagsToWord flags
result <- gst_buffer_has_flags buffer' flags'
let result' = (/= 0) result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferHasFlagsMethodInfo
instance (signature ~ ([Gst.Flags.BufferFlags] -> m Bool), MonadIO m) => O.MethodInfo BufferHasFlagsMethodInfo Buffer signature where
overloadedMethod _ = bufferHasFlags
#endif
-- method Buffer::insert_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index to add the memory at, or -1 to append it to the end", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory.", 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_insert_memory" gst_buffer_insert_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Int32 -> -- idx : TBasicType TInt
Ptr Gst.Memory.Memory -> -- mem : TInterface (Name {namespace = "Gst", name = "Memory"})
IO ()
{- |
Insert the memory block /@mem@/ to /@buffer@/ at /@idx@/. This function takes ownership
of /@mem@/ and thus doesn\'t increase its refcount.
Only 'GI.Gst.Functions.bufferGetMaxMemory' can be added to a buffer. If more memory is
added, existing memory blocks will automatically be merged to make room for
the new memory.
-}
bufferInsertMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Int32
{- ^ /@idx@/: the index to add the memory at, or -1 to append it to the end -}
-> Gst.Memory.Memory
{- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory'. -}
-> m ()
bufferInsertMemory buffer idx mem = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
mem' <- B.ManagedPtr.disownBoxed mem
gst_buffer_insert_memory buffer' idx mem'
touchManagedPtr buffer
touchManagedPtr mem
return ()
#if ENABLE_OVERLOADING
data BufferInsertMemoryMethodInfo
instance (signature ~ (Int32 -> Gst.Memory.Memory -> m ()), MonadIO m) => O.MethodInfo BufferInsertMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferInsertMemory
#endif
-- method Buffer::is_all_memory_writable
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_is_all_memory_writable" gst_buffer_is_all_memory_writable ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO CInt
{- |
Check if all memory blocks in /@buffer@/ are writable.
Note that this function does not check if /@buffer@/ is writable, use
@/gst_buffer_is_writable()/@ to check that if needed.
/Since: 1.4/
-}
bufferIsAllMemoryWritable ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> m Bool
{- ^ __Returns:__ 'True' if all memory blocks in /@buffer@/ are writable -}
bufferIsAllMemoryWritable buffer = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_is_all_memory_writable buffer'
let result' = (/= 0) result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferIsAllMemoryWritableMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo BufferIsAllMemoryWritableMethodInfo Buffer signature where
overloadedMethod _ = bufferIsAllMemoryWritable
#endif
-- method Buffer::is_memory_range_writable
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a length should not be 0", 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_is_memory_range_writable" gst_buffer_is_memory_range_writable ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Int32 -> -- length : TBasicType TInt
IO CInt
{- |
Check if /@length@/ memory blocks in /@buffer@/ starting from /@idx@/ are writable.
/@length@/ can be -1 to check all the memory blocks after /@idx@/.
Note that this function does not check if /@buffer@/ is writable, use
@/gst_buffer_is_writable()/@ to check that if needed.
/Since: 1.4/
-}
bufferIsMemoryRangeWritable ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Int32
{- ^ /@length@/: a length should not be 0 -}
-> m Bool
{- ^ __Returns:__ 'True' if the memory range is writable -}
bufferIsMemoryRangeWritable buffer idx length_ = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_is_memory_range_writable buffer' idx length_
let result' = (/= 0) result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferIsMemoryRangeWritableMethodInfo
instance (signature ~ (Word32 -> Int32 -> m Bool), MonadIO m) => O.MethodInfo BufferIsMemoryRangeWritableMethodInfo Buffer signature where
overloadedMethod _ = bufferIsMemoryRangeWritable
#endif
-- method Buffer::map
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MapInfo"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "info about the mapping", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "MapFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags for the mapping", 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_map" gst_buffer_map ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.MapInfo.MapInfo -> -- info : TInterface (Name {namespace = "Gst", name = "MapInfo"})
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "MapFlags"})
IO CInt
{- |
This function fills /@info@/ with the 'GI.Gst.Structs.MapInfo.MapInfo' of all merged memory
blocks in /@buffer@/.
/@flags@/ describe the desired access of the memory. When /@flags@/ is
@/GST_MAP_WRITE/@, /@buffer@/ should be writable (as returned from
@/gst_buffer_is_writable()/@).
When /@buffer@/ is writable but the memory isn\'t, a writable copy will
automatically be created and returned. The readonly copy of the
buffer memory will then also be replaced with this writable copy.
The memory in /@info@/ should be unmapped with 'GI.Gst.Structs.Buffer.bufferUnmap' after
usage.
-}
bufferMap ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> [Gst.Flags.MapFlags]
{- ^ /@flags@/: flags for the mapping -}
-> m ((Bool, Gst.MapInfo.MapInfo))
{- ^ __Returns:__ 'True' if the map succeeded and /@info@/ contains valid data. -}
bufferMap buffer flags = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
info <- callocBytes 104 :: IO (Ptr Gst.MapInfo.MapInfo)
let flags' = gflagsToWord flags
result <- gst_buffer_map buffer' info flags'
let result' = (/= 0) result
info' <- (wrapPtr Gst.MapInfo.MapInfo) info
touchManagedPtr buffer
return (result', info')
#if ENABLE_OVERLOADING
data BufferMapMethodInfo
instance (signature ~ ([Gst.Flags.MapFlags] -> m ((Bool, Gst.MapInfo.MapInfo))), MonadIO m) => O.MethodInfo BufferMapMethodInfo Buffer signature where
overloadedMethod _ = bufferMap
#endif
-- method Buffer::map_range
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a length", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MapInfo"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "info about the mapping", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "MapFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags for the mapping", 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_map_range" gst_buffer_map_range ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Int32 -> -- length : TBasicType TInt
Ptr Gst.MapInfo.MapInfo -> -- info : TInterface (Name {namespace = "Gst", name = "MapInfo"})
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "MapFlags"})
IO CInt
{- |
This function fills /@info@/ with the 'GI.Gst.Structs.MapInfo.MapInfo' of /@length@/ merged memory blocks
starting at /@idx@/ in /@buffer@/. When /@length@/ is -1, all memory blocks starting
from /@idx@/ are merged and mapped.
/@flags@/ describe the desired access of the memory. When /@flags@/ is
@/GST_MAP_WRITE/@, /@buffer@/ should be writable (as returned from
@/gst_buffer_is_writable()/@).
When /@buffer@/ is writable but the memory isn\'t, a writable copy will
automatically be created and returned. The readonly copy of the buffer memory
will then also be replaced with this writable copy.
The memory in /@info@/ should be unmapped with 'GI.Gst.Structs.Buffer.bufferUnmap' after usage.
-}
bufferMapRange ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Int32
{- ^ /@length@/: a length -}
-> [Gst.Flags.MapFlags]
{- ^ /@flags@/: flags for the mapping -}
-> m ((Bool, Gst.MapInfo.MapInfo))
{- ^ __Returns:__ 'True' if the map succeeded and /@info@/ contains valid
data. -}
bufferMapRange buffer idx length_ flags = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
info <- callocBytes 104 :: IO (Ptr Gst.MapInfo.MapInfo)
let flags' = gflagsToWord flags
result <- gst_buffer_map_range buffer' idx length_ info flags'
let result' = (/= 0) result
info' <- (wrapPtr Gst.MapInfo.MapInfo) info
touchManagedPtr buffer
return (result', info')
#if ENABLE_OVERLOADING
data BufferMapRangeMethodInfo
instance (signature ~ (Word32 -> Int32 -> [Gst.Flags.MapFlags] -> m ((Bool, Gst.MapInfo.MapInfo))), MonadIO m) => O.MethodInfo BufferMapRangeMethodInfo Buffer signature where
overloadedMethod _ = bufferMapRange
#endif
-- method Buffer::memcmp
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset in @buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mem", argType = TCArray False (-1) 3 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the memory to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_memcmp" gst_buffer_memcmp ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word64 -> -- offset : TBasicType TUInt64
Ptr Word8 -> -- mem : TCArray False (-1) 3 (TBasicType TUInt8)
Word64 -> -- size : TBasicType TUInt64
IO Int32
{- |
Compare /@size@/ bytes starting from /@offset@/ in /@buffer@/ with the memory in /@mem@/.
-}
bufferMemcmp ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word64
{- ^ /@offset@/: the offset in /@buffer@/ -}
-> ByteString
{- ^ /@mem@/: the memory to compare -}
-> m Int32
{- ^ __Returns:__ 0 if the memory is equal. -}
bufferMemcmp buffer offset mem = liftIO $ do
let size = fromIntegral $ B.length mem
buffer' <- unsafeManagedPtrGetPtr buffer
mem' <- packByteString mem
result <- gst_buffer_memcmp buffer' offset mem' size
touchManagedPtr buffer
freeMem mem'
return result
#if ENABLE_OVERLOADING
data BufferMemcmpMethodInfo
instance (signature ~ (Word64 -> ByteString -> m Int32), MonadIO m) => O.MethodInfo BufferMemcmpMethodInfo Buffer signature where
overloadedMethod _ = bufferMemcmp
#endif
-- method Buffer::memset
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset in @buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "val", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_memset" gst_buffer_memset ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word64 -> -- offset : TBasicType TUInt64
Word8 -> -- val : TBasicType TUInt8
Word64 -> -- size : TBasicType TUInt64
IO Word64
{- |
Fill /@buf@/ with /@size@/ bytes with /@val@/ starting from /@offset@/.
-}
bufferMemset ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word64
{- ^ /@offset@/: the offset in /@buffer@/ -}
-> Word8
{- ^ /@val@/: the value to set -}
-> Word64
{- ^ /@size@/: the size to set -}
-> m Word64
{- ^ __Returns:__ The amount of bytes filled. This value can be lower than /@size@/
when /@buffer@/ did not contain enough data. -}
bufferMemset buffer offset val size = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_memset buffer' offset val size
touchManagedPtr buffer
return result
#if ENABLE_OVERLOADING
data BufferMemsetMethodInfo
instance (signature ~ (Word64 -> Word8 -> Word64 -> m Word64), MonadIO m) => O.MethodInfo BufferMemsetMethodInfo Buffer signature where
overloadedMethod _ = bufferMemset
#endif
-- method Buffer::n_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_n_memory" gst_buffer_n_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO Word32
{- |
Get the amount of memory blocks that this buffer has. This amount is never
larger than what 'GI.Gst.Functions.bufferGetMaxMemory' returns.
-}
bufferNMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> m Word32
{- ^ __Returns:__ the number of memory blocks this buffer is made of. -}
bufferNMemory buffer = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_n_memory buffer'
touchManagedPtr buffer
return result
#if ENABLE_OVERLOADING
data BufferNMemoryMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo BufferNMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferNMemory
#endif
-- method Buffer::peek_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Memory"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_peek_memory" gst_buffer_peek_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
IO (Ptr Gst.Memory.Memory)
{- |
Get the memory block at /@idx@/ in /@buffer@/. The memory block stays valid until
the memory block in /@buffer@/ is removed, replaced or merged, typically with
any call that modifies the memory in /@buffer@/.
-}
bufferPeekMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> m (Maybe Gst.Memory.Memory)
{- ^ __Returns:__ the 'GI.Gst.Structs.Memory.Memory' at /@idx@/. -}
bufferPeekMemory buffer idx = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_peek_memory buffer' idx
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed Gst.Memory.Memory) result'
return result''
touchManagedPtr buffer
return maybeResult
#if ENABLE_OVERLOADING
data BufferPeekMemoryMethodInfo
instance (signature ~ (Word32 -> m (Maybe Gst.Memory.Memory)), MonadIO m) => O.MethodInfo BufferPeekMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferPeekMemory
#endif
-- method Buffer::prepend_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory.", 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_prepend_memory" gst_buffer_prepend_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.Memory.Memory -> -- mem : TInterface (Name {namespace = "Gst", name = "Memory"})
IO ()
{- |
Prepend the memory block /@mem@/ to /@buffer@/. This function takes
ownership of /@mem@/ and thus doesn\'t increase its refcount.
This function is identical to 'GI.Gst.Structs.Buffer.bufferInsertMemory' with an index of 0.
See 'GI.Gst.Structs.Buffer.bufferInsertMemory' for more details.
-}
bufferPrependMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Gst.Memory.Memory
{- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory'. -}
-> m ()
bufferPrependMemory buffer mem = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
mem' <- B.ManagedPtr.disownBoxed mem
gst_buffer_prepend_memory buffer' mem'
touchManagedPtr buffer
touchManagedPtr mem
return ()
#if ENABLE_OVERLOADING
data BufferPrependMemoryMethodInfo
instance (signature ~ (Gst.Memory.Memory -> m ()), MonadIO m) => O.MethodInfo BufferPrependMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferPrependMemory
#endif
-- method Buffer::remove_all_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_remove_all_memory" gst_buffer_remove_all_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
IO ()
{- |
Remove all the memory blocks in /@buffer@/.
-}
bufferRemoveAllMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> m ()
bufferRemoveAllMemory buffer = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
gst_buffer_remove_all_memory buffer'
touchManagedPtr buffer
return ()
#if ENABLE_OVERLOADING
data BufferRemoveAllMemoryMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo BufferRemoveAllMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferRemoveAllMemory
#endif
-- method Buffer::remove_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", 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_remove_memory" gst_buffer_remove_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
IO ()
{- |
Remove the memory block in /@b@/ at index /@i@/.
-}
bufferRemoveMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> m ()
bufferRemoveMemory buffer idx = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
gst_buffer_remove_memory buffer' idx
touchManagedPtr buffer
return ()
#if ENABLE_OVERLOADING
data BufferRemoveMemoryMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo BufferRemoveMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferRemoveMemory
#endif
-- method Buffer::remove_memory_range
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a length", 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_remove_memory_range" gst_buffer_remove_memory_range ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Int32 -> -- length : TBasicType TInt
IO ()
{- |
Remove /@length@/ memory blocks in /@buffer@/ starting from /@idx@/.
/@length@/ can be -1, in which case all memory starting from /@idx@/ is removed.
-}
bufferRemoveMemoryRange ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Int32
{- ^ /@length@/: a length -}
-> m ()
bufferRemoveMemoryRange buffer idx length_ = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
gst_buffer_remove_memory_range buffer' idx length_
touchManagedPtr buffer
return ()
#if ENABLE_OVERLOADING
data BufferRemoveMemoryRangeMethodInfo
instance (signature ~ (Word32 -> Int32 -> m ()), MonadIO m) => O.MethodInfo BufferRemoveMemoryRangeMethodInfo Buffer signature where
overloadedMethod _ = bufferRemoveMemoryRange
#endif
-- method Buffer::remove_meta
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "meta", argType = TInterface (Name {namespace = "Gst", name = "Meta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMeta", 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_remove_meta" gst_buffer_remove_meta ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.Meta.Meta -> -- meta : TInterface (Name {namespace = "Gst", name = "Meta"})
IO CInt
{- |
Remove the metadata for /@meta@/ on /@buffer@/.
-}
bufferRemoveMeta ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> Gst.Meta.Meta
{- ^ /@meta@/: a 'GI.Gst.Structs.Meta.Meta' -}
-> m Bool
{- ^ __Returns:__ 'True' if the metadata existed and was removed, 'False' if no such
metadata was on /@buffer@/. -}
bufferRemoveMeta buffer meta = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
meta' <- unsafeManagedPtrGetPtr meta
result <- gst_buffer_remove_meta buffer' meta'
let result' = (/= 0) result
touchManagedPtr buffer
touchManagedPtr meta
return result'
#if ENABLE_OVERLOADING
data BufferRemoveMetaMethodInfo
instance (signature ~ (Gst.Meta.Meta -> m Bool), MonadIO m) => O.MethodInfo BufferRemoveMetaMethodInfo Buffer signature where
overloadedMethod _ = bufferRemoveMeta
#endif
-- method Buffer::replace_all_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", 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_replace_all_memory" gst_buffer_replace_all_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.Memory.Memory -> -- mem : TInterface (Name {namespace = "Gst", name = "Memory"})
IO ()
{- |
Replaces all memory in /@buffer@/ with /@mem@/.
-}
bufferReplaceAllMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Gst.Memory.Memory
{- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
-> m ()
bufferReplaceAllMemory buffer mem = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
mem' <- B.ManagedPtr.disownBoxed mem
gst_buffer_replace_all_memory buffer' mem'
touchManagedPtr buffer
touchManagedPtr mem
return ()
#if ENABLE_OVERLOADING
data BufferReplaceAllMemoryMethodInfo
instance (signature ~ (Gst.Memory.Memory -> m ()), MonadIO m) => O.MethodInfo BufferReplaceAllMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferReplaceAllMemory
#endif
-- method Buffer::replace_memory
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", 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_replace_memory" gst_buffer_replace_memory ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Ptr Gst.Memory.Memory -> -- mem : TInterface (Name {namespace = "Gst", name = "Memory"})
IO ()
{- |
Replaces the memory block at index /@idx@/ in /@buffer@/ with /@mem@/.
-}
bufferReplaceMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Gst.Memory.Memory
{- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
-> m ()
bufferReplaceMemory buffer idx mem = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
mem' <- B.ManagedPtr.disownBoxed mem
gst_buffer_replace_memory buffer' idx mem'
touchManagedPtr buffer
touchManagedPtr mem
return ()
#if ENABLE_OVERLOADING
data BufferReplaceMemoryMethodInfo
instance (signature ~ (Word32 -> Gst.Memory.Memory -> m ()), MonadIO m) => O.MethodInfo BufferReplaceMemoryMethodInfo Buffer signature where
overloadedMethod _ = bufferReplaceMemory
#endif
-- method Buffer::replace_memory_range
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a length should not be 0", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mem", argType = TInterface (Name {namespace = "Gst", name = "Memory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMemory", 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_replace_memory_range" gst_buffer_replace_memory_range ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Int32 -> -- length : TBasicType TInt
Ptr Gst.Memory.Memory -> -- mem : TInterface (Name {namespace = "Gst", name = "Memory"})
IO ()
{- |
Replaces /@length@/ memory blocks in /@buffer@/ starting at /@idx@/ with /@mem@/.
If /@length@/ is -1, all memory starting from /@idx@/ will be removed and
replaced with /@mem@/.
/@buffer@/ should be writable.
-}
bufferReplaceMemoryRange ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Int32
{- ^ /@length@/: a length should not be 0 -}
-> Gst.Memory.Memory
{- ^ /@mem@/: a 'GI.Gst.Structs.Memory.Memory' -}
-> m ()
bufferReplaceMemoryRange buffer idx length_ mem = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
mem' <- B.ManagedPtr.disownBoxed mem
gst_buffer_replace_memory_range buffer' idx length_ mem'
touchManagedPtr buffer
touchManagedPtr mem
return ()
#if ENABLE_OVERLOADING
data BufferReplaceMemoryRangeMethodInfo
instance (signature ~ (Word32 -> Int32 -> Gst.Memory.Memory -> m ()), MonadIO m) => O.MethodInfo BufferReplaceMemoryRangeMethodInfo Buffer signature where
overloadedMethod _ = bufferReplaceMemoryRange
#endif
-- method Buffer::resize
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset adjustment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new size or -1 to just adjust the offset", 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_resize" gst_buffer_resize ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Int64 -> -- offset : TBasicType TInt64
Int64 -> -- size : TBasicType TInt64
IO ()
{- |
Set the offset and total size of the memory blocks in /@buffer@/.
-}
bufferResize ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Int64
{- ^ /@offset@/: the offset adjustment -}
-> Int64
{- ^ /@size@/: the new size or -1 to just adjust the offset -}
-> m ()
bufferResize buffer offset size = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
gst_buffer_resize buffer' offset size
touchManagedPtr buffer
return ()
#if ENABLE_OVERLOADING
data BufferResizeMethodInfo
instance (signature ~ (Int64 -> Int64 -> m ()), MonadIO m) => O.MethodInfo BufferResizeMethodInfo Buffer signature where
overloadedMethod _ = bufferResize
#endif
-- method Buffer::resize_range
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a length", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the offset adjustment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new size or -1 to just adjust the offset", 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_resize_range" gst_buffer_resize_range ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Word32 -> -- idx : TBasicType TUInt
Int32 -> -- length : TBasicType TInt
Int64 -> -- offset : TBasicType TInt64
Int64 -> -- size : TBasicType TInt64
IO CInt
{- |
Set the total size of the /@length@/ memory blocks starting at /@idx@/ in
/@buffer@/
-}
bufferResizeRange ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Word32
{- ^ /@idx@/: an index -}
-> Int32
{- ^ /@length@/: a length -}
-> Int64
{- ^ /@offset@/: the offset adjustment -}
-> Int64
{- ^ /@size@/: the new size or -1 to just adjust the offset -}
-> m Bool
{- ^ __Returns:__ 'True' if resizing succeeded, 'False' otherwise. -}
bufferResizeRange buffer idx length_ offset size = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
result <- gst_buffer_resize_range buffer' idx length_ offset size
let result' = (/= 0) result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferResizeRangeMethodInfo
instance (signature ~ (Word32 -> Int32 -> Int64 -> Int64 -> m Bool), MonadIO m) => O.MethodInfo BufferResizeRangeMethodInfo Buffer signature where
overloadedMethod _ = bufferResizeRange
#endif
-- method Buffer::set_flags
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "BufferFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferFlags to set.", 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_set_flags" gst_buffer_set_flags ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "BufferFlags"})
IO CInt
{- |
Sets one or more buffer flags on a buffer.
/Since: 1.10/
-}
bufferSetFlags ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> [Gst.Flags.BufferFlags]
{- ^ /@flags@/: the 'GI.Gst.Flags.BufferFlags' to set. -}
-> m Bool
{- ^ __Returns:__ 'True' if /@flags@/ were successfully set on buffer. -}
bufferSetFlags buffer flags = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
let flags' = gflagsToWord flags
result <- gst_buffer_set_flags buffer' flags'
let result' = (/= 0) result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferSetFlagsMethodInfo
instance (signature ~ ([Gst.Flags.BufferFlags] -> m Bool), MonadIO m) => O.MethodInfo BufferSetFlagsMethodInfo Buffer signature where
overloadedMethod _ = bufferSetFlags
#endif
-- method Buffer::set_size
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "size", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new size", 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_set_size" gst_buffer_set_size ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Int64 -> -- size : TBasicType TInt64
IO ()
{- |
Set the total size of the memory blocks in /@buffer@/.
-}
bufferSetSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Int64
{- ^ /@size@/: the new size -}
-> m ()
bufferSetSize buffer size = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
gst_buffer_set_size buffer' size
touchManagedPtr buffer
return ()
#if ENABLE_OVERLOADING
data BufferSetSizeMethodInfo
instance (signature ~ (Int64 -> m ()), MonadIO m) => O.MethodInfo BufferSetSizeMethodInfo Buffer signature where
overloadedMethod _ = bufferSetSize
#endif
-- method Buffer::unmap
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "info", argType = TInterface (Name {namespace = "Gst", name = "MapInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMapInfo", 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_unmap" gst_buffer_unmap ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
Ptr Gst.MapInfo.MapInfo -> -- info : TInterface (Name {namespace = "Gst", name = "MapInfo"})
IO ()
{- |
Release the memory previously mapped with 'GI.Gst.Structs.Buffer.bufferMap'.
-}
bufferUnmap ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer'. -}
-> Gst.MapInfo.MapInfo
{- ^ /@info@/: a 'GI.Gst.Structs.MapInfo.MapInfo' -}
-> m ()
bufferUnmap buffer info = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
info' <- unsafeManagedPtrGetPtr info
gst_buffer_unmap buffer' info'
touchManagedPtr buffer
touchManagedPtr info
return ()
#if ENABLE_OVERLOADING
data BufferUnmapMethodInfo
instance (signature ~ (Gst.MapInfo.MapInfo -> m ()), MonadIO m) => O.MethodInfo BufferUnmapMethodInfo Buffer signature where
overloadedMethod _ = bufferUnmap
#endif
-- method Buffer::unset_flags
-- method type : OrdinaryMethod
-- Args : [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 = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "BufferFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferFlags to clear", 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_unset_flags" gst_buffer_unset_flags ::
Ptr Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
CUInt -> -- flags : TInterface (Name {namespace = "Gst", name = "BufferFlags"})
IO CInt
{- |
Clears one or more buffer flags.
/Since: 1.10/
-}
bufferUnsetFlags ::
(B.CallStack.HasCallStack, MonadIO m) =>
Buffer
{- ^ /@buffer@/: a 'GI.Gst.Structs.Buffer.Buffer' -}
-> [Gst.Flags.BufferFlags]
{- ^ /@flags@/: the 'GI.Gst.Flags.BufferFlags' to clear -}
-> m Bool
{- ^ __Returns:__ true if /@flags@/ is successfully cleared from buffer. -}
bufferUnsetFlags buffer flags = liftIO $ do
buffer' <- unsafeManagedPtrGetPtr buffer
let flags' = gflagsToWord flags
result <- gst_buffer_unset_flags buffer' flags'
let result' = (/= 0) result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
data BufferUnsetFlagsMethodInfo
instance (signature ~ ([Gst.Flags.BufferFlags] -> m Bool), MonadIO m) => O.MethodInfo BufferUnsetFlagsMethodInfo Buffer signature where
overloadedMethod _ = bufferUnsetFlags
#endif
-- method Buffer::get_max_memory
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False
foreign import ccall "gst_buffer_get_max_memory" gst_buffer_get_max_memory ::
IO Word32
{- |
Get the maximum amount of memory blocks that a buffer can hold. This is a
compile time constant that can be queried with the function.
When more memory blocks are added, existing memory blocks will be merged
together to make room for the new block.
/Since: 1.2/
-}
bufferGetMaxMemory ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Word32
{- ^ __Returns:__ the maximum amount of memory blocks that a buffer can hold. -}
bufferGetMaxMemory = liftIO $ do
result <- gst_buffer_get_max_memory
return result
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveBufferMethod (t :: Symbol) (o :: *) :: * where
ResolveBufferMethod "addMeta" o = BufferAddMetaMethodInfo
ResolveBufferMethod "addParentBufferMeta" o = BufferAddParentBufferMetaMethodInfo
ResolveBufferMethod "addProtectionMeta" o = BufferAddProtectionMetaMethodInfo
ResolveBufferMethod "addReferenceTimestampMeta" o = BufferAddReferenceTimestampMetaMethodInfo
ResolveBufferMethod "append" o = BufferAppendMethodInfo
ResolveBufferMethod "appendMemory" o = BufferAppendMemoryMethodInfo
ResolveBufferMethod "appendRegion" o = BufferAppendRegionMethodInfo
ResolveBufferMethod "copyDeep" o = BufferCopyDeepMethodInfo
ResolveBufferMethod "copyInto" o = BufferCopyIntoMethodInfo
ResolveBufferMethod "copyRegion" o = BufferCopyRegionMethodInfo
ResolveBufferMethod "extract" o = BufferExtractMethodInfo
ResolveBufferMethod "extractDup" o = BufferExtractDupMethodInfo
ResolveBufferMethod "fill" o = BufferFillMethodInfo
ResolveBufferMethod "findMemory" o = BufferFindMemoryMethodInfo
ResolveBufferMethod "foreachMeta" o = BufferForeachMetaMethodInfo
ResolveBufferMethod "hasFlags" o = BufferHasFlagsMethodInfo
ResolveBufferMethod "insertMemory" o = BufferInsertMemoryMethodInfo
ResolveBufferMethod "isAllMemoryWritable" o = BufferIsAllMemoryWritableMethodInfo
ResolveBufferMethod "isMemoryRangeWritable" o = BufferIsMemoryRangeWritableMethodInfo
ResolveBufferMethod "map" o = BufferMapMethodInfo
ResolveBufferMethod "mapRange" o = BufferMapRangeMethodInfo
ResolveBufferMethod "memcmp" o = BufferMemcmpMethodInfo
ResolveBufferMethod "memset" o = BufferMemsetMethodInfo
ResolveBufferMethod "nMemory" o = BufferNMemoryMethodInfo
ResolveBufferMethod "peekMemory" o = BufferPeekMemoryMethodInfo
ResolveBufferMethod "prependMemory" o = BufferPrependMemoryMethodInfo
ResolveBufferMethod "removeAllMemory" o = BufferRemoveAllMemoryMethodInfo
ResolveBufferMethod "removeMemory" o = BufferRemoveMemoryMethodInfo
ResolveBufferMethod "removeMemoryRange" o = BufferRemoveMemoryRangeMethodInfo
ResolveBufferMethod "removeMeta" o = BufferRemoveMetaMethodInfo
ResolveBufferMethod "replaceAllMemory" o = BufferReplaceAllMemoryMethodInfo
ResolveBufferMethod "replaceMemory" o = BufferReplaceMemoryMethodInfo
ResolveBufferMethod "replaceMemoryRange" o = BufferReplaceMemoryRangeMethodInfo
ResolveBufferMethod "resize" o = BufferResizeMethodInfo
ResolveBufferMethod "resizeRange" o = BufferResizeRangeMethodInfo
ResolveBufferMethod "unmap" o = BufferUnmapMethodInfo
ResolveBufferMethod "unsetFlags" o = BufferUnsetFlagsMethodInfo
ResolveBufferMethod "getAllMemory" o = BufferGetAllMemoryMethodInfo
ResolveBufferMethod "getFlags" o = BufferGetFlagsMethodInfo
ResolveBufferMethod "getMemory" o = BufferGetMemoryMethodInfo
ResolveBufferMethod "getMemoryRange" o = BufferGetMemoryRangeMethodInfo
ResolveBufferMethod "getMeta" o = BufferGetMetaMethodInfo
ResolveBufferMethod "getNMeta" o = BufferGetNMetaMethodInfo
ResolveBufferMethod "getReferenceTimestampMeta" o = BufferGetReferenceTimestampMetaMethodInfo
ResolveBufferMethod "getSize" o = BufferGetSizeMethodInfo
ResolveBufferMethod "getSizes" o = BufferGetSizesMethodInfo
ResolveBufferMethod "getSizesRange" o = BufferGetSizesRangeMethodInfo
ResolveBufferMethod "setFlags" o = BufferSetFlagsMethodInfo
ResolveBufferMethod "setSize" o = BufferSetSizeMethodInfo
ResolveBufferMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveBufferMethod t Buffer, O.MethodInfo info Buffer p) => OL.IsLabel t (Buffer -> 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