mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
ges: Use the new GNL element message feature to notify async operations
This commit is contained in:
parent
2104cd9e50
commit
b9c6606e89
1 changed files with 36 additions and 39 deletions
|
@ -373,59 +373,56 @@ ges_timeline_finalize (GObject * object)
|
||||||
static void
|
static void
|
||||||
ges_timeline_handle_message (GstBin * bin, GstMessage * message)
|
ges_timeline_handle_message (GstBin * bin, GstMessage * message)
|
||||||
{
|
{
|
||||||
GstMessageType type;
|
|
||||||
GESTimeline *timeline = GES_TIMELINE (bin);
|
GESTimeline *timeline = GES_TIMELINE (bin);
|
||||||
GstMessage *forwarded_message;
|
|
||||||
GstObject *element;
|
|
||||||
|
|
||||||
type = GST_MESSAGE_TYPE (message);
|
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) {
|
||||||
|
GstMessage *amessage = NULL;
|
||||||
if (type == GST_MESSAGE_ELEMENT) {
|
|
||||||
const GstStructure *mstructure = gst_message_get_structure (message);
|
const GstStructure *mstructure = gst_message_get_structure (message);
|
||||||
|
|
||||||
if (!gst_structure_get (mstructure, "message", GST_TYPE_MESSAGE, &forwarded_message, NULL))
|
if (gst_structure_has_name (mstructure, "GnlCompositionStartUpdate")) {
|
||||||
goto forward;
|
if (g_strcmp0 (gst_structure_get_string (mstructure, "reason"), "Seek")) {
|
||||||
} else {
|
GST_INFO_OBJECT (timeline,
|
||||||
|
"A composition is starting an update because of %s"
|
||||||
|
" not concidering async", gst_structure_get_string (mstructure,
|
||||||
|
"reason"));
|
||||||
|
|
||||||
goto forward;
|
goto forward;
|
||||||
}
|
}
|
||||||
|
|
||||||
element = GST_MESSAGE_SRC (forwarded_message);
|
|
||||||
if (!GES_IS_TRACK (GST_ELEMENT_PARENT (GST_ELEMENT (element))))
|
|
||||||
goto forward;
|
|
||||||
|
|
||||||
if (!gst_mini_object_get_qdata ((GstMiniObject *) forwarded_message,
|
|
||||||
g_quark_from_static_string ("gnl-async-seek")))
|
|
||||||
goto forward;
|
|
||||||
|
|
||||||
type = GST_MESSAGE_TYPE (forwarded_message);
|
|
||||||
switch (type) {
|
|
||||||
case GST_MESSAGE_ASYNC_START:
|
|
||||||
GST_OBJECT_LOCK (timeline);
|
GST_OBJECT_LOCK (timeline);
|
||||||
if (timeline->priv->expected_async_done == 0) {
|
if (timeline->priv->expected_async_done == 0) {
|
||||||
GstMessage *amessage = gst_message_new_async_start (GST_OBJECT_CAST (bin));
|
amessage = gst_message_new_async_start (GST_OBJECT_CAST (bin));
|
||||||
timeline->priv->expected_async_done = g_list_length (timeline->tracks);
|
timeline->priv->expected_async_done = g_list_length (timeline->tracks);
|
||||||
GST_OBJECT_UNLOCK (timeline);
|
GST_INFO_OBJECT (timeline, "Posting ASYNC_START %s",
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (bin), amessage);
|
gst_structure_get_string (mstructure, "reason"));
|
||||||
} else {
|
|
||||||
GST_OBJECT_UNLOCK (timeline);
|
|
||||||
}
|
}
|
||||||
return;
|
GST_OBJECT_UNLOCK (timeline);
|
||||||
case GST_MESSAGE_ASYNC_DONE:
|
|
||||||
|
} else if (gst_structure_has_name (mstructure, "GnlCompositionUpdateDone")) {
|
||||||
|
if (g_strcmp0 (gst_structure_get_string (mstructure, "reason"), "Seek")) {
|
||||||
|
GST_INFO_OBJECT (timeline,
|
||||||
|
"A composition is done updating because of %s"
|
||||||
|
" not concidering async", gst_structure_get_string (mstructure,
|
||||||
|
"reason"));
|
||||||
|
|
||||||
|
goto forward;
|
||||||
|
}
|
||||||
|
|
||||||
GST_OBJECT_LOCK (timeline);
|
GST_OBJECT_LOCK (timeline);
|
||||||
timeline->priv->expected_async_done -= 1;
|
timeline->priv->expected_async_done -= 1;
|
||||||
if (timeline->priv->expected_async_done == 0) {
|
if (timeline->priv->expected_async_done == 0) {
|
||||||
GstMessage *amessage = gst_message_new_async_done (GST_OBJECT_CAST (bin),
|
amessage = gst_message_new_async_done (GST_OBJECT_CAST (bin),
|
||||||
GST_CLOCK_TIME_NONE);
|
GST_CLOCK_TIME_NONE);
|
||||||
|
GST_INFO_OBJECT (timeline, "Posting ASYNC_DONE %s",
|
||||||
|
gst_structure_get_string (mstructure, "reason"));
|
||||||
|
}
|
||||||
GST_OBJECT_UNLOCK (timeline);
|
GST_OBJECT_UNLOCK (timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amessage)
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (bin), amessage);
|
gst_element_post_message (GST_ELEMENT_CAST (bin), amessage);
|
||||||
} else {
|
|
||||||
GST_OBJECT_UNLOCK (timeline);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
goto forward;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forward:
|
forward:
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (bin), message);
|
gst_element_post_message (GST_ELEMENT_CAST (bin), message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue