| Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gst.Structs.Buffer
Contents
- Exported types
- Methods
- addMeta
- addParentBufferMeta
- addProtectionMeta
- append
- appendMemory
- appendRegion
- copyDeep
- copyInto
- copyRegion
- extract
- extractDup
- fill
- findMemory
- foreachMeta
- getAllMemory
- getFlags
- getMaxMemory
- getMemory
- getMemoryRange
- getMeta
- getSize
- getSizes
- getSizesRange
- hasFlags
- insertMemory
- isAllMemoryWritable
- isMemoryRangeWritable
- iterateMeta
- map
- mapRange
- memcmp
- memset
- nMemory
- new
- newAllocate
- newWrapped
- newWrappedFull
- peekMemory
- prependMemory
- removeAllMemory
- removeMemory
- removeMemoryRange
- removeMeta
- replaceAllMemory
- replaceMemory
- replaceMemoryRange
- resize
- resizeRange
- setFlags
- setSize
- unmap
- unsetFlags
- Properties
Description
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 Memory blocks that the buffer contains.
Buffers are usually created with 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 bufferNewAllocate to create a buffer with
preallocated data of a given size.
Buffers can contain a list of Memory objects. You can retrieve how many
memory objects with bufferNMemory and you can get a pointer
to memory with bufferPeekMemory
A buffer will usually have timestamps, and a duration, but neither of these
are guaranteed (they may be set to 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 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 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 BufferFlags flag is set.
Buffers can be efficiently merged into a larger buffer with
bufferAppend. Copying of memory will only be done when absolutely
needed.
Arbitrary extra metadata can be set on a buffer with bufferAddMeta.
Metadata can be retrieved with bufferGetMeta. See also Meta
An element should either unref the buffer or push it out on a src pad
using padPush (see 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 BufferPool will be returned to
the pool when the refcount drops to 0.
The ParentBufferMeta is a meta which can be attached to a Buffer
to hold a reference to another buffer that is only released when the child
Buffer is released.
Typically, ParentBufferMeta is used when the child buffer is directly
using the Memory of the parent buffer, and wants to prevent the parent
buffer from being returned to a buffer pool until the Memory is available
for re-use. (Since 1.6)
- newtype Buffer = Buffer (ManagedPtr Buffer)
- newZeroBuffer :: MonadIO m => m Buffer
- noBuffer :: Maybe Buffer
- data BufferAddMetaMethodInfo
- bufferAddMeta :: (HasCallStack, MonadIO m) => Buffer -> MetaInfo -> Ptr () -> m Meta
- data BufferAddParentBufferMetaMethodInfo
- bufferAddParentBufferMeta :: (HasCallStack, MonadIO m) => Buffer -> Buffer -> m ParentBufferMeta
- data BufferAddProtectionMetaMethodInfo
- bufferAddProtectionMeta :: (HasCallStack, MonadIO m) => Buffer -> Structure -> m ProtectionMeta
- data BufferAppendMethodInfo
- bufferAppend :: (HasCallStack, MonadIO m) => Buffer -> Buffer -> m Buffer
- data BufferAppendMemoryMethodInfo
- bufferAppendMemory :: (HasCallStack, MonadIO m) => Buffer -> Memory -> m ()
- data BufferAppendRegionMethodInfo
- bufferAppendRegion :: (HasCallStack, MonadIO m) => Buffer -> Buffer -> Int64 -> Int64 -> m Buffer
- data BufferCopyDeepMethodInfo
- bufferCopyDeep :: (HasCallStack, MonadIO m) => Buffer -> m Buffer
- data BufferCopyIntoMethodInfo
- bufferCopyInto :: (HasCallStack, MonadIO m) => Buffer -> Buffer -> [BufferCopyFlags] -> Word64 -> Word64 -> m Bool
- data BufferCopyRegionMethodInfo
- bufferCopyRegion :: (HasCallStack, MonadIO m) => Buffer -> [BufferCopyFlags] -> Word64 -> Word64 -> m Buffer
- data BufferExtractMethodInfo
- bufferExtract :: (HasCallStack, MonadIO m) => Buffer -> Word64 -> Ptr () -> Word64 -> m Word64
- data BufferExtractDupMethodInfo
- bufferExtractDup :: (HasCallStack, MonadIO m) => Buffer -> Word64 -> Word64 -> m ByteString
- data BufferFillMethodInfo
- bufferFill :: (HasCallStack, MonadIO m) => Buffer -> Word64 -> ByteString -> m Word64
- data BufferFindMemoryMethodInfo
- bufferFindMemory :: (HasCallStack, MonadIO m) => Buffer -> Word64 -> Word64 -> m (Bool, Word32, Word32, Word64)
- data BufferForeachMetaMethodInfo
- bufferForeachMeta :: (HasCallStack, MonadIO m) => Buffer -> BufferForeachMetaFunc -> m Bool
- data BufferGetAllMemoryMethodInfo
- bufferGetAllMemory :: (HasCallStack, MonadIO m) => Buffer -> m Memory
- data BufferGetFlagsMethodInfo
- bufferGetFlags :: (HasCallStack, MonadIO m) => Buffer -> m [BufferFlags]
- bufferGetMaxMemory :: (HasCallStack, MonadIO m) => m Word32
- data BufferGetMemoryMethodInfo
- bufferGetMemory :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> m Memory
- data BufferGetMemoryRangeMethodInfo
- bufferGetMemoryRange :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Int32 -> m Memory
- data BufferGetMetaMethodInfo
- bufferGetMeta :: (HasCallStack, MonadIO m) => Buffer -> GType -> m (Maybe Meta)
- data BufferGetSizeMethodInfo
- bufferGetSize :: (HasCallStack, MonadIO m) => Buffer -> m Word64
- data BufferGetSizesMethodInfo
- bufferGetSizes :: (HasCallStack, MonadIO m) => Buffer -> m (Word64, Word64, Word64)
- data BufferGetSizesRangeMethodInfo
- bufferGetSizesRange :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Int32 -> m (Word64, Word64, Word64)
- data BufferHasFlagsMethodInfo
- bufferHasFlags :: (HasCallStack, MonadIO m) => Buffer -> [BufferFlags] -> m Bool
- data BufferInsertMemoryMethodInfo
- bufferInsertMemory :: (HasCallStack, MonadIO m) => Buffer -> Int32 -> Memory -> m ()
- data BufferIsAllMemoryWritableMethodInfo
- bufferIsAllMemoryWritable :: (HasCallStack, MonadIO m) => Buffer -> m Bool
- data BufferIsMemoryRangeWritableMethodInfo
- bufferIsMemoryRangeWritable :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Int32 -> m Bool
- data BufferIterateMetaMethodInfo
- bufferIterateMeta :: (HasCallStack, MonadIO m) => Buffer -> Ptr () -> m (Maybe Meta)
- data BufferMapMethodInfo
- bufferMap :: (HasCallStack, MonadIO m) => Buffer -> [MapFlags] -> m (Bool, MapInfo)
- data BufferMapRangeMethodInfo
- bufferMapRange :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Int32 -> [MapFlags] -> m (Bool, MapInfo)
- data BufferMemcmpMethodInfo
- bufferMemcmp :: (HasCallStack, MonadIO m) => Buffer -> Word64 -> ByteString -> m Int32
- data BufferMemsetMethodInfo
- bufferMemset :: (HasCallStack, MonadIO m) => Buffer -> Word64 -> Word8 -> Word64 -> m Word64
- data BufferNMemoryMethodInfo
- bufferNMemory :: (HasCallStack, MonadIO m) => Buffer -> m Word32
- bufferNew :: (HasCallStack, MonadIO m) => m Buffer
- bufferNewAllocate :: (HasCallStack, MonadIO m, IsAllocator a) => Maybe a -> Word64 -> Maybe AllocationParams -> m (Maybe Buffer)
- bufferNewWrapped :: (HasCallStack, MonadIO m) => ByteString -> m Buffer
- bufferNewWrappedFull :: (HasCallStack, MonadIO m) => [MemoryFlags] -> ByteString -> Word64 -> Word64 -> Maybe DestroyNotify -> m Buffer
- data BufferPeekMemoryMethodInfo
- bufferPeekMemory :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> m Memory
- data BufferPrependMemoryMethodInfo
- bufferPrependMemory :: (HasCallStack, MonadIO m) => Buffer -> Memory -> m ()
- data BufferRemoveAllMemoryMethodInfo
- bufferRemoveAllMemory :: (HasCallStack, MonadIO m) => Buffer -> m ()
- data BufferRemoveMemoryMethodInfo
- bufferRemoveMemory :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> m ()
- data BufferRemoveMemoryRangeMethodInfo
- bufferRemoveMemoryRange :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Int32 -> m ()
- data BufferRemoveMetaMethodInfo
- bufferRemoveMeta :: (HasCallStack, MonadIO m) => Buffer -> Meta -> m Bool
- data BufferReplaceAllMemoryMethodInfo
- bufferReplaceAllMemory :: (HasCallStack, MonadIO m) => Buffer -> Memory -> m ()
- data BufferReplaceMemoryMethodInfo
- bufferReplaceMemory :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Memory -> m ()
- data BufferReplaceMemoryRangeMethodInfo
- bufferReplaceMemoryRange :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Int32 -> Memory -> m ()
- data BufferResizeMethodInfo
- bufferResize :: (HasCallStack, MonadIO m) => Buffer -> Int64 -> Int64 -> m ()
- data BufferResizeRangeMethodInfo
- bufferResizeRange :: (HasCallStack, MonadIO m) => Buffer -> Word32 -> Int32 -> Int64 -> Int64 -> m Bool
- data BufferSetFlagsMethodInfo
- bufferSetFlags :: (HasCallStack, MonadIO m) => Buffer -> [BufferFlags] -> m Bool
- data BufferSetSizeMethodInfo
- bufferSetSize :: (HasCallStack, MonadIO m) => Buffer -> Int64 -> m ()
- data BufferUnmapMethodInfo
- bufferUnmap :: (HasCallStack, MonadIO m) => Buffer -> MapInfo -> m ()
- data BufferUnsetFlagsMethodInfo
- bufferUnsetFlags :: (HasCallStack, MonadIO m) => Buffer -> [BufferFlags] -> m Bool
- buffer_dts :: AttrLabelProxy "dts"
- getBufferDts :: MonadIO m => Buffer -> m Word64
- setBufferDts :: MonadIO m => Buffer -> Word64 -> m ()
- buffer_duration :: AttrLabelProxy "duration"
- getBufferDuration :: MonadIO m => Buffer -> m Word64
- setBufferDuration :: MonadIO m => Buffer -> Word64 -> m ()
- buffer_miniObject :: AttrLabelProxy "miniObject"
- getBufferMiniObject :: MonadIO m => Buffer -> m MiniObject
- buffer_offset :: AttrLabelProxy "offset"
- getBufferOffset :: MonadIO m => Buffer -> m Word64
- setBufferOffset :: MonadIO m => Buffer -> Word64 -> m ()
- buffer_offsetEnd :: AttrLabelProxy "offsetEnd"
- getBufferOffsetEnd :: MonadIO m => Buffer -> m Word64
- setBufferOffsetEnd :: MonadIO m => Buffer -> Word64 -> m ()
- buffer_pool :: AttrLabelProxy "pool"
- clearBufferPool :: MonadIO m => Buffer -> m ()
- getBufferPool :: MonadIO m => Buffer -> m (Maybe BufferPool)
- setBufferPool :: MonadIO m => Buffer -> Ptr BufferPool -> m ()
- buffer_pts :: AttrLabelProxy "pts"
- getBufferPts :: MonadIO m => Buffer -> m Word64
- setBufferPts :: MonadIO m => Buffer -> Word64 -> m ()
Exported types
Constructors
| Buffer (ManagedPtr Buffer) |
Instances
Methods
addMeta
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> MetaInfo |
|
| -> Ptr () |
|
| -> m Meta | Returns: the metadata for the api in |
Add metadata for info to buffer using the parameters in params.
addParentBufferMeta
data BufferAddParentBufferMetaMethodInfo Source #
Instances
| ((~) * signature (Buffer -> m ParentBufferMeta), MonadIO m) => MethodInfo * BufferAddParentBufferMetaMethodInfo Buffer signature Source # | |
bufferAddParentBufferMeta Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Buffer |
|
| -> m ParentBufferMeta | Returns: The |
Add a ParentBufferMeta to buffer that holds a reference on
ref until the buffer is freed.
Since: 1.6
addProtectionMeta
data BufferAddProtectionMetaMethodInfo Source #
Instances
| ((~) * signature (Structure -> m ProtectionMeta), MonadIO m) => MethodInfo * BufferAddProtectionMetaMethodInfo Buffer signature Source # | |
bufferAddProtectionMeta Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Structure |
|
| -> m ProtectionMeta | Returns: a pointer to the added |
Attaches protection metadata to a Buffer.
Since: 1.6
append
data BufferAppendMethodInfo Source #
Instances
| ((~) * signature (Buffer -> m Buffer), MonadIO m) => MethodInfo * BufferAppendMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Buffer |
|
| -> m Buffer | Returns: the new |
Append all the memory from buf2 to buf1. The result buffer will contain a
concatenation of the memory of buf1 and buf2.
appendMemory
data BufferAppendMemoryMethodInfo Source #
Instances
| ((~) * signature (Memory -> m ()), MonadIO m) => MethodInfo * BufferAppendMemoryMethodInfo Buffer signature Source # | |
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 bufferInsertMemory with an index of -1.
See bufferInsertMemory for more details.
appendRegion
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Buffer |
|
| -> Int64 |
|
| -> Int64 |
|
| -> m Buffer | Returns: the new |
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.
copyDeep
data BufferCopyDeepMethodInfo Source #
Instances
| ((~) * signature (m Buffer), MonadIO m) => MethodInfo * BufferCopyDeepMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m Buffer | Returns: a new copy of |
Create a copy of the given buffer. This will make a newly allocated copy of the data the source buffer contains.
Since: 1.6
copyInto
data BufferCopyIntoMethodInfo Source #
Instances
| ((~) * signature (Buffer -> [BufferCopyFlags] -> Word64 -> Word64 -> m Bool), MonadIO m) => MethodInfo * BufferCopyIntoMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Buffer |
|
| -> [BufferCopyFlags] |
|
| -> Word64 |
|
| -> Word64 |
|
| -> m Bool |
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.
copyRegion
data BufferCopyRegionMethodInfo Source #
Instances
| ((~) * signature ([BufferCopyFlags] -> Word64 -> Word64 -> m Buffer), MonadIO m) => MethodInfo * BufferCopyRegionMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> [BufferCopyFlags] |
|
| -> Word64 |
|
| -> Word64 |
|
| -> m Buffer | Returns: the new |
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 CLOCK_TIME_NONE and
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 CLOCK_TIME_NONE and BUFFER_OFFSET_NONE.
MT safe.
extract
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word64 |
|
| -> Ptr () |
|
| -> Word64 |
|
| -> m Word64 | Returns: The amount of bytes extracted. This value can be lower than |
Copy size bytes starting from offset in buffer to dest.
extractDup
data BufferExtractDupMethodInfo Source #
Instances
| ((~) * signature (Word64 -> Word64 -> m ByteString), MonadIO m) => MethodInfo * BufferExtractDupMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word64 |
|
| -> Word64 |
|
| -> m ByteString |
Extracts a copy of at most size bytes the data at offset into
newly-allocated memory. dest must be freed using free when done.
Since: 1.0.10
fill
data BufferFillMethodInfo Source #
Instances
| ((~) * signature (Word64 -> ByteString -> m Word64), MonadIO m) => MethodInfo * BufferFillMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word64 |
|
| -> ByteString |
|
| -> m Word64 | Returns: The amount of bytes copied. This value can be lower than |
Copy size bytes from src to buffer at offset.
findMemory
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word64 |
|
| -> Word64 |
|
| -> m (Bool, Word32, Word32, Word64) | Returns: |
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.
foreachMeta
data BufferForeachMetaMethodInfo Source #
Instances
| ((~) * signature (BufferForeachMetaFunc -> m Bool), MonadIO m) => MethodInfo * BufferForeachMetaMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> BufferForeachMetaFunc |
|
| -> m Bool | Returns: |
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.
getAllMemory
data BufferGetAllMemoryMethodInfo Source #
Instances
| ((~) * signature (m Memory), MonadIO m) => MethodInfo * BufferGetAllMemoryMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m Memory | Returns: a |
Get all the memory block in buffer. The memory blocks will be merged
into one large Memory.
getFlags
data BufferGetFlagsMethodInfo Source #
Instances
| ((~) * signature (m [BufferFlags]), MonadIO m) => MethodInfo * BufferGetFlagsMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m [BufferFlags] | Returns: the flags set on this buffer. |
Get the BufferFlags flags set on this buffer.
Since: 1.10
getMaxMemory
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Word32 | Returns: the maximum amount of memory blocks that a buffer can hold. |
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
getMemory
data BufferGetMemoryMethodInfo Source #
Instances
| ((~) * signature (Word32 -> m Memory), MonadIO m) => MethodInfo * BufferGetMemoryMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> m Memory | Returns: a |
Get the memory block at index idx in buffer.
getMemoryRange
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Int32 |
|
| -> m Memory | Returns: a |
Get length memory blocks in buffer starting at idx. The memory blocks will
be merged into one large Memory.
If length is -1, all memory starting from idx is merged.
getMeta
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> GType |
|
| -> m (Maybe Meta) | Returns: the metadata for |
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 bufferIterateMeta or bufferForeachMeta instead
and check the meta->info.api member for the API type.
getSize
data BufferGetSizeMethodInfo Source #
Instances
| ((~) * signature (m Word64), MonadIO m) => MethodInfo * BufferGetSizeMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m Word64 | Returns: total size of the memory blocks in |
Get the total size of the memory blocks in buffer.
getSizes
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m (Word64, Word64, Word64) | Returns: total size of the memory blocks in |
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 bufferResize.
getSizesRange
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Int32 |
|
| -> m (Word64, Word64, Word64) | Returns: total size of |
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
bufferResizeRange.
hasFlags
data BufferHasFlagsMethodInfo Source #
Instances
| ((~) * signature ([BufferFlags] -> m Bool), MonadIO m) => MethodInfo * BufferHasFlagsMethodInfo Buffer signature Source # | |
bufferHasFlags :: (HasCallStack, MonadIO m) => Buffer -> [BufferFlags] -> m Bool Source #
No description available in the introspection data.
insertMemory
data BufferInsertMemoryMethodInfo Source #
Instances
| ((~) * signature (Int32 -> Memory -> m ()), MonadIO m) => MethodInfo * BufferInsertMemoryMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Int32 |
|
| -> Memory |
|
| -> m () |
Insert the memory block mem to buffer at idx. This function takes ownership
of mem and thus doesn't increase its refcount.
Only 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.
isAllMemoryWritable
data BufferIsAllMemoryWritableMethodInfo Source #
Instances
| ((~) * signature (m Bool), MonadIO m) => MethodInfo * BufferIsAllMemoryWritableMethodInfo Buffer signature Source # | |
bufferIsAllMemoryWritable Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m Bool | Returns: |
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
isMemoryRangeWritable
bufferIsMemoryRangeWritable Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Int32 |
|
| -> m Bool | Returns: |
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
iterateMeta
map
data BufferMapMethodInfo Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> [MapFlags] |
|
| -> m (Bool, MapInfo) | Returns: |
This function fills info with the 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 bufferUnmap after
usage.
mapRange
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Int32 |
|
| -> [MapFlags] |
|
| -> m (Bool, MapInfo) | Returns: |
This function fills info with the 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 bufferUnmap after usage.
memcmp
data BufferMemcmpMethodInfo Source #
Instances
| ((~) * signature (Word64 -> ByteString -> m Int32), MonadIO m) => MethodInfo * BufferMemcmpMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word64 |
|
| -> ByteString |
|
| -> m Int32 | Returns: 0 if the memory is equal. |
Compare size bytes starting from offset in buffer with the memory in mem.
memset
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word64 |
|
| -> Word8 |
|
| -> Word64 |
|
| -> m Word64 | Returns: The amount of bytes filled. This value can be lower than |
Fill buf with size bytes with val starting from offset.
nMemory
data BufferNMemoryMethodInfo Source #
Instances
| ((~) * signature (m Word32), MonadIO m) => MethodInfo * BufferNMemoryMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m Word32 | Returns: the number of memory blocks this buffer is made of. |
Get the amount of memory blocks that this buffer has. This amount is never
larger than what bufferGetMaxMemory returns.
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Buffer | Returns: the new |
Creates a newly allocated buffer without any data.
MT safe.
newAllocate
Arguments
| :: (HasCallStack, MonadIO m, IsAllocator a) | |
| => Maybe a |
|
| -> Word64 |
|
| -> Maybe AllocationParams |
|
| -> m (Maybe Buffer) | Returns: a new |
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.
newWrapped
Arguments
| :: (HasCallStack, MonadIO m) | |
| => ByteString |
|
| -> m Buffer | Returns: a new |
Creates a new buffer that wraps the given data. The memory will be freed
with g_free and will be marked writable.
MT safe.
newWrappedFull
Arguments
| :: (HasCallStack, MonadIO m) | |
| => [MemoryFlags] |
|
| -> ByteString |
|
| -> Word64 |
|
| -> Word64 |
|
| -> Maybe DestroyNotify |
|
| -> m Buffer | Returns: a new |
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.
peekMemory
data BufferPeekMemoryMethodInfo Source #
Instances
| ((~) * signature (Word32 -> m Memory), MonadIO m) => MethodInfo * BufferPeekMemoryMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> m Memory | Returns: the |
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.
prependMemory
data BufferPrependMemoryMethodInfo Source #
Instances
| ((~) * signature (Memory -> m ()), MonadIO m) => MethodInfo * BufferPrependMemoryMethodInfo Buffer signature Source # | |
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 bufferInsertMemory with an index of 0.
See bufferInsertMemory for more details.
removeAllMemory
data BufferRemoveAllMemoryMethodInfo Source #
Instances
| ((~) * signature (m ()), MonadIO m) => MethodInfo * BufferRemoveAllMemoryMethodInfo Buffer signature Source # | |
bufferRemoveAllMemory Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> m () |
Remove all the memory blocks in buffer.
removeMemory
data BufferRemoveMemoryMethodInfo Source #
Instances
| ((~) * signature (Word32 -> m ()), MonadIO m) => MethodInfo * BufferRemoveMemoryMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> m () |
Remove the memory block in b at index i.
removeMemoryRange
data BufferRemoveMemoryRangeMethodInfo Source #
Instances
| ((~) * signature (Word32 -> Int32 -> m ()), MonadIO m) => MethodInfo * BufferRemoveMemoryRangeMethodInfo Buffer signature Source # | |
bufferRemoveMemoryRange Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Int32 |
|
| -> m () |
Remove length memory blocks in buffer starting from idx.
length can be -1, in which case all memory starting from idx is removed.
removeMeta
data BufferRemoveMetaMethodInfo Source #
Instances
| ((~) * signature (Meta -> m Bool), MonadIO m) => MethodInfo * BufferRemoveMetaMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Meta |
|
| -> m Bool | Returns: |
Remove the metadata for meta on buffer.
replaceAllMemory
data BufferReplaceAllMemoryMethodInfo Source #
Instances
| ((~) * signature (Memory -> m ()), MonadIO m) => MethodInfo * BufferReplaceAllMemoryMethodInfo Buffer signature Source # | |
bufferReplaceAllMemory Source #
Replaces all memory in buffer with mem.
replaceMemory
data BufferReplaceMemoryMethodInfo Source #
Instances
| ((~) * signature (Word32 -> Memory -> m ()), MonadIO m) => MethodInfo * BufferReplaceMemoryMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Memory |
|
| -> m () |
Replaces the memory block at index idx in buffer with mem.
replaceMemoryRange
bufferReplaceMemoryRange Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Int32 |
|
| -> Memory |
|
| -> m () |
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.
resize
data BufferResizeMethodInfo Source #
Instances
| ((~) * signature (Int64 -> Int64 -> m ()), MonadIO m) => MethodInfo * BufferResizeMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Int64 |
|
| -> Int64 |
|
| -> m () |
Set the offset and total size of the memory blocks in buffer.
resizeRange
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Word32 |
|
| -> Int32 |
|
| -> Int64 |
|
| -> Int64 |
|
| -> m Bool |
Set the total size of the length memory blocks starting at idx in
buffer
setFlags
data BufferSetFlagsMethodInfo Source #
Instances
| ((~) * signature ([BufferFlags] -> m Bool), MonadIO m) => MethodInfo * BufferSetFlagsMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> [BufferFlags] |
|
| -> m Bool | Returns: |
Sets one or more buffer flags on a buffer.
Since: 1.10
setSize
data BufferSetSizeMethodInfo Source #
Instances
| ((~) * signature (Int64 -> m ()), MonadIO m) => MethodInfo * BufferSetSizeMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> Int64 |
|
| -> m () |
Set the total size of the memory blocks in buffer.
unmap
data BufferUnmapMethodInfo Source #
Instances
| ((~) * signature (MapInfo -> m ()), MonadIO m) => MethodInfo * BufferUnmapMethodInfo Buffer signature Source # | |
Release the memory previously mapped with bufferMap.
unsetFlags
data BufferUnsetFlagsMethodInfo Source #
Instances
| ((~) * signature ([BufferFlags] -> m Bool), MonadIO m) => MethodInfo * BufferUnsetFlagsMethodInfo Buffer signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Buffer |
|
| -> [BufferFlags] |
|
| -> m Bool | Returns: true if |
Clears one or more buffer flags.
Since: 1.10
Properties
dts
buffer_dts :: AttrLabelProxy "dts" Source #
duration
buffer_duration :: AttrLabelProxy "duration" Source #
miniObject
buffer_miniObject :: AttrLabelProxy "miniObject" Source #
getBufferMiniObject :: MonadIO m => Buffer -> m MiniObject Source #
offset
buffer_offset :: AttrLabelProxy "offset" Source #
offsetEnd
buffer_offsetEnd :: AttrLabelProxy "offsetEnd" Source #
pool
buffer_pool :: AttrLabelProxy "pool" Source #
clearBufferPool :: MonadIO m => Buffer -> m () Source #
getBufferPool :: MonadIO m => Buffer -> m (Maybe BufferPool) Source #
setBufferPool :: MonadIO m => Buffer -> Ptr BufferPool -> m () Source #
pts
buffer_pts :: AttrLabelProxy "pts" Source #