mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
libs/gst/base/gstcollectpads.*: Don't put the previously added destroy notify in the GstCollectData struct as all it'...
Original commit message from CVS: reviewed by: Tim-Philipp Müller <tim at centricular dot net> * libs/gst/base/gstcollectpads.c: (gst_collect_pads_finalize), (unref_data), (gst_collect_pads_add_pad_full): * libs/gst/base/gstcollectpads.h: Don't put the previously added destroy notify in the GstCollectData struct as all it's padding is already used and we don't want to break ABI. Instead put in the pad's GObject data for now. This should be cleaned up for 0.11 (#402393).
This commit is contained in:
parent
a2d3362309
commit
c50cb6a421
3 changed files with 35 additions and 8 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2007-02-01 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
reviewed by: Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_finalize),
|
||||
(unref_data), (gst_collect_pads_add_pad_full):
|
||||
* libs/gst/base/gstcollectpads.h:
|
||||
Don't put the previously added destroy notify in the GstCollectData
|
||||
struct as all it's padding is already used and we don't want to break
|
||||
ABI. Instead put in the pad's GObject data for now. This should be
|
||||
cleaned up for 0.11 (#402393).
|
||||
|
||||
2007-02-01 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
reviewed by: Wim Taymans <wim@fluendo.com>
|
||||
|
|
|
@ -134,6 +134,15 @@ gst_collect_pads_finalize (GObject * object)
|
|||
collected = pads->abidata.ABI.pad_list;
|
||||
for (; collected; collected = g_slist_next (collected)) {
|
||||
GstCollectData *pdata = (GstCollectData *) collected->data;
|
||||
GstCollectDataDestroyNotify destroy_notify;
|
||||
|
||||
/* FIXME: Ugly hack as we can't add more fields to GstCollectData */
|
||||
destroy_notify = (GstCollectDataDestroyNotify)
|
||||
g_object_get_data (G_OBJECT (pdata->pad),
|
||||
"gst-collect-data-destroy-notify");
|
||||
|
||||
if (destroy_notify)
|
||||
destroy_notify (pdata);
|
||||
|
||||
if (pdata->pad) {
|
||||
GST_DEBUG ("finalize pad %s:%s", GST_DEBUG_PAD_NAME (pdata->pad));
|
||||
|
@ -141,9 +150,6 @@ gst_collect_pads_finalize (GObject * object)
|
|||
pdata->pad = NULL;
|
||||
}
|
||||
|
||||
if (pdata->abidata.ABI.destroy_notify)
|
||||
pdata->abidata.ABI.destroy_notify (pdata);
|
||||
|
||||
g_free (pdata);
|
||||
}
|
||||
/* Free pads list */
|
||||
|
@ -207,19 +213,27 @@ ref_data (GstCollectData * data)
|
|||
static void
|
||||
unref_data (GstCollectData * data)
|
||||
{
|
||||
GstCollectDataDestroyNotify destroy_notify;
|
||||
|
||||
g_assert (data != NULL);
|
||||
g_assert (data->abidata.ABI.refcount > 0);
|
||||
|
||||
if (!g_atomic_int_dec_and_test (&(data->abidata.ABI.refcount)))
|
||||
return;
|
||||
|
||||
/* FIXME: Ugly hack as we can't add more fields to GstCollectData */
|
||||
destroy_notify = (GstCollectDataDestroyNotify)
|
||||
g_object_get_data (G_OBJECT (data->pad),
|
||||
"gst-collect-data-destroy-notify");
|
||||
|
||||
if (destroy_notify)
|
||||
destroy_notify (data);
|
||||
|
||||
g_object_unref (data->pad);
|
||||
if (data->buffer) {
|
||||
gst_buffer_unref (data->buffer);
|
||||
}
|
||||
|
||||
if (data->abidata.ABI.destroy_notify)
|
||||
data->abidata.ABI.destroy_notify (data);
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
@ -310,7 +324,10 @@ gst_collect_pads_add_pad_full (GstCollectPads * pads, GstPad * pad, guint size,
|
|||
data->abidata.ABI.new_segment = FALSE;
|
||||
data->abidata.ABI.eos = FALSE;
|
||||
data->abidata.ABI.refcount = 1;
|
||||
data->abidata.ABI.destroy_notify = destroy_notify;
|
||||
|
||||
/* FIXME: Ugly hack as we can't add more fields to GstCollectData */
|
||||
g_object_set_data (G_OBJECT (pad), "gst-collect-data-destroy-notify",
|
||||
destroy_notify);
|
||||
|
||||
GST_COLLECT_PADS_PAD_LOCK (pads);
|
||||
GST_OBJECT_LOCK (pad);
|
||||
|
|
|
@ -75,8 +75,6 @@ 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];
|
||||
|
|
Loading…
Reference in a new issue