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.
This commit is contained in:
Wim Taymans 2009-05-28 16:36:32 +02:00
parent 1d05e05b3e
commit 8f7c59936e
3 changed files with 18 additions and 5 deletions

View file

@ -1472,6 +1472,7 @@ GST_FLOW_IS_SUCCESS
<SUBSECTION Standard>
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

View file

@ -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;

View file

@ -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)