summaryrefslogtreecommitdiff
path: root/ges
diff options
context:
space:
mode:
authorPiotrek Brzeziński <thewildtree@outlook.com>2021-07-09 16:15:01 +0200
committerPiotrek Brzeziński <thewildtree@outlook.com>2021-08-14 00:10:06 +0200
commit951e6181ce7106d2ed9f55474b3db8fe538867f7 (patch)
tree1eac4f3431d143100d2c8ebb4a1343e197ad4ff9 /ges
parent9c03f99e58a472fae4d6ea84d69d793fec1e6a81 (diff)
xml-formatter: Add support for metadata on sources
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/260>
Diffstat (limited to 'ges')
-rw-r--r--ges/ges-base-xml-formatter.c6
-rw-r--r--ges/ges-internal.h3
-rw-r--r--ges/ges-xml-formatter.c17
3 files changed, 18 insertions, 8 deletions
diff --git a/ges/ges-base-xml-formatter.c b/ges/ges-base-xml-formatter.c
index a6d1a680..1a1f4e3d 100644
--- a/ges/ges-base-xml-formatter.c
+++ b/ges/ges-base-xml-formatter.c
@@ -1109,7 +1109,7 @@ done:
void
ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
const gchar * track_id, GstStructure * children_properties,
- GstStructure * properties)
+ GstStructure * properties, const gchar * metadatas)
{
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
GESTrackElement *element = NULL;
@@ -1138,6 +1138,10 @@ ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
if (children_properties)
gst_structure_foreach (children_properties,
(GstStructureForeachFunc) _set_child_property, element);
+
+ if (metadatas)
+ ges_meta_container_add_metas_from_string (GES_META_CONTAINER
+ (element), metadatas);
}
void
diff --git a/ges/ges-internal.h b/ges/ges-internal.h
index dad6c9cd..66b2ba80 100644
--- a/ges/ges-internal.h
+++ b/ges/ges-internal.h
@@ -366,7 +366,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 *properties);
+ GstStructure *properties,
+ const gchar *metadatas);
G_GNUC_INTERNAL void ges_base_xml_formatter_add_group (GESBaseXmlFormatter *self,
const gchar *name,
diff --git a/ges/ges-xml-formatter.c b/ges/ges-xml-formatter.c
index 0747ccf5..63660f1f 100644
--- a/ges/ges-xml-formatter.c
+++ b/ges/ges-xml-formatter.c
@@ -35,8 +35,8 @@
#define parent_class ges_xml_formatter_parent_class
#define API_VERSION 0
-#define MINOR_VERSION 7
-#define VERSION 0.7
+#define MINOR_VERSION 8
+#define VERSION 0.8
#define COLLECT_STR_OPT (G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL)
@@ -722,14 +722,15 @@ _parse_source (GMarkupParseContext * context, const gchar * element_name,
GESXmlFormatter * self, GError ** error)
{
GstStructure *children_props = NULL, *props = NULL;
- const gchar *track_id = NULL, *children_properties = NULL, *properties = NULL;
+ const gchar *track_id = NULL, *children_properties = NULL, *properties =
+ NULL, *metadatas = 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)) {
+ COLLECT_STR_OPT, "metadatas", &metadatas, G_MARKUP_COLLECT_INVALID)) {
return;
}
@@ -746,7 +747,7 @@ _parse_source (GMarkupParseContext * context, const gchar * element_name,
}
ges_base_xml_formatter_add_source (GES_BASE_XML_FORMATTER (self), track_id,
- children_props, props);
+ children_props, props, metadatas);
done:
if (children_props)
@@ -1619,7 +1620,7 @@ _save_source (GESXmlFormatter * self, GString * str,
{
gint index, n_props;
gboolean serialize;
- gchar *properties;
+ gchar *properties, *metas;
if (!GES_IS_SOURCE (element))
return;
@@ -1648,6 +1649,10 @@ _save_source (GESXmlFormatter * self, GString * str,
}
g_free (properties);
+ metas = ges_meta_container_metas_to_string (GES_META_CONTAINER (element));
+ g_string_append_printf (str, "metadatas='%s' ", metas);
+ g_free (metas);
+
_save_children_properties (str, element, depth);
append_escaped (str, g_markup_printf_escaped (">\n"), depth);
_save_keyframes (str, GES_TRACK_ELEMENT (element), index, depth);