Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / gst / gstpad.h
index 5317dee..dc10fee 100644 (file)
 
 #include <gst/gstconfig.h>
 
+typedef struct _GstPad GstPad;
+typedef struct _GstPadPrivate GstPadPrivate;
+typedef struct _GstPadClass GstPadClass;
+
+/**
+ * GstPadDirection:
+ * @GST_PAD_UNKNOWN: direction is unknown.
+ * @GST_PAD_SRC: the pad is a source pad.
+ * @GST_PAD_SINK: the pad is a sink pad.
+ *
+ * The direction of a pad.
+ */
+typedef enum {
+  GST_PAD_UNKNOWN,
+  GST_PAD_SRC,
+  GST_PAD_SINK
+} GstPadDirection;
+
 #include <gst/gstobject.h>
 #include <gst/gstbuffer.h>
 #include <gst/gstbufferlist.h>
 #include <gst/gstcaps.h>
+#include <gst/gstpadtemplate.h>
 #include <gst/gstevent.h>
 #include <gst/gstquery.h>
 #include <gst/gsttask.h>
@@ -47,9 +66,6 @@ G_BEGIN_DECLS
 #define GST_PAD_CAST(obj)              ((GstPad*)(obj))
 
 
-typedef struct _GstPad GstPad;
-typedef struct _GstPadPrivate GstPadPrivate;
-typedef struct _GstPadClass GstPadClass;
 
 /**
  * GstPadLinkReturn:
@@ -149,41 +165,6 @@ typedef enum {
   GST_FLOW_CUSTOM_ERROR_2 = -102
 } GstFlowReturn;
 
-/**
- * GST_FLOW_IS_FATAL:
- * @ret: a #GstFlowReturn value
- *
- * Macro to test if the given #GstFlowReturn value indicates a fatal
- * error. This macro is mainly used in elements driving the pipeline to decide
- * whether an error message should be posted on the bus. Note that such
- * elements may also need to post an error message in the #GST_FLOW_NOT_LINKED
- * case which is not caught by this macro.
- *
- * Deprecated: This macro is badly named and can't be used in any real
- * scenarios without additional checks.
- */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED)
-#endif
-
-/**
- * GST_FLOW_IS_SUCCESS:
- * @ret: a #GstFlowReturn value
- *
- * Macro to test if the given #GstFlowReturn value indicates a
- * successfull result
- * This macro is mainly used in elements to decide if the processing
- * of a buffer was successfull.
- *
- * Since: 0.10.7
- *
- * Deprecated: This macro is badly named and can't be used in any real
- * scenarios without additional checks.
- */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_FLOW_IS_SUCCESS(ret) ((ret) >= GST_FLOW_OK)
-#endif
-
 const gchar*           gst_flow_get_name       (GstFlowReturn ret);
 GQuark                 gst_flow_to_quark       (GstFlowReturn ret);
 
@@ -377,40 +358,8 @@ typedef GstFlowReturn              (*GstPadGetRangeFunction)       (GstPad *pad, guint64 offset,
 typedef gboolean               (*GstPadEventFunction)          (GstPad *pad, GstEvent *event);
 
 
-/* FIXME: 0.11: deprecate me, check range should use seeking query */
-/**
- * GstPadCheckGetRangeFunction:
- * @pad: a #GstPad
- *
- * Check if @pad can be activated in pull mode.
- *
- * This function will be deprecated after 0.10; use the seeking query to check
- * if a pad can support random access.
- *
- * Returns: TRUE if the pad can operate in pull mode.
- */
-typedef gboolean               (*GstPadCheckGetRangeFunction)  (GstPad *pad);
-
 /* internal links */
 /**
- * GstPadIntLinkFunction:
- * @pad: The #GstPad to query.
- *
- * The signature of the internal pad link function.
- *
- * Returns: (element-type Gst.Pad) (transfer container): a newly allocated #GList of pads that are linked to the given pad on
- * the inside of the parent element.
- *
- * The caller must call g_list_free() on it after use.
- *
- * Deprecated: use the threadsafe #GstPadIterIntLinkFunction instead.
- */
-#ifndef GST_DISABLE_DEPRECATED
-typedef GList*                 (*GstPadIntLinkFunction)        (GstPad *pad);
-#endif
-
-
-/**
  * GstPadIterIntLinkFunction:
  * @pad: The #GstPad to query.
  *
@@ -472,6 +421,13 @@ typedef void                       (*GstPadUnlinkFunction)         (GstPad *pad);
 /**
  * GstPadGetCapsFunction:
  * @pad: the #GstPad to get the capabilities of.
+ * @filter: filter #GstCaps.
+ *
+ * When called on sinkpads @filter contains the caps that
+ * upstream could produce in the order preferred by upstream. When
+ * called on srcpads @filter contains the caps accepted by
+ * downstream in the preffered order. @filter might be %NULL but if
+ * it is not %NULL only a subset of @filter must be returned.
  *
  * Returns a copy of the capabilities of the specified pad. By default this
  * function will return the pad template capabilities, but can optionally
@@ -479,21 +435,9 @@ typedef void                       (*GstPadUnlinkFunction)         (GstPad *pad);
  *
  * Returns: a newly allocated copy #GstCaps of the pad.
  */
-typedef GstCaps*               (*GstPadGetCapsFunction)        (GstPad *pad);
+typedef GstCaps*               (*GstPadGetCapsFunction)        (GstPad *pad, GstCaps *filter);
 
 /**
- * GstPadSetCapsFunction:
- * @pad: the #GstPad to set the capabilities of.
- * @caps: the #GstCaps to set
- *
- * Set @caps on @pad. By default this function updates the caps of the
- * pad but the function can be overriden by elements to perform extra
- * actions or verifications.
- *
- * Returns: TRUE if the caps could be set on the pad.
- */
-typedef gboolean               (*GstPadSetCapsFunction)        (GstPad *pad, GstCaps *caps);
-/**
  * GstPadAcceptCapsFunction:
  * @pad: the #GstPad to check
  * @caps: the #GstCaps to check
@@ -516,104 +460,128 @@ typedef gboolean                (*GstPadAcceptCapsFunction)     (GstPad *pad, GstCaps *caps);
  * elements can override this function to perform other behaviour.
  */
 typedef void                   (*GstPadFixateCapsFunction)     (GstPad *pad, GstCaps *caps);
-/**
- * GstPadBufferAllocFunction:
- * @pad: a sink #GstPad
- * @offset: the desired offset of the buffer
- * @size: the desired size of the buffer
- * @caps: the desired caps of the buffer
- * @buf: pointer to hold the allocated buffer.
- *
- * Ask the sinkpad @pad to allocate a buffer with @offset, @size and @caps.
- * The result will be stored in @buf.
- *
- * The purpose of this function is to allocate a buffer that is optimal to
- * be processed by @pad. The function is mostly overridden by elements that can
- * provide a hardware buffer in order to avoid additional memcpy operations.
- *
- * The function can return a buffer that has caps different from the requested
- * @caps, in which case the upstream element requests a format change to this
- * new caps.
- * If a format change was requested, the returned buffer will be one to hold
- * the data of said new caps, so its size might be different from the requested
- * @size.
- *
- * When this function returns anything else than #GST_FLOW_OK, the buffer allocation
- * failed and @buf does not contain valid data. If the function returns #GST_FLOW_OK and
- * the @buf is NULL, a #GstBuffer will be created with @caps, @offset and @size.
- *
- * By default this function returns a new buffer of @size and with @caps containing
- * purely malloced data. The buffer should be freed with gst_buffer_unref()
- * after usage.
- *
- * Returns: #GST_FLOW_OK if @buf contains a valid buffer, any other return
- *  value means @buf does not hold a valid buffer.
- */
-typedef GstFlowReturn          (*GstPadBufferAllocFunction)    (GstPad *pad, guint64 offset, guint size,
-                                                                GstCaps *caps, GstBuffer **buf);
 
 /* misc */
 /**
- * GstPadDispatcherFunction:
- * @pad: the #GstPad that is dispatched.
- * @data: the gpointer to optional user data.
+ * GstPadForwardFunction:
+ * @pad: the #GstPad that is forwarded.
+ * @user_data: the gpointer to optional user data.
  *
- * A dispatcher function is called for all internally linked pads, see
- * gst_pad_dispatcher().
+ * A forward function is called for all internally linked pads, see
+ * gst_pad_forward().
  *
  * Returns: TRUE if the dispatching procedure has to be stopped.
  */
-typedef gboolean               (*GstPadDispatcherFunction)     (GstPad *pad, gpointer data);
-
-/**
- * GstPadBlockCallback:
- * @pad: the #GstPad that is blockend or unblocked.
- * @blocked: blocking state for the pad
+typedef gboolean               (*GstPadForwardFunction)        (GstPad *pad, gpointer user_data);
+
+/**
+ * GstProbeType:
+ * @GST_PROBE_TYPE_INVALID: invalid probe type
+ * @GST_PROBE_TYPE_IDLE: probe idle pads and block
+ * @GST_PROBE_TYPE_BLOCK: probe and block pads
+ * @GST_PROBE_TYPE_BUFFER: probe buffers
+ * @GST_PROBE_TYPE_BUFFER_LIST: probe buffer lists
+ * @GST_PROBE_TYPE_EVENT: probe events
+ * @GST_PROBE_TYPE_PUSH: probe push
+ * @GST_PROBE_TYPE_PULL: probe pull
+ *
+ * The different probing types that can occur. When either one of
+ * @GST_PROBE_TYPE_IDLE or @GST_PROBE_TYPE_BLOCK is used, the probe will be a
+ * blocking probe.
+ */
+typedef enum
+{
+  GST_PROBE_TYPE_INVALID      = 0,
+  /* flags to control blocking */
+  GST_PROBE_TYPE_IDLE         = (1 << 0),
+  GST_PROBE_TYPE_BLOCK        = (1 << 1),
+  /* flags to select datatypes */
+  GST_PROBE_TYPE_BUFFER       = (1 << 2),
+  GST_PROBE_TYPE_BUFFER_LIST  = (1 << 3),
+  GST_PROBE_TYPE_EVENT        = (1 << 4),
+  /* flags to select scheduling mode */
+  GST_PROBE_TYPE_PUSH         = (1 << 5),
+  GST_PROBE_TYPE_PULL         = (1 << 6),
+} GstProbeType;
+
+#define GST_PROBE_TYPE_BLOCKING   (GST_PROBE_TYPE_IDLE | GST_PROBE_TYPE_BLOCK)
+#define GST_PROBE_TYPE_DATA       (GST_PROBE_TYPE_BUFFER | GST_PROBE_TYPE_EVENT | \
+                                   GST_PROBE_TYPE_BUFFER_LIST)
+#define GST_PROBE_TYPE_SCHEDULING (GST_PROBE_TYPE_PUSH | GST_PROBE_TYPE_PULL)
+
+/**
+ * GstProbeReturn:
+ * @GST_PROBE_OK: normal probe return value
+ * @GST_PROBE_DROP: drop data in data probes
+ * @GST_PROBE_REMOVE: remove probe
+ * @GST_PROBE_PASS: pass the data item in the block probe and block on
+ *                         the next item
+ *
+ * Different return values for the #GstPadProbeCallback.
+ */
+typedef enum
+{
+  GST_PROBE_DROP,
+  GST_PROBE_OK,
+  GST_PROBE_REMOVE,
+  GST_PROBE_PASS,
+} GstProbeReturn;
+
+/**
+ * GstPadProbeCallback
+ * @pad: the #GstPad that is blocked
+ * @type: the current probe type
+ * @type_data: type specific data
  * @user_data: the gpointer to optional user data.
  *
- * Callback used by gst_pad_set_blocked_async(). Gets called when the blocking
- * operation succeeds.
+ * Callback used by gst_pad_add_probe(). Gets called to notify about the current
+ * blocking type.
  */
