gi-gst-1.0.20: GStreamer bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Gst.Structs.Buffer

Contents

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)

Synopsis

Exported types

newtype Buffer Source #

Memory-managed wrapper type.

Constructors

Buffer (ManagedPtr Buffer) 
Instances
BoxedObject Buffer Source # 
Instance details

Defined in GI.Gst.Structs.Buffer

Methods

boxedType :: Buffer -> IO GType

tag ~ AttrSet => Constructible Buffer tag Source # 
Instance details

Defined in GI.Gst.Structs.Buffer

Methods

new :: MonadIO m => (ManagedPtr Buffer -> Buffer) -> [AttrOp Buffer tag] -> m Buffer

newZeroBuffer :: MonadIO m => m Buffer Source #

Construct a Buffer struct initialized to zero.

noBuffer :: Maybe Buffer Source #

A convenience alias for Nothing :: Maybe Buffer.

Methods

addMeta

bufferAddMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> MetaInfo

info: a MetaInfo

-> Ptr ()

params: params for info

-> m (Maybe Meta)

Returns: the metadata for the api in info on buffer.

Add metadata for info to buffer using the parameters in params.

addParentBufferMeta

bufferAddParentBufferMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> Buffer

ref: a Buffer to ref

-> m (Maybe ParentBufferMeta)

Returns: The ParentBufferMeta that was added to the buffer

Add a ParentBufferMeta to buffer that holds a reference on ref until the buffer is freed.

Since: 1.6

addProtectionMeta

bufferAddProtectionMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: Buffer holding an encrypted sample, to which protection metadata should be added.

-> Structure

info: a Structure holding cryptographic information relating to the sample contained in buffer. This function takes ownership of info.

-> m ProtectionMeta

Returns: a pointer to the added ProtectionMeta if successful; Nothing if unsuccessful.

Attaches protection metadata to a Buffer.

Since: 1.6

addReferenceTimestampMeta

bufferAddReferenceTimestampMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> Caps

reference: identifier for the timestamp reference.

-> Word64

timestamp: timestamp

-> Word64

duration: duration, or CLOCK_TIME_NONE

-> m (Maybe ReferenceTimestampMeta)

Returns: The ReferenceTimestampMeta that was added to the buffer

Add a ReferenceTimestampMeta to buffer that holds a timestamp and optionally duration based on a specific timestamp reference. See the documentation of ReferenceTimestampMeta for details.

Since: 1.14

append

bufferAppend Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buf1: the first source Buffer to append.

-> Buffer

buf2: the second source Buffer to append.

-> m Buffer

Returns: the new Buffer that contains the memory of the two source buffers.

Append all the memory from buf2 to buf1. The result buffer will contain a concatenation of the memory of buf1 and buf2.

appendMemory

bufferAppendMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Memory

mem: a Memory.

-> m () 

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

bufferAppendRegion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buf1: the first source Buffer to append.

-> Buffer

buf2: the second source Buffer to append.

-> Int64

offset: the offset in buf2

-> Int64

size: the size or -1 of buf2

-> m Buffer

Returns: the new Buffer that contains the memory of the two source buffers.

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

bufferCopyDeep Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buf: a Buffer.

-> m Buffer

Returns: a new copy of buf.

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

bufferCopyInto Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

dest: a destination Buffer

-> Buffer

src: a source Buffer

