Package ch.bailu.gtk.gst
Klasse Buffer
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.gst.Buffer
- Alle implementierten Schnittstellen:
PointerInterface
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 #GstMemory blocks that the buffer contains.
Buffers are usually created with gst_buffer_new(). 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
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 gst_buffer_new_allocate() to create a buffer with
preallocated data of a given size.
Buffers can contain a list of #GstMemory objects. You can retrieve how many
memory objects with gst_buffer_n_memory() and you can get a pointer
to memory with gst_buffer_peek_memory()
A buffer will usually have timestamps, and a duration, but neither of these
are guaranteed (they may be set to #GST_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 #GST_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 gst_buffer_copy_region(). 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 #GstBufferFlags flag is set.
Buffers can be efficiently merged into a larger buffer with
gst_buffer_append(). Copying of memory will only be done when absolutely
needed.
Arbitrary extra metadata can be set on a buffer with gst_buffer_add_meta().
Metadata can be retrieved with gst_buffer_get_meta(). See also #GstMeta.
An element should either unref the buffer or push it out on a src pad
using gst_pad_push() (see #GstPad).
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 #GstBufferPool will be returned to
the pool when the refcount drops to 0.
The #GstParentBufferMeta is a meta which can be attached to a #GstBuffer
to hold a reference to another buffer that is only released when the child
#GstBuffer is released.
Typically, #GstParentBufferMeta is used when the child buffer is directly
using the #GstMemory of the parent buffer, and wants to prevent the parent
buffer from being returned to a buffer pool until the #GstMemory is available
for re-use. (Since: 1.6)
timing and offset along with other arbitrary metadata that is associated
with the #GstMemory blocks that the buffer contains.
Buffers are usually created with gst_buffer_new(). 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
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 gst_buffer_new_allocate() to create a buffer with
preallocated data of a given size.
Buffers can contain a list of #GstMemory objects. You can retrieve how many
memory objects with gst_buffer_n_memory() and you can get a pointer
to memory with gst_buffer_peek_memory()
A buffer will usually have timestamps, and a duration, but neither of these
are guaranteed (they may be set to #GST_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 #GST_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 gst_buffer_copy_region(). 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 #GstBufferFlags flag is set.
Buffers can be efficiently merged into a larger buffer with
gst_buffer_append(). Copying of memory will only be done when absolutely
needed.
Arbitrary extra metadata can be set on a buffer with gst_buffer_add_meta().
Metadata can be retrieved with gst_buffer_get_meta(). See also #GstMeta.
An element should either unref the buffer or push it out on a src pad
using gst_pad_push() (see #GstPad).
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 #GstBufferPool will be returned to
the pool when the refcount drops to 0.
The #GstParentBufferMeta is a meta which can be attached to a #GstBuffer
to hold a reference to another buffer that is only released when the child
#GstBuffer is released.
Typically, #GstParentBufferMeta is used when the child buffer is directly
using the #GstMemory of the parent buffer, and wants to prevent the parent
buffer from being returned to a buffer pool until the #GstMemory is available
for re-use. (Since: 1.6)
https://gstreamer.freedesktop.org/documentation/gstreamer/gi-index.html
-
Verschachtelte Klassen - Übersicht
Verschachtelte Klassen -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final String
decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
dts is not known or relevant.static final String
duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
when the duration is not known or relevant.static final String
the parent structure
Private field: direct-typestatic final String
a media specific offset for the buffer data.static final String
the last offset contained in this buffer.static final String
pointer to the pool owner of the bufferstatic final String
presentation timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
pts is not known or relevant. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungBuffer()
Creates a newly allocated buffer without any data.Buffer
(PointerContainer pointer) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungaddCustomMeta
(Str name) Creates and adds a #GstCustomMeta for the desired @name.addCustomMeta
(String name) Creates and adds a #GstCustomMeta for the desired @name.Adds metadata for @info to @buffer using the parameters in @params.Adds a #GstParentBufferMeta to @buffer that holds a reference on
@ref until the buffer is freed.addProtectionMeta
(Structure info) Attaches protection metadata to a #GstBuffer.addReferenceTimestampMeta
(Caps reference, long timestamp, long duration) Adds a #GstReferenceTimestampMeta to @buffer that holds a @timestamp and
optionally @duration based on a specific timestamp @reference.Appends all the memory from @buf2 to @buf1.void
appendMemory
(Memory mem) Appends the memory block @mem to @buffer.appendRegion
(Buffer buf2, long offset, long size) Appends @size bytes at @offset from @buf2 to @buf1.copyDeep()
Creates a copy of the given buffer.boolean
Copies the information from @src into @dest.copyRegion
(int flags, long offset, long size) Creates a sub-buffer from @parent at @offset and @size.long
Copies @size bytes starting from @offset in @buffer to @dest.long
Copies @size bytes from @src to @buffer at @offset.Gets all the memory blocks in @buffer.static ClassHandler
getCustomMeta
(Str name) Finds the first #GstCustomMeta on @buffer for the desired @name.getCustomMeta
(String name) Finds the first #GstCustomMeta on @buffer for the desired @name.long
decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
dts is not known or relevant.long
duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
when the duration is not known or relevant.long
a media specific offset for the buffer data.long
the last offset contained in this buffer.pointer to the pool owner of the bufferlong
presentation timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
pts is not known or relevant.int
getFlags()
Gets the #GstBufferFlags flags set on this buffer.static int
static int
Gets the maximum amount of memory blocks that a buffer can hold.getMemory
(int idx) Gets the memory block at index @idx in @buffer.getMemoryRange
(int idx, int length) Gets @length memory blocks in @buffer starting at @idx.getMeta
(long api) Gets the metadata for @api on buffer.int
getNMeta
(long api_type) static long
static TypeSystem.TypeSize
getReferenceTimestampMeta
(Caps reference) Finds the first #GstReferenceTimestampMeta on @buffer that conforms to
@reference.long
getSize()
Gets the total size of the memory blocks in @buffer.long
Gets the total size of the memory blocks in @buffer.long
getSizesRange
(int idx, int length, Int64 offset, Int64 maxsize) Gets the total size of @length memory blocks stating from @idx in @buffer.static long
static TypeSystem.TypeSize
boolean
hasFlags
(int flags) Gives the status of a specific flag on a buffer.void
insertMemory
(int idx, Memory mem) Inserts the memory block @mem into @buffer at @idx.boolean
Checks if all memory blocks in @buffer are writable.boolean
isMemoryRangeWritable
(int idx, int length) Checks if @length memory blocks in @buffer starting from @idx are writable.boolean
Fills @info with the #GstMapInfo of all merged memory blocks in @buffer.boolean
Fills @info with the #GstMapInfo of @length merged memory blocks
starting at @idx in @buffer.int
Compares @size bytes starting from @offset in @buffer with the memory in @mem.long
memset
(long offset, int val, long size) Fills @buf with @size bytes with @val starting from @offset.static Buffer
newAllocateBuffer
(Allocator allocator, long size, AllocationParams params) Tries to create a newly allocated buffer with data of the given size and
extra parameters from @allocator.static Buffer
newMemdupBuffer
(Pointer data, long size) Creates a new buffer of size @size and fills it with a copy of @data.static Buffer
newWrappedBuffer
(Pointer data, long size) Creates a new buffer that wraps the given @data.static Buffer
newWrappedBytesBuffer
(Bytes bytes) Creates a new #GstBuffer that wraps the given @bytes.static Buffer
newWrappedFullBuffer
(int flags, Pointer data, long maxsize, long offset, long size, Pointer user_data, Buffer.OnDestroyNotify notify) Allocates a new buffer that wraps the given memory.int
nMemory()
Gets the amount of memory blocks that this buffer has.peekMemory
(int idx) Gets the memory block at @idx in @buffer.void
prependMemory
(Memory mem) Prepends the memory block @mem to @buffer.void
Removes all the memory blocks in @buffer.void
removeMemory
(int idx) Removes the memory block in @b at index @i.void
removeMemoryRange
(int idx, int length) Removes @length memory blocks in @buffer starting from @idx.boolean
removeMeta
(Meta meta) Removes the metadata for @meta on @buffer.void
replaceAllMemory
(Memory mem) Replaces all memory in @buffer with @mem.void
replaceMemory
(int idx, Memory mem) Replaces the memory block at index @idx in @buffer with @mem.void
replaceMemoryRange
(int idx, int length, Memory mem) Replaces @length memory blocks in @buffer starting at @idx with @mem.void
resize
(long offset, long size) Sets the offset and total size of the memory blocks in @buffer.boolean
resizeRange
(int idx, int length, long offset, long size) Sets the total size of the @length memory blocks starting at @idx in
@buffervoid
setFieldDts
(long dts) decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
dts is not known or relevant.void
setFieldDuration
(long duration) duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
when the duration is not known or relevant.void
setFieldOffset
(long offset) a media specific offset for the buffer data.void
setFieldOffsetEnd
(long offset_end) the last offset contained in this buffer.void
setFieldPool
(BufferPool pool) pointer to the pool owner of the buffervoid
setFieldPts
(long pts) presentation timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
pts is not known or relevant.boolean
setFlags
(int flags) Sets one or more buffer flags on a buffer.void
setSize
(long size) Sets the total size of the memory blocks in @buffer.void
Releases the memory previously mapped with gst_buffer_map().boolean
unsetFlags
(int flags) Clears one or more buffer flags.Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
MINI_OBJECT
the parent structure
Private field: direct-type- Siehe auch:
-
POOL
pointer to the pool owner of the buffer- Siehe auch:
-
PTS
presentation timestamp of the buffer, can be #GST_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.- Siehe auch:
-
DTS
decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
dts is not known or relevant. The dts contains the timestamp when the
media should be processed.- Siehe auch:
-
DURATION
duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
when the duration is not known or relevant.- Siehe auch:
-
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.- Siehe auch:
-
OFFSET_END
the last offset contained in this buffer. It has the same
format as @offset.- Siehe auch:
-
-
Konstruktordetails
-
Buffer
-
Buffer
public Buffer()Creates a newly allocated buffer without any data.
-
-
Methodendetails
-
getClassHandler
-
setFieldPool
pointer to the pool owner of the buffer -
getFieldPool
pointer to the pool owner of the buffer -
setFieldPts
public void setFieldPts(long pts) presentation timestamp of the buffer, can be #GST_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. -
getFieldPts
public long getFieldPts()presentation timestamp of the buffer, can be #GST_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. -
setFieldDts
public void setFieldDts(long dts) decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
dts is not known or relevant. The dts contains the timestamp when the
media should be processed. -
getFieldDts
public long getFieldDts()decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
dts is not known or relevant. The dts contains the timestamp when the
media should be processed. -
setFieldDuration
public void setFieldDuration(long duration) duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
when the duration is not known or relevant. -
getFieldDuration
public long getFieldDuration()duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
when the duration is not known or relevant. -
setFieldOffset
public void setFieldOffset(long 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. -
getFieldOffset
public long getFieldOffset()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. -
setFieldOffsetEnd
public void setFieldOffsetEnd(long offset_end) the last offset contained in this buffer. It has the same
format as @offset. -
getFieldOffsetEnd
public long getFieldOffsetEnd()the last offset contained in this buffer. It has the same
format as @offset. -
newAllocateBuffer
public static Buffer newAllocateBuffer(@Nullable Allocator allocator, long size, @Nullable AllocationParams params) 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, %NULL will be returned. The allocated buffer memory is not cleared.
When @allocator is %NULL, the default memory allocator will be used.
Note that when @size == 0, the buffer will not have memory associated with it.- Parameter:
allocator
- the #GstAllocator to use, or %NULL to use the default allocatorsize
- the size in bytes of the new buffer's data.params
- optional parameters- Gibt zurück:
- a new #GstBuffer
-
newMemdupBuffer
Creates a new buffer of size @size and fills it with a copy of @data.- Parameter:
data
- data to copy into new buffersize
- size of @data in bytes- Gibt zurück:
- a new #GstBuffer
-
newWrappedBuffer
Creates a new buffer that wraps the given @data. The memory will be freed
with g_free() and will be marked writable.- Parameter:
data
- data to wrapsize
- allocated size of @data- Gibt zurück:
- a new #GstBuffer
-
newWrappedBytesBuffer
Creates a new #GstBuffer that wraps the given @bytes. The data inside
@bytes cannot be %NULL and the resulting buffer will be marked as read only.- Parameter:
bytes
- a #GBytes to wrap- Gibt zurück:
- a new #GstBuffer wrapping @bytes
-
newWrappedFullBuffer
public static Buffer newWrappedFullBuffer(int flags, @Nonnull Pointer data, long maxsize, long offset, long size, @Nullable Pointer user_data, Buffer.OnDestroyNotify notify) Allocates 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 @user_data.
The prefix/padding must be filled with 0 if @flags contains
#GST_MEMORY_FLAG_ZERO_PREFIXED and #GST_MEMORY_FLAG_ZERO_PADDED respectively.- Parameter:
flags
- #GstMemoryFlagsdata
- data to wrapmaxsize
- allocated size of @dataoffset
- offset in @datasize
- size of valid datauser_data
- user_datanotify
- called with @user_data when the memory is freed- Gibt zurück:
- a new #GstBuffer
-
addCustomMeta
Creates and adds a #GstCustomMeta for the desired @name. @name must have
been successfully registered with gst_meta_register_custom().- Parameter:
name
- the registered name of the desired custom meta- Gibt zurück:
- The #GstCustomMeta that was added to the buffer
-
addCustomMeta
Creates and adds a #GstCustomMeta for the desired @name. @name must have
been successfully registered with gst_meta_register_custom().- Parameter:
name
- the registered name of the desired custom meta- Gibt zurück:
- The #GstCustomMeta that was added to the buffer
-
addMeta
Adds metadata for @info to @buffer using the parameters in @params.- Parameter:
info
- a #GstMetaInfoparams
- params for @info- Gibt zurück:
- the metadata for the api in @info on @buffer.
-
addParentBufferMeta
Adds a #GstParentBufferMeta to @buffer that holds a reference on
@ref until the buffer is freed.- Parameter:
ref
- a #GstBuffer to ref- Gibt zurück:
- The #GstParentBufferMeta that was added to the buffer
-
addProtectionMeta
Attaches protection metadata to a #GstBuffer.- Parameter:
info
- a #GstStructure holding cryptographic information relating to the sample contained in @buffer. This function takes ownership of @info.- Gibt zurück:
- a pointer to the added #GstProtectionMeta if successful
-
addReferenceTimestampMeta
public ReferenceTimestampMeta addReferenceTimestampMeta(@Nonnull Caps reference, long timestamp, long duration) Adds a #GstReferenceTimestampMeta to @buffer that holds a @timestamp and
optionally @duration based on a specific timestamp @reference. See the
documentation of #GstReferenceTimestampMeta for details.- Parameter:
reference
- identifier for the timestamp reference.timestamp
- timestampduration
- duration, or %GST_CLOCK_TIME_NONE- Gibt zurück:
- The #GstReferenceTimestampMeta that was added to the buffer
-
append
Appends all the memory from @buf2 to @buf1. The result buffer will contain a
concatenation of the memory of @buf1 and @buf2.- Parameter:
buf2
- the second source #GstBuffer to append.- Gibt zurück:
- the new #GstBuffer that contains the memory of the two source buffers.
-
appendMemory
Appends the memory block @mem to @buffer. This function takes
ownership of @mem and thus doesn't increase its refcount.
This function is identical to gst_buffer_insert_memory() with an index of -1.
See gst_buffer_insert_memory() for more details.- Parameter:
mem
- a #GstMemory.
-
appendRegion
Appends @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.- Parameter:
buf2
- the second source #GstBuffer to append.offset
- the offset in @buf2size
- the size or -1 of @buf2- Gibt zurück:
- the new #GstBuffer that contains the memory of the two source buffers.
-
copyDeep
Creates a copy of the given buffer. This will make a newly allocated
copy of the data the source buffer contains.- Gibt zurück:
- a new copy of @buf if the copy succeeded, %NULL otherwise.
-
copyInto
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.- Parameter:
src
- a source #GstBufferflags
- flags indicating what metadata fields should be copied.offset
- offset to copy fromsize
- total size to copy. If -1, all data is copied.- Gibt zurück:
- %TRUE if the copying succeeded, %FALSE otherwise.
-
copyRegion
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 #GST_CLOCK_TIME_NONE and
#GST_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 #GST_CLOCK_TIME_NONE and #GST_BUFFER_OFFSET_NONE.- Parameter:
flags
- the #GstBufferCopyFlagsoffset
- the offset into parent #GstBuffer at which the new sub-buffer begins.size
- the size of the new #GstBuffer sub-buffer, in bytes. If -1, all data is copied.- Gibt zurück:
- the new #GstBuffer or %NULL if copying failed.
-
extract
Copies @size bytes starting from @offset in @buffer to @dest.- Parameter:
offset
- the offset to extractdest
- the destination addresssize
- the size to extract- Gibt zurück:
- The amount of bytes extracted. This value can be lower than @size when @buffer did not contain enough data.
-
fill
Copies @size bytes from @src to @buffer at @offset.- Parameter:
offset
- the offset to fillsrc
- the source addresssize
- the size to fill- Gibt zurück:
- The amount of bytes copied. This value can be lower than @size when @buffer did not contain enough data.
-
getAllMemory
Gets all the memory blocks in @buffer. The memory blocks will be merged
into one large #GstMemory.- Gibt zurück:
- a #GstMemory that contains the merged memory.
-
getCustomMeta
Finds the first #GstCustomMeta on @buffer for the desired @name.- Parameter:
name
- the registered name of the custom meta to retrieve.- Gibt zurück:
- the #GstCustomMeta
-
getCustomMeta
Finds the first #GstCustomMeta on @buffer for the desired @name.- Parameter:
name
- the registered name of the custom meta to retrieve.- Gibt zurück:
- the #GstCustomMeta
-
getFlags
public int getFlags()Gets the #GstBufferFlags flags set on this buffer.- Gibt zurück:
- the flags set on this buffer.
-
getMemory
Gets the memory block at index @idx in @buffer.- Parameter:
idx
- an index- Gibt zurück:
- a #GstMemory that contains the data of the memory block at @idx.
-
getMemoryRange
Gets @length memory blocks in @buffer starting at @idx. The memory blocks will
be merged into one large #GstMemory.
If @length is -1, all memory starting from @idx is merged.- Parameter:
idx
- an indexlength
- a length- Gibt zurück:
- a #GstMemory that contains the merged data of @length blocks starting at @idx.
-
getMeta
Gets the metadata for @api on buffer. When there is no such metadata, %NULL 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 gst_buffer_foreach_meta() instead
and check the `meta->info.api` member for the API type.- Parameter:
api
- the #GType of an API- Gibt zurück:
- the metadata for @api on @buffer.
-
getNMeta
public int getNMeta(long api_type) - Parameter:
api_type
- the #GType of an API- Gibt zurück:
- number of metas of type @api_type on @buffer.
-
getReferenceTimestampMeta
Finds the first #GstReferenceTimestampMeta 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 #GstReferenceTimestampMeta metadata items.- Parameter:
reference
- a reference #GstCaps- Gibt zurück:
- the #GstReferenceTimestampMeta or %NULL when there is no such metadata on @buffer.
-
getSize
public long getSize()Gets the total size of the memory blocks in @buffer.- Gibt zurück:
- total size of the memory blocks in @buffer.
-
getSizes
Gets the total size of the memory blocks in @buffer.
When not %NULL, @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 gst_buffer_resize().- Parameter:
offset
- a pointer to the offsetmaxsize
- a pointer to the maxsize- Gibt zurück:
- total size of the memory blocks in @buffer.
-
getSizesRange
Gets the total size of @length memory blocks stating from @idx in @buffer.
When not %NULL, @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
gst_buffer_resize_range().- Parameter:
idx
- an indexlength
- a lengthoffset
- a pointer to the offsetmaxsize
- a pointer to the maxsize- Gibt zurück:
- total size of @length memory blocks starting at @idx in @buffer.
-
hasFlags
public boolean hasFlags(int flags) Gives the status of a specific flag on a buffer.- Parameter:
flags
- the #GstBufferFlags flag to check.- Gibt zurück:
- %TRUE if all flags in @flags are found on @buffer.
-
insertMemory
Inserts the memory block @mem into @buffer at @idx. This function takes ownership
of @mem and thus doesn't increase its refcount.
Only gst_buffer_get_max_memory() 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.- Parameter:
idx
- the index to add the memory at, or -1 to append it to the endmem
- a #GstMemory.
-
isAllMemoryWritable
public boolean isAllMemoryWritable()Checks 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.- Gibt zurück:
- %TRUE if all memory blocks in @buffer are writable
-
isMemoryRangeWritable
public boolean isMemoryRangeWritable(int idx, int length) Checks 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.- Parameter:
idx
- an indexlength
- a length, should not be 0- Gibt zurück:
- %TRUE if the memory range is writable
-
map
Fills @info with the #GstMapInfo 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 gst_buffer_unmap() after
usage.- Parameter:
info
- info about the mappingflags
- flags for the mapping- Gibt zurück:
- %TRUE if the map succeeded and @info contains valid data.
-
mapRange
Fills @info with the #GstMapInfo 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 gst_buffer_unmap() after usage.- Parameter:
idx
- an indexlength
- a lengthinfo
- info about the mappingflags
- flags for the mapping- Gibt zurück:
- %TRUE if the map succeeded and @info contains valid data.
-
memcmp
Compares @size bytes starting from @offset in @buffer with the memory in @mem.- Parameter:
offset
- the offset in @buffermem
- the memory to comparesize
- the size to compare- Gibt zurück:
- 0 if the memory is equal.
-
memset
public long memset(long offset, int val, long size) Fills @buf with @size bytes with @val starting from @offset.- Parameter:
offset
- the offset in @bufferval
- the value to setsize
- the size to set- Gibt zurück:
- The amount of bytes filled. This value can be lower than @size when @buffer did not contain enough data.
-
nMemory
public int nMemory()Gets the amount of memory blocks that this buffer has. This amount is never
larger than what gst_buffer_get_max_memory() returns.- Gibt zurück:
- the number of memory blocks this buffer is made of.
-
peekMemory
Gets 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.- Parameter:
idx
- an index- Gibt zurück:
- the #GstMemory at @idx.
-
prependMemory
Prepends the memory block @mem to @buffer. This function takes
ownership of @mem and thus doesn't increase its refcount.
This function is identical to gst_buffer_insert_memory() with an index of 0.
See gst_buffer_insert_memory() for more details.- Parameter:
mem
- a #GstMemory.
-
removeAllMemory
public void removeAllMemory()Removes all the memory blocks in @buffer. -
removeMemory
public void removeMemory(int idx) Removes the memory block in @b at index @i.- Parameter:
idx
- an index
-
removeMemoryRange
public void removeMemoryRange(int idx, int length) Removes @length memory blocks in @buffer starting from @idx.
@length can be -1, in which case all memory starting from @idx is removed.- Parameter:
idx
- an indexlength
- a length
-
removeMeta
Removes the metadata for @meta on @buffer.- Parameter:
meta
- a #GstMeta- Gibt zurück:
- %TRUE if the metadata existed and was removed, %FALSE if no such metadata was on @buffer.
-
replaceAllMemory
Replaces all memory in @buffer with @mem.- Parameter:
mem
- a #GstMemory
-
replaceMemory
Replaces the memory block at index @idx in @buffer with @mem.- Parameter:
idx
- an indexmem
- a #GstMemory
-
replaceMemoryRange
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.- Parameter:
idx
- an indexlength
- a length, should not be 0mem
- a #GstMemory
-
resize
public void resize(long offset, long size) Sets the offset and total size of the memory blocks in @buffer.- Parameter:
offset
- the offset adjustmentsize
- the new size or -1 to just adjust the offset
-
resizeRange
public boolean resizeRange(int idx, int length, long offset, long size) Sets the total size of the @length memory blocks starting at @idx in
@buffer- Parameter:
idx
- an indexlength
- a lengthoffset
- the offset adjustmentsize
- the new size or -1 to just adjust the offset- Gibt zurück:
- %TRUE if resizing succeeded, %FALSE otherwise.
-
setFlags
public boolean setFlags(int flags) Sets one or more buffer flags on a buffer.- Parameter:
flags
- the #GstBufferFlags to set.- Gibt zurück:
- %TRUE if @flags were successfully set on buffer.
-
setSize
public void setSize(long size) Sets the total size of the memory blocks in @buffer.- Parameter:
size
- the new size
-
unmap
Releases the memory previously mapped with gst_buffer_map().- Parameter:
info
- a #GstMapInfo
-
unsetFlags
public boolean unsetFlags(int flags) Clears one or more buffer flags.- Parameter:
flags
- the #GstBufferFlags to clear- Gibt zurück:
- true if @flags is successfully cleared from buffer.
-
getMaxMemory
public static int getMaxMemory()Gets 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.- Gibt zurück:
- the maximum amount of memory blocks that a buffer can hold.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-