Commit fdd893cd authored by Siavash Safi's avatar Siavash Safi Committed by Wim Taymans

gst/gstindex.*: Add new function with option to dispose of user_data in resolver.

Original commit message from CVS:
Patch by: Siavash Safi <siavash dot safi at gmail dot com>
* gst/gstindex.c: (gst_index_finalize), (gst_index_set_resolver),
(gst_index_set_resolver_full):
* gst/gstindex.h:
Add new function with option to dispose of user_data in resolver.
Actually call the dispose function when finalizing the object and not
just when changing the resolver/filter.
API: GstIndex::gst_index_set_resolver_full()
* docs/gst/gstreamer-sections.txt:
Add new function to docs. Fixes #515469.
parent 0a5db2e4
2008-02-11 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: Siavash Safi <siavash dot safi at gmail dot com>
* gst/gstindex.c: (gst_index_finalize), (gst_index_set_resolver),
(gst_index_set_resolver_full):
* gst/gstindex.h:
Add new function with option to dispose of user_data in resolver.
Actually call the dispose function when finalizing the object and not
just when changing the resolver/filter.
API: GstIndex::gst_index_set_resolver_full()
* docs/gst/gstreamer-sections.txt:
Add new function to docs. Fixes #515469.
2008-02-11 Sebastian Dröge <slomo@circular-chaos.org>
* gst/gstindex.c: (gst_index_finalize):
......
common @ 05a617c9
Subproject commit 961bb6bd997d7c8da6058534e86b4a1361c0fcea
Subproject commit 05a617c9043ddb78f8578195b18c166d7e1d4c2e
......@@ -791,6 +791,7 @@ gst_index_get_certainty
gst_index_set_filter
gst_index_set_filter_full
gst_index_set_resolver
gst_index_set_resolver_full
gst_index_get_writer_id
gst_index_add_format
gst_index_add_association
......
......@@ -227,6 +227,12 @@ gst_index_finalize (GObject * object)
index->writers = NULL;
}
if (index->filter_user_data && index->filter_user_data_destroy)
index->filter_user_data_destroy (index->filter_user_data);
if (index->resolver_user_data && index->resolver_user_data_destroy)
index->resolver_user_data_destroy (index->resolver_user_data);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -471,11 +477,34 @@ gst_index_set_filter_full (GstIndex * index,
void
gst_index_set_resolver (GstIndex * index,
GstIndexResolver resolver, gpointer user_data)
{
gst_index_set_resolver_full (index, resolver, user_data, NULL);
}
/**
* gst_index_set_resolver_full:
* @index: the index to register the resolver on
* @resolver: the resolver to register
* @user_data: data passed to the resolver function
* @user_data_destroy: destroy function for @user_data
*
* Lets the app register a custom function to map index
* ids to writer descriptions.
*
* Since: 0.10.18
*/
void
gst_index_set_resolver_full (GstIndex * index, GstIndexResolver resolver,
gpointer user_data, GDestroyNotify user_data_destroy)
{
g_return_if_fail (GST_IS_INDEX (index));
if (index->resolver_user_data && index->resolver_user_data_destroy)
index->resolver_user_data_destroy (index->resolver_user_data);
index->resolver = resolver;
index->resolver_user_data = user_data;
index->resolver_user_data_destroy = user_data_destroy;
index->method = GST_INDEX_RESOLVER_CUSTOM;
}
......
......@@ -340,8 +340,11 @@ struct _GstIndex {
GHashTable *writers;
gint last_id;
/* ABI added since 0.10.18 */
GDestroyNotify resolver_user_data_destroy;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
gpointer _gst_reserved[GST_PADDING - 1];
};
struct _GstIndexClass {
......@@ -386,6 +389,9 @@ void gst_index_set_filter_full (GstIndex *index,
GDestroyNotify user_data_destroy);
void gst_index_set_resolver (GstIndex *index,
GstIndexResolver resolver, gpointer user_data);
void gst_index_set_resolver_full (GstIndex *index, GstIndexResolver resolver,
gpointer user_data,
GDestroyNotify user_data_destroy);
gboolean gst_index_get_writer_id (GstIndex *index, GstObject *writer, gint *id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment