basexmlformatter: Only set timeline auto transitions when done loading.

This commit is contained in:
Mathieu Duponchelle 2013-08-07 19:37:49 +02:00 committed by Thibault Saunier
parent ce57a0aacf
commit 2226882a5c
3 changed files with 45 additions and 13 deletions

View file

@ -111,6 +111,8 @@ struct _GESBaseXmlFormatterPrivate
GESClip *current_clip; GESClip *current_clip;
PendingClip *current_pending_clip; PendingClip *current_pending_clip;
gboolean timeline_auto_transition;
}; };
static void static void
@ -221,6 +223,8 @@ _load_from_uri (GESFormatter * self, GESTimeline * timeline, const gchar * uri,
{ {
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self); GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
ges_timeline_set_auto_transition (timeline, FALSE);
priv->parsecontext = priv->parsecontext =
create_parser_context (GES_BASE_XML_FORMATTER (self), uri, error); create_parser_context (GES_BASE_XML_FORMATTER (self), uri, error);
@ -356,6 +360,7 @@ ges_base_xml_formatter_init (GESBaseXmlFormatter * self)
priv->current_track_element = NULL; priv->current_track_element = NULL;
priv->current_clip = NULL; priv->current_clip = NULL;
priv->current_pending_clip = NULL; priv->current_pending_clip = NULL;
priv->timeline_auto_transition = FALSE;
} }
static void static void
@ -406,6 +411,9 @@ _loading_done (GESFormatter * self)
g_markup_parse_context_free (priv->parsecontext); g_markup_parse_context_free (priv->parsecontext);
priv->parsecontext = NULL; priv->parsecontext = NULL;
ges_timeline_set_auto_transition (self->timeline,
priv->timeline_auto_transition);
g_hash_table_foreach (priv->layers, (GHFunc) _set_auto_transition, NULL); g_hash_table_foreach (priv->layers, (GHFunc) _set_auto_transition, NULL);
ges_project_set_loaded (self->project, self); ges_project_set_loaded (self->project, self);
} }
@ -807,6 +815,35 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
priv->current_clip = nclip; priv->current_clip = nclip;
} }
void
ges_base_xml_formatter_set_timeline_properties (GESBaseXmlFormatter * self,
GESTimeline * timeline, const gchar * properties, const gchar * metadatas)
{
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
gboolean auto_transition = FALSE;
if (properties) {
GstStructure *props = gst_structure_from_string (properties, NULL);
if (props) {
if (gst_structure_get_boolean (props, "auto-transition",
&auto_transition))
gst_structure_remove_field (props, "auto-transition");
gst_structure_foreach (props,
(GstStructureForeachFunc) set_property_foreach, timeline);
gst_structure_free (props);
}
}
if (metadatas) {
ges_meta_container_add_metas_from_string (GES_META_CONTAINER (timeline),
metadatas);
};
priv->timeline_auto_transition = auto_transition;
}
void void
ges_base_xml_formatter_add_layer (GESBaseXmlFormatter * self, ges_base_xml_formatter_add_layer (GESBaseXmlFormatter * self,
GType extractable_type, guint priority, GstStructure * properties, GType extractable_type, guint priority, GstStructure * properties,

View file

@ -253,6 +253,12 @@ G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement *
G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a, G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a,
GESTimelineElement * b); GESTimelineElement * b);
void
ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
GESTimeline *timeline,
const gchar *properties,
const gchar *metadatas);
/**************************************************** /****************************************************
* GESContainer * * GESContainer *
****************************************************/ ****************************************************/

View file

@ -244,19 +244,8 @@ _parse_timeline (GMarkupParseContext * context, const gchar * element_name,
if (timeline == NULL) if (timeline == NULL)
return; return;
if (properties) { ges_base_xml_formatter_set_timeline_properties (GES_BASE_XML_FORMATTER (self),
GstStructure *props = gst_structure_from_string (properties, NULL); timeline, properties, metadatas);
if (props) {
gst_structure_foreach (props,
(GstStructureForeachFunc) set_property_foreach, timeline);
gst_structure_free (props);
}
}
if (metadatas) {
ges_meta_container_add_metas_from_string (GES_META_CONTAINER (timeline),
metadatas);
};
} }
static inline void static inline void