/** * gst_buffer_list_insert: * @list: a #GstBufferList * @idx: the index * @buffer: (transfer full): a #GstBuffer * * Insert @buffer at @idx in @list. Other buffers are moved to make room for * this new buffer. * * A -1 value for @idx will append the buffer at the end. */ void gst_buffer_list_insert (GstBufferList * list, gint idx, GstBuffer * buffer) { guint want_alloc; g_return_if_fail (GST_IS_BUFFER_LIST (list)); g_return_if_fail (buffer != NULL); g_return_if_fail (gst_buffer_list_is_writable (list)); if (idx == -1 && list->n_buffers < list->n_allocated) { list->buffers[list->n_buffers++] = buffer; return; } if (idx == -1 || idx > list->n_buffers) idx = list->n_buffers; want_alloc = list->n_buffers + 1; if (want_alloc > list->n_allocated) { want_alloc = MAX (GST_ROUND_UP_16 (want_alloc), list->n_allocated * 2); if (GST_BUFFER_LIST_IS_USING_DYNAMIC_ARRAY (list)) { list->buffers = g_renew (GstBuffer *, list->buffers, want_alloc); } else {
/** * gst_buffer_list_iterator_do: * @it: a #GstBufferListIterator * @do_func: the function to be called * @user_data: the gpointer to optional user data. * * Calls the given function for the last buffer returned by * gst_buffer_list_iterator_next(). gst_buffer_list_iterator_next() must have * been called on @it before this function is called. * gst_buffer_list_iterator_remove() and gst_buffer_list_iterator_steal() must * not have been called since the last call to gst_buffer_list_iterator_next(). * * See #GstBufferListDoFunction for more details. * * Returns: the return value from @do_func * * Since: 0.10.24 */ GstBuffer * gst_buffer_list_iterator_do (GstBufferListIterator * it, GstBufferListDoFunction do_func, gpointer user_data) { GstBuffer *buffer; g_return_val_if_fail (it != NULL, NULL); g_return_val_if_fail (it->last_returned != NULL, NULL); g_return_val_if_fail (it->last_returned->data != STOLEN, NULL); g_return_val_if_fail (do_func != NULL, NULL); g_return_val_if_fail (gst_buffer_list_is_writable (it->list), NULL); g_assert (it->last_returned->data != GROUP_START); buffer = gst_buffer_list_iterator_steal (it); buffer = do_func (buffer, user_data); if (buffer == NULL) { gst_buffer_list_iterator_remove (it); } else { gst_buffer_list_iterator_take (it, buffer); } return buffer; }