mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
gst/gstbuffer.c: (gst_buffer_join): Add function gst_buffer_join() to eventually deprecate gst_buffer_merge(). (bug...
Original commit message from CVS: * gst/gstbuffer.c: (gst_buffer_join): Add function gst_buffer_join() to eventually deprecate gst_buffer_merge(). (bug: #136408) * gst/gstbuffer.h:
This commit is contained in:
parent
e6a6307944
commit
cf56f6b30c
3 changed files with 39 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-03-31 David Schleef <ds@schleef.org>
|
||||
|
||||
* gst/gstbuffer.c: (gst_buffer_join): Add function gst_buffer_join()
|
||||
to eventually deprecate gst_buffer_merge(). (bug: #136408)
|
||||
* gst/gstbuffer.h:
|
||||
|
||||
2004-03-31 David Schleef <ds@schleef.org>
|
||||
|
||||
* gst/gstvalue.c: (gst_value_union_int_int_range),
|
||||
|
|
|
@ -318,8 +318,11 @@ gst_buffer_create_sub (GstBuffer * parent, guint offset, guint size)
|
|||
* buffers. The original source buffers will not be modified or
|
||||
* unref'd.
|
||||
*
|
||||
* Internally is nothing more than a specialized gst_buffer_span(),
|
||||
* so the same optimizations can occur.
|
||||
* WARNING: Incorrect use of this function can lead to memory leaks.
|
||||
* It is recommended to use gst_buffer_join() instead of this function.
|
||||
*
|
||||
* If the buffers point to contiguous areas of memory, the buffer
|
||||
* is created without copying the data.
|
||||
*
|
||||
* Returns: the new #GstBuffer that's the concatenation of the source buffers.
|
||||
*/
|
||||
|
@ -334,6 +337,33 @@ gst_buffer_merge (GstBuffer * buf1, GstBuffer * buf2)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_join:
|
||||
* @buf1: a first source #GstBuffer to merge.
|
||||
* @buf2: the second source #GstBuffer to merge.
|
||||
*
|
||||
* Create a new buffer that is the concatenation of the two source
|
||||
* buffers. The original buffers are unreferenced.
|
||||
*
|
||||
* If the buffers point to contiguous areas of memory, the buffer
|
||||
* is created without copying the data.
|
||||
*
|
||||
* Returns: the new #GstBuffer that's the concatenation of the source buffers.
|
||||
*/
|
||||
GstBuffer *
|
||||
gst_buffer_join (GstBuffer * buf1, GstBuffer * buf2)
|
||||
{
|
||||
GstBuffer *result;
|
||||
|
||||
/* we're just a specific case of the more general gst_buffer_span() */
|
||||
result = gst_buffer_span (buf1, 0, buf2, buf1->size + buf2->size);
|
||||
|
||||
gst_buffer_unref (buf1);
|
||||
gst_buffer_unref (buf2);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_is_span_fast:
|
||||
* @buf1: a first source #GstBuffer.
|
||||
|
|
|
@ -138,6 +138,7 @@ GstBuffer* gst_buffer_create_sub (GstBuffer *parent, guint offset, guint size);
|
|||
|
||||
/* merge, span, or append two buffers, intelligently */
|
||||
GstBuffer* gst_buffer_merge (GstBuffer *buf1, GstBuffer *buf2);
|
||||
GstBuffer* gst_buffer_join (GstBuffer *buf1, GstBuffer *buf2);
|
||||
gboolean gst_buffer_is_span_fast (GstBuffer *buf1, GstBuffer *buf2);
|
||||
GstBuffer* gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len);
|
||||
|
||||
|
|
Loading…
Reference in a new issue