gst/gstindex.h (GstIndex): Add field for user_data_destroy. We don't have a dispose function, so it won't get called ...

Original commit message from CVS:
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.
This commit is contained in:
Andy Wingo 2005-11-19 17:26:27 +00:00
parent 77d95482f6
commit 4a61de0e11
3 changed files with 36 additions and 0 deletions

View file

@ -1,5 +1,14 @@
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

View file

@ -402,8 +402,31 @@ gst_index_set_filter (GstIndex * index,
{
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;
}
/**

View file

@ -327,6 +327,7 @@ struct _GstIndex {
GstIndexFilter filter;
gpointer filter_user_data;
GDestroyNotify filter_user_data_destroy;
GHashTable *writers;
gint last_id;
@ -369,6 +370,9 @@ GstIndexCertainty gst_index_get_certainty (GstIndex *index);
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);