mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
buffer: update docs
This commit is contained in:
parent
47eb1fe52b
commit
79aeef49b8
1 changed files with 12 additions and 21 deletions
|
@ -23,7 +23,7 @@
|
||||||
/**
|
/**
|
||||||
* SECTION:gstbuffer
|
* SECTION:gstbuffer
|
||||||
* @short_description: Data-passing buffer type, supporting sub-buffers.
|
* @short_description: Data-passing buffer type, supporting sub-buffers.
|
||||||
* @see_also: #GstPad, #GstMiniObject
|
* @see_also: #GstPad, #GstMiniObject, #GstBufferPool
|
||||||
*
|
*
|
||||||
* Buffers are the basic unit of data transfer in GStreamer. The #GstBuffer
|
* Buffers are the basic unit of data transfer in GStreamer. The #GstBuffer
|
||||||
* type provides all the state necessary to define the regions of memory as
|
* type provides all the state necessary to define the regions of memory as
|
||||||
|
@ -32,39 +32,30 @@
|
||||||
* ensure that neither memory space goes away prematurely.
|
* ensure that neither memory space goes away prematurely.
|
||||||
*
|
*
|
||||||
* Buffers are usually created with gst_buffer_new(). After a buffer has been
|
* 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
|
* created one will typically allocate memory for it and add it to the buffer.
|
||||||
* buffer data. The following example creates a buffer that can hold a given
|
* The following example creates a buffer that can hold a given video frame
|
||||||
* video frame with a given width, height and bits per plane.
|
* with a given width, height and bits per plane.
|
||||||
* <example>
|
* <example>
|
||||||
* <title>Creating a buffer for a video frame</title>
|
* <title>Creating a buffer for a video frame</title>
|
||||||
* <programlisting>
|
* <programlisting>
|
||||||
* GstBuffer *buffer;
|
* GstBuffer *buffer;
|
||||||
|
* GstMemory *memory;
|
||||||
* gint size, width, height, bpp;
|
* gint size, width, height, bpp;
|
||||||
* ...
|
* ...
|
||||||
* size = width * height * bpp;
|
* size = width * height * bpp;
|
||||||
* buffer = gst_buffer_new ();
|
* buffer = gst_buffer_new ();
|
||||||
* GST_BUFFER_SIZE (buffer) = size;
|
* memory = gst_allocator_alloc (NULL, size, 0);
|
||||||
* GST_BUFFER_MALLOCDATA (buffer) = g_malloc (size);
|
* gst_buffer_take_memory (buffer, -1, memory);
|
||||||
* GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
|
|
||||||
* ...
|
* ...
|
||||||
* </programlisting>
|
* </programlisting>
|
||||||
* </example>
|
* </example>
|
||||||
*
|
*
|
||||||
* Alternatively, use gst_buffer_new_and_alloc()
|
* Alternatively, use gst_buffer_new_allocate()
|
||||||
* to create a buffer with preallocated data of a given size.
|
* to create a buffer with preallocated data of a given size.
|
||||||
*
|
*
|
||||||
* The data pointed to by the buffer can be retrieved with the GST_BUFFER_DATA()
|
* Buffers can contain a list of #GstMemory objects. You can retrieve how many
|
||||||
* macro. The size of the data can be found with GST_BUFFER_SIZE(). For buffers
|
* memory objects with gst_buffer_n_memory() and you can get a pointer
|
||||||
* of size 0, the data pointer is undefined (usually NULL) and should never be used.
|
* to memory with gst_buffer_peek_memory()
|
||||||
*
|
|
||||||
* If an element knows what pad you will push the buffer out on, it should use
|
|
||||||
* gst_pad_alloc_buffer() instead to create a buffer. This allows downstream
|
|
||||||
* elements to provide special buffers to write in, like hardware buffers.
|
|
||||||
*
|
|
||||||
* A buffer has a pointer to a #GstCaps describing the media type of the data
|
|
||||||
* in the buffer. Attach caps to the buffer with gst_buffer_set_caps(); this
|
|
||||||
* is typically done before pushing out a buffer using gst_pad_push() so that
|
|
||||||
* the downstream element knows the type of the buffer.
|
|
||||||
*
|
*
|
||||||
* A buffer will usually have timestamps, and a duration, but neither of these
|
* 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
|
* are guaranteed (they may be set to #GST_CLOCK_TIME_NONE). Whenever a
|
||||||
|
@ -107,7 +98,7 @@
|
||||||
* the refcount drops to 0, any data pointed to by the buffer is unreffed as
|
* the refcount drops to 0, any data pointed to by the buffer is unreffed as
|
||||||
* well.
|
* well.
|
||||||
*
|
*
|
||||||
* Last reviewed on March 30, 2011 (0.11.0)
|
* Last reviewed on November 8, 2011 (0.11.2)
|
||||||
*/
|
*/
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue