(return-type "GESPitiviFormatter*")
)
+(define-method get_sources
+ (of-object "GESPitiviFormatter")
+ (c-name "ges_pitivi_formatter_get_sources")
+ (return-type "GList*")
+ (parameters
+ '("const-gchar*" "uri")
+ )
+)
+
;; From ges-timeline-effect.h
(define-function timeline_effect_get_type
/* I did not override ges_formatter_get_data and set_data for these functions are deprecated */
%%
+override ges_pitivi_formatter_get_sources kwargs
+static PyObject *
+_wrap_ges_pitivi_formatter_get_sources(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ const GList *l, *list;
+ PyObject *py_list;
+ gchar *uri;
+
+ g_return_val_if_fail (GES_IS_PITIVI_FORMATTER (self->obj),PyList_New(0));
+
+ if (!PyArg_ParseTuple(args, "s:GES.TrackObject.lookup_child", &uri))
+ return FALSE;
+ pyg_begin_allow_threads;
+ list = ges_pitivi_formatter_get_sources (GES_PITIVI_FORMATTER (self->obj), uri);
+ pyg_end_allow_threads;
+
+ py_list = PyList_New(0);
+ for (l = list; l; l = l->next) {
+ gchar * source = (gchar *)l->data;
+ PyList_Append(py_list, PyString_FromString(source));
+ Py_DECREF(source);
+ }
+
+ return py_list;
+}
+
+%%
override ges_timeline_object_get_top_effects noargs
static PyObject *
_wrap_ges_timeline_object_get_top_effects(PyGObject *self)
return TRUE;
}
+GList *
+ges_pitivi_formatter_get_sources (GESPitiviFormatter * formatter, gchar * uri)
+{
+ GList *source_list = NULL;
+ xmlXPathContextPtr xpathCtx;
+ xmlDocPtr doc;
+ xmlXPathObjectPtr xpathObj;
+ int size, j;
+ xmlNodeSetPtr nodes;
+
+ if (!(doc = xmlParseFile (uri))) {
+ GST_ERROR ("The xptv file for uri %s was badly formed or did not exist",
+ uri);
+ return FALSE;
+ }
+
+ xpathCtx = xmlXPathNewContext (doc);
+
+ xpathObj = xmlXPathEvalExpression ((const xmlChar *)
+ "/pitivi/factories/sources/source", xpathCtx);
+
+ nodes = xpathObj->nodesetval;
+
+ size = (nodes) ? nodes->nodeNr : 0;
+ for (j = 0; j < size; ++j) {
+ xmlAttr *cur_attr;
+ gchar *name, *value;
+ xmlNodePtr node;
+
+ node = nodes->nodeTab[j];
+ for (cur_attr = node->properties; cur_attr; cur_attr = cur_attr->next) {
+ name = (gchar *) cur_attr->name;
+ value = (gchar *) xmlGetProp (node, cur_attr->name);
+ if (!g_strcmp0 (name, (gchar *) "filename"))
+ source_list = g_list_append (source_list, g_strdup (value));
+ xmlFree (value);
+ }
+ }
+
+ xmlXPathFreeObject (xpathObj);
+
+ xpathObj = xmlXPathEvalExpression ((const xmlChar *)
+ "/pitivi/factories/sources/unused_source", xpathCtx);
+
+ nodes = xpathObj->nodesetval;
+
+ size = (nodes) ? nodes->nodeNr : 0;
+ for (j = 0; j < size; ++j) {
+ xmlNodePtr node;
+
+ node = nodes->nodeTab[j];
+ source_list =
+ g_list_append (source_list,
+ g_strdup ((gchar *) xmlNodeGetContent (node)));
+ }
+
+ xmlXPathFreeObject (xpathObj);
+
+ xmlXPathFreeContext (xpathCtx);
+ xmlFreeDoc (doc);
+ return source_list;
+}
+
/* Project loading functions */
/* Return: a GHashTable containing: