summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-11-28 23:07:44 +0100
committerWim Taymans <wim@metal.(none)>2009-12-28 15:16:57 +0100
commitff9b07a587413c263b32473a15cc2359b59adf1a (patch)
tree237451eef5fe2d8fe74548ce997465a29b247265
parent1c5a6768cc254e6a1f922eb407890236c7b02c20 (diff)
pad: make event function return GstFlowReturnevents2
-rw-r--r--gst/gstpad.c59
-rw-r--r--gst/gstpad.h12
2 files changed, 34 insertions, 37 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c
index e0801a071..823445e5a 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -3403,10 +3403,10 @@ gst_pad_get_internal_links (GstPad * pad)
}
#endif /* GST_REMOVE_DEPRECATED */
-static gboolean
+static GstFlowReturn
gst_pad_event_default_dispatch (GstPad * pad, GstEvent * event)
{
- gboolean result = FALSE;
+ GstFlowReturn result = GST_FLOW_NOT_LINKED;
GstIterator *iter;
gboolean done = FALSE;
gpointer item;
@@ -3439,6 +3439,7 @@ gst_pad_event_default_dispatch (GstPad * pad, GstEvent * event)
event, GST_EVENT_TYPE_NAME (event),
GST_DEBUG_PAD_NAME (eventpad));
gst_event_ref (event);
+ /* FIXME, do aggregation */
result |= gst_pad_push_event (eventpad, event);
} else {
/* we only send the event on one pad, multi-sinkpad elements
@@ -3473,12 +3474,6 @@ gst_pad_event_default_dispatch (GstPad * pad, GstEvent * event)
no_iter:
- /* If this is a sinkpad and we don't have pads to send the event to, we
- * return TRUE. This is so that when using the default handler on a sink
- * element, we don't fail to push it. */
- if (!pushed_pads)
- result = GST_PAD_IS_SINK (pad);
-
g_list_free (pushed_pads);
/* we handled the incoming event so we unref once */
@@ -3501,9 +3496,9 @@ no_iter:
* pads that are internally linked to @pad, only one will be sent an event.
* Multi-sinkpad elements should implement custom event handlers.
*
- * Returns: TRUE if the event was sent succesfully.
+ * Returns: GST_FLOW_OK if the event was sent succesfully.
*/
-gboolean
+GstFlowReturn
gst_pad_event_default (GstPad * pad, GstEvent * event)
{
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
@@ -3536,13 +3531,13 @@ gst_pad_event_default (GstPad * pad, GstEvent * event)
* The GstPadDispatcherFunction should return TRUE when no further pads
* need to be processed.
*
- * Returns: TRUE if one of the dispatcher functions returned TRUE.
+ * Returns: GST_FLOW_OK if one of the dispatcher functions returned TRUE.
*/
-gboolean
+GstFlowReturn
gst_pad_dispatcher (GstPad * pad, GstPadDispatcherFunction dispatch,
gpointer data)
{
- gboolean res = FALSE;
+ GstFlowReturn res = GST_FLOW_NOT_LINKED;
GstIterator *iter = NULL;
gboolean done = FALSE;
gpointer item;
@@ -4825,19 +4820,19 @@ not_negotiated:
* This function takes owership of the provided event so you should
* gst_event_ref() it if you want to reuse the event after this call.
*
- * Returns: TRUE if the event was handled.
+ * Returns: GST_FLOW_OK if the event was handled.
*
* MT safe.
*/
-gboolean
+GstFlowReturn
gst_pad_push_event (GstPad * pad, GstEvent * event)
{
GstPad *peerpad;
- gboolean result;
+ GstFlowReturn result;
- g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
- g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
+ g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
+ g_return_val_if_fail (event != NULL, GST_FLOW_ERROR);
+ g_return_val_if_fail (GST_IS_EVENT (event), GST_FLOW_ERROR);
GST_LOG_OBJECT (pad, "event: %s", GST_EVENT_TYPE_NAME (event));
@@ -4909,14 +4904,14 @@ dropping:
{
GST_DEBUG_OBJECT (pad, "Dropping event after FALSE probe return");
gst_event_unref (event);
- return FALSE;
+ return GST_FLOW_OK;
}
not_linked:
{
GST_DEBUG_OBJECT (pad, "Dropping event because pad is not linked");
gst_event_unref (event);
GST_OBJECT_UNLOCK (pad);
- return FALSE;
+ return GST_FLOW_NOT_LINKED;
}
flushed:
{
@@ -4924,7 +4919,7 @@ flushed:
"Not forwarding event since we're flushing and blocking");
gst_event_unref (event);
GST_OBJECT_UNLOCK (pad);
- return TRUE;
+ return GST_FLOW_OK;
}
}
@@ -4954,17 +4949,17 @@ flushed:
* This function takes owership of the provided event so you should
* gst_event_ref() it if you want to reuse the event after this call.
*
- * Returns: TRUE if the event was handled.
+ * Returns: GST_FLOW_OK if the event was handled.
*/
-gboolean
+GstFlowReturn
gst_pad_send_event (GstPad * pad, GstEvent * event)
{
- gboolean result = FALSE;
+ GstFlowReturn result = GST_FLOW_NOT_LINKED;
GstPadEventFunction eventfunc;
gboolean serialized, need_unlock = FALSE;
- g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
+ g_return_val_if_fail (event != NULL, GST_FLOW_ERROR);
GST_OBJECT_LOCK (pad);
if (GST_PAD_IS_SINK (pad)) {
@@ -5055,14 +5050,14 @@ wrong_direction:
GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE_NAME (event));
GST_OBJECT_UNLOCK (pad);
gst_event_unref (event);
- return FALSE;
+ return GST_FLOW_ERROR;
}
unknown_direction:
{
g_warning ("pad %s:%s has invalid direction", GST_DEBUG_PAD_NAME (pad));
GST_OBJECT_UNLOCK (pad);
gst_event_unref (event);
- return FALSE;
+ return GST_FLOW_ERROR;
}
no_function:
{
@@ -5072,7 +5067,7 @@ no_function:
if (need_unlock)
GST_PAD_STREAM_UNLOCK (pad);
gst_event_unref (event);
- return FALSE;
+ return GST_FLOW_NOT_SUPPORTED;
}
flushing:
{
@@ -5082,13 +5077,13 @@ flushing:
GST_CAT_INFO_OBJECT (GST_CAT_EVENT, pad,
"Received event on flushing pad. Discarding");
gst_event_unref (event);
- return FALSE;
+ return GST_FLOW_WRONG_STATE;
}
dropping:
{
GST_DEBUG_OBJECT (pad, "Dropping event after FALSE probe return");
gst_event_unref (event);
- return FALSE;
+ return GST_FLOW_OK;
}
}
diff --git a/gst/gstpad.h b/gst/gstpad.h
index ee684e14c..7b6528f90 100644
--- a/gst/gstpad.h
+++ b/gst/gstpad.h
@@ -96,6 +96,7 @@ typedef enum {
* @GST_FLOW_CUSTOM_SUCCESS: Elements can use values starting from
* this to define custom success codes.
* Since 0.10.7.
+ * @GST_FLOW_DROPPED: The buffer was dropped for some reason.
* @GST_FLOW_RESEND: Resend buffer, possibly with new caps (not
* sent yet) (unused/unimplemented).
* @GST_FLOW_OK: Data passing was ok.
@@ -120,6 +121,7 @@ typedef enum {
GST_FLOW_CUSTOM_SUCCESS = 100,
/* core predefined */
+ GST_FLOW_DROPPED = 2,
GST_FLOW_RESEND = 1,
GST_FLOW_OK = 0,
/* expected failures */
@@ -303,9 +305,9 @@ typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, guint64 offset,
*
* Function signature to handle an event for the pad.
*
- * Returns: TRUE if the pad could handle the event.
+ * Returns: #GST_FLOW_OK for success
*/
-typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
+typedef GstFlowReturn (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
/* FIXME: 0.11: deprecate me, check range should use seeking query */
@@ -910,15 +912,15 @@ 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);
-gboolean gst_pad_event_default (GstPad *pad, GstEvent *event);
+GstFlowReturn gst_pad_push_event (GstPad *pad, GstEvent *event);
+GstFlowReturn gst_pad_event_default (GstPad *pad, GstEvent *event);
/* data passing functions on pad */
GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
GstFlowReturn gst_pad_chain_list (GstPad *pad, GstBufferList *list);
GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
GstBuffer **buffer);
-gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
+GstFlowReturn gst_pad_send_event (GstPad *pad, GstEvent *event);
/* pad tasks */
gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,