#include <gst/gstobject.h>
#include <gst/gstbuffer.h>
#include <gst/gstbufferlist.h>
-#include <gst/gstcontext.h>
#include <gst/gstcaps.h>
#include <gst/gstevent.h>
#include <gst/gstquery.h>
* @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility.
* @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents.
* Could be omitted if it is already known that the two elements that own the
- * pads are in the same bin.
+ * pads are in the same bin.
* @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using
* their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
* would be unsafe e.g. if one pad has %GST_CAPS_ANY.
/**
* GST_PAD_LINK_CHECK_DEFAULT:
*
- * The default checks done when linking pads (i.e. the ones used by
+ * The default checks done when linking pads (i.e. the ones used by
* gst_pad_link()).
*
* Since: 0.10.30
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 */
/**
* GstPadIterIntLinkFunction:
/**
* 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
*
* Returns: a newly allocated copy #GstCaps of the pad.
*/
-typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad);
+typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *filter);
/**
* GstPadSetCapsFunction:
typedef gboolean (*GstPadDispatcherFunction) (GstPad *pad, gpointer data);
/**
- * GstPadBlockCallback:
- * @pad: the #GstPad that is blockend or unblocked.
- * @blocked: blocking state for the pad
+ * 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.
+ */
+typedef enum
+{
+ GST_PROBE_TYPE_INVALID = (1 << 0),
+
+ GST_PROBE_TYPE_IDLE = (1 << 1),
+ GST_PROBE_TYPE_BLOCK = (1 << 2),
+
+ GST_PROBE_TYPE_BUFFER = (1 << 3),
+ GST_PROBE_TYPE_BUFFER_LIST = (1 << 4),
+ GST_PROBE_TYPE_EVENT = (1 << 5),
+
+ GST_PROBE_TYPE_PUSH = (1 << 6),
+ GST_PROBE_TYPE_PULL = (1 << 7),
+} 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)
+
+/**
+ * GstProbeResult:
+ * @GST_PROBE_RESULT_OK: normal probe return value
+ * @GST_PROBE_RESULT_DROP: drop data in data probes
+ * @GST_PROBE_RESULT_REMOVE: remove probe
+ * @GST_PROBE_RESULT_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 GstProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstProbeType type,
+ gpointer type_data, gpointer user_data);
+
+/**
+ * GstPadStickyEventsForeachFunction:
+ * @pad: the #GstPad.
+ * @event: the sticky #GstEvent.
+ * @user_data: the #gpointer to optional user data.
+ *
+ * Callback used by gst_pad_sticky_events_foreach().
+ *
+ * Returns: GST_FLOW_OK if the iteration should continue
*/
-typedef void (*GstPadBlockCallback) (GstPad *pad, gboolean blocked, gpointer user_data);
+typedef GstFlowReturn (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent *event, gpointer user_data);
/**
* GstPadDirection:
* 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
GST_PAD_IN_SETCAPS = (GST_OBJECT_FLAG_LAST << 3),
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 << 16)
} GstPadFlags;
* @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
* 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 */
/*< public >*/ /* with LOCK */
/* block cond, mutex is from the object */
GCond *block_cond;
- GstPadBlockCallback block_callback;
- gpointer block_data;
- GDestroyNotify block_destroy_data;
- gboolean block_callback_called;
+ 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;
GstPadChainListFunction chainlistfunc;
- GstPadCheckGetRangeFunction checkgetrangefunc;
GstPadGetRangeFunction getrangefunc;
GstPadEventFunction eventfunc;
- GstContext *context;
- GstActivateMode mode;
+ /* pad offset */
+ gint64 offset;
/* generic query method */
GstPadQueryTypeFunction querytypefunc;
/* internal links */
GstPadIterIntLinkFunction iterintlinkfunc;
- /* whether to emit signals for have-data. counts number
- * of handlers attached. */
- gint do_buffer_signals;
- gint do_event_signals;
+ /* counts number of probes attached. */
+ gint num_probes;
+ gint num_blocked;
/*< private >*/
GstPadPrivate *priv;
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];
/* 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)
#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_CONTEXT(pad) (GST_PAD_CAST(pad)->context)
#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_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_NEEDS_RECONFIGURE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_NEED_RECONFIGURE))
-#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_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))
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);
GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
+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_chain_function (GstPad *pad, GstPadChainFunction chain);
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 */
void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
-G_CONST_RETURN 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 (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 (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);