From 8f7c59936e36bba05e0aad1cbd8b871b8f1a071a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 28 May 2009 16:36:32 +0200 Subject: [PATCH] pad: add pad private structure Add pad private structure and move the new chainlistfunc into the private struct. This avoids ABI breakage and allows us to expand in the future. --- docs/gst/gstreamer-sections.txt | 2 +- gst/gstpad.c | 14 ++++++++++++++ gst/gstpad.h | 7 +++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 08e0a95..337e0c0 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -1472,6 +1472,7 @@ GST_FLOW_IS_SUCCESS GstPadClass +GstPadPrivate GST_PAD GST_IS_PAD GST_PAD_CLASS @@ -1526,7 +1527,6 @@ GST_PAD_ACTIVATEPULLFUNC GST_PAD_ACTIVATEPUSHFUNC GST_PAD_BUFFERALLOCFUNC GST_PAD_CHAINFUNC -GST_PAD_CHAINLISTFUNC GST_PAD_CHECKGETRANGEFUNC GST_PAD_EVENTFUNC GST_PAD_FIXATECAPSFUNC diff --git a/gst/gstpad.c b/gst/gstpad.c index e4ca3d7..f91b331 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -95,6 +95,16 @@ enum /* FILL ME */ }; +#define GST_PAD_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_PAD, GstPadPrivate)) + +#define GST_PAD_CHAINLISTFUNC(pad) ((pad)->abidata.ABI.priv->chainlistfunc) + +struct _GstPadPrivate +{ + GstPadChainListFunction chainlistfunc; +}; + static void gst_pad_dispose (GObject * object); static void gst_pad_finalize (GObject * object); static void gst_pad_set_property (GObject * object, guint prop_id, @@ -230,6 +240,8 @@ gst_pad_class_init (GstPadClass * klass) gobject_class = G_OBJECT_CLASS (klass); gstobject_class = GST_OBJECT_CLASS (klass); + g_type_class_add_private (klass, sizeof (GstPadPrivate)); + parent_class = g_type_class_peek_parent (klass); gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_pad_dispose); @@ -314,6 +326,8 @@ gst_pad_class_init (GstPadClass * klass) static void gst_pad_init (GstPad * pad) { + pad->abidata.ABI.priv = GST_PAD_GET_PRIVATE (pad); + GST_PAD_DIRECTION (pad) = GST_PAD_UNKNOWN; GST_PAD_PEER (pad) = NULL; diff --git a/gst/gstpad.h b/gst/gstpad.h index 2b71939..fa53012 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -48,6 +48,7 @@ G_BEGIN_DECLS typedef struct _GstPad GstPad; +typedef struct _GstPadPrivate GstPadPrivate; typedef struct _GstPadClass GstPadClass; /** @@ -568,7 +569,6 @@ typedef struct _GstPadTemplate GstPadTemplate; * @peer: the pad this pad is linked to * @sched_private: private storage for the scheduler * @chainfunc: function to chain buffer to pad - * @chainlistfunc: function to chain buffer list to pad * @checkgetrangefunc: function to check if pad can operate in pull mode * @getrangefunc: function to get a range of data from a pad * @eventfunc: function to send an event to a pad @@ -651,7 +651,6 @@ struct _GstPad { /* ABI added */ /* iterate internal links */ GstPadIterIntLinkFunction iterintlinkfunc; - GstPadChainListFunction chainlistfunc; /* free block_data */ GDestroyNotify block_destroy_data; @@ -660,8 +659,9 @@ struct _GstPad { union { struct { gboolean block_callback_called; + GstPadPrivate *priv; } ABI; - gpointer _gst_reserved[GST_PADDING - 3]; + gpointer _gst_reserved[GST_PADDING - 2]; } abidata; }; @@ -693,7 +693,6 @@ struct _GstPadClass { #define GST_PAD_ACTIVATEPUSHFUNC(pad) (GST_PAD_CAST(pad)->activatepushfunc) #define GST_PAD_ACTIVATEPULLFUNC(pad) (GST_PAD_CAST(pad)->activatepullfunc) #define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc) -#define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc) #define GST_PAD_CHECKGETRANGEFUNC(pad) (GST_PAD_CAST(pad)->checkgetrangefunc) #define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc) #define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc) -- 2.7.4