* @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:
/*< 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;
/* data transport functions */
GstPadChainFunction chainfunc;
GstPadChainListFunction chainlistfunc;
- GstPadCheckGetRangeFunction checkgetrangefunc;
GstPadGetRangeFunction getrangefunc;
GstPadEventFunction eventfunc;
+ /* pad offset */
+ gint64 offset;
+
/* generic query method */
GstPadQueryTypeFunction querytypefunc;
GstPadQueryFunction queryfunc;
/* 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];
#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)
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_current_caps (GstPad * pad);
gboolean gst_pad_has_current_caps (GstPad * pad);
-GstCaps * gst_pad_get_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);
+/* 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);