diff options
author | Erik Walthinsen <omega@temple-baptist.org> | 2001-04-22 01:30:19 +0000 |
---|---|---|
committer | Erik Walthinsen <omega@temple-baptist.org> | 2001-04-22 01:30:19 +0000 |
commit | 819efb4e9044f0005e49d02acfb9efd3bafd3aab (patch) | |
tree | 57b8ef679a568c0ef9964d458b66ad76e0f66954 | |
parent | 8e344d5d620a4069b2951b8be9c470f1c9d744cb (diff) |
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.
-rw-r--r-- | gst/gstbuffer.c | 18 | ||||
-rw-r--r-- | gst/gstbuffer.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 5f29ab84d..db9c9d429 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -395,3 +395,21 @@ gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta) buffer->metas = g_slist_remove (buffer->metas, 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; +} diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h index bf9fe23f3..1a89f9a8a 100644 --- a/gst/gstbuffer.h +++ b/gst/gstbuffer.h @@ -143,6 +143,9 @@ void gst_buffer_unref (GstBuffer *buffer); /* destroying the buffer */ void gst_buffer_destroy (GstBuffer *buffer); +/* copy buffer */ +GstBuffer* gst_buffer_copy (GstBuffer *buffer); + /* add, retrieve, and remove metadata from the buffer */ void gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta); void gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta); |