+2005-08-10 Tim-Philipp Müller <tim at centricular dot net>
+
+ * gst/base/gsttypefindhelper.c: (helper_find_peek),
+ (gst_type_find_helper):
+ The memory returned by gst_type_find_peek() needs to
+ stay valid until the end of a typefind function, and
+ typefind functions may keep results from different
+ offsets around, so we can't just unref the buffer from
+ the previous _peek(), but have to save all buffers
+ returned by _peek() until typefinding is done and only
+ free them then.
+
2005-08-09 Tim-Philipp Müller <tim at centricular dot net>
* docs/gst/gstreamer-sections.txt:
guint best_probability;
GstCaps *caps;
guint64 size;
- GstBuffer *buffer;
+ GList *buffers;
}
GstTypeFindHelper;
offset += find->size;
}
+ /* TODO: is it worth checking our list of buffers for
+ * a match before pulling a new buffer via _getrange()? */
buffer = NULL;
ret = GST_PAD_GETRANGEFUNC (src) (src, offset, size, &buffer);
- if (find->buffer) {
- gst_buffer_unref (find->buffer);
- find->buffer = NULL;
- }
-
if (ret != GST_FLOW_OK)
goto error;
- find->buffer = buffer;
+ find->buffers = g_list_prepend (find->buffers, buffer);
return GST_BUFFER_DATA (buffer);
find.best_probability = 0;
find.caps = NULL;
find.size = size;
- find.buffer = NULL;
+ find.buffers = NULL;
gst_find.data = &find;
gst_find.peek = helper_find_peek;
gst_find.suggest = helper_find_suggest;
if (find.best_probability > 0)
result = find.caps;
- if (find.buffer)
- gst_buffer_unref (find.buffer);
+ for (walk = find.buffers; walk; walk = walk->next)
+ gst_buffer_unref (GST_BUFFER (walk->data));
+ g_list_free (find.buffers);
return result;
}
guint best_probability;
GstCaps *caps;
guint64 size;
- GstBuffer *buffer;
+ GList *buffers;
}
GstTypeFindHelper;
offset += find->size;
}
+ /* TODO: is it worth checking our list of buffers for
+ * a match before pulling a new buffer via _getrange()? */
buffer = NULL;
ret = GST_PAD_GETRANGEFUNC (src) (src, offset, size, &buffer);
- if (find->buffer) {
- gst_buffer_unref (find->buffer);
- find->buffer = NULL;
- }
-
if (ret != GST_FLOW_OK)
goto error;
- find->buffer = buffer;
+ find->buffers = g_list_prepend (find->buffers, buffer);
return GST_BUFFER_DATA (buffer);
find.best_probability = 0;
find.caps = NULL;
find.size = size;
- find.buffer = NULL;
+ find.buffers = NULL;
gst_find.data = &find;
gst_find.peek = helper_find_peek;
gst_find.suggest = helper_find_suggest;
if (find.best_probability > 0)
result = find.caps;
- if (find.buffer)
- gst_buffer_unref (find.buffer);
+ for (walk = find.buffers; walk; walk = walk->next)
+ gst_buffer_unref (GST_BUFFER (walk->data));
+ g_list_free (find.buffers);
return result;
}