From 7f81f16674aebdff63a309bafad9a7dc6d47df5d Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sat, 12 Jan 2013 20:49:31 -0300 Subject: [PATCH] pitiviformatter: Handle project metadatas --- ges/ges-pitivi-formatter.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ges/ges-pitivi-formatter.c b/ges/ges-pitivi-formatter.c index 780d47961f..e7ef6a0c28 100644 --- a/ges/ges-pitivi-formatter.c +++ b/ges/ges-pitivi-formatter.c @@ -531,6 +531,30 @@ create_tracks (GESFormatter * self) return TRUE; } +static void +parse_metadatas (GESFormatter * self) +{ + guint i, size; + xmlNodePtr node; + xmlAttr *cur_attr; + xmlNodeSetPtr nodes; + xmlXPathObjectPtr xpathObj; + GESMetaContainer *metacontainer = GES_META_CONTAINER (self->project); + + xpathObj = xmlXPathEvalExpression ((const xmlChar *) + "/pitivi/metadata", GES_PITIVI_FORMATTER (self)->priv->xpathCtx); + nodes = xpathObj->nodesetval; + + size = (nodes) ? nodes->nodeNr : 0; + for (i = 0; i < size; i++) { + node = nodes->nodeTab[i]; + for (cur_attr = node->properties; cur_attr; cur_attr = cur_attr->next) { + ges_meta_container_set_string (metacontainer, (gchar *) cur_attr->name, + (gchar *) xmlGetProp (node, cur_attr->name)); + } + } +} + static void list_sources (GESFormatter * self) { @@ -1023,6 +1047,9 @@ load_pitivi_file_from_uri (GESFormatter * self, priv->xpathCtx = xmlXPathNewContext (doc); + if (self->project) + parse_metadatas (self); + if (!create_tracks (self)) { GST_ERROR ("Couldn't create tracks"); return FALSE;