summaryrefslogtreecommitdiff
path: root/gst/gstpad.h
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2015-04-29 15:49:17 +0200
committerEdward Hervey <bilboed@bilboed.com>2015-08-15 17:00:12 +0200
commit7f0e0ff3ca4f3533e66843c084d084517cff4d47 (patch)
tree4fef69955f75fa32d1750ab39653ec641c239e5c /gst/gstpad.h
parentafff60b0b59b15a29ade9d4e41aecee414bffe01 (diff)
gstpad: Add a new GST_PROBE_HANDLED return value for probes
In some cases, probes might want to handle the buffer/event/query themselves and stop the data from travelling further downstream. While this was somewhat possible with buffer/events and using GST_PROBE_DROP, it was not applicable to queries, and would result in the query failing. With this new GST_PROBE_HANDLED value, the buffer/event/query will be considered as successfully handled, will not be pushed further and the appropriate return value (TRUE or GST_FLOW_OK) will be returned This also allows probes to return a non-default GstFlowReturn when dealing with buffer push. This can be done by setting the GST_PAD_PROBE_INFO_FLOW_RETURN() field accordingly https://bugzilla.gnome.org/show_bug.cgi?id=748643
Diffstat (limited to 'gst/gstpad.h')
-rw-r--r--gst/gstpad.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/gst/gstpad.h b/gst/gstpad.h
index 89a24d42a..157d147b7 100644
--- a/gst/gstpad.h
+++ b/gst/gstpad.h
@@ -514,6 +514,14 @@ typedef enum
* @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.
*/
@@ -523,6 +531,7 @@ typedef enum
GST_PAD_PROBE_OK,
GST_PAD_PROBE_REMOVE,
GST_PAD_PROBE_PASS,
+ GST_PAD_PROBE_HANDLED
} GstPadProbeReturn;
@@ -548,12 +557,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))