Index: libs/gst/base/gstcollectpads.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstcollectpads.c,v
retrieving revision 1.47
diff -u -p -u -p -r1.47 gstcollectpads.c
--- libs/gst/base/gstcollectpads.c	9 Jan 2007 12:34:45 -0000	1.47
+++ libs/gst/base/gstcollectpads.c	30 Jan 2007 19:38:35 -0000
@@ -140,6 +140,10 @@ gst_collect_pads_finalize (GObject * obj
       gst_object_unref (pdata->pad);
       pdata->pad = NULL;
     }
+
+    if (pdata->abidata.ABI.destroy_notify)
+      pdata->abidata.ABI.destroy_notify (pdata);
+
     g_free (pdata);
   }
   /* Free pads list */
@@ -213,6 +217,10 @@ unref_data (GstCollectData * data)
   if (data->buffer) {
     gst_buffer_unref (data->buffer);
   }
+
+  if (data->abidata.ABI.destroy_notify)
+    data->abidata.ABI.destroy_notify (data);
+
   g_free (data);
 }
 
@@ -233,6 +241,9 @@ unref_data (GstCollectData * data)
  * The pad will be automatically activated in push mode when @pads is
  * started.
  *
+ * This function calls gst_collect_pads_add_pad() passing a value of NULL
+ * for destroy_notify.
+ *
  * Returns: a new #GstCollectData to identify the new pad. Or NULL
  *   if wrong parameters are supplied.
  *
@@ -241,6 +252,44 @@ unref_data (GstCollectData * data)
 GstCollectData *
 gst_collect_pads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
 {
+  return gst_collect_pads_add_pad_full (pads, pad, size, NULL);
+}
+
+/**
+ * gst_collect_pads_add_pad_full:
+ * @pads: the collectspads to use
+ * @pad: the pad to add
+ * @size: the size of the returned #GstCollectData structure
+ * @destroy_notify: function to be called before the returned #GstCollectData
+ * structure is freed
+ *
+ * Add a pad to the collection of collect pads. The pad has to be
+ * a sinkpad. The refcount of the pad is incremented. Use
+ * gst_collect_pads_remove_pad() to remove the pad from the collection
+ * again.
+ *
+ * You specify a size for the returned #GstCollectData structure
+ * so that you can use it to store additional information.
+ *
+ * You can also specify a #GstCollectDataDestroyNotify that will be called
+ * just before the #GstCollectData structure is freed. It is passed the
+ * pointer to the structure and should free any custom memory and resources
+ * allocated for it.
+ *
+ * The pad will be automatically activated in push mode when @pads is
+ * started.
+ *
+ * Since: 0.10.12
+ *
+ * Returns: a new #GstCollectData to identify the new pad. Or NULL
+ *   if wrong parameters are supplied.
+ *
+ * MT safe.
+ */
+GstCollectData *
+gst_collect_pads_add_pad_full (GstCollectPads * pads, GstPad * pad, guint size,
+    GstCollectDataDestroyNotify destroy_notify)
+{
   GstCollectData *data;
 
   g_return_val_if_fail (pads != NULL, NULL);
@@ -261,6 +310,7 @@ gst_collect_pads_add_pad (GstCollectPads
   data->abidata.ABI.new_segment = FALSE;
   data->abidata.ABI.eos = FALSE;
   data->abidata.ABI.refcount = 1;
+  data->abidata.ABI.destroy_notify = destroy_notify;
 
   GST_COLLECT_PADS_PAD_LOCK (pads);
   GST_OBJECT_LOCK (pad);
Index: libs/gst/base/gstcollectpads.h
===================================================================
RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstcollectpads.h,v
retrieving revision 1.19
diff -u -p -u -p -r1.19 gstcollectpads.h
--- libs/gst/base/gstcollectpads.h	16 Dec 2006 15:17:54 -0000	1.19
+++ libs/gst/base/gstcollectpads.h	30 Jan 2007 19:38:35 -0000
@@ -38,6 +38,18 @@ typedef struct _GstCollectPads GstCollec
 typedef struct _GstCollectPadsClass GstCollectPadsClass;
 
 /**
+ * GstCollectDataDestroyNotify:
+ * @data: the #GstCollectData that will be freed
+ *
+ * A function that will be called when the #GstCollectData will be freed.
+ * It is passed the pointer to the structure and should free any custom
+ * memory and resources allocated for it.
+ *
+ * Since: 0.10.12
+ */
+typedef void (*GstCollectDataDestroyNotify) (GstCollectData *data);
+
+/**
  * GstCollectData:
  * @collect: owner #GstCollectPads
  * @pad: #GstPad managed by this data
@@ -63,6 +75,8 @@ struct _GstCollectData
       gboolean           new_segment;
       gboolean           eos;
       gint               refcount;
+      /* since 0.10.12 */
+      GstCollectDataDestroyNotify  destroy_notify;
     } ABI;
     /* adding + 0 to mark ABI change to be undone later */
     gpointer _gst_reserved[GST_PADDING + 0];
@@ -149,6 +163,7 @@ void		gst_collect_pads_set_function 	(Gs
 
 /* pad management */
 GstCollectData*	gst_collect_pads_add_pad	(GstCollectPads *pads, GstPad *pad, guint size);
+GstCollectData* gst_collect_pads_add_pad_full   (GstCollectPads *pads, GstPad *pad, guint size, GstCollectDataDestroyNotify destroy_notify);
 gboolean	gst_collect_pads_remove_pad	(GstCollectPads *pads, GstPad *pad);
 gboolean	gst_collect_pads_is_active 	(GstCollectPads *pads, GstPad *pad);
 
Index: docs/libs/gstreamer-libs-sections.txt
===================================================================
RCS file: /cvs/gstreamer/gstreamer/docs/libs/gstreamer-libs-sections.txt,v
retrieving revision 1.51
diff -u -p -u -p -r1.51 gstreamer-libs-sections.txt
--- docs/libs/gstreamer-libs-sections.txt	25 Jan 2007 10:50:03 -0000	1.51
+++ docs/libs/gstreamer-libs-sections.txt	30 Jan 2007 19:38:36 -0000
@@ -241,9 +241,11 @@ gst_base_transform_get_type
 GstCollectData
 GstCollectPads
 GstCollectPadsFunction
+GstCollectDataDestroyNotify
 gst_collect_pads_new
 gst_collect_pads_set_function
 gst_collect_pads_add_pad
+gst_collect_pads_add_pad_full
 gst_collect_pads_remove_pad
 gst_collect_pads_is_active
 gst_collect_pads_collect
