2005-11-19 Andy Wingo <wingo@pobox.com>
+ * gst/gstindex.h (GstIndex): Add field for user_data_destroy. We
+ don't have a dispose function, so it won't get called when the
+ object is unreffed, but oh well!
+
+ * gst/gstindex.c (gst_index_set_filter_full): New API function,
+ allows a destroy function to be set so user_data can be freed.
+ Fixes #168438.
+ (gst_index_set_filter): Call gst_index_set_filter_full.
+
* check/gst/gstvalue.c (test_string): Add test for bug #165650.
* gst/gstvalue.c (gst_string_wrap): Trying to serialize a NULL
{
g_return_if_fail (GST_IS_INDEX (index));
+ gst_index_set_filter_full (index, filter, user_data, NULL);
+}
+
+/**
+ * gst_index_set_filter_full:
+ * @index: the index to register the filter on
+ * @filter: the filter to register
+ * @user_data: data passed to the filter function
+ * @user_data_destroy: function to call when @user_data is unset
+ *
+ * Lets the app register a custom filter function so that
+ * it can select what entries should be stored in the index.
+ */
+void
+gst_index_set_filter_full (GstIndex * index,
+ GstIndexFilter filter, gpointer user_data, GDestroyNotify user_data_destroy)
+{
+ g_return_if_fail (GST_IS_INDEX (index));
+
+ if (index->filter_user_data && index->filter_user_data_destroy)
+ index->filter_user_data_destroy (index->filter_user_data);
+
index->filter = filter;
index->filter_user_data = user_data;
+ index->filter_user_data_destroy = user_data_destroy;
}
/**
GstIndexFilter filter;
gpointer filter_user_data;
+ GDestroyNotify filter_user_data_destroy;
GHashTable *writers;
gint last_id;
void gst_index_set_filter (GstIndex *index,
GstIndexFilter filter, gpointer user_data);
+void gst_index_set_filter_full (GstIndex *index,
+ GstIndexFilter filter, gpointer user_data,
+ GDestroyNotify user_data_destroy);
void gst_index_set_resolver (GstIndex *index,
GstIndexResolver resolver, gpointer user_data);