ges: Keep internal stream selection messages internally

Timeline StreamCollection are very specific to inner working of nested
timelines and should not interfere with the usual stream selection
process and are now handled as element messages.

Stream selection inside `nleobject` need to be handled internally by the
application or GES itself so we should just drop all those as they would
interfere and fail if they are exposed to other elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5983>
This commit is contained in:
Thibault Saunier 2023-08-04 17:57:35 -04:00 committed by GStreamer Marge Bot
parent b14207cc9e
commit 37602d1d02
4 changed files with 45 additions and 14 deletions

View file

@ -514,6 +514,16 @@ forward:
GST_BIN_CLASS (parent_class)->handle_message (bin, message);
}
static void
ges_timeline_post_stream_collection (GESTimeline * timeline)
{
gst_element_post_message ((GstElement *) timeline,
gst_message_new_element ((GstObject *) timeline,
gst_structure_new ("ges-timeline-collection", "collection",
GST_TYPE_STREAM_COLLECTION, timeline->priv->stream_collection,
NULL)));
}
static GstStateChangeReturn
ges_timeline_change_state (GstElement * element, GstStateChange transition)
{
@ -524,9 +534,7 @@ ges_timeline_change_state (GstElement * element, GstStateChange transition)
transition);
if (transition == GST_STATE_CHANGE_READY_TO_PAUSED)
gst_element_post_message ((GstElement *) timeline,
gst_message_new_stream_collection ((GstObject *) timeline,
timeline->priv->stream_collection));
ges_timeline_post_stream_collection (timeline);
return res;
}
@ -2894,9 +2902,7 @@ ges_timeline_commit (GESTimeline * timeline)
UNLOCK_DYN (timeline);
if (pcollection != timeline->priv->stream_collection) {
gst_element_post_message ((GstElement *) timeline,
gst_message_new_stream_collection ((GstObject *) timeline,
timeline->priv->stream_collection));
ges_timeline_post_stream_collection (timeline);
}
ges_timeline_emit_snapping (timeline, NULL, NULL, GST_CLOCK_TIME_NONE);

View file

@ -488,17 +488,37 @@ ges_track_handle_message (GstBin * bin, GstMessage * message)
{
GESTrack *track = GES_TRACK (bin);
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_COLLECTION) {
GstStreamCollection *collection;
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_STREAM_COLLECTION:
g_error ("Internal stream collection messages should be kept internal");
break;
case GST_MESSAGE_ELEMENT:
{
const GstStructure *s = gst_message_get_structure (message);
gst_message_parse_stream_collection (message, &collection);
if (GES_IS_TIMELINE (GST_MESSAGE_SRC (message))) {
ges_track_select_subtimeline_streams (track, collection,
GST_ELEMENT (GST_MESSAGE_SRC (message)));
if (gst_structure_has_name (s, "ges-timeline-collection")) {
GstStreamCollection *collection;
gst_structure_get (s, "collection", GST_TYPE_STREAM_COLLECTION,
&collection, NULL);
ges_track_select_subtimeline_streams (track, collection,
GST_ELEMENT (GST_MESSAGE_SRC (message)));
GST_INFO_OBJECT (bin,
"Handled ges-timeline-collection message, dropping");
gst_message_unref (message);
return;
}
break;
}
default:
break;
}
gst_element_post_message (GST_ELEMENT_CAST (bin), message);
GST_BIN_CLASS (ges_track_parent_class)->handle_message (bin, message);
}
/* GObject virtual methods */

View file

@ -752,7 +752,7 @@ _extract (GESAsset * asset, GError ** error)
GESUriSourceAssetPrivate *priv = GES_URI_SOURCE_ASSET (asset)->priv;
if (GST_IS_DISCOVERER_STREAM_INFO (priv->sinfo) == FALSE) {
GST_WARNING_OBJECT (asset, "Can not extract as no strean info set");
GST_WARNING_OBJECT (asset, "Can not extract as no stream info set");
return NULL;
}

View file

@ -140,6 +140,11 @@ nle_bin_handle_message (GstBin * bin, GstMessage * message)
return;
}
} else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_COLLECTION) {
GST_INFO_OBJECT (bin, "Dropping stream collection message, "
" those are internal to and should be kept as such");
return;
}
return GST_BIN_CLASS (parent_class)->handle_message (bin, message);