mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
ges: Avoid to always commit when a project is loaded
In case we are not in a PLAYING state and the project is loaded, the only thing that should be done is to fill the gaps and this way when the composition get to PLAYING, their initialization will be enough to get everything on track.
This commit is contained in:
parent
57eef236b5
commit
0d54d796de
4 changed files with 29 additions and 6 deletions
|
@ -100,6 +100,14 @@ gboolean
|
||||||
timeline_remove_element (GESTimeline *timeline,
|
timeline_remove_element (GESTimeline *timeline,
|
||||||
GESTimelineElement *element);
|
GESTimelineElement *element);
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
void
|
||||||
|
timeline_fill_gaps (GESTimeline *timeline);
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
void
|
||||||
|
track_resort_and_fill_gaps (GESTrack *track);
|
||||||
|
|
||||||
G_GNUC_INTERNAL void
|
G_GNUC_INTERNAL void
|
||||||
ges_asset_cache_init (void);
|
ges_asset_cache_init (void);
|
||||||
|
|
||||||
|
|
|
@ -540,7 +540,12 @@ gboolean
|
||||||
ges_project_set_loaded (GESProject * project, GESFormatter * formatter)
|
ges_project_set_loaded (GESProject * project, GESFormatter * formatter)
|
||||||
{
|
{
|
||||||
GST_INFO_OBJECT (project, "Emit project loaded");
|
GST_INFO_OBJECT (project, "Emit project loaded");
|
||||||
|
if (GST_STATE (formatter->timeline) < GST_STATE_PAUSED) {
|
||||||
|
timeline_fill_gaps (formatter->timeline);
|
||||||
|
} else {
|
||||||
ges_timeline_commit (formatter->timeline);
|
ges_timeline_commit (formatter->timeline);
|
||||||
|
}
|
||||||
|
|
||||||
g_signal_emit (project, _signals[LOADED_SIGNAL], 0, formatter->timeline);
|
g_signal_emit (project, _signals[LOADED_SIGNAL], 0, formatter->timeline);
|
||||||
|
|
||||||
/* We are now done with that formatter */
|
/* We are now done with that formatter */
|
||||||
|
|
|
@ -2474,6 +2474,16 @@ timeline_remove_element (GESTimeline * timeline, GESTimelineElement * element)
|
||||||
return g_hash_table_remove (timeline->priv->all_elements, element->name);
|
return g_hash_table_remove (timeline->priv->all_elements, element->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
timeline_fill_gaps (GESTimeline * timeline)
|
||||||
|
{
|
||||||
|
GList *tmp;
|
||||||
|
|
||||||
|
for (tmp = timeline->tracks; tmp; tmp = tmp->next) {
|
||||||
|
track_resort_and_fill_gaps (tmp->data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**** API *****/
|
/**** API *****/
|
||||||
/**
|
/**
|
||||||
* ges_timeline_new:
|
* ges_timeline_new:
|
||||||
|
|
|
@ -237,8 +237,8 @@ update_gaps (GESTrack * track)
|
||||||
g_list_free_full (gaps, (GDestroyNotify) free_gap);
|
g_list_free_full (gaps, (GDestroyNotify) free_gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
void
|
||||||
resort_and_fill_gaps (GESTrack * track)
|
track_resort_and_fill_gaps (GESTrack * track)
|
||||||
{
|
{
|
||||||
g_sequence_sort (track->priv->trackelements_by_start,
|
g_sequence_sort (track->priv->trackelements_by_start,
|
||||||
(GCompareDataFunc) element_start_compare, NULL);
|
(GCompareDataFunc) element_start_compare, NULL);
|
||||||
|
@ -691,7 +691,7 @@ ges_track_set_timeline (GESTrack * track, GESTimeline * timeline)
|
||||||
GST_DEBUG ("track:%p, timeline:%p", track, timeline);
|
GST_DEBUG ("track:%p, timeline:%p", track, timeline);
|
||||||
|
|
||||||
track->priv->timeline = timeline;
|
track->priv->timeline = timeline;
|
||||||
resort_and_fill_gaps (track);
|
track_resort_and_fill_gaps (track);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -907,7 +907,7 @@ ges_track_remove_element (GESTrack * track, GESTrackElement * object)
|
||||||
|
|
||||||
it = g_hash_table_lookup (priv->trackelements_iter, object);
|
it = g_hash_table_lookup (priv->trackelements_iter, object);
|
||||||
g_sequence_remove (it);
|
g_sequence_remove (it);
|
||||||
resort_and_fill_gaps (track);
|
track_resort_and_fill_gaps (track);
|
||||||
|
|
||||||
if (remove_object_internal (track, object) == TRUE) {
|
if (remove_object_internal (track, object) == TRUE) {
|
||||||
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (object), NULL);
|
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (object), NULL);
|
||||||
|
@ -990,7 +990,7 @@ ges_track_commit (GESTrack * track)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GES_IS_TRACK (track), FALSE);
|
g_return_val_if_fail (GES_IS_TRACK (track), FALSE);
|
||||||
|
|
||||||
resort_and_fill_gaps (track);
|
track_resort_and_fill_gaps (track);
|
||||||
|
|
||||||
return nle_object_commit (NLE_OBJECT (track->priv->composition), TRUE);
|
return nle_object_commit (NLE_OBJECT (track->priv->composition), TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue