~ubuntu-branches/ubuntu/trusty/gstreamer1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to gst/gstbufferlist.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2012-08-08 18:12:33 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120808181233-riejwxprfsxh1njl
Tags: 0.11.93-1
* New upstream release:
  + debian/libgstreamer.symbols:
    - Update symbols file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 * GstBufferList:
48
48
 *
49
49
 * Opaque list of grouped buffers.
50
 
 *
51
 
 * Since: 0.10.24
52
50
 */
53
51
struct _GstBufferList
54
52
{
97
95
    gst_buffer_unref (g_array_index (list->array, GstBuffer *, i));
98
96
  g_array_free (list->array, TRUE);
99
97
 
100
 
  g_slice_free1 (GST_MINI_OBJECT_SIZE (list), list);
 
98
  g_slice_free1 (sizeof (GstBufferList), list);
101
99
}
102
100
 
103
101
static void
104
 
gst_buffer_list_init (GstBufferList * list, gsize size, guint asize)
 
102
gst_buffer_list_init (GstBufferList * list, guint asize)
105
103
{
106
 
  gst_mini_object_init (GST_MINI_OBJECT_CAST (list), _gst_buffer_list_type,
107
 
      size);
108
 
 
109
 
  list->mini_object.copy = (GstMiniObjectCopyFunction) _gst_buffer_list_copy;
110
 
  list->mini_object.free = (GstMiniObjectFreeFunction) _gst_buffer_list_free;
 
104
  gst_mini_object_init (GST_MINI_OBJECT_CAST (list), 0, _gst_buffer_list_type,
 
105
      (GstMiniObjectCopyFunction) _gst_buffer_list_copy, NULL,
 
106
      (GstMiniObjectFreeFunction) _gst_buffer_list_free);
111
107
 
112
108
  list->array = g_array_sized_new (FALSE, FALSE, sizeof (GstBuffer *), asize);
113
109
 
126
122
 *
127
123
 * Returns: (transfer full): the new #GstBufferList. gst_buffer_list_unref()
128
124
 *     after usage.
129
 
 *
130
 
 * Since: 0.10.24
131
125
 */
132
126
GstBufferList *
133
127
gst_buffer_list_new_sized (guint size)
138
132
 
139
133
  GST_LOG ("new %p", list);
140
134
 
141
 
  gst_buffer_list_init (list, sizeof (GstBufferList), size);
 
135
  gst_buffer_list_init (list, size);
142
136
 
143
137
  return list;
144
138
}
153
147
 *
154
148
 * Returns: (transfer full): the new #GstBufferList. gst_buffer_list_unref()
155
149
 *     after usage.
156
 
 *
157
 
 * Since: 0.10.24
158
150
 */
159
151
GstBufferList *
160
152
gst_buffer_list_new (void)
169
161
 * Returns the number of buffers in @list.
170
162
 *
171
163
 * Returns: the number of buffers in the buffer list
172
 
 *
173
 
 * Since: 0.10.24
174
164
 */
175
165
guint
176
166
gst_buffer_list_length (GstBufferList * list)
192
182
 * of @func define if this function returns or if the remaining buffers in
193
183
 * the list should be skipped.
194
184
 *
195
 
 * Since: 0.10.24
 
185
 * Returns: %TRUE when @func returned %TRUE for each buffer in @list or when
 
186
 * @list is empty.
196
187
 */
197
 
void
 
188
gboolean
198
189
gst_buffer_list_foreach (GstBufferList * list, GstBufferListFunc func,
199
190
    gpointer user_data)
200
191
{
201
192
  guint i, len;
 
193
  gboolean ret = TRUE;
202
194
 
203
 
  g_return_if_fail (GST_IS_BUFFER_LIST (list));
204
 
  g_return_if_fail (func != NULL);
 
195
  g_return_val_if_fail (GST_IS_BUFFER_LIST (list), FALSE);
 
196
  g_return_val_if_fail (func != NULL, FALSE);
205
197
 
206
198
  len = list->array->len;
207
199
  for (i = 0; i < len;) {
208
200
    GstBuffer *buf, *buf_ret;
209
 
    gboolean ret;
210
201
 
211
202
    buf = buf_ret = g_array_index (list->array, GstBuffer *, i);
212
203
    ret = func (&buf_ret, i, user_data);
228
219
    if (buf_ret != NULL)
229
220
      i++;
230
221
  }
 
222
  return ret;
231
223
}
232
224
 
233
225
/**
239
231
 *
240
232
 * Returns: (transfer none): the buffer at @idx in @group or NULL when there
241
233
 *     is no buffer. The buffer remains valid as long as @list is valid.
242
 
 *
243
 
 * Since: 0.10.24
244
234
 */
245
235
GstBuffer *
246
236
gst_buffer_list_get (GstBufferList * list, guint idx)
256
246
}
257
247
 
258
248
/**
 
249
 * gst_buffer_list_add:
 
250
 * @l: a #GstBufferList
 
251
 * @b: a #GstBuffer
 
252
 *
 
253
 * Append @b at the end of @l.
 
254
 */
 
255
/**
259
256
 * gst_buffer_list_insert:
260
257
 * @list: a #GstBufferList
261
258
 * @idx: the index
262
 
 * @buffer: a #GstBuffer
 
259
 * @buffer: (transfer full): a #GstBuffer
263
260
 *
264
261
 * Insert @buffer at @idx in @list. Other buffers are moved to make room for
265
262
 * this new buffer.
267
264
 * A -1 value for @idx will append the buffer at the end.
268
265
 */
269
266
void
270
 
gst_buffer_list_insert (GstBufferList * list, guint idx, GstBuffer * buffer)
 
267
gst_buffer_list_insert (GstBufferList * list, gint idx, GstBuffer * buffer)
271
268
{
272
269
  g_return_if_fail (GST_IS_BUFFER_LIST (list));
273
270
  g_return_if_fail (buffer != NULL);