mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
xml-formatter: Add support for metadata on sources
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/260>
This commit is contained in:
parent
9c03f99e58
commit
951e6181ce
3 changed files with 18 additions and 8 deletions
|
@ -1109,7 +1109,7 @@ done:
|
||||||
void
|
void
|
||||||
ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
|
ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
|
||||||
const gchar * track_id, GstStructure * children_properties,
|
const gchar * track_id, GstStructure * children_properties,
|
||||||
GstStructure * properties)
|
GstStructure * properties, const gchar * metadatas)
|
||||||
{
|
{
|
||||||
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
|
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
|
||||||
GESTrackElement *element = NULL;
|
GESTrackElement *element = NULL;
|
||||||
|
@ -1138,6 +1138,10 @@ ges_base_xml_formatter_add_source (GESBaseXmlFormatter * self,
|
||||||
if (children_properties)
|
if (children_properties)
|
||||||
gst_structure_foreach (children_properties,
|
gst_structure_foreach (children_properties,
|
||||||
(GstStructureForeachFunc) _set_child_property, element);
|
(GstStructureForeachFunc) _set_child_property, element);
|
||||||
|
|
||||||
|
if (metadatas)
|
||||||
|
ges_meta_container_add_metas_from_string (GES_META_CONTAINER
|
||||||
|
(element), metadatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -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,
|
G_GNUC_INTERNAL void ges_base_xml_formatter_add_source (GESBaseXmlFormatter *self,
|
||||||
const gchar * track_id,
|
const gchar * track_id,
|
||||||
GstStructure *children_properties,
|
GstStructure *children_properties,
|
||||||
GstStructure *properties);
|
GstStructure *properties,
|
||||||
|
const gchar *metadatas);
|
||||||
|
|
||||||
G_GNUC_INTERNAL void ges_base_xml_formatter_add_group (GESBaseXmlFormatter *self,
|
G_GNUC_INTERNAL void ges_base_xml_formatter_add_group (GESBaseXmlFormatter *self,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
#define parent_class ges_xml_formatter_parent_class
|
#define parent_class ges_xml_formatter_parent_class
|
||||||
#define API_VERSION 0
|
#define API_VERSION 0
|
||||||
#define MINOR_VERSION 7
|
#define MINOR_VERSION 8
|
||||||
#define VERSION 0.7
|
#define VERSION 0.8
|
||||||
|
|
||||||
#define COLLECT_STR_OPT (G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL)
|
#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)
|
GESXmlFormatter * self, GError ** error)
|
||||||
{
|
{
|
||||||
GstStructure *children_props = NULL, *props = NULL;
|
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,
|
if (!g_markup_collect_attributes (element_name, attribute_names,
|
||||||
attribute_values, error,
|
attribute_values, error,
|
||||||
G_MARKUP_COLLECT_STRING, "track-id", &track_id,
|
G_MARKUP_COLLECT_STRING, "track-id", &track_id,
|
||||||
COLLECT_STR_OPT, "children-properties", &children_properties,
|
COLLECT_STR_OPT, "children-properties", &children_properties,
|
||||||
COLLECT_STR_OPT, "properties", &properties,
|
COLLECT_STR_OPT, "properties", &properties,
|
||||||
G_MARKUP_COLLECT_INVALID)) {
|
COLLECT_STR_OPT, "metadatas", &metadatas, G_MARKUP_COLLECT_INVALID)) {
|
||||||
return;
|
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,
|
ges_base_xml_formatter_add_source (GES_BASE_XML_FORMATTER (self), track_id,
|
||||||
children_props, props);
|
children_props, props, metadatas);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (children_props)
|
if (children_props)
|
||||||
|
@ -1619,7 +1620,7 @@ _save_source (GESXmlFormatter * self, GString * str,
|
||||||
{
|
{
|
||||||
gint index, n_props;
|
gint index, n_props;
|
||||||
gboolean serialize;
|
gboolean serialize;
|
||||||
gchar *properties;
|
gchar *properties, *metas;
|
||||||
|
|
||||||
if (!GES_IS_SOURCE (element))
|
if (!GES_IS_SOURCE (element))
|
||||||
return;
|
return;
|
||||||
|
@ -1648,6 +1649,10 @@ _save_source (GESXmlFormatter * self, GString * str,
|
||||||
}
|
}
|
||||||
g_free (properties);
|
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);
|
_save_children_properties (str, element, depth);
|
||||||
append_escaped (str, g_markup_printf_escaped (">\n"), depth);
|
append_escaped (str, g_markup_printf_escaped (">\n"), depth);
|
||||||
_save_keyframes (str, GES_TRACK_ELEMENT (element), index, depth);
|
_save_keyframes (str, GES_TRACK_ELEMENT (element), index, depth);
|
||||||
|
|
Loading…
Reference in a new issue