summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-06-29 11:56:10 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-06-29 11:56:10 +0200
commit92b0f32d74f620518ba8569f63cf57c8682ff9a8 (patch)
tree994b3296ba456cf6b7ff13e55edf248c06f66c25
parent939f6045b10eb810384fec87c4a5215a7a644eb9 (diff)
bufferlist: use faster gst_buffer_list_get()
Use the faster gst_buffer_list_get() to get the first buffer of a list.
-rw-r--r--gst/gstpad.c14
-rw-r--r--libs/gst/base/gstbasesink.c27
2 files changed, 7 insertions, 34 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 8d0fa47b9..9dc09ef63 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -3987,18 +3987,12 @@ gst_pad_data_get_caps (gboolean is_buffer, void *data)
if (G_LIKELY (is_buffer)) {
caps = GST_BUFFER_CAPS (data);
} else {
- GstBufferListIterator *it;
GstBuffer *buf;
- caps = NULL;
- it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (data));
- if (gst_buffer_list_iterator_next_group (it)) {
- buf = gst_buffer_list_iterator_next (it);
- if (buf != NULL) {
- caps = GST_BUFFER_CAPS (buf);
- }
- }
- gst_buffer_list_iterator_free (it);
+ if ((buf = gst_buffer_list_get (GST_BUFFER_LIST_CAST (data), 0, 0)))
+ caps = GST_BUFFER_CAPS (buf);
+ else
+ caps = NULL;
}
return caps;
}
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
index a72807474..780fc3f72 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -2660,14 +2660,7 @@ gst_base_sink_render_object (GstBaseSink * basesink, GstPad * pad,
* If buffer list, use the first group buffer within the list
* for syncing
*/
- GstBufferListIterator *it;
- gboolean got_group;
-
- it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (obj));
- got_group = gst_buffer_list_iterator_next_group (it);
- g_assert (got_group);
- sync_obj = gst_buffer_list_iterator_next (it);
- gst_buffer_list_iterator_free (it);
+ sync_obj = gst_buffer_list_get (GST_BUFFER_LIST_CAST (obj), 0, 0);
g_assert (NULL != sync_obj);
} else {
sync_obj = obj;
@@ -2850,14 +2843,7 @@ gst_base_sink_preroll_object (GstBaseSink * basesink, gboolean is_list,
GstClockTime timestamp;
if (is_list) {
- GstBufferListIterator *it;
- gboolean got_group;
-
- it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (obj));
- got_group = gst_buffer_list_iterator_next_group (it);
- g_assert (got_group);
- buf = gst_buffer_list_iterator_next (it);
- gst_buffer_list_iterator_free (it);
+ buf = gst_buffer_list_get (GST_BUFFER_LIST_CAST (obj), 0, 0);
g_assert (NULL != buf);
} else {
buf = GST_BUFFER_CAST (obj);
@@ -3277,14 +3263,7 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
goto was_eos;
if (is_list) {
- GstBufferListIterator *it;
- gboolean got_group;
-
- it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (obj));
- got_group = gst_buffer_list_iterator_next_group (it);
- g_assert (got_group);
- time_buf = gst_buffer_list_iterator_next (it);
- gst_buffer_list_iterator_free (it);
+ time_buf = gst_buffer_list_get (GST_BUFFER_LIST_CAST (obj), 0, 0);
g_assert (NULL != time_buf);
} else {
time_buf = GST_BUFFER_CAST (obj);