diff options
author | Hyunjun Ko <zzoon.ko@samsung.com> | 2015-06-24 14:18:47 +0900 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-06-24 10:52:56 +0200 |
commit | 7ecef53dbb46c5938ef3019fcf79f162c3caa845 (patch) | |
tree | 4219395b73dfc4842422c33d30168798c91c2703 /gst | |
parent | fabe966b0a3be259dc2261109811c9de855b7652 (diff) |
bufferlist: add new api gst_buffer_list_copy_deep
https://bugzilla.gnome.org/show_bug.cgi?id=751420
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstbufferlist.c | 30 | ||||
-rw-r--r-- | gst/gstbufferlist.h | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gst/gstbufferlist.c b/gst/gstbufferlist.c index 3b2b9a0d8..2ae3f2f48 100644 --- a/gst/gstbufferlist.c +++ b/gst/gstbufferlist.c @@ -364,3 +364,33 @@ gst_buffer_list_remove (GstBufferList * list, guint idx, guint length) gst_buffer_list_remove_range_internal (list, idx, length, TRUE); } + +/** + * gst_buffer_list_copy_deep: + * @list: a #GstBufferList + * + * Create a copy of the given buffer list. This will make a newly allocated + * copy of the buffer that the source buffer list contains. + * + * Returns: (transfer full): a new copy of @list. + * + * Since: 1.6 + */ +GstBufferList * +gst_buffer_list_copy_deep (const GstBufferList * list) +{ + guint i, len; + GstBufferList *result = NULL; + + g_return_val_if_fail (GST_IS_BUFFER_LIST (list), NULL); + + result = gst_buffer_list_new (); + + len = list->n_buffers; + for (i = 0; i < len; i++) { + GstBuffer *old = list->buffers[i]; + gst_buffer_list_insert (result, i, gst_buffer_copy_deep (old)); + } + + return result; +} diff --git a/gst/gstbufferlist.h b/gst/gstbufferlist.h index e5ddb0892..96ea72761 100644 --- a/gst/gstbufferlist.h +++ b/gst/gstbufferlist.h @@ -158,6 +158,7 @@ void gst_buffer_list_remove (GstBufferList *l gboolean gst_buffer_list_foreach (GstBufferList *list, GstBufferListFunc func, gpointer user_data); +GstBufferList * gst_buffer_list_copy_deep (const GstBufferList * list); #define gst_buffer_list_add(l,b) gst_buffer_list_insert((l),-1,(b)); |