mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-08 16:35:40 +00:00
bufferlist: clean up API
gst_buffer_list_len() -> gst_buffer_list_length() gst_buffer_list_sized_new() -> gst_buffer_list_new_sized()
This commit is contained in:
parent
2e29d8fc06
commit
88e12228cf
9 changed files with 23 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue