gstpad: Probes that return HANDLED can reset the data info field
[platform/upstream/gstreamer.git] / gst / gstpad.h
index e024ad4..1908398 100644 (file)
@@ -61,6 +61,9 @@ typedef enum {
   GST_PAD_MODE_PULL
 } GstPadMode;
 
+#include <glib.h>
+
+GST_API
 const gchar   * gst_pad_mode_get_name (GstPadMode mode);
 
 #include <gst/gstobject.h>
@@ -179,9 +182,14 @@ typedef enum {
   GST_FLOW_CUSTOM_ERROR_2 = -102
 } GstFlowReturn;
 
-const gchar*           gst_flow_get_name (GstFlowReturn ret);
-GQuark                           gst_flow_to_quark (GstFlowReturn ret);
-const gchar*          gst_pad_link_get_name (GstPadLinkReturn ret);
+GST_API
+const gchar *         gst_flow_get_name (GstFlowReturn ret);
+
+GST_API
+GQuark                gst_flow_to_quark (GstFlowReturn ret);
+
+GST_API
+const gchar *         gst_pad_link_get_name (GstPadLinkReturn ret);
 
 /**
  * GstPadLinkCheck:
@@ -194,6 +202,8 @@ const gchar*          gst_pad_link_get_name (GstPadLinkReturn ret);
  *   would be unsafe e.g. if one pad has %GST_CAPS_ANY.
  * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
  *   caps returned by gst_pad_query_caps().
+ * @GST_PAD_LINK_CHECK_NO_RECONFIGURE: Disables pushing a reconfigure event when pads are
+ *   linked.
  * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking
  *   pads (i.e. the ones used by gst_pad_link()).
  *
@@ -201,12 +211,10 @@ const gchar*          gst_pad_link_get_name (GstPadLinkReturn ret);
  * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
  * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed.
  *
- * <warning><para>
- * Only disable some of the checks if you are 100% certain you know the link
- * will not fail because of hierarchy/caps compatibility failures. If uncertain,
- * use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
- * for linking the pads.
- * </para></warning>
+ * > Only disable some of the checks if you are 100% certain you know the link
+ * > will not fail because of hierarchy/caps compatibility failures. If uncertain,
+ * > use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
+ * > for linking the pads.
  */
 
 typedef enum {
@@ -215,6 +223,11 @@ typedef enum {
   GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1,
   GST_PAD_LINK_CHECK_CAPS          = 1 << 2,
 
+
+  /* Not really checks, more like flags
+   * Added here to avoid creating a new gst_pad_link_variant */
+  GST_PAD_LINK_CHECK_NO_RECONFIGURE = 1 << 3,
+
   GST_PAD_LINK_CHECK_DEFAULT       = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS
 } GstPadLinkCheck;
 
@@ -229,7 +242,7 @@ typedef enum {
  * activate function that puts the pad in push mode but elements can
  * override this function to activate the pad in pull mode if they wish.
  *
- * Returns: TRUE if the pad could be activated.
+ * Returns: %TRUE if the pad could be activated.
  */
 typedef gboolean               (*GstPadActivateFunction)       (GstPad *pad, GstObject *parent);
 /**
@@ -241,7 +254,7 @@ typedef gboolean            (*GstPadActivateFunction)       (GstPad *pad, GstObject *parent);
  *
  * The prototype of the push and pull activate functions.
  *
- * Returns: TRUE if the pad could be activated or deactivated.
+ * Returns: %TRUE if the pad could be activated or deactivated.
  */
 typedef gboolean               (*GstPadActivateModeFunction)   (GstPad *pad, GstObject *parent,
                                                                  GstPadMode mode, gboolean active);
@@ -251,10 +264,10 @@ typedef gboolean          (*GstPadActivateModeFunction)   (GstPad *pad, GstObject *parent,
 /**
  * GstPadChainFunction:
  * @pad: the sink #GstPad that performed the chain.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
- * @buffer: the #GstBuffer that is chained, not %NULL.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
+ * @buffer: (transfer full): the #GstBuffer that is chained, not %NULL.
  *
  * A function that will be called on sinkpads when chaining buffers.
  * The function typically processes the data contained in the buffer and
@@ -274,10 +287,10 @@ typedef GstFlowReturn             (*GstPadChainFunction)          (GstPad *pad, GstObject *parent,
 /**
  * GstPadChainListFunction:
  * @pad: the sink #GstPad that performed the chain.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
- * @list: the #GstBufferList that is chained, not %NULL.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
+ * @list: (transfer full): the #GstBufferList that is chained, not %NULL.
  *
  * A function that will be called on sinkpads when chaining buffer lists.
  * The function typically processes the data contained in the buffer list and
@@ -297,12 +310,12 @@ typedef GstFlowReturn             (*GstPadChainListFunction)      (GstPad *pad, GstObject *paren
 /**
  * GstPadGetRangeFunction:
  * @pad: the src #GstPad to perform the getrange on.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
  * @offset: the offset of the range
  * @length: the length of the range
- * @buffer: a memory location to hold the result buffer, cannot be NULL.
+ * @buffer: a memory location to hold the result buffer, cannot be %NULL.
  *
  * This function will be called on source pads when a peer element
  * request a buffer at the specified @offset and @length. If this function
@@ -348,26 +361,48 @@ typedef GstFlowReturn             (*GstPadGetRangeFunction)       (GstPad *pad, GstObject *parent
 /**
  * GstPadEventFunction:
  * @pad: the #GstPad to handle the event.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
- * @event: the #GstEvent to handle.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
+ * @event: (transfer full): the #GstEvent to handle.
  *
  * Function signature to handle an event for the pad.
  *
- * Returns: TRUE if the pad could handle the event.
+ * Returns: %TRUE if the pad could handle the event.
  */
 typedef gboolean               (*GstPadEventFunction)          (GstPad *pad, GstObject *parent,
                                                                  GstEvent *event);
 
+/**
+ * GstPadEventFullFunction:
+ * @pad: the #GstPad to handle the event.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
+ * @event: (transfer full): the #GstEvent to handle.
+ *
+ * Function signature to handle an event for the pad.
+ *
+ * This variant is for specific elements that will take into account the
+ * last downstream flow return (from a pad push), in which case they can
+ * return it.
+ *
+ * Returns: %GST_FLOW_OK if the event was handled properly, or any other
+ * #GstFlowReturn dependent on downstream state.
+ *
+ * Since: 1.8
+ */
+typedef GstFlowReturn          (*GstPadEventFullFunction)      (GstPad *pad, GstObject *parent,
+                                                                 GstEvent *event);
+
 
 /* internal links */
 /**
  * GstPadIterIntLinkFunction:
  * @pad: The #GstPad to query.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
  *
  * The signature of the internal pad link iterator function.
  *
@@ -382,14 +417,14 @@ typedef GstIterator*           (*GstPadIterIntLinkFunction)    (GstPad *pad, Gst
 /**
  * GstPadQueryFunction:
  * @pad: the #GstPad to query.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
  * @query: the #GstQuery object to execute
  *
  * The signature of the query function.
  *
- * Returns: TRUE if the query could be performed.
+ * Returns: %TRUE if the query could be performed.
  */
 typedef gboolean               (*GstPadQueryFunction)          (GstPad *pad, GstObject *parent,
                                                                  GstQuery *query);
@@ -399,9 +434,9 @@ typedef gboolean            (*GstPadQueryFunction)          (GstPad *pad, GstObject *parent,
 /**
  * GstPadLinkFunction:
  * @pad: the #GstPad that is linked.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
  * @peer: the peer #GstPad of the link
  *
  * Function signature to handle a new link on the pad.
@@ -412,11 +447,14 @@ typedef GstPadLinkReturn  (*GstPadLinkFunction)           (GstPad *pad, GstObject *parent,
 /**
  * GstPadUnlinkFunction:
  * @pad: the #GstPad that is linked.
- * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
- *          @parent is guaranteed to be not-NULL and remain valid during the
- *          execution of this function.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ *          during the execution of this function.
  *
  * Function signature to handle a unlinking the pad prom its peer.
+ *
+ * The pad's lock is already held when the unlink function is called, so most
+ * pad functions cannot be called from within the callback.
  */
 typedef void                   (*GstPadUnlinkFunction)         (GstPad *pad, GstObject *parent);
 
@@ -430,14 +468,14 @@ typedef void                      (*GstPadUnlinkFunction)         (GstPad *pad, GstObject *parent);
  * A forward function is called for all internally linked pads, see
  * gst_pad_forward().
  *
- * Returns: TRUE if the dispatching procedure has to be stopped.
+ * Returns: %TRUE if the dispatching procedure has to be stopped.
  */
 typedef gboolean               (*GstPadForwardFunction)        (GstPad *pad, gpointer user_data);
 
 /**
  * GstPadProbeType:
  * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
- * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block
+ * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block while the callback is called
  * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
  * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
  * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
@@ -500,14 +538,27 @@ typedef enum
 
 /**
  * GstPadProbeReturn:
- * @GST_PAD_PROBE_OK: normal probe return value
+ * @GST_PAD_PROBE_OK: normal probe return value. This leaves the probe in
+ *        place, and defers decisions about dropping or passing data to other
+ *        probes, if any. If there are no other probes, the default behaviour
+ *        for the probe type applies ('block' for blocking probes,
+ *        and 'pass' for non-blocking probes).
  * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
- *        the data item is not sent downstream. For pull mode, it means that the
- *        data item is not passed upstream. In both cases, this result code
- *        means that #GST_FLOW_OK or %TRUE is returned to the caller.
- * @GST_PAD_PROBE_REMOVE: remove probe
- * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on
- *                         the next item
+ *        the data item is not sent downstream. For pull mode, it means that
+ *        the data item is not passed upstream. In both cases, no other probes
+ *        are called for this item and %GST_FLOW_OK or %TRUE is returned to the
+ *        caller.
+ * @GST_PAD_PROBE_REMOVE: remove this probe.
+ * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on the
+ *        next item.
+ * @GST_PAD_PROBE_HANDLED: Data has been handled in the probe and will not be
+ *        forwarded further. For events and buffers this is the same behaviour as
+ *        %GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer
+ *        or event yourself). For queries it will also return %TRUE to the caller.
+ *        The probe can also modify the #GstFlowReturn value by using the
+ *        #GST_PAD_PROBE_INFO_FLOW_RETURN() accessor.
+ *        Note that the resulting query must contain valid entries.
+ *        Since: 1.6
  *
  * Different return values for the #GstPadProbeCallback.
  */
@@ -517,6 +568,7 @@ typedef enum
   GST_PAD_PROBE_OK,
   GST_PAD_PROBE_REMOVE,
   GST_PAD_PROBE_PASS,
+  GST_PAD_PROBE_HANDLED
 } GstPadProbeReturn;
 
 
@@ -524,8 +576,8 @@ typedef enum
  * GstPadProbeInfo:
  * @type: the current probe type
  * @id: the id of the probe
- * @data: type specific data, check the @type field to know the datatype.
- *    This field can be NULL.
+ * @data: (allow-none): type specific data, check the @type field to know the
+ *    datatype.  This field can be %NULL.
  * @offset: offset of pull probe, this field is valid when @type contains
  *    #GST_PAD_PROBE_TYPE_PULL
  * @size: size of pull probe, this field is valid when @type contains
@@ -542,12 +594,18 @@ struct _GstPadProbeInfo
   guint size;
 
   /*< private >*/
-  gpointer _gst_reserved[GST_PADDING];
+  union {
+    gpointer _gst_reserved[GST_PADDING];
+    struct {
+      GstFlowReturn flow_ret;
+    } abi;
+  } ABI;
 };
 
 #define GST_PAD_PROBE_INFO_TYPE(d)         ((d)->type)
 #define GST_PAD_PROBE_INFO_ID(d)           ((d)->id)
 #define GST_PAD_PROBE_INFO_DATA(d)         ((d)->data)
+#define GST_PAD_PROBE_INFO_FLOW_RETURN(d)  ((d)->ABI.abi.flow_ret)
 
 #define GST_PAD_PROBE_INFO_BUFFER(d)       GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
 #define GST_PAD_PROBE_INFO_BUFFER_LIST(d)  GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
@@ -557,9 +615,16 @@ struct _GstPadProbeInfo
 #define GST_PAD_PROBE_INFO_OFFSET(d)       ((d)->offset)
 #define GST_PAD_PROBE_INFO_SIZE(d)         ((d)->size)
 
+GST_API
 GstEvent*      gst_pad_probe_info_get_event       (GstPadProbeInfo * info);
+
+GST_API
 GstQuery*      gst_pad_probe_info_get_query       (GstPadProbeInfo * info);
+
+GST_API
 GstBuffer*     gst_pad_probe_info_get_buffer      (GstPadProbeInfo * info);
+
+GST_API
 GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
 
 /**
@@ -581,7 +646,7 @@ typedef GstPadProbeReturn   (*GstPadProbeCallback)   (GstPad *pad, GstPadProbeIn
 /**
  * GstPadStickyEventsForeachFunction:
  * @pad: the #GstPad.
- * @event: a sticky #GstEvent.
+ * @event: (allow-none): a sticky #GstEvent.
  * @user_data: the #gpointer to optional user data.
  *
  * Callback used by gst_pad_sticky_events_foreach().
@@ -589,7 +654,7 @@ typedef GstPadProbeReturn   (*GstPadProbeCallback)   (GstPad *pad, GstPadProbeIn
  * When this function returns %TRUE, the next event will be
  * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
  *
- * When @event is set to NULL, the item will be removed from the list of sticky events.
+ * When @event is set to %NULL, the item will be removed from the list of sticky events.
  * @event can be replaced by assigning a new reference to it.
  * This function is responsible for unreffing the old event when
  * removing or modifying.
@@ -627,6 +692,10 @@ typedef gboolean  (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **
  *                      it the caps intersect the query-caps result instead
  *                      of checking for a subset. This is interesting for
  *                      parsers that can accept incompletely specified caps.
+ * @GST_PAD_FLAG_ACCEPT_TEMPLATE: the default accept-caps handler will use
+ *                      the template pad caps instead of query caps to
+ *                      compare with the accept caps. Use this in combination
+ *                      with %GST_PAD_FLAG_ACCEPT_INTERSECT. (Since: 1.6)
  * @GST_PAD_FLAG_LAST: offset to define more flags
  *
  * Pad state flags
@@ -644,6 +713,7 @@ typedef enum {
   GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9),
   GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10),
   GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11),
+  GST_PAD_FLAG_ACCEPT_TEMPLATE  = (GST_OBJECT_FLAG_LAST << 12),
   /* padding */
   GST_PAD_FLAG_LAST        = (GST_OBJECT_FLAG_LAST << 16)
 } GstPadFlags;
@@ -726,7 +796,13 @@ struct _GstPad {
 
   GstPadPrivate                 *priv;
 
-  gpointer _gst_reserved[GST_PADDING];
+  union {
+    gpointer _gst_reserved[GST_PADDING];
+    struct {
+      GstFlowReturn last_flowret;
+      GstPadEventFullFunction eventfullfunc;
+    } abi;
+  } ABI;
 };
 
 struct _GstPadClass {
@@ -850,6 +926,19 @@ struct _GstPadClass {
  */
 #define GST_PAD_EVENTFUNC(pad)         (GST_PAD_CAST(pad)->eventfunc)
 /**
+ * GST_PAD_EVENTFULLFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadEventFullFunction from the given @pad, which
+ * is the function that handles events on the pad. You can
+ * use this to set your own event handling function on a pad
+ * after you create it.  If your element derives from a base
+ * class, use the base class's virtual functions instead.
+ *
+ * Since: 1.8
+ */
+#define GST_PAD_EVENTFULLFUNC(pad)     (GST_PAD_CAST(pad)->ABI.abi.eventfullfunc)
+/**
  * GST_PAD_QUERYFUNC:
  * @pad: a #GstPad
  *
@@ -893,21 +982,21 @@ struct _GstPadClass {
  * GST_PAD_IS_SRC:
  * @pad: a #GstPad
  *
- * Returns: TRUE if the pad is a source pad (i.e. produces data).
+ * Returns: %TRUE if the pad is a source pad (i.e. produces data).
  */
 #define GST_PAD_IS_SRC(pad)            (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
 /**
  * GST_PAD_IS_SINK:
  * @pad: a #GstPad
  *
- * Returns: TRUE if the pad is a sink pad (i.e. consumes data).
+ * Returns: %TRUE if the pad is a sink pad (i.e. consumes data).
  */
 #define GST_PAD_IS_SINK(pad)           (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
 /**
  * GST_PAD_IS_LINKED:
  * @pad: a #GstPad
  *
- * Returns: TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
+ * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
  * instead.
  */
 #define GST_PAD_IS_LINKED(pad)         (GST_PAD_PEER(pad) != NULL)
@@ -915,7 +1004,7 @@ struct _GstPadClass {
  * GST_PAD_IS_ACTIVE:
  * @pad: a #GstPad
  *
- * Returns: TRUE if the pad has been activated.
+ * Returns: %TRUE if the pad has been activated.
  */
 #define GST_PAD_IS_ACTIVE(pad)          (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
 /**
@@ -1086,7 +1175,7 @@ struct _GstPadClass {
  * @pad: a #GstPad
  *
  * Check if the pad's accept intersect flag is set. The default accept-caps
- * handler will check it the caps intersect the query-caps result instead of
+ * handler will check if the caps intersect the query-caps result instead of
  * checking for a subset. This is interesting for parser elements that can
  * accept incompletely specified caps.
  */
@@ -1108,6 +1197,38 @@ struct _GstPadClass {
  */
 #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
 /**
+ * GST_PAD_IS_ACCEPT_TEMPLATE:
+ * @pad: a #GstPad
+ *
+ * Check if the pad's accept caps operation will use the pad template caps.
+ * The default accept-caps will do a query caps to get the caps, which might
+ * be querying downstream causing unnecessary overhead. It is recommended to
+ * implement a proper accept-caps query handler or to use this flag to prevent
+ * recursive accept-caps handling.
+ *
+ * Since: 1.6
+ */
+#define GST_PAD_IS_ACCEPT_TEMPLATE(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
+/**
+ * GST_PAD_SET_ACCEPT_TEMPLATE:
+ * @pad: a #GstPad
+ *
+ * Set @pad to by default use the pad template caps to compare with
+ * the accept caps instead of using a caps query result.
+ *
+ * Since: 1.6
+ */
+#define GST_PAD_SET_ACCEPT_TEMPLATE(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
+/**
+ * GST_PAD_UNSET_ACCEPT_TEMPLATE:
+ * @pad: a #GstPad
+ *
+ * Unset accept template flag.
+ *
+ * Since: 1.6
+ */
+#define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
+/**
  * GST_PAD_GET_STREAM_LOCK:
  * @pad: a #GstPad
  *
@@ -1129,8 +1250,8 @@ struct _GstPadClass {
  * GST_PAD_STREAM_TRYLOCK:
  * @pad: a #GstPad
  *
- * Try to take the pad's stream lock, and return TRUE if the lock could be
- * taken, and otherwise FALSE.
+ * Try to take the pad's stream lock, and return %TRUE if the lock could be
+ * taken, and otherwise %FALSE.
  */
 #define GST_PAD_STREAM_TRYLOCK(pad)     g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
 /**
@@ -1140,17 +1261,33 @@ struct _GstPadClass {
  * Release the pad's stream lock.
  */
 #define GST_PAD_STREAM_UNLOCK(pad)      g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
+/**
+ * GST_PAD_LAST_FLOW_RETURN:
+ * @pad: a #GstPad
+ *
+ * Gets the last flow return on this pad
+ *
+ * Since: 1.4
+ */
+#define GST_PAD_LAST_FLOW_RETURN(pad)   (GST_PAD_CAST(pad)->ABI.abi.last_flowret)
 
 #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)))
 
+GST_API
 GType                  gst_pad_get_type                        (void);
 
 /* creating pads */
+
+GST_API
 GstPad*                        gst_pad_new                             (const gchar *name, GstPadDirection direction);
+
+GST_API
 GstPad*                        gst_pad_new_from_template               (GstPadTemplate *templ, const gchar *name);
+
+GST_API
 GstPad*                        gst_pad_new_from_static_template        (GstStaticPadTemplate *templ, const gchar *name);
 
 
@@ -1169,69 +1306,108 @@ GstPad*                        gst_pad_new_from_static_template        (GstStaticPadTemplate *templ, const g
  *
  * Get the parent of @pad. This function increases the refcount
  * of the parent object so you should gst_object_unref() it after usage.
- * Can return NULL if the pad did not have a parent.
+ * Can return %NULL if the pad did not have a parent.
  *
  * MT safe.
+ *
+ * Returns: (nullable): the parent
  */
 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
 
+GST_API
 GstPadDirection                gst_pad_get_direction                   (GstPad *pad);
 
+GST_API
 gboolean               gst_pad_set_active                      (GstPad *pad, gboolean active);
+
+GST_API
 gboolean               gst_pad_is_active                       (GstPad *pad);
+
+GST_API
 gboolean               gst_pad_activate_mode                   (GstPad *pad, GstPadMode mode,
                                                                  gboolean active);
-
+GST_API
 gulong                  gst_pad_add_probe                       (GstPad *pad,
                                                                 GstPadProbeType mask,
                                                                 GstPadProbeCallback callback,
                                                                  gpointer user_data,
                                                                  GDestroyNotify destroy_data);
+GST_API
 void                    gst_pad_remove_probe                    (GstPad *pad, gulong id);
 
+GST_API
 gboolean               gst_pad_is_blocked                      (GstPad *pad);
+
+GST_API
 gboolean               gst_pad_is_blocking                     (GstPad *pad);
 
+GST_API
 void                    gst_pad_mark_reconfigure                (GstPad *pad);
+
+GST_API
 gboolean               gst_pad_needs_reconfigure               (GstPad *pad);
+
+GST_API
 gboolean               gst_pad_check_reconfigure               (GstPad *pad);
 
+GST_API
 void                   gst_pad_set_element_private             (GstPad *pad, gpointer priv);
+
+GST_API
 gpointer               gst_pad_get_element_private             (GstPad *pad);
 
+GST_API
 GstPadTemplate*                gst_pad_get_pad_template                (GstPad *pad);
 
+GST_API
 GstFlowReturn           gst_pad_store_sticky_event              (GstPad *pad, GstEvent *event);
+
+GST_API
 GstEvent*               gst_pad_get_sticky_event                (GstPad *pad, GstEventType event_type,
                                                                  guint idx);
+
+GST_API
 void                    gst_pad_sticky_events_foreach           (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
 
 /* data passing setup functions */
+
+GST_API
 void                   gst_pad_set_activate_function_full      (GstPad *pad,
                                                                  GstPadActivateFunction activate,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+GST_API
 void                   gst_pad_set_activatemode_function_full  (GstPad *pad,
                                                                  GstPadActivateModeFunction activatemode,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
 /* data passing functions */
+
+GST_API
 void                   gst_pad_set_chain_function_full         (GstPad *pad,
                                                                  GstPadChainFunction chain,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+GST_API
 void                   gst_pad_set_chain_list_function_full    (GstPad *pad,
                                                                  GstPadChainListFunction chainlist,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+GST_API
 void                   gst_pad_set_getrange_function_full      (GstPad *pad,
                                                                  GstPadGetRangeFunction get,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+GST_API
 void                   gst_pad_set_event_function_full         (GstPad *pad,
                                                                  GstPadEventFunction event,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+GST_API
+void                   gst_pad_set_event_full_function_full    (GstPad *pad,
+                                                                 GstPadEventFullFunction event,
+                                                                 gpointer user_data,
+                                                                 GDestroyNotify notify);
 
 #define gst_pad_set_activate_function(p,f)      gst_pad_set_activate_function_full((p),(f),NULL,NULL)
 #define gst_pad_set_activatemode_function(p,f)  gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
@@ -1239,12 +1415,16 @@ void                    gst_pad_set_event_function_full         (GstPad *pad,
 #define gst_pad_set_chain_list_function(p,f)    gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
 #define gst_pad_set_getrange_function(p,f)      gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
 #define gst_pad_set_event_function(p,f)         gst_pad_set_event_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_event_full_function(p,f)    gst_pad_set_event_full_function_full((p),(f),NULL,NULL)
 
 /* pad links */
+
+GST_API
 void                   gst_pad_set_link_function_full          (GstPad *pad,
                                                                  GstPadLinkFunction link,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+GST_API
 void                   gst_pad_set_unlink_function_full        (GstPad *pad,
                                                                  GstPadUnlinkFunction unlink,
                                                                  gpointer user_data,
@@ -1253,74 +1433,140 @@ void                   gst_pad_set_unlink_function_full        (GstPad *pad,
 #define gst_pad_set_link_function(p,f)          gst_pad_set_link_function_full((p),(f),NULL,NULL)
 #define gst_pad_set_unlink_function(p,f)        gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
 
+GST_API
 gboolean                gst_pad_can_link                        (GstPad *srcpad, GstPad *sinkpad);
+
+GST_API
 GstPadLinkReturn        gst_pad_link                           (GstPad *srcpad, GstPad *sinkpad);
+
+GST_API
 GstPadLinkReturn        gst_pad_link_full                      (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
+
+GST_API
 gboolean               gst_pad_unlink                          (GstPad *srcpad, GstPad *sinkpad);
+
+GST_API
 gboolean               gst_pad_is_linked                       (GstPad *pad);
 
+GST_API
 GstPad*                        gst_pad_get_peer                        (GstPad *pad);
 
+GST_API
 GstCaps*                gst_pad_get_pad_template_caps          (GstPad *pad);
 
 /* capsnego function for linked/unlinked pads */
+
+GST_API
 GstCaps *              gst_pad_get_current_caps                (GstPad * pad);
+
+GST_API
 gboolean               gst_pad_has_current_caps                (GstPad * pad);
 
 /* capsnego for linked pads */
+
+GST_API
 GstCaps *              gst_pad_get_allowed_caps                (GstPad * pad);
 
 /* pad offsets */
+
+GST_API
 gint64                  gst_pad_get_offset                      (GstPad *pad);
+
+GST_API
 void                    gst_pad_set_offset                      (GstPad *pad, gint64 offset);
 
 /* data passing functions to peer */
+
+GST_API
 GstFlowReturn          gst_pad_push                            (GstPad *pad, GstBuffer *buffer);
+
+GST_API
 GstFlowReturn          gst_pad_push_list                       (GstPad *pad, GstBufferList *list);
+
+GST_API
 GstFlowReturn          gst_pad_pull_range                      (GstPad *pad, guint64 offset, guint size,
                                                                 GstBuffer **buffer);
+GST_API
 gboolean               gst_pad_push_event                      (GstPad *pad, GstEvent *event);
+
+GST_API
 gboolean               gst_pad_event_default                   (GstPad *pad, GstObject *parent,
                                                                  GstEvent *event);
+GST_API
+GstFlowReturn           gst_pad_get_last_flow_return            (GstPad *pad);
 
 /* data passing functions on pad */
+
+GST_API
 GstFlowReturn          gst_pad_chain                           (GstPad *pad, GstBuffer *buffer);
+
+GST_API
 GstFlowReturn          gst_pad_chain_list                      (GstPad *pad, GstBufferList *list);
+
+GST_API
 GstFlowReturn          gst_pad_get_range                       (GstPad *pad, guint64 offset, guint size,
                                                                 GstBuffer **buffer);
+GST_API
 gboolean               gst_pad_send_event                      (GstPad *pad, GstEvent *event);
 
 /* pad tasks */
+
+GST_API
 gboolean               gst_pad_start_task                      (GstPad *pad, GstTaskFunction func,
                                                                 gpointer user_data, GDestroyNotify notify);
+GST_API
 gboolean               gst_pad_pause_task                      (GstPad *pad);
+
+GST_API
 gboolean               gst_pad_stop_task                       (GstPad *pad);
 
+GST_API
+GstTaskState   gst_pad_get_task_state          (GstPad *pad);
+
 /* internal links */
+
+GST_API
 void                    gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
                                                                  GstPadIterIntLinkFunction iterintlink,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+
+GST_API
 GstIterator *           gst_pad_iterate_internal_links          (GstPad * pad);
+
+GST_API
 GstIterator *           gst_pad_iterate_internal_links_default  (GstPad * pad, GstObject *parent);
 
 #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
 
 /* generic query function */
+
+GST_API
 gboolean               gst_pad_query                           (GstPad *pad, GstQuery *query);
+
+GST_API
 gboolean               gst_pad_peer_query                      (GstPad *pad, GstQuery *query);
+
+GST_API
 void                   gst_pad_set_query_function_full         (GstPad *pad, GstPadQueryFunction query,
                                                                  gpointer user_data,
                                                                  GDestroyNotify notify);
+GST_API
 gboolean               gst_pad_query_default                   (GstPad *pad, GstObject *parent,
                                                                  GstQuery *query);
 
 #define gst_pad_set_query_function(p,f)   gst_pad_set_query_function_full((p),(f),NULL,NULL)
 
 /* misc helper functions */
+
+GST_API
 gboolean               gst_pad_forward                         (GstPad *pad, GstPadForwardFunction forward,
                                                                 gpointer user_data);
 
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPad, gst_object_unref)
+#endif
+
 G_END_DECLS
 
 #endif /* __GST_PAD_H__ */