Added gst_buffer_copy(). It's not complete, it should copy more stuff like flags and such. FIXME.

Original commit message from CVS:
Added gst_buffer_copy().  It's not complete, it should copy more stuff
like flags and such.  FIXME.
This commit is contained in:
Erik Walthinsen 2001-04-22 01:30:19 +00:00
parent 8e344d5d62
commit 819efb4e90
2 changed files with 21 additions and 0 deletions

View file

@ -395,3 +395,21 @@ gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta)
buffer->metas = g_slist_remove (buffer->metas, meta); buffer->metas = g_slist_remove (buffer->metas, meta);
gst_meta_unref (meta); gst_meta_unref (meta);
} }
GstBuffer *
gst_buffer_copy (GstBuffer *buf)
{
GstBuffer *newbuf;
/***** FIXME: this is not complete, it doesn't copy everything it should *****/
newbuf = gst_buffer_new();
GST_BUFFER_SIZE(newbuf) = GST_BUFFER_DATA(buf);
GST_BUFFER_DATA(newbuf) = malloc(GST_BUFFER_SIZE(buf));
memcpy(GST_BUFFER_DATA(newbuf),GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));
GST_BUFFER_OFFSET(newbuf) = GST_BUFFER_OFFSET(buf);
GST_BUFFER_TIMESTAMP(newbuf) = GST_BUFFER_TIMESTAMP(buf);
return newbuf;
}

View file

@ -143,6 +143,9 @@ void gst_buffer_unref (GstBuffer *buffer);
/* destroying the buffer */ /* destroying the buffer */
void gst_buffer_destroy (GstBuffer *buffer); void gst_buffer_destroy (GstBuffer *buffer);
/* copy buffer */
GstBuffer* gst_buffer_copy (GstBuffer *buffer);
/* add, retrieve, and remove metadata from the buffer */ /* add, retrieve, and remove metadata from the buffer */
void gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta); void gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta);
void gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta); void gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta);