GstBuffer
Data-passing buffer type, supporting sub-buffers and metadata
Buffers are the basic unit of data transfer in GST. The GstBuffer type
provides all the state necessary to define a region of memory as part of a
stream. Sub-buffer are also supported, allowing a smaller region of a
buffer to become its own buffer, with mechanisms in place to ensure that
neither memory space goes away. Metadata is supported as a list of
pointers to arbitrary metadata.
Buffers are usually created with gst_buffer_new(). After a buffer has been
created one will typically allocate memory for it and set the size of the
buffer data.
GstBuffer *buffer;
gint size, widht, height, bpp;
size = width * height * bpp;
buffer = gst_buffer_new ();
GST_BUFFER_SIZE (buffer) = size;
GST_BUFFER_DATA (buffer) = g_alloc (size);
...
GstBuffers can also be created from a GstBufferPool with
gst_buffer_new_from_pool(). The bufferpool can be obtained from a
peer element with gst_pad_get_bufferpool().
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.
To efficiently create a smaller buffer out of an existing one, you can
use gst_buffer_create_sub().
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 it
a certain flag is set.
Buffers usually are freed by unreffing them with gst_buffer_unref().
gst_buffer_destroy() can also be used to effectively destroy the buffer
regardless of the refcount (dangerous).
#GstBufferPool, #GstPad
Get the flags from this buffer.
@buf: GstBuffer to retrieve the flags from
Gives the status of a given flag.
@buf: GstBuffer to query
@flag: the flag to check
Set a flag in a buffer.
@buf: GstBuffer to query
@flag: the flag to set
Clear a flag in a buffer.
@buf: GstBuffer to modify
@flag: the flag to clear
Retrieves a pointer to the data element of this buffer
@buf: GstBuffer
Get the size of the data in this buffer.
@buf: GstBuffer
Get the offset in the source file of this buffer.
@buf: GstBuffer
Gets the maximun size of this buffer.
@buf: GstBuffer
Get the timestamp for this buffer.
@buf: GstBuffer
Get the bufferpool for this buffer.
@buf: GstBuffer
Get the bufferpool private data.
@buf: GstBuffer
@pool:
This macro will obtain a lock on the object, making serialization
possible.
@buf: GstBuffer to lock
This macro will try to obtain a lock on the object, but will return with
FALSE if it can't get it immediately.
@buf: GstBuffer to try to lock
This macro releases a lock on the object.
@buf: GstBuffer to unlock.
Get the parent of this buffer. The parent is set on subbuffers.
@buf: GstBuffer to get the parent of.
Get the maximun age of a buffer.
@buf: GstBuffer to get the maxage of.
This function is used to copy the buffer contents.
@srcbuf: the src buffer
@dstbuf: the destination buffer
The function called when the buffer data has to be freed
@buf: the buffer to clear the buffer data of.
@GST_BUFFER_READONLY: the buffer is read only
@GST_BUFFER_ORIGINAL: this buffer not a copy
@GST_BUFFER_DONTFREE: do not try to free the data when this buffer is unref-ed
@GST_BUFFER_FLUSH: this buffer is not related to previous buffers. This flag is mainly
used when data in a stream has been skipped
@GST_BUFFER_EOS: this buffer is the last one in the stream
@GST_BUFFER_DISCONTINUOUS: The buffer has a discontinuity
@data_type:
@lock:
@data:
@size:
@maxsize:
@offset:
@timestamp:
@maxage:
@parent:
@pool:
@pool_private:
@free:
@Returns:
@pool:
@location:
@size:
@Returns:
@buffer:
@Returns:
@parent:
@offset:
@size:
@Returns:
@buf:
@buf2:
@Returns:
@buffer:
@append:
@buffer:
@buffer:
@count:
@buffer:
@buffer: