From 88e12228cfe01bdf01ab69359efe0aba11c623f3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 29 Oct 2011 08:24:12 +0200 Subject: [PATCH] bufferlist: clean up API gst_buffer_list_len() -> gst_buffer_list_length() gst_buffer_list_sized_new() -> gst_buffer_list_new_sized() --- docs/gst/gstreamer-sections.txt | 4 ++-- docs/random/porting-to-0.11.txt | 5 ++++- gst/gstbufferlist.c | 12 ++++++------ gst/gstbufferlist.h | 4 ++-- gst/gstpad.c | 2 +- libs/gst/base/gstbasesink.c | 2 +- plugins/elements/gstmultiqueue.c | 2 +- tests/check/gst/gstbufferlist.c | 8 ++++---- win32/common/libgstreamer.def | 4 ++-- 9 files changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 4bfc2a04aa..b8c975b38f 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -310,8 +310,8 @@ GST_BUFFER_POOL_GET_CLASS GstBufferList gst_buffer_list_new -gst_buffer_list_sized_new -gst_buffer_list_len +gst_buffer_list_new_sized +gst_buffer_list_length gst_buffer_list_add gst_buffer_list_insert gst_buffer_list_remove diff --git a/docs/random/porting-to-0.11.txt b/docs/random/porting-to-0.11.txt index 8d393d24e4..9785164d83 100644 --- a/docs/random/porting-to-0.11.txt +++ b/docs/random/porting-to-0.11.txt @@ -224,12 +224,15 @@ The 0.11 porting guide The object is reduced to encapsulating an array of buffers that you can send with the regular gst_pad_push_list. The iterator is not needed anymore - because you can simply use gst_buffer_list_len() and gst_buffer_list_get() + because you can simply use gst_buffer_list_length() and gst_buffer_list_get() to iterate the array. For dealing with the groups, it's now needed to add the memory blocks to GstBuffer and use the normal buffer API to get and merge the groups. + gst_buffer_list_sized_new() -> gst_buffer_list_new_sized() + gst_buffer_list_len() -> gst_buffer_list_length() + * GstStructure The GArray of the structure fields are moved to private part and are not diff --git a/gst/gstbufferlist.c b/gst/gstbufferlist.c index 06f817ff79..cc5ddf26d1 100644 --- a/gst/gstbufferlist.c +++ b/gst/gstbufferlist.c @@ -69,7 +69,7 @@ _gst_buffer_list_copy (GstBufferList * list) guint i, len; len = list->array->len; - copy = gst_buffer_list_sized_new (len); + copy = gst_buffer_list_new_sized (len); /* add and ref all buffers in the array */ for (i = 0; i < len; i++) { @@ -110,7 +110,7 @@ gst_buffer_list_init (GstBufferList * list, gsize size, guint asize) } /** - * gst_buffer_list_sized_new: + * gst_buffer_list_new_sized: * @size: an initial reserved size * * Creates a new, empty #GstBufferList. The caller is responsible for unreffing @@ -125,7 +125,7 @@ gst_buffer_list_init (GstBufferList * list, gsize size, guint asize) * Since: 0.10.24 */ GstBufferList * -gst_buffer_list_sized_new (guint size) +gst_buffer_list_new_sized (guint size) { GstBufferList *list; @@ -154,11 +154,11 @@ gst_buffer_list_sized_new (guint size) GstBufferList * gst_buffer_list_new (void) { - return gst_buffer_list_sized_new (8); + return gst_buffer_list_new_sized (8); } /** - * gst_buffer_list_len: + * gst_buffer_list_length: * @list: a #GstBufferList * * Returns the number of buffers in @list. @@ -168,7 +168,7 @@ gst_buffer_list_new (void) * Since: 0.10.24 */ guint -gst_buffer_list_len (GstBufferList * list) +gst_buffer_list_length (GstBufferList * list) { g_return_val_if_fail (GST_IS_BUFFER_LIST (list), 0); diff --git a/gst/gstbufferlist.h b/gst/gstbufferlist.h index 7275dad098..d160b04ba9 100644 --- a/gst/gstbufferlist.h +++ b/gst/gstbufferlist.h @@ -157,9 +157,9 @@ GType gst_buffer_list_get_type (void); /* allocation */ GstBufferList * gst_buffer_list_new (void); -GstBufferList * gst_buffer_list_sized_new (guint size); +GstBufferList * gst_buffer_list_new_sized (guint size); -guint gst_buffer_list_len (GstBufferList *list); +guint gst_buffer_list_length (GstBufferList *list); GstBuffer * gst_buffer_list_get (GstBufferList *list, guint idx); void gst_buffer_list_insert (GstBufferList *list, guint idx, GstBuffer *buffer); diff --git a/gst/gstpad.c b/gst/gstpad.c index e54d6127fe..1e1d8b7c4d 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -3748,7 +3748,7 @@ gst_pad_chain_list_default (GstPad * pad, GstBufferList * list) GST_INFO_OBJECT (pad, "chaining each group in list as a merged buffer"); - len = gst_buffer_list_len (list); + len = gst_buffer_list_length (list); ret = GST_FLOW_OK; for (i = 0; i < len; i++) { diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 82b79e1c80..0d17691b7b 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -3661,7 +3661,7 @@ gst_base_sink_chain_list (GstPad * pad, GstBufferList * list) GST_INFO_OBJECT (pad, "chaining each group in list as a merged buffer"); - len = gst_buffer_list_len (list); + len = gst_buffer_list_length (list); result = GST_FLOW_OK; for (i = 0; i < len; i++) { diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 1e4c06dd5a..73fec6c0da 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -991,7 +991,7 @@ get_running_time (GstSegment * segment, GstMiniObject * object, gboolean end) gint i, n; GstBuffer *buf; - n = gst_buffer_list_len (list); + n = gst_buffer_list_length (list); for (i = 0; i < n; i++) { buf = gst_buffer_list_get (list, i); if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { diff --git a/tests/check/gst/gstbufferlist.c b/tests/check/gst/gstbufferlist.c index b65dac3b85..55ca748e20 100644 --- a/tests/check/gst/gstbufferlist.c +++ b/tests/check/gst/gstbufferlist.c @@ -85,7 +85,7 @@ GST_START_TEST (test_add_and_iterate) GstBuffer *buf2; /* buffer list is initially empty */ - fail_unless (gst_buffer_list_len (list) == 0); + fail_unless (gst_buffer_list_length (list) == 0); ASSERT_CRITICAL (gst_buffer_list_insert (list, 0, NULL)); ASSERT_CRITICAL (gst_buffer_list_insert (NULL, 0, NULL)); @@ -93,16 +93,16 @@ GST_START_TEST (test_add_and_iterate) buf1 = gst_buffer_new (); /* add a group of 2 buffers */ - fail_unless (gst_buffer_list_len (list) == 0); + fail_unless (gst_buffer_list_length (list) == 0); ASSERT_CRITICAL (gst_buffer_list_insert (list, -1, NULL)); ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 1); gst_buffer_list_add (list, buf1); ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 1); /* list takes ownership */ - fail_unless (gst_buffer_list_len (list) == 1); + fail_unless (gst_buffer_list_length (list) == 1); buf2 = gst_buffer_new (); gst_buffer_list_add (list, buf2); ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 1); - fail_unless (gst_buffer_list_len (list) == 2); + fail_unless (gst_buffer_list_length (list) == 2); } GST_END_TEST; diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index 6c6896a8c7..4b14057fbe 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -108,10 +108,10 @@ EXPORTS gst_buffer_list_get gst_buffer_list_get_type gst_buffer_list_insert - gst_buffer_list_len + gst_buffer_list_length gst_buffer_list_new + gst_buffer_list_new_sized gst_buffer_list_remove - gst_buffer_list_sized_new gst_buffer_map gst_buffer_memcmp gst_buffer_memset