From fdd893cd1767a2c0bd5cee4cc346733d852a14f1 Mon Sep 17 00:00:00 2001 From: Siavash Safi Date: Mon, 11 Feb 2008 17:53:57 +0000 Subject: [PATCH] gst/gstindex.*: Add new function with option to dispose of user_data in resolver. Original commit message from CVS: Patch by: Siavash Safi * 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. --- ChangeLog | 15 +++++++++++++++ common | 2 +- docs/gst/gstreamer-sections.txt | 1 + gst/gstindex.c | 29 +++++++++++++++++++++++++++++ gst/gstindex.h | 8 +++++++- 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 776c0fa..a284736 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-02-11 Wim Taymans + + Patch by: Siavash Safi + + * 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 * gst/gstindex.c: (gst_index_finalize): diff --git a/common b/common index 961bb6b..05a617c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 961bb6bd997d7c8da6058534e86b4a1361c0fcea +Subproject commit 05a617c9043ddb78f8578195b18c166d7e1d4c2e diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index ec703eb..0d1af6f 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 diff --git a/gst/gstindex.c b/gst/gstindex.c index 6f3a447..eb12397 100644 --- a/gst/gstindex.c +++ b/gst/gstindex.c @@ -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); } @@ -472,10 +478,33 @@ 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; } diff --git a/gst/gstindex.h b/gst/gstindex.h index cd99be6..6ce477a 100644 --- a/gst/gstindex.h +++ b/gst/gstindex.h @@ -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); -- 2.7.4