mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
formatter: Serialize source properties
This way we ensure that the TrackElement 'active' property is properly serialized
This commit is contained in:
parent
f9f30c4ced
commit
2d810bd7b7
4 changed files with 37 additions and 12 deletions
|
@ -1106,7 +1106,8 @@ ges_base_xml_formatter_add_control_binding (GESBaseXmlFormatter * self,
|
|||
|
||||
void
|
||||
ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
|
||||
const gchar * track_id, GstStructure * children_properties)
|
||||
const gchar * track_id, GstStructure * children_properties,
|
||||
GstStructure * properties)
|
||||
{
|
||||
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
|
||||
GESTrackElement *element = NULL;
|
||||
|
@ -1128,6 +1129,11 @@ ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
|
|||
return;
|
||||
}
|
||||
|
||||
if (properties)
|
||||
gst_structure_foreach (properties,
|
||||
(GstStructureForeachFunc) set_property_foreach, element);
|
||||
|
||||
if (children_properties)
|
||||
gst_structure_foreach (children_properties,
|
||||
(GstStructureForeachFunc) _set_child_property, element);
|
||||
}
|
||||
|
|
|
@ -329,7 +329,8 @@ G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element (GESBaseXmlForma
|
|||
|
||||
G_GNUC_INTERNAL void ges_base_xml_formatter_add_source (GESBaseXmlFormatter *self,
|
||||
const gchar * track_id,
|
||||
GstStructure *children_properties);
|
||||
GstStructure *children_properties,
|
||||
GstStructure *properties);
|
||||
|
||||
G_GNUC_INTERNAL void ges_base_xml_formatter_add_group (GESBaseXmlFormatter *self,
|
||||
const gchar *name,
|
||||
|
|
|
@ -712,13 +712,14 @@ _parse_source (GMarkupParseContext * context, const gchar * element_name,
|
|||
const gchar ** attribute_names, const gchar ** attribute_values,
|
||||
GESXmlFormatter * self, GError ** error)
|
||||
{
|
||||
GstStructure *children_props = NULL;
|
||||
const gchar *track_id = NULL, *children_properties = NULL;
|
||||
GstStructure *children_props = NULL, *props = NULL;
|
||||
const gchar *track_id = NULL, *children_properties = NULL, *properties = NULL;
|
||||
|
||||
if (!g_markup_collect_attributes (element_name, attribute_names,
|
||||
attribute_values, error,
|
||||
G_MARKUP_COLLECT_STRING, "track-id", &track_id,
|
||||
COLLECT_STR_OPT, "children-properties", &children_properties,
|
||||
COLLECT_STR_OPT, "properties", &properties,
|
||||
G_MARKUP_COLLECT_INVALID)) {
|
||||
return;
|
||||
}
|
||||
|
@ -729,12 +730,22 @@ _parse_source (GMarkupParseContext * context, const gchar * element_name,
|
|||
goto wrong_children_properties;
|
||||
}
|
||||
|
||||
ges_base_xml_formatter_add_source (GES_BASE_XML_FORMATTER (self), track_id,
|
||||
children_props);
|
||||
if (properties) {
|
||||
props = gst_structure_from_string (properties, NULL);
|
||||
if (props == NULL)
|
||||
goto wrong_properties;
|
||||
}
|
||||
|
||||
ges_base_xml_formatter_add_source (GES_BASE_XML_FORMATTER (self), track_id,
|
||||
children_props, props);
|
||||
|
||||
done:
|
||||
if (children_props)
|
||||
gst_structure_free (children_props);
|
||||
|
||||
if (props)
|
||||
gst_structure_free (props);
|
||||
|
||||
return;
|
||||
|
||||
wrong_children_properties:
|
||||
|
@ -742,6 +753,13 @@ wrong_children_properties:
|
|||
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"element '%s', children properties '%s', could no be deserialized",
|
||||
element_name, children_properties);
|
||||
goto done;
|
||||
|
||||
wrong_properties:
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"element '%s', properties '%s', could no be deserialized",
|
||||
element_name, properties);
|
||||
goto done;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
Loading…
Reference in a new issue