-typedef void                   (*GstPadBlockCallback)          (GstPad *pad, gboolean blocked, gpointer user_data);
+typedef GstProbeReturn      (*GstPadProbeCallback)              (GstPad *pad, GstProbeType type,
+                                                                 gpointer type_data, gpointer user_data);
 
 /**
- * GstPadDirection:
- * @GST_PAD_UNKNOWN: direction is unknown.
- * @GST_PAD_SRC: the pad is a source pad.
- * @GST_PAD_SINK: the pad is a sink pad.
+ * GstPadStickyEventsForeachFunction:
+ * @pad: the #GstPad.
+ * @event: the sticky #GstEvent.
+ * @user_data: the #gpointer to optional user data.
  *
- * The direction of a pad.
+ * Callback used by gst_pad_sticky_events_foreach().
+ *
+ * Returns: GST_FLOW_OK if the iteration should continue
  */
-typedef enum {
-  GST_PAD_UNKNOWN,
-  GST_PAD_SRC,
-  GST_PAD_SINK
-} GstPadDirection;
+typedef GstFlowReturn           (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent *event, gpointer user_data);
 
 /**
  * GstPadFlags:
  * @GST_PAD_BLOCKED: is dataflow on a pad blocked
  * @GST_PAD_FLUSHING: is pad refusing buffers
  * @GST_PAD_IN_GETCAPS: GstPadGetCapsFunction() is running now
- * @GST_PAD_IN_SETCAPS: GstPadSetCapsFunction() is running now
  * @GST_PAD_BLOCKING: is pad currently blocking on a buffer or event
+ * @GST_PAD_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
+ *                            The flag has to be unset manually after
+ *                            reconfiguration happened.
+ *                            Since: 0.10.34.
+ * @GST_PAD_NEED_EVENTS: the pad has pending events
+ * @GST_PAD_FIXED_CAPS: the pad is using fixed caps this means that once the
+ *                      caps are set on the pad, the getcaps function only
+ *                      returns those caps.
  * @GST_PAD_FLAG_LAST: offset to define more flags
  *
  * Pad state flags
  */
 typedef enum {
-  GST_PAD_BLOCKED       = (GST_OBJECT_FLAG_LAST << 0),
-  GST_PAD_FLUSHING      = (GST_OBJECT_FLAG_LAST << 1),
-  GST_PAD_IN_GETCAPS    = (GST_OBJECT_FLAG_LAST << 2),
-  GST_PAD_IN_SETCAPS    = (GST_OBJECT_FLAG_LAST << 3),
-  GST_PAD_BLOCKING     = (GST_OBJECT_FLAG_LAST << 4),
+  GST_PAD_BLOCKED          = (GST_OBJECT_FLAG_LAST << 0),
+  GST_PAD_FLUSHING         = (GST_OBJECT_FLAG_LAST << 1),
+  GST_PAD_IN_GETCAPS       = (GST_OBJECT_FLAG_LAST << 2),
+  GST_PAD_BLOCKING         = (GST_OBJECT_FLAG_LAST << 4),
+  GST_PAD_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
+  GST_PAD_NEED_EVENTS      = (GST_OBJECT_FLAG_LAST << 6),
+  GST_PAD_FIXED_CAPS       = (GST_OBJECT_FLAG_LAST << 7),
   /* padding */
-  GST_PAD_FLAG_LAST     = (GST_OBJECT_FLAG_LAST << 8)
+  GST_PAD_FLAG_LAST        = (GST_OBJECT_FLAG_LAST << 16)
 } GstPadFlags;
 