-> [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.

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

bufferCopyRegion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

parent: a Buffer.

-> [BufferCopyFlags]

flags: the BufferCopyFlags

-> Word64

offset: the offset into parent Buffer at which the new sub-buffer begins.

-> Word64

size: the size of the new Buffer sub-buffer, in bytes. If -1, all data is copied.

-> m Buffer

Returns: the new Buffer or Nothing if the arguments were invalid.

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

bufferExtract Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a 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.

Copy size bytes starting from offset in buffer to dest.

extractDup

bufferExtractDup Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> Word64

offset: the offset to extract

-> Word64

size: the size to extract

-> 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

bufferFill Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a 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.

Copy size bytes from src to buffer at offset.

findMemory

bufferFindMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a 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.

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

bufferForeachMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> BufferForeachMetaFunc

func: a BufferForeachMetaFunc to call

-> m Bool

Returns: False when func returned False for one of the metadata.

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

bufferGetAllMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> m (Maybe Memory)

Returns: a Memory that contains the merged memory. Use gst_memory_unref () after usage.

Get all the memory block in buffer. The memory blocks will be merged into one large Memory.

getFlags

bufferGetFlags Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> m [BufferFlags]

Returns: the flags set on this buffer.

Get the BufferFlags flags set on this buffer.

Since: 1.10

getMaxMemory

bufferGetMaxMemory Source #

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

bufferGetMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> m (Maybe Memory)

Returns: a Memory that contains the data of the memory block at idx. Use gst_memory_unref () after usage.

Get the memory block at index idx in buffer.

getMemoryRange

bufferGetMemoryRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> Int32

length: a length

-> m (Maybe Memory)

Returns: a Memory that contains the merged data of length blocks starting at idx. Use gst_memory_unref () after usage.

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

bufferGetMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> GType

api: the GType of an API

-> m (Maybe Meta)

Returns: the metadata for api on buffer.

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 bufferForeachMeta instead and check the meta->info.api member for the API type.

getNMeta

bufferGetNMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> GType

apiType: the GType of an API

-> m Word32

Returns: number of metas of type apiType on buffer.

No description available in the introspection data.

Since: 1.14

getReferenceTimestampMeta

bufferGetReferenceTimestampMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> Maybe Caps

reference: a reference Caps

-> m (Maybe ReferenceTimestampMeta)

Returns: the ReferenceTimestampMeta or Nothing when there is no such metadata on buffer.

Find the first 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 ReferenceTimestampMeta metadata items.

Since: 1.14

getSize

bufferGetSize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> m Word64

Returns: total size of the memory blocks in buffer.

Get the total size of the memory blocks in buffer.

getSizes

bufferGetSizes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> m (Word64, Word64, Word64)

Returns: total size of the memory blocks in buffer.

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

bufferGetSizesRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a 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.

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

bufferHasFlags :: (HasCallStack, MonadIO m) => Buffer -> [BufferFlags] -> m Bool Source #

No description available in the introspection data.

insertMemory

bufferInsertMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Int32

idx: the index to add the memory at, or -1 to append it to the end

-> Memory

mem: a 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

bufferIsAllMemoryWritable Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> m Bool

Returns: True if all memory blocks in buffer are writable

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

buffer: a Buffer.

-> Word32

idx: an index

-> Int32

length: a length should not be 0

-> m Bool

Returns: True if the memory range is writable

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

map

bufferMap Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> [MapFlags]

flags: flags for the mapping

-> m (Bool, MapInfo)

Returns: True if the map succeeded and info contains valid data.

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

bufferMapRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> Int32

length: a length

-> [MapFlags]

flags: flags for the mapping

-> m (Bool, MapInfo)

Returns: True if the map succeeded and info contains valid data.

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

bufferMemcmp Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word64

offset: the offset in buffer

-> ByteString

mem: the memory to compare

-> m Int32

Returns: 0 if the memory is equal.

Compare size bytes starting from offset in buffer with the memory in mem.

memset

bufferMemset Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a 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.

Fill buf with size bytes with val starting from offset.

nMemory

bufferNMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a 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

bufferNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Buffer

Returns: the new Buffer.

Creates a newly allocated buffer without any data.

MT safe.

newAllocate

bufferNewAllocate Source #

Arguments

:: (HasCallStack, MonadIO m, IsAllocator a) 
=> Maybe a

allocator: the Allocator to use, or Nothing to use the default allocator

-> Word64

size: the size in bytes of the new buffer's data.

-> Maybe AllocationParams

params: optional parameters

-> m (Maybe Buffer)

Returns: a new Buffer, or Nothing if the memory couldn't be allocated.

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

bufferNewWrapped Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

data: data to wrap

-> m Buffer

Returns: a new 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.

newWrappedBytes

bufferNewWrappedBytes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Bytes

bytes: a Bytes to wrap

-> m Buffer

Returns: a new Buffer wrapping bytes

Creates a new 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

newWrappedFull

bufferNewWrappedFull Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [MemoryFlags]

flags: MemoryFlags

-> ByteString

data: data to wrap

-> Word64

maxsize: allocated size of data

-> Word64

offset: offset in data

-> Maybe DestroyNotify

notify: called with userData when the memory is freed

-> m Buffer

Returns: a new 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.

peekMemory

bufferPeekMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> m (Maybe Memory)

Returns: the Memory at idx.

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

bufferPrependMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Memory

mem: a Memory.

-> m () 

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

bufferRemoveAllMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> m () 

Remove all the memory blocks in buffer.

removeMemory

bufferRemoveMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> m () 

Remove the memory block in b at index i.

removeMemoryRange

bufferRemoveMemoryRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> Int32

length: a length

-> 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

bufferRemoveMeta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> Meta

meta: a Meta

-> m Bool

Returns: True if the metadata existed and was removed, False if no such metadata was on buffer.

Remove the metadata for meta on buffer.

replaceAllMemory

bufferReplaceAllMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Memory

mem: a Memory

-> m () 

Replaces all memory in buffer with mem.

replaceMemory

bufferReplaceMemory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> Memory

mem: a Memory

-> m () 

Replaces the memory block at index idx in buffer with mem.

replaceMemoryRange

bufferReplaceMemoryRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Word32

idx: an index

-> Int32

length: a length should not be 0

-> Memory

mem: a 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

bufferResize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Int64

offset: the offset adjustment

-> Int64

size: the new size or -1 to just adjust the offset

-> m () 

Set the offset and total size of the memory blocks in buffer.

resizeRange

bufferResizeRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a 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.

Set the total size of the length memory blocks starting at idx in buffer

setFlags

bufferSetFlags Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> [BufferFlags]

flags: the BufferFlags to set.

-> m Bool

Returns: True if flags were successfully set on buffer.

Sets one or more buffer flags on a buffer.

Since: 1.10

setSize

bufferSetSize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> Int64

size: the new size

-> m () 

Set the total size of the memory blocks in buffer.

unmap

bufferUnmap Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer.

-> MapInfo

info: a MapInfo

-> m () 

Release the memory previously mapped with bufferMap.

unsetFlags

bufferUnsetFlags Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Buffer

buffer: a Buffer

-> [BufferFlags]

flags: the BufferFlags to clear

-> m Bool

Returns: true if flags is successfully cleared from buffer.

Clears one or more buffer flags.

Since: 1.10

Properties

dts

decoding timestamp of the buffer, can be CLOCK_TIME_NONE when the dts is not known or relevant. The dts contains the timestamp when the media should be processed.

getBufferDts :: MonadIO m => Buffer -> m Word64 Source #

Get the value of the “dts” field. When overloading is enabled, this is equivalent to

get buffer #dts

setBufferDts :: MonadIO m => Buffer -> Word64 -> m () Source #

Set the value of the “dts” field. When overloading is enabled, this is equivalent to

set buffer [ #dts := value ]

duration

duration in time of the buffer data, can be CLOCK_TIME_NONE when the duration is not known or relevant.

getBufferDuration :: MonadIO m => Buffer -> m Word64 Source #

Get the value of the “duration” field. When overloading is enabled, this is equivalent to

get buffer #duration

setBufferDuration :: MonadIO m => Buffer -> Word64 -> m () Source #

Set the value of the “duration” field. When overloading is enabled, this is equivalent to

set buffer [ #duration := value ]

miniObject

the parent structure

getBufferMiniObject :: MonadIO m => Buffer -> m MiniObject Source #

Get the value of the “mini_object” field. When overloading is enabled, this is equivalent to

get buffer #miniObject

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.

getBufferOffset :: MonadIO m => Buffer -> m Word64 Source #

Get the value of the “offset” field. When overloading is enabled, this is equivalent to

get buffer #offset

setBufferOffset :: MonadIO m => Buffer -> Word64 -> m () Source #

Set the value of the “offset” field. When overloading is enabled, this is equivalent to

set buffer [ #offset := value ]

offsetEnd

the last offset contained in this buffer. It has the same format as offset.

getBufferOffsetEnd :: MonadIO m => Buffer -> m Word64 Source #

Get the value of the “offset_end” field. When overloading is enabled, this is equivalent to

get buffer #offsetEnd

setBufferOffsetEnd :: MonadIO m => Buffer -> Word64 -> m () Source #

Set the value of the “offset_end” field. When overloading is enabled, this is equivalent to

set buffer [ #offsetEnd := value ]

pool

pointer to the pool owner of the buffer

clearBufferPool :: MonadIO m => Buffer -> m () Source #

Set the value of the “pool” field to Nothing. When overloading is enabled, this is equivalent to

clear #pool

getBufferPool :: MonadIO m => Buffer -> m (Maybe BufferPool) Source #

Get the value of the “pool” field. When overloading is enabled, this is equivalent to

get buffer #pool

setBufferPool :: MonadIO m => Buffer -> Ptr BufferPool -> m () Source #

Set the value of the “pool” field. When overloading is enabled, this is equivalent to

set buffer [ #pool := value ]

pts

presentation timestamp of the buffer, can be 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.

getBufferPts :: MonadIO m => Buffer -> m Word64 Source #

Get the value of the “pts” field. When overloading is enabled, this is equivalent to

get buffer #pts

setBufferPts :: MonadIO m => Buffer -> Word64 -> m () Source #

Set the value of the “pts” field. When overloading is enabled, this is equivalent to

set buffer [ #pts := value ]