summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-06-13 10:52:48 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2012-06-14 09:04:33 +0200
commit7b6ebd4b5bb0cb5460972c6b7ca860eaf1b13d24 (patch)
treeb0dac376b850ff895b185c95e51a4b3c20f2d4cb /gst
parent9c8ee44f9bcbe039a133a7a2adc76ccf4652239a (diff)
message: add the running-time to the async-done message
Add the running-time of the buffer that caused the async operation to complete to the async-done message. Update bin to handle the new async-done message.
Diffstat (limited to 'gst')
-rw-r--r--gst/gstbin.c20
-rw-r--r--gst/gstmessage.c26
-rw-r--r--gst/gstmessage.h4
3 files changed, 27 insertions, 23 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c
index a9790ab20..8e31a48fe 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -221,7 +221,7 @@ static void gst_bin_state_changed (GstElement * element, GstState oldstate,
static GstStateChangeReturn gst_bin_get_state_func (GstElement * element,
GstState * state, GstState * pending, GstClockTime timeout);
static void bin_handle_async_done (GstBin * bin, GstStateChangeReturn ret,
- gboolean flag_pending, gboolean reset_time);
+ gboolean flag_pending, GstClockTime running_time);
static void bin_handle_async_start (GstBin * bin);
static void bin_push_state_continue (BinContinueData * data);
static void bin_do_eos (GstBin * bin);
@@ -1134,7 +1134,7 @@ gst_bin_add_func (GstBin * bin, GstElement * element)
}
case GST_STATE_CHANGE_NO_PREROLL:
/* ignore all async elements we might have and commit our state */
- bin_handle_async_done (bin, ret, FALSE, FALSE);
+ bin_handle_async_done (bin, ret, FALSE, GST_CLOCK_TIME_NONE);
break;
case GST_STATE_CHANGE_FAILURE:
break;
@@ -1451,7 +1451,7 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
else
ret = GST_STATE_CHANGE_SUCCESS;
- bin_handle_async_done (bin, ret, FALSE, FALSE);
+ bin_handle_async_done (bin, ret, FALSE, GST_CLOCK_TIME_NONE);
} else {
GST_DEBUG_OBJECT (bin,
"recalc state preroll: %d, other async: %d, this async %d",
@@ -2696,7 +2696,8 @@ done:
bin_remove_messages (bin, NULL, GST_MESSAGE_ASYNC_DONE);
GST_DEBUG_OBJECT (bin, "async elements commited");
- bin_handle_async_done (bin, GST_STATE_CHANGE_SUCCESS, FALSE, FALSE);
+ bin_handle_async_done (bin, GST_STATE_CHANGE_SUCCESS, FALSE,
+ GST_CLOCK_TIME_NONE);
}
state_end:
@@ -2955,7 +2956,7 @@ was_no_preroll:
*/
static void
bin_handle_async_done (GstBin * bin, GstStateChangeReturn ret,
- gboolean flag_pending, gboolean reset_time)
+ gboolean flag_pending, GstClockTime running_time)
{
GstState current, pending, target;
GstStateChangeReturn old_ret;
@@ -2983,7 +2984,7 @@ bin_handle_async_done (GstBin * bin, GstStateChangeReturn ret,
target = GST_STATE_TARGET (bin);
pending = GST_STATE_PENDING (bin) = target;
- amessage = gst_message_new_async_done (GST_OBJECT_CAST (bin), reset_time);
+ amessage = gst_message_new_async_done (GST_OBJECT_CAST (bin), running_time);
old_state = GST_STATE (bin);
/* this is the state we should go to next */
@@ -3413,13 +3414,13 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
}
case GST_MESSAGE_ASYNC_DONE:
{
- gboolean reset_time;
+ GstClockTime running_time;
GstState target;
GST_DEBUG_OBJECT (bin, "ASYNC_DONE message %p, %s", message,
src ? GST_OBJECT_NAME (src) : "(NULL)");
- gst_message_parse_async_done (message, &reset_time);
+ gst_message_parse_async_done (message, &running_time);
GST_OBJECT_LOCK (bin);
bin_do_message_forward (bin, message);
@@ -3441,7 +3442,8 @@ gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
* need to set the pending_done flag so that at the end of the state
* change we can see if we need to verify pending async elements, hence
* the TRUE argument here. */
- bin_handle_async_done (bin, GST_STATE_CHANGE_SUCCESS, TRUE, reset_time);
+ bin_handle_async_done (bin, GST_STATE_CHANGE_SUCCESS, TRUE,
+ running_time);
} else {
GST_DEBUG_OBJECT (bin, "there are more async elements pending");
}
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index d3d4af657..ae03f99c4 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -870,24 +870,26 @@ gst_message_new_async_start (GstObject * src)
/**
* gst_message_new_async_done:
* @src: (transfer none): The object originating the message.
- * @reset_time: if the running_time should be reset
+ * @running_time: the desired running_time
*
* The message is posted when elements completed an ASYNC state change.
- * @reset_time is set to TRUE when the element requests a new running_time
- * before going to PLAYING.
+ * @running_time contains the time of the desired running_time when this
+ * elements goes to PLAYING. A value of #GST_CLOCK_TIME_NONE for @running_time
+ * means that the element has no clock interaction and thus doesn't care about
+ * the running_time of the pipeline.
*
* Returns: (transfer full): The new async_done message.
*
* MT safe.
*/
GstMessage *
-gst_message_new_async_done (GstObject * src, gboolean reset_time)
+gst_message_new_async_done (GstObject * src, GstClockTime running_time)
{
GstMessage *message;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (MESSAGE_ASYNC_DONE),
- GST_QUARK (RESET_TIME), G_TYPE_BOOLEAN, reset_time, NULL);
+ GST_QUARK (RUNNING_TIME), G_TYPE_UINT64, running_time, NULL);
message = gst_message_new_custom (GST_MESSAGE_ASYNC_DONE, src, structure);
return message;
@@ -1542,14 +1544,14 @@ gst_message_parse_duration (GstMessage * message, GstFormat * format,
/**
* gst_message_parse_async_done:
* @message: A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE.
- * @reset_time: (out): Result location for the reset_time or NULL
+ * @running_time: (out): Result location for the running_time or NULL
*
- * Extract the reset_time from the async_done message.
+ * Extract the running_time from the async_done message.
*
* MT safe.
*/
void
-gst_message_parse_async_done (GstMessage * message, gboolean * reset_time)
+gst_message_parse_async_done (GstMessage * message, GstClockTime * running_time)
{
GstStructure *structure;
@@ -1557,10 +1559,10 @@ gst_message_parse_async_done (GstMessage * message, gboolean * reset_time)
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_DONE);
structure = GST_MESSAGE_STRUCTURE (message);
- if (reset_time)
- *reset_time =
- g_value_get_boolean (gst_structure_id_get_value (structure,
- GST_QUARK (RESET_TIME)));
+ if (running_time)
+ *running_time =
+ g_value_get_uint64 (gst_structure_id_get_value (structure,
+ GST_QUARK (RUNNING_TIME)));
}
/**
diff --git a/gst/gstmessage.h b/gst/gstmessage.h
index 4dfcdb25a..50e014616 100644
--- a/gst/gstmessage.h
+++ b/gst/gstmessage.h
@@ -502,8 +502,8 @@ GstMessage * gst_message_new_latency (GstObject * src) G_GNUC_MALLOC;
GstMessage * gst_message_new_async_start (GstObject * src) G_GNUC_MALLOC;
/* ASYNC_DONE */
-GstMessage * gst_message_new_async_done (GstObject * src, gboolean reset_time) G_GNUC_MALLOC;
-void gst_message_parse_async_done (GstMessage *message, gboolean *reset_time);
+GstMessage * gst_message_new_async_done (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
+void gst_message_parse_async_done (GstMessage *message, GstClockTime *running_time);
/* STRUCTURE CHANGE */
GstMessage * gst_message_new_structure_change (GstObject * src, GstStructureChangeType type,