-/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
-typedef struct _GstPadTemplate GstPadTemplate;
-
 /**
  * GstPad:
  * @element_private: private data owned by the parent element
@@ -623,14 +591,8 @@ typedef struct _GstPadTemplate GstPadTemplate;
  * @stream_rec_lock: recursive stream lock of the pad, used to protect
  *                   the data used in streaming.
  * @task: task for this pad if the pad is actively driving dataflow.
- * @preroll_lock: lock used when prerolling
- * @preroll_cond: conf to signal preroll
  * @block_cond: conditional to signal pad block
- * @block_callback: callback for the pad block if any
- * @block_data: user data for @block_callback
- * @caps: the current caps of the pad
  * @getcapsfunc: function to get caps of the pad
- * @setcapsfunc: function to set caps on the pad
  * @acceptcapsfunc: function to check if pad can accept caps
  * @fixatecapsfunc: function to fixate caps
  * @activatefunc: pad activation function
@@ -639,108 +601,75 @@ typedef struct _GstPadTemplate GstPadTemplate;
  * @linkfunc: function called when pad is linked
  * @unlinkfunc: function called when pad is unlinked
  * @peer: the pad this pad is linked to
- * @sched_private: private storage for the scheduler
  * @chainfunc: function to chain buffer 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
  * @mode: current activation mode of the pad
  * @querytypefunc: get list of supported queries
  * @queryfunc: perform a query on the pad
- * @intlinkfunc: get the internal links of this pad
- * @bufferallocfunc: function to allocate a buffer for this pad
- * @do_buffer_signals: counter counting installed buffer signals
- * @do_event_signals: counter counting installed event signals
  * @iterintlinkfunc: get the internal links iterator of this pad
- * @block_destroy_data: notify function for gst_pad_set_blocked_async_full()
  *
  * The #GstPad structure. Use the functions to update the variables.
  */
 struct _GstPad {
-  GstObject                    object;
+  GstObject                      object;
 
   /*< public >*/
-  gpointer                     element_private;
+  gpointer                       element_private;
 
-  GstPadTemplate               *padtemplate;
+  GstPadTemplate                *padtemplate;
 
-  GstPadDirection               direction;
+  GstPadDirection                direction;
 
   /*< public >*/ /* with STREAM_LOCK */
   /* streaming rec_lock */
-  GStaticRecMutex              *stream_rec_lock;
+  GStaticRecMutex               stream_rec_lock;
   GstTask                      *task;
-  /*< public >*/ /* with PREROLL_LOCK */
-  GMutex                       *preroll_lock;
-  GCond                                *preroll_cond;
 
   /*< public >*/ /* with LOCK */
   /* block cond, mutex is from the object */
   GCond                                *block_cond;
-  GstPadBlockCallback           block_callback;
-  gpointer                      block_data;
+  GHookList                      probes;
 
   /* the pad capabilities */
-  GstCaps                      *caps;
   GstPadGetCapsFunction                getcapsfunc;
-  GstPadSetCapsFunction                setcapsfunc;
   GstPadAcceptCapsFunction      acceptcapsfunc;
   GstPadFixateCapsFunction      fixatecapsfunc;
 
+  GstActivateMode               mode;
   GstPadActivateFunction        activatefunc;
   GstPadActivateModeFunction    activatepushfunc;
   GstPadActivateModeFunction    activatepullfunc;
 
   /* pad link */
+  GstPad                       *peer;
   GstPadLinkFunction            linkfunc;
   GstPadUnlinkFunction          unlinkfunc;
-  GstPad                       *peer;
-
-  gpointer                      sched_private;
 
   /* data transport functions */
   GstPadChainFunction           chainfunc;
-  GstPadCheckGetRangeFunction   checkgetrangefunc;
+  GstPadChainListFunction        chainlistfunc;
   GstPadGetRangeFunction        getrangefunc;
   GstPadEventFunction           eventfunc;
 
-  GstActivateMode               mode;
+  /* pad offset */
+  gint64                         offset;
 
   /* generic query method */
   GstPadQueryTypeFunction       querytypefunc;
   GstPadQueryFunction           queryfunc;
 
   /* internal links */
-#ifndef GST_DISABLE_DEPRECATED
-  GstPadIntLinkFunction                 intlinkfunc;
-#else
-#ifndef __GTK_DOC_IGNORE__
-  gpointer intlinkfunc;
-#endif
-#endif
-
-  GstPadBufferAllocFunction      bufferallocfunc;
-
-  /* whether to emit signals for have-data. counts number
-   * of handlers attached. */
-  gint                          do_buffer_signals;
-  gint                          do_event_signals;
+  GstPadIterIntLinkFunction      iterintlinkfunc;
 
-  /* ABI added */
-  /* iterate internal links */
-  GstPadIterIntLinkFunction     iterintlinkfunc;
-
-  /* free block_data */
-  GDestroyNotify block_destroy_data;
+  /* counts number of probes attached. */
+  gint                          num_probes;
+  gint                          num_blocked;
 
   /*< private >*/
-  union {
-    struct {
-      gboolean                      block_callback_called;
-      GstPadPrivate                *priv;
-    } ABI;
-    gpointer _gst_reserved[GST_PADDING - 2];
-  } abidata;
+  GstPadPrivate                 *priv;
+
+  gpointer _gst_reserved[GST_PADDING];
 };
 
 struct _GstPadClass {
@@ -749,8 +678,6 @@ struct _GstPadClass {
   /* signal callbacks */
   void         (*linked)               (GstPad *pad, GstPad *peer);
   void         (*unlinked)             (GstPad *pad, GstPad *peer);
-  void         (*request_link)         (GstPad *pad);
-  gboolean     (*have_data)            (GstPad *pad, GstMiniObject *data);
 
   /*< private >*/
   gpointer _gst_reserved[GST_PADDING];
@@ -761,7 +688,7 @@ struct _GstPadClass {
 /* GstPad */
 #define GST_PAD_NAME(pad)              (GST_OBJECT_NAME(pad))
 #define GST_PAD_PARENT(pad)            (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
-#define GST_PAD_ELEMENT_PRIVATE(pad)   (GST_PAD_CAST(pad)->element_private)
+#define GST_PAD_ELEMENT_PRIVATE(pad)    (GST_PAD_CAST(pad)->element_private)
 #define GST_PAD_PAD_TEMPLATE(pad)      (GST_PAD_CAST(pad)->padtemplate)
 #define GST_PAD_DIRECTION(pad)         (GST_PAD_CAST(pad)->direction)
 #define GST_PAD_TASK(pad)              (GST_PAD_CAST(pad)->task)
@@ -771,45 +698,33 @@ 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_CHECKGETRANGEFUNC(pad) (GST_PAD_CAST(pad)->checkgetrangefunc)
+#define GST_PAD_CHAINLISTFUNC(pad)      (GST_PAD_CAST(pad)->chainlistfunc)
 #define GST_PAD_GETRANGEFUNC(pad)      (GST_PAD_CAST(pad)->getrangefunc)
 #define GST_PAD_EVENTFUNC(pad)         (GST_PAD_CAST(pad)->eventfunc)
 #define GST_PAD_QUERYTYPEFUNC(pad)     (GST_PAD_CAST(pad)->querytypefunc)
 #define GST_PAD_QUERYFUNC(pad)         (GST_PAD_CAST(pad)->queryfunc)
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_PAD_INTLINKFUNC(pad)       (GST_PAD_CAST(pad)->intlinkfunc)
-#endif
 #define GST_PAD_ITERINTLINKFUNC(pad)    (GST_PAD_CAST(pad)->iterintlinkfunc)
 
 #define GST_PAD_PEER(pad)              (GST_PAD_CAST(pad)->peer)
 #define GST_PAD_LINKFUNC(pad)          (GST_PAD_CAST(pad)->linkfunc)
 #define GST_PAD_UNLINKFUNC(pad)                (GST_PAD_CAST(pad)->unlinkfunc)
 
-/**
- * GST_PAD_CAPS:
- * @pad: a #GstPad.
- *
- * The caps for this pad.
- */
-#define GST_PAD_CAPS(pad)              (GST_PAD_CAST(pad)->caps)
 #define GST_PAD_GETCAPSFUNC(pad)       (GST_PAD_CAST(pad)->getcapsfunc)
-#define GST_PAD_SETCAPSFUNC(pad)       (GST_PAD_CAST(pad)->setcapsfunc)
 #define GST_PAD_ACCEPTCAPSFUNC(pad)    (GST_PAD_CAST(pad)->acceptcapsfunc)
 #define GST_PAD_FIXATECAPSFUNC(pad)    (GST_PAD_CAST(pad)->fixatecapsfunc)
 
-#define GST_PAD_BUFFERALLOCFUNC(pad)   (GST_PAD_CAST(pad)->bufferallocfunc)
-
-#define GST_PAD_DO_BUFFER_SIGNALS(pad)         (GST_PAD_CAST(pad)->do_buffer_signals)
-#define GST_PAD_DO_EVENT_SIGNALS(pad)  (GST_PAD_CAST(pad)->do_event_signals)
+#define GST_PAD_IS_SRC(pad)            (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
+#define GST_PAD_IS_SINK(pad)           (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
 
 #define GST_PAD_IS_LINKED(pad)         (GST_PAD_PEER(pad) != NULL)
+
 #define GST_PAD_IS_BLOCKED(pad)                (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKED))
 #define GST_PAD_IS_BLOCKING(pad)       (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKING))
 #define GST_PAD_IS_FLUSHING(pad)       (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLUSHING))
 #define GST_PAD_IS_IN_GETCAPS(pad)     (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS))
-#define GST_PAD_IS_IN_SETCAPS(pad)     (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS))
-#define GST_PAD_IS_SRC(pad)            (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
-#define GST_PAD_IS_SINK(pad)           (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
+#define GST_PAD_NEEDS_RECONFIGURE(pad)  (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_NEED_RECONFIGURE))
+#define GST_PAD_NEEDS_EVENTS(pad)       (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_NEED_EVENTS))
+#define GST_PAD_IS_FIXED_CAPS(pad)     (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FIXED_CAPS))
 
 #define GST_PAD_SET_FLUSHING(pad)      (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLUSHING))
 #define GST_PAD_UNSET_FLUSHING(pad)    (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLUSHING))
@@ -821,7 +736,7 @@ struct _GstPadClass {
  * Get the stream lock of @pad. The stream lock is protecting the
  * resources used in the data processing functions of @pad.
  */
-#define GST_PAD_GET_STREAM_LOCK(pad)    (GST_PAD_CAST(pad)->stream_rec_lock)
+#define GST_PAD_GET_STREAM_LOCK(pad)    (&(GST_PAD_CAST(pad)->stream_rec_lock))
 /**
  * GST_PAD_STREAM_LOCK:
  * @pad: a #GstPad
@@ -861,27 +776,11 @@ struct _GstPadClass {
  */
 #define GST_PAD_STREAM_UNLOCK_FULL(pad) (g_static_rec_mutex_unlock_full(GST_PAD_GET_STREAM_LOCK(pad)))
 
-#define GST_PAD_GET_PREROLL_LOCK(pad)   (GST_PAD_CAST(pad)->preroll_lock)
-#define GST_PAD_PREROLL_LOCK(pad)       (g_mutex_lock(GST_PAD_GET_PREROLL_LOCK(pad)))
-#define GST_PAD_PREROLL_TRYLOCK(pad)    (g_mutex_trylock(GST_PAD_GET_PREROLL_LOCK(pad)))
-#define GST_PAD_PREROLL_UNLOCK(pad)     (g_mutex_unlock(GST_PAD_GET_PREROLL_LOCK(pad)))
-
-#define GST_PAD_GET_PREROLL_COND(pad)   (GST_PAD_CAST(pad)->preroll_cond)
-#define GST_PAD_PREROLL_WAIT(pad)       \
-    g_cond_wait (GST_PAD_GET_PREROLL_COND (pad), GST_PAD_GET_PREROLL_LOCK (pad))
-#define GST_PAD_PREROLL_TIMED_WAIT(pad, timeval) \
-    g_cond_timed_wait (GST_PAD_GET_PREROLL_COND (pad), GST_PAD_GET_PREROLL_LOCK (pad), timeval)
-#define GST_PAD_PREROLL_SIGNAL(pad)     g_cond_signal (GST_PAD_GET_PREROLL_COND (pad));
-#define GST_PAD_PREROLL_BROADCAST(pad)  g_cond_broadcast (GST_PAD_GET_PREROLL_COND (pad));
-
 #define GST_PAD_BLOCK_GET_COND(pad)     (GST_PAD_CAST(pad)->block_cond)
 #define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
 #define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
 #define GST_PAD_BLOCK_BROADCAST(pad)    (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
 
-/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
-#include <gst/gstpadtemplate.h>
-
 GType                  gst_pad_get_type                        (void);
 
 /* creating pads */
@@ -918,12 +817,13 @@ gboolean          gst_pad_is_active                       (GstPad *pad);
 gboolean               gst_pad_activate_pull                   (GstPad *pad, gboolean active);
 gboolean               gst_pad_activate_push                   (GstPad *pad, gboolean active);
 
-gboolean               gst_pad_set_blocked                     (GstPad *pad, gboolean blocked);
-gboolean               gst_pad_set_blocked_async               (GstPad *pad, gboolean blocked,
-                                                                GstPadBlockCallback callback, gpointer user_data);
-gboolean               gst_pad_set_blocked_async_full          (GstPad *pad, gboolean blocked,
-                                                                GstPadBlockCallback callback, gpointer user_data,
+gulong                  gst_pad_add_probe                       (GstPad *pad,
+                                                                GstProbeType mask,
+                                                                GstPadProbeCallback callback,
+                                                                 gpointer user_data,
                                                                  GDestroyNotify destroy_data);
+void                    gst_pad_remove_probe                    (GstPad *pad, gulong id);
+
 gboolean               gst_pad_is_blocked                      (GstPad *pad);
 gboolean               gst_pad_is_blocking                     (GstPad *pad);
 
@@ -932,20 +832,16 @@ gpointer          gst_pad_get_element_private             (GstPad *pad);
 
 GstPadTemplate*                gst_pad_get_pad_template                (GstPad *pad);
 
-void                   gst_pad_set_bufferalloc_function        (GstPad *pad, GstPadBufferAllocFunction bufalloc);
-GstFlowReturn          gst_pad_alloc_buffer                    (GstPad *pad, guint64 offset, gint size,
-                                                                GstCaps *caps, GstBuffer **buf);
-GstFlowReturn          gst_pad_alloc_buffer_and_set_caps       (GstPad *pad, guint64 offset, gint size,
-                                                                GstCaps *caps, GstBuffer **buf);
+GstEvent*               gst_pad_get_sticky_event                (GstPad *pad, GstEventType event_type);
+GstFlowReturn           gst_pad_sticky_events_foreach           (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
 
 /* data passing setup functions */
 void                   gst_pad_set_activate_function           (GstPad *pad, GstPadActivateFunction activate);
 void                   gst_pad_set_activatepull_function       (GstPad *pad, GstPadActivateModeFunction activatepull);
 void                   gst_pad_set_activatepush_function       (GstPad *pad, GstPadActivateModeFunction activatepush);
 void                   gst_pad_set_chain_function              (GstPad *pad, GstPadChainFunction chain);
-void                   gst_pad_set_chain_list_function (GstPad *pad, GstPadChainListFunction chainlist);
+void                   gst_pad_set_chain_list_function         (GstPad *pad, GstPadChainListFunction chainlist);
 void                   gst_pad_set_getrange_function           (GstPad *pad, GstPadGetRangeFunction get);
-void                   gst_pad_set_checkgetrange_function      (GstPad *pad, GstPadCheckGetRangeFunction check);
 void                   gst_pad_set_event_function              (GstPad *pad, GstPadEventFunction event);
 
 /* pad links */
@@ -964,29 +860,31 @@ GstPad*                   gst_pad_get_peer                        (GstPad *pad);
 void                   gst_pad_set_getcaps_function            (GstPad *pad, GstPadGetCapsFunction getcaps);
 void                   gst_pad_set_acceptcaps_function         (GstPad *pad, GstPadAcceptCapsFunction acceptcaps);
 void                   gst_pad_set_fixatecaps_function         (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
-void                   gst_pad_set_setcaps_function            (GstPad *pad, GstPadSetCapsFunction setcaps);
 
-const GstCaps*         gst_pad_get_pad_template_caps           (GstPad *pad);
+GstCaps*                gst_pad_get_pad_template_caps          (GstPad *pad);
 
 /* capsnego function for linked/unlinked pads */
-GstCaps *              gst_pad_get_caps_reffed                 (GstPad * pad);
-GstCaps *              gst_pad_get_caps                        (GstPad * pad);
+GstCaps *              gst_pad_get_current_caps                (GstPad * pad);
+gboolean               gst_pad_has_current_caps                (GstPad * pad);
+GstCaps *              gst_pad_get_caps                        (GstPad * pad, GstCaps *filter);
 void                   gst_pad_fixate_caps                     (GstPad * pad, GstCaps *caps);
 gboolean               gst_pad_accept_caps                     (GstPad * pad, GstCaps *caps);
 gboolean               gst_pad_set_caps                        (GstPad * pad, GstCaps *caps);
 
-GstCaps *              gst_pad_peer_get_caps_reffed            (GstPad * pad);
-GstCaps *              gst_pad_peer_get_caps                   (GstPad * pad);
+GstCaps *              gst_pad_peer_get_caps                   (GstPad * pad, GstCaps *filter);
 gboolean               gst_pad_peer_accept_caps                (GstPad * pad, GstCaps *caps);
 
 /* capsnego for linked pads */
 GstCaps *              gst_pad_get_allowed_caps                (GstPad * pad);
-GstCaps *              gst_pad_get_negotiated_caps             (GstPad * pad);
+GstCaps *               gst_pad_get_negotiated_caps             (GstPad * pad);
+
+/* pad offsets */
+gint64                  gst_pad_get_offset                      (GstPad *pad);
+void                    gst_pad_set_offset                      (GstPad *pad, gint64 offset);
 
 /* data passing functions to peer */
 GstFlowReturn          gst_pad_push                            (GstPad *pad, GstBuffer *buffer);
 GstFlowReturn          gst_pad_push_list                       (GstPad *pad, GstBufferList *list);
-gboolean               gst_pad_check_pull_range                (GstPad *pad);
 GstFlowReturn          gst_pad_pull_range                      (GstPad *pad, guint64 offset, guint size,
                                                                 GstBuffer **buffer);
 gboolean               gst_pad_push_event                      (GstPad *pad, GstEvent *event);
@@ -1006,12 +904,6 @@ gboolean          gst_pad_pause_task                      (GstPad *pad);
 gboolean               gst_pad_stop_task                       (GstPad *pad);
 
 /* internal links */
-#ifndef GST_DISABLE_DEPRECATED
-void                   gst_pad_set_internal_link_function      (GstPad *pad, GstPadIntLinkFunction intlink);
-GList*                 gst_pad_get_internal_links              (GstPad *pad);
-GList*                 gst_pad_get_internal_links_default      (GstPad *pad);
-#endif
-
 void                    gst_pad_set_iterate_internal_links_function (GstPad * pad,
                                                                  GstPadIterIntLinkFunction iterintlink);
 GstIterator *           gst_pad_iterate_internal_links          (GstPad * pad);
@@ -1029,12 +921,8 @@ void                      gst_pad_set_query_function              (GstPad *pad, GstPadQueryFunction query);
 gboolean               gst_pad_query_default                   (GstPad *pad, GstQuery *query);
 
 /* misc helper functions */
-gboolean               gst_pad_dispatcher                      (GstPad *pad, GstPadDispatcherFunction dispatch,
-                                                                gpointer data);
-
-#if !defined(GST_DISABLE_LOADSAVE) && !defined(GST_DISABLE_DEPRECATED)
-void                   gst_pad_load_and_link                   (xmlNodePtr self, GstObject *parent);
-#endif
+gboolean               gst_pad_forward                         (GstPad *pad, GstPadForwardFunction forward,
+                                                                gpointer user_data);
 
 G_END_DECLS