2012-03-19 10:56:53 +00:00
|
|
|
/* GStreamer Editing Services Pitivi Formatter
|
|
|
|
* Copyright (C) 2011-2012 Mathieu Duponchelle <seeed@laposte.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:25:20 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2012-03-19 10:56:53 +00:00
|
|
|
*/
|
|
|
|
|
2012-05-09 16:12:38 +00:00
|
|
|
/**
|
2014-04-07 19:02:48 +00:00
|
|
|
* SECTION: gespitiviformatter
|
2017-03-08 21:13:48 +00:00
|
|
|
* @title: GESPitiviFormatter
|
2014-02-26 03:36:11 +00:00
|
|
|
* @short_description: A formatter for the obsolete Pitivi xptv project file format
|
2013-09-16 14:19:13 +00:00
|
|
|
*
|
|
|
|
* This is a legacy format and you should avoid to use it. The formatter
|
|
|
|
* is really not in good shape and is deprecated.
|
|
|
|
*
|
|
|
|
* Deprecated: 1.0
|
2012-05-09 16:12:38 +00:00
|
|
|
*/
|
2018-09-24 14:41:24 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#undef VERSION
|
|
|
|
#endif
|
2012-05-09 16:12:38 +00:00
|
|
|
|
2012-03-12 15:09:39 +00:00
|
|
|
#include <libxml/xmlreader.h>
|
|
|
|
#include <libxml/tree.h>
|
|
|
|
#include <libxml/parser.h>
|
|
|
|
#include <libxml/xpath.h>
|
|
|
|
#include <libxml/xpathInternals.h>
|
2013-05-28 06:51:08 +00:00
|
|
|
#include <libxml/encoding.h>
|
|
|
|
#include <libxml/xmlwriter.h>
|
2012-03-12 15:09:39 +00:00
|
|
|
|
2012-11-19 17:19:17 +00:00
|
|
|
#include "ges-internal.h"
|
2018-11-30 15:41:04 +00:00
|
|
|
#include <ges/ges-pitivi-formatter.h>
|
2011-08-28 01:55:46 +00:00
|
|
|
#include <ges/ges.h>
|
|
|
|
|
2014-02-26 03:36:11 +00:00
|
|
|
/* The Pitivi etree formatter is 0.1 we set GES one to 0.2 */
|
2018-09-24 14:41:24 +00:00
|
|
|
//#define VERSION "0.2"
|
2012-12-17 22:26:23 +00:00
|
|
|
#define DOUBLE_VERSION 0.2
|
|
|
|
|
2012-11-19 17:19:17 +00:00
|
|
|
#undef GST_CAT_DEFAULT
|
2011-11-02 16:52:16 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (ges_pitivi_formatter_debug);
|
|
|
|
#define GST_CAT_DEFAULT ges_pitivi_formatter_debug
|
|
|
|
|
|
|
|
typedef struct SrcMapping
|
|
|
|
{
|
|
|
|
gchar *id;
|
2013-02-15 02:34:48 +00:00
|
|
|
GESClip *clip;
|
2011-11-02 16:52:16 +00:00
|
|
|
guint priority;
|
2013-02-10 00:49:16 +00:00
|
|
|
GList *track_element_ids;
|
2011-11-02 16:52:16 +00:00
|
|
|
} SrcMapping;
|
2011-08-28 01:55:46 +00:00
|
|
|
|
|
|
|
struct _GESPitiviFormatterPrivate
|
|
|
|
{
|
|
|
|
xmlXPathContextPtr xpathCtx;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
/* {"sourceId" : {"prop": "value"}} */
|
2012-01-04 22:04:53 +00:00
|
|
|
GHashTable *sources_table;
|
|
|
|
|
|
|
|
/* Used as a set of the uris */
|
|
|
|
GHashTable *source_uris;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
/* {trackId: {"factory_ref": factoryId, ""}
|
|
|
|
* if effect:
|
|
|
|
* {"factory_ref": "effect",
|
|
|
|
* "effect_name": name
|
|
|
|
* "effect_props": {"propname": value}}}
|
|
|
|
*/
|
2013-01-26 15:31:33 +00:00
|
|
|
GHashTable *track_elements_table;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
/* {factory-ref: [track-object-ref-id,...]} */
|
2013-01-20 15:42:29 +00:00
|
|
|
GHashTable *clips_table;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
/* {layerPriority: layer} */
|
|
|
|
GHashTable *layers_table;
|
|
|
|
|
2011-08-28 01:55:46 +00:00
|
|
|
GESTimeline *timeline;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
2011-08-28 01:55:46 +00:00
|
|
|
GESTrack *tracka, *trackv;
|
2012-01-04 21:06:37 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
/* List the Clip that haven't been loaded yet */
|
2012-01-07 16:36:33 +00:00
|
|
|
GList *sources_to_load;
|
|
|
|
|
2012-01-04 21:06:37 +00:00
|
|
|
/* Saving context */
|
|
|
|
/* {factory_id: uri} */
|
|
|
|
GHashTable *saving_source_table;
|
|
|
|
guint nb_sources;
|
2011-08-28 01:55:46 +00:00
|
|
|
};
|
|
|
|
|
2018-09-06 01:55:02 +00:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GESPitiviFormatter, ges_pitivi_formatter,
|
|
|
|
GES_TYPE_FORMATTER);
|
|
|
|
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
static void
|
|
|
|
list_table_destroyer (gpointer key, gpointer value, void *unused)
|
|
|
|
{
|
2012-01-12 14:12:14 +00:00
|
|
|
g_list_foreach (value, (GFunc) g_free, NULL);
|
|
|
|
g_list_free (value);
|
2011-11-02 16:52:16 +00:00
|
|
|
}
|
|
|
|
|
2012-09-23 00:07:04 +00:00
|
|
|
static gboolean
|
2013-04-22 20:34:09 +00:00
|
|
|
pitivi_can_load_uri (GESFormatter * dummy_instance, const gchar * uri,
|
2012-12-17 22:26:23 +00:00
|
|
|
GError ** error)
|
2012-09-23 00:07:04 +00:00
|
|
|
{
|
|
|
|
xmlDocPtr doc;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
xmlXPathObjectPtr xpathObj;
|
|
|
|
xmlXPathContextPtr xpathCtx;
|
2015-03-25 11:22:43 +00:00
|
|
|
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
|
|
|
|
2018-07-14 13:00:51 +00:00
|
|
|
if (!filename || !g_file_test (filename, G_FILE_TEST_EXISTS)) {
|
2015-03-25 11:22:43 +00:00
|
|
|
g_free (filename);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (filename);
|
2012-09-23 00:07:04 +00:00
|
|
|
|
|
|
|
if (!(doc = xmlParseFile (uri))) {
|
2015-03-25 11:22:43 +00:00
|
|
|
GST_ERROR ("The xptv file for uri %s was badly formed", uri);
|
2012-09-23 00:07:04 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
xpathCtx = xmlXPathNewContext (doc);
|
|
|
|
xpathObj = xmlXPathEvalExpression ((const xmlChar *) "/pitivi", xpathCtx);
|
|
|
|
if (!xpathObj || !xpathObj->nodesetval || xpathObj->nodesetval->nodeNr == 0)
|
|
|
|
ret = FALSE;
|
|
|
|
|
|
|
|
xmlFreeDoc (doc);
|
|
|
|
xmlXPathFreeObject (xpathObj);
|
|
|
|
xmlXPathFreeContext (xpathCtx);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
/* Project loading functions */
|
|
|
|
|
|
|
|
/* Return: a GHashTable containing:
|
|
|
|
* {attr: value}
|
|
|
|
*/
|
|
|
|
static GHashTable *
|
|
|
|
get_nodes_infos (xmlNodePtr node)
|
|
|
|
{
|
|
|
|
xmlAttr *cur_attr;
|
|
|
|
GHashTable *props_table;
|
|
|
|
gchar *name, *value;
|
|
|
|
|
|
|
|
props_table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
|
|
|
|
|
|
|
|
for (cur_attr = node->properties; cur_attr; cur_attr = cur_attr->next) {
|
|
|
|
name = (gchar *) cur_attr->name;
|
|
|
|
value = (gchar *) xmlGetProp (node, cur_attr->name);
|
|
|
|
g_hash_table_insert (props_table, g_strdup (name), g_strdup (value));
|
|
|
|
xmlFree (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return props_table;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
create_tracks (GESFormatter * self)
|
|
|
|
{
|
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
|
|
|
GList *tracks = NULL;
|
|
|
|
|
2012-07-01 23:39:57 +00:00
|
|
|
tracks = ges_timeline_get_tracks (self->timeline);
|
2011-11-02 16:52:16 +00:00
|
|
|
|
2012-01-04 21:06:37 +00:00
|
|
|
GST_DEBUG ("Creating tracks, current number of tracks %d",
|
2011-11-02 16:52:16 +00:00
|
|
|
g_list_length (tracks));
|
|
|
|
|
|
|
|
if (tracks) {
|
|
|
|
GList *tmp = NULL;
|
|
|
|
GESTrack *track;
|
|
|
|
for (tmp = tracks; tmp; tmp = tmp->next) {
|
|
|
|
track = tmp->data;
|
|
|
|
if (track->type == GES_TRACK_TYPE_AUDIO) {
|
|
|
|
priv->tracka = track;
|
|
|
|
} else {
|
|
|
|
priv->trackv = track;
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
}
|
2013-03-16 22:05:04 +00:00
|
|
|
g_list_foreach (tracks, (GFunc) gst_object_unref, NULL);
|
2012-01-12 14:12:14 +00:00
|
|
|
g_list_free (tracks);
|
2011-11-02 16:52:16 +00:00
|
|
|
return TRUE;
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
2013-03-28 17:51:45 +00:00
|
|
|
priv->tracka = GES_TRACK (ges_audio_track_new ());
|
|
|
|
priv->trackv = GES_TRACK (ges_video_track_new ());
|
2011-11-02 16:52:16 +00:00
|
|
|
|
2012-07-01 23:39:57 +00:00
|
|
|
if (!ges_timeline_add_track (self->timeline, priv->trackv)) {
|
2011-11-02 16:52:16 +00:00
|
|
|
return FALSE;
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
2011-11-02 16:52:16 +00:00
|
|
|
|
2012-07-01 23:39:57 +00:00
|
|
|
if (!ges_timeline_add_track (self->timeline, priv->tracka)) {
|
2011-11-02 16:52:16 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
2013-01-12 23:49:31 +00:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-04 22:04:53 +00:00
|
|
|
static void
|
2011-11-02 16:52:16 +00:00
|
|
|
list_sources (GESFormatter * self)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
2011-11-02 16:52:16 +00:00
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
|
|
|
xmlXPathObjectPtr xpathObj;
|
2012-01-04 22:04:53 +00:00
|
|
|
GHashTable *table;
|
2011-11-02 16:52:16 +00:00
|
|
|
int size, j;
|
2012-01-04 22:04:53 +00:00
|
|
|
gchar *id, *filename;
|
2011-11-02 16:52:16 +00:00
|
|
|
xmlNodeSetPtr nodes;
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
xpathObj = xmlXPathEvalExpression ((const xmlChar *)
|
|
|
|
"/pitivi/factories/sources/source", priv->xpathCtx);
|
|
|
|
nodes = xpathObj->nodesetval;
|
|
|
|
|
|
|
|
size = (nodes) ? nodes->nodeNr : 0;
|
|
|
|
for (j = 0; j < size; ++j) {
|
|
|
|
table = get_nodes_infos (nodes->nodeTab[j]);
|
|
|
|
id = (gchar *) g_hash_table_lookup (table, (gchar *) "id");
|
2012-01-04 22:04:53 +00:00
|
|
|
filename = (gchar *) g_hash_table_lookup (table, (gchar *) "filename");
|
|
|
|
g_hash_table_insert (priv->sources_table, g_strdup (id), table);
|
|
|
|
g_hash_table_insert (priv->source_uris, g_strdup (filename),
|
|
|
|
g_strdup (filename));
|
2013-01-11 14:49:02 +00:00
|
|
|
if (self->project)
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_project_create_asset (self->project, filename, GES_TYPE_URI_CLIP);
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
xmlXPathFreeObject (xpathObj);
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-01-26 15:31:33 +00:00
|
|
|
parse_track_elements (GESFormatter * self)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
|
|
|
xmlXPathObjectPtr xpathObj;
|
|
|
|
xmlNodeSetPtr nodes;
|
|
|
|
int size, j;
|
|
|
|
gchar *id, *fac_ref;
|
2011-11-02 16:52:16 +00:00
|
|
|
GHashTable *table = NULL, *effect_table = NULL;
|
|
|
|
xmlNode *first_child;
|
2011-08-28 01:55:46 +00:00
|
|
|
gchar *media_type;
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
/* FIXME Make this whole function cleaner starting from
|
|
|
|
* "/pitivi/timeline/tracks/track/stream" and descending
|
|
|
|
* into the children. */
|
2011-08-28 01:55:46 +00:00
|
|
|
xpathObj = xmlXPathEvalExpression ((const xmlChar *)
|
|
|
|
"/pitivi/timeline/tracks/track/track-objects/track-object",
|
|
|
|
priv->xpathCtx);
|
|
|
|
|
|
|
|
if (xpathObj == NULL) {
|
2011-11-02 16:52:16 +00:00
|
|
|
GST_DEBUG ("No track object found");
|
|
|
|
|
2011-08-28 01:55:46 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-11-02 16:52:16 +00:00
|
|
|
|
2011-08-28 01:55:46 +00:00
|
|
|
nodes = xpathObj->nodesetval;
|
|
|
|
size = (nodes) ? nodes->nodeNr : 0;
|
|
|
|
|
|
|
|
for (j = 0; j < size; ++j) {
|
2011-11-02 16:52:16 +00:00
|
|
|
xmlNodePtr node = nodes->nodeTab[j];
|
|
|
|
|
2011-08-28 01:55:46 +00:00
|
|
|
table = get_nodes_infos (nodes->nodeTab[j]);
|
|
|
|
id = (gchar *) g_hash_table_lookup (table, (gchar *) "id");
|
2011-11-02 16:52:16 +00:00
|
|
|
first_child = nodes->nodeTab[j]->children->next;
|
|
|
|
fac_ref = (gchar *) xmlGetProp (first_child, (xmlChar *) "id");
|
|
|
|
|
|
|
|
/* We check if the first child is "effect" */
|
|
|
|
if (!g_strcmp0 ((gchar *) first_child->name, (gchar *) "effect")) {
|
|
|
|
xmlChar *effect_name;
|
|
|
|
xmlNodePtr fact_node = first_child->children->next;
|
|
|
|
|
|
|
|
/* We have a node called "text" in between thus ->next->next */
|
|
|
|
xmlNodePtr elem_props_node = fact_node->next->next;
|
|
|
|
|
|
|
|
effect_name = xmlGetProp (fact_node, (xmlChar *) "name");
|
2011-08-28 01:55:46 +00:00
|
|
|
g_hash_table_insert (table, g_strdup ((gchar *) "effect_name"),
|
2011-11-02 16:52:16 +00:00
|
|
|
g_strdup ((gchar *) effect_name));
|
|
|
|
xmlFree (effect_name);
|
|
|
|
|
|
|
|
/* We put the effects properties in an hacktable (Lapsus is on :) */
|
|
|
|
effect_table = get_nodes_infos (elem_props_node);
|
|
|
|
|
|
|
|
g_hash_table_insert (table, g_strdup ((gchar *) "fac_ref"),
|
|
|
|
g_strdup ("effect"));
|
|
|
|
|
|
|
|
xmlFree (fac_ref);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
g_hash_table_insert (table, g_strdup ((gchar *) "fac_ref"),
|
|
|
|
g_strdup (fac_ref));
|
|
|
|
xmlFree (fac_ref);
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
/* Same as before, we got a text node in between, thus the 2 prev
|
|
|
|
* node->parent is <track-objects>, the one before is <stream>
|
|
|
|
*/
|
|
|
|
media_type = (gchar *) xmlGetProp (node->parent->prev->prev,
|
|
|
|
(const xmlChar *) "type");
|
2011-08-28 01:55:46 +00:00
|
|
|
g_hash_table_insert (table, g_strdup ((gchar *) "media_type"),
|
|
|
|
g_strdup (media_type));
|
|
|
|
xmlFree (media_type);
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (effect_table)
|
|
|
|
g_hash_table_insert (table, g_strdup ("effect_props"), effect_table);
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
g_hash_table_insert (priv->track_elements_table, g_strdup (id), table);
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
xmlXPathFreeObject (xpathObj);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-01-20 15:42:29 +00:00
|
|
|
parse_clips (GESFormatter * self)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
|
|
|
int size, j;
|
2011-11-02 16:52:16 +00:00
|
|
|
xmlNodeSetPtr nodes;
|
|
|
|
xmlXPathObjectPtr xpathObj;
|
2013-01-20 15:42:29 +00:00
|
|
|
xmlNodePtr clip_nd, tmp_nd, tmp_nd2;
|
2013-01-26 15:31:33 +00:00
|
|
|
xmlChar *trackelementrefId, *facrefId = NULL;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
GList *reflist = NULL;
|
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
2013-01-20 15:42:29 +00:00
|
|
|
GHashTable *clips_table = priv->clips_table;
|
2011-08-28 01:55:46 +00:00
|
|
|
|
|
|
|
xpathObj = xmlXPathEvalExpression ((const xmlChar *)
|
2013-01-27 19:02:31 +00:00
|
|
|
"/pitivi/timeline/timeline-objects/timeline-object", priv->xpathCtx);
|
2011-08-28 01:55:46 +00:00
|
|
|
|
|
|
|
if (xpathObj == NULL) {
|
|
|
|
xmlXPathFreeObject (xpathObj);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nodes = xpathObj->nodesetval;
|
|
|
|
size = (nodes) ? nodes->nodeNr : 0;
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
for (j = 0; j < size; j++) {
|
2013-01-20 15:42:29 +00:00
|
|
|
clip_nd = nodes->nodeTab[j];
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
for (tmp_nd = clip_nd->children; tmp_nd; tmp_nd = tmp_nd->next) {
|
2013-01-27 19:02:31 +00:00
|
|
|
/* We assume that factory-ref is always before the tckobjs-ref */
|
2011-11-02 16:52:16 +00:00
|
|
|
if (!xmlStrcmp (tmp_nd->name, (xmlChar *) "factory-ref")) {
|
|
|
|
facrefId = xmlGetProp (tmp_nd, (xmlChar *) "id");
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
} else if (!xmlStrcmp (tmp_nd->name, (xmlChar *) "track-object-refs")) {
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
for (tmp_nd2 = tmp_nd->children; tmp_nd2; tmp_nd2 = tmp_nd2->next) {
|
|
|
|
if (!xmlStrcmp (tmp_nd2->name, (xmlChar *) "track-object-ref")) {
|
|
|
|
/* We add the track object ref ID to the list of the current
|
2013-01-20 15:42:29 +00:00
|
|
|
* Clip tracks, this way we can merge 2
|
2013-01-26 15:31:33 +00:00
|
|
|
* Clip-s into 1 when we have unlinked TrackElement-s */
|
2013-01-20 15:42:29 +00:00
|
|
|
reflist = g_hash_table_lookup (clips_table, facrefId);
|
2013-01-26 15:31:33 +00:00
|
|
|
trackelementrefId = xmlGetProp (tmp_nd2, (xmlChar *) "id");
|
|
|
|
reflist =
|
|
|
|
g_list_append (reflist, g_strdup ((gchar *) trackelementrefId));
|
2013-01-20 15:42:29 +00:00
|
|
|
g_hash_table_insert (clips_table, g_strdup ((gchar *) facrefId),
|
2011-11-02 16:52:16 +00:00
|
|
|
reflist);
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
xmlFree (trackelementrefId);
|
2011-11-02 16:52:16 +00:00
|
|
|
}
|
|
|
|
}
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
xmlXPathFreeObject (xpathObj);
|
2011-08-28 01:55:46 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
static void
|
|
|
|
set_properties (GObject * obj, GHashTable * props_table)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
2011-11-02 16:52:16 +00:00
|
|
|
gint i;
|
|
|
|
gchar **prop_array, *valuestr;
|
|
|
|
gint64 value;
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
gchar props[3][10] = { "duration", "in_point", "start" };
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
valuestr = g_hash_table_lookup (props_table, props[i]);
|
|
|
|
prop_array = g_strsplit (valuestr, ")", 0);
|
|
|
|
value = g_ascii_strtoll (prop_array[1], NULL, 0);
|
|
|
|
g_object_set (obj, props[i], value, NULL);
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
g_strfreev (prop_array);
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-02-15 02:34:48 +00:00
|
|
|
track_element_added_cb (GESClip * clip,
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement * track_element, GHashTable * props_table)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
2012-01-07 16:36:33 +00:00
|
|
|
GESPitiviFormatter *formatter;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
2012-01-07 16:36:33 +00:00
|
|
|
formatter = GES_PITIVI_FORMATTER (g_hash_table_lookup (props_table,
|
|
|
|
"current-formatter"));
|
|
|
|
if (formatter) {
|
|
|
|
GESPitiviFormatterPrivate *priv = formatter->priv;
|
|
|
|
|
|
|
|
/* Make sure the hack to get a ref to the formatter
|
|
|
|
* doesn't break everything */
|
|
|
|
g_hash_table_steal (props_table, "current-formatter");
|
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
priv->sources_to_load = g_list_remove (priv->sources_to_load, clip);
|
2012-12-17 22:26:23 +00:00
|
|
|
if (!priv->sources_to_load && GES_FORMATTER (formatter)->project)
|
|
|
|
ges_project_set_loaded (GES_FORMATTER (formatter)->project,
|
|
|
|
GES_FORMATTER (formatter));
|
2012-01-07 16:36:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Disconnect the signal */
|
2013-02-15 02:34:48 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (clip, track_element_added_cb,
|
2012-01-07 16:36:33 +00:00
|
|
|
props_table);
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
static void
|
|
|
|
make_source (GESFormatter * self, GList * reflist, GHashTable * source_table)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
2011-11-02 16:52:16 +00:00
|
|
|
GHashTable *props_table, *effect_table;
|
|
|
|
gchar **prio_array;
|
2013-04-23 23:04:04 +00:00
|
|
|
GESLayer *layer;
|
2011-11-02 16:52:16 +00:00
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
2011-08-28 01:55:46 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
gchar *fac_ref = NULL, *media_type = NULL, *filename = NULL, *prio_str;
|
|
|
|
GList *tmp = NULL, *keys, *tmp_key;
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClip *src = NULL;
|
2011-11-02 16:52:16 +00:00
|
|
|
gint prio;
|
|
|
|
gboolean a_avail = FALSE, v_avail = FALSE, video;
|
2013-01-26 15:31:33 +00:00
|
|
|
GHashTable *trackelement_table = priv->track_elements_table;
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
for (tmp = reflist; tmp; tmp = tmp->next) {
|
|
|
|
|
|
|
|
/* Get the layer */
|
2013-01-26 15:31:33 +00:00
|
|
|
props_table = g_hash_table_lookup (trackelement_table, (gchar *) tmp->data);
|
2011-11-02 16:52:16 +00:00
|
|
|
prio_str = (gchar *) g_hash_table_lookup (props_table, "priority");
|
|
|
|
prio_array = g_strsplit (prio_str, ")", 0);
|
|
|
|
prio = (gint) g_ascii_strtod (prio_array[1], NULL);
|
|
|
|
g_strfreev (prio_array);
|
|
|
|
|
|
|
|
/* If we do not have any layer with this priority, create it */
|
|
|
|
if (!(layer = g_hash_table_lookup (priv->layers_table, &prio))) {
|
2013-04-23 23:04:04 +00:00
|
|
|
layer = ges_layer_new ();
|
2011-11-02 16:52:16 +00:00
|
|
|
g_object_set (layer, "auto-transition", TRUE, "priority", prio, NULL);
|
2012-07-01 23:57:30 +00:00
|
|
|
ges_timeline_add_layer (self->timeline, layer);
|
2011-11-02 16:52:16 +00:00
|
|
|
g_hash_table_insert (priv->layers_table, g_memdup (&prio,
|
|
|
|
sizeof (guint64)), layer);
|
|
|
|
}
|
|
|
|
|
|
|
|
fac_ref = (gchar *) g_hash_table_lookup (props_table, "fac_ref");
|
|
|
|
media_type = (gchar *) g_hash_table_lookup (props_table, "media_type");
|
|
|
|
|
|
|
|
if (!g_strcmp0 (media_type, "pitivi.stream.VideoStream"))
|
|
|
|
video = TRUE;
|
|
|
|
else
|
|
|
|
video = FALSE;
|
|
|
|
|
|
|
|
/* FIXME I am sure we could reimplement this whole part
|
|
|
|
* in a simpler way */
|
2012-01-07 16:36:33 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
if (g_strcmp0 (fac_ref, (gchar *) "effect")) {
|
2012-01-07 16:36:33 +00:00
|
|
|
/* FIXME this is a hack to get a ref to the formatter when receiving
|
2013-03-30 14:40:38 +00:00
|
|
|
* child-added */
|
2012-01-07 16:36:33 +00:00
|
|
|
g_hash_table_insert (props_table, (gchar *) "current-formatter", self);
|
2011-11-02 16:52:16 +00:00
|
|
|
if (a_avail && (!video)) {
|
|
|
|
a_avail = FALSE;
|
|
|
|
} else if (v_avail && (video)) {
|
|
|
|
v_avail = FALSE;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* If we only have audio or only video in the previous source,
|
|
|
|
* set it has such */
|
|
|
|
if (a_avail) {
|
2013-01-20 15:42:29 +00:00
|
|
|
ges_clip_set_supported_formats (GES_CLIP (src), GES_TRACK_TYPE_VIDEO);
|
2011-11-02 16:52:16 +00:00
|
|
|
} else if (v_avail) {
|
2013-01-20 15:42:29 +00:00
|
|
|
ges_clip_set_supported_formats (GES_CLIP (src), GES_TRACK_TYPE_AUDIO);
|
2011-11-02 16:52:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
filename = (gchar *) g_hash_table_lookup (source_table, "filename");
|
|
|
|
|
2013-01-20 15:44:57 +00:00
|
|
|
src = ges_uri_clip_new (filename);
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
if (!video) {
|
|
|
|
v_avail = TRUE;
|
|
|
|
a_avail = FALSE;
|
|
|
|
} else {
|
|
|
|
a_avail = TRUE;
|
|
|
|
v_avail = FALSE;
|
|
|
|
}
|
2012-01-07 16:36:33 +00:00
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
set_properties (G_OBJECT (src), props_table);
|
2013-04-23 23:04:04 +00:00
|
|
|
ges_layer_add_clip (layer, GES_CLIP (src));
|
2012-01-07 16:36:33 +00:00
|
|
|
|
2013-03-30 14:40:38 +00:00
|
|
|
g_signal_connect (src, "child-added",
|
2013-01-26 15:31:33 +00:00
|
|
|
G_CALLBACK (track_element_added_cb), props_table);
|
2012-01-07 16:36:33 +00:00
|
|
|
|
|
|
|
priv->sources_to_load = g_list_prepend (priv->sources_to_load, src);
|
2011-11-02 16:52:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2013-01-26 15:40:51 +00:00
|
|
|
GESEffect *effect;
|
2011-11-02 16:52:16 +00:00
|
|
|
gchar *active = (gchar *) g_hash_table_lookup (props_table, "active");
|
|
|
|
|
2013-01-26 15:40:51 +00:00
|
|
|
effect = ges_effect_new ((gchar *)
|
2011-11-02 16:52:16 +00:00
|
|
|
g_hash_table_lookup (props_table, (gchar *) "effect_name"));
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_track_type (GES_TRACK_ELEMENT (effect),
|
2012-12-20 23:23:54 +00:00
|
|
|
(video ? GES_TRACK_TYPE_VIDEO : GES_TRACK_TYPE_AUDIO));
|
2011-11-02 16:52:16 +00:00
|
|
|
effect_table =
|
|
|
|
g_hash_table_lookup (props_table, (gchar *) "effect_props");
|
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
ges_container_add (GES_CONTAINER (src), GES_TIMELINE_ELEMENT (effect));
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
if (!g_strcmp0 (active, (gchar *) "(bool)False"))
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_active (GES_TRACK_ELEMENT (effect), FALSE);
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
/* Set effect properties */
|
|
|
|
keys = g_hash_table_get_keys (effect_table);
|
|
|
|
for (tmp_key = keys; tmp_key; tmp_key = tmp_key->next) {
|
|
|
|
GstStructure *structure;
|
|
|
|
const GValue *value;
|
|
|
|
GParamSpec *spec;
|
|
|
|
GstCaps *caps;
|
|
|
|
gchar *prop_val;
|
|
|
|
|
|
|
|
prop_val = (gchar *) g_hash_table_lookup (effect_table,
|
|
|
|
(gchar *) tmp_key->data);
|
|
|
|
|
|
|
|
if (g_strstr_len (prop_val, -1, "(GEnum)")) {
|
|
|
|
gchar **val = g_strsplit (prop_val, ")", 2);
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_properties (GES_TRACK_ELEMENT (effect),
|
2011-11-02 16:52:16 +00:00
|
|
|
(gchar *) tmp_key->data, atoi (val[1]), NULL);
|
|
|
|
g_strfreev (val);
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
} else if (ges_track_element_lookup_child (GES_TRACK_ELEMENT (effect),
|
2011-11-02 16:52:16 +00:00
|
|
|
(gchar *) tmp->data, NULL, &spec)) {
|
|
|
|
gchar *caps_str = g_strdup_printf ("structure1, property1=%s;",
|
|
|
|
prop_val);
|
|
|
|
|
|
|
|
caps = gst_caps_from_string (caps_str);
|
|
|
|
g_free (caps_str);
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
value = gst_structure_get_value (structure, "property1");
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
ges_track_element_set_child_property_by_pspec (GES_TRACK_ELEMENT
|
2011-11-02 16:52:16 +00:00
|
|
|
(effect), spec, (GValue *) value);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a_avail) {
|
2013-01-20 15:42:29 +00:00
|
|
|
ges_clip_set_supported_formats (GES_CLIP (src), GES_TRACK_TYPE_VIDEO);
|
2011-11-02 16:52:16 +00:00
|
|
|
} else if (v_avail) {
|
2013-01-20 15:42:29 +00:00
|
|
|
ges_clip_set_supported_formats (GES_CLIP (src), GES_TRACK_TYPE_AUDIO);
|
2011-11-02 16:52:16 +00:00
|
|
|
}
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
static gboolean
|
2013-01-20 15:42:29 +00:00
|
|
|
make_clips (GESFormatter * self)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
2011-11-02 16:52:16 +00:00
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
|
|
|
GHashTable *source_table;
|
|
|
|
|
|
|
|
GList *keys = NULL, *tmp = NULL, *reflist = NULL;
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
keys = g_hash_table_get_keys (priv->clips_table);
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
for (tmp = keys; tmp; tmp = tmp->next) {
|
|
|
|
gchar *fac_id = (gchar *) tmp->data;
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
reflist = g_hash_table_lookup (priv->clips_table, fac_id);
|
2012-01-04 22:04:53 +00:00
|
|
|
source_table = g_hash_table_lookup (priv->sources_table, fac_id);
|
2011-11-02 16:52:16 +00:00
|
|
|
make_source (self, reflist, source_table);
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
2011-11-02 16:52:16 +00:00
|
|
|
|
|
|
|
g_list_free (keys);
|
|
|
|
return TRUE;
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
static gboolean
|
|
|
|
load_pitivi_file_from_uri (GESFormatter * self,
|
2012-09-23 00:05:42 +00:00
|
|
|
GESTimeline * timeline, const gchar * uri, GError ** error)
|
2011-08-28 01:55:46 +00:00
|
|
|
{
|
2011-11-02 16:52:16 +00:00
|
|
|
xmlDocPtr doc;
|
2013-04-23 23:04:04 +00:00
|
|
|
GESLayer *layer;
|
2011-11-02 16:52:16 +00:00
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
|
|
|
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
gint *prio = malloc (sizeof (gint));
|
|
|
|
|
|
|
|
*prio = 0;
|
2013-04-23 23:04:04 +00:00
|
|
|
layer = ges_layer_new ();
|
2011-11-02 16:52:16 +00:00
|
|
|
g_object_set (layer, "auto-transition", TRUE, NULL);
|
|
|
|
|
|
|
|
g_hash_table_insert (priv->layers_table, prio, layer);
|
|
|
|
g_object_set (layer, "priority", (gint32) 0, NULL);
|
|
|
|
|
|
|
|
if (!ges_timeline_add_layer (timeline, layer)) {
|
|
|
|
GST_ERROR ("Couldn't add layer");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(doc = xmlParseFile (uri))) {
|
|
|
|
GST_ERROR ("The xptv file for uri %s was badly formed or did not exist",
|
|
|
|
uri);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->xpathCtx = xmlXPathNewContext (doc);
|
|
|
|
|
2013-01-12 23:49:31 +00:00
|
|
|
if (self->project)
|
|
|
|
parse_metadatas (self);
|
|
|
|
|
2011-11-02 16:52:16 +00:00
|
|
|
if (!create_tracks (self)) {
|
|
|
|
GST_ERROR ("Couldn't create tracks");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-04 22:04:53 +00:00
|
|
|
list_sources (self);
|
2011-11-02 16:52:16 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
if (!parse_clips (self)) {
|
2013-02-08 20:11:22 +00:00
|
|
|
GST_ERROR ("Couldn't find clips markup in the xptv file");
|
2011-11-02 16:52:16 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
if (!parse_track_elements (self)) {
|
2011-11-02 16:52:16 +00:00
|
|
|
GST_ERROR ("Couldn't find track objects markup in the xptv file");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-04-07 21:30:03 +00:00
|
|
|
|
|
|
|
|
2013-02-08 20:11:22 +00:00
|
|
|
/* If there are no clips to load we should emit
|
2012-04-07 21:30:03 +00:00
|
|
|
* 'project-loaded' signal.
|
|
|
|
*/
|
2013-01-20 15:42:29 +00:00
|
|
|
if (!g_hash_table_size (priv->clips_table) && GES_FORMATTER (self)->project) {
|
2012-12-17 22:26:23 +00:00
|
|
|
ges_project_set_loaded (GES_FORMATTER (self)->project,
|
|
|
|
GES_FORMATTER (self));
|
2012-04-07 21:30:03 +00:00
|
|
|
} else {
|
2013-01-20 15:42:29 +00:00
|
|
|
if (!make_clips (self)) {
|
2012-04-07 21:30:03 +00:00
|
|
|
GST_ERROR ("Couldn't deserialise the project properly");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-11-02 16:52:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
xmlXPathFreeContext (priv->xpathCtx);
|
|
|
|
xmlFreeDoc (doc);
|
|
|
|
return ret;
|
2011-08-28 01:55:46 +00:00
|
|
|
}
|
2012-01-04 18:06:11 +00:00
|
|
|
|
2012-11-19 17:19:17 +00:00
|
|
|
/* Object functions */
|
|
|
|
static void
|
|
|
|
ges_pitivi_formatter_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GESPitiviFormatter *self = GES_PITIVI_FORMATTER (object);
|
|
|
|
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
|
|
|
|
|
|
|
|
g_hash_table_destroy (priv->sources_table);
|
|
|
|
g_hash_table_destroy (priv->source_uris);
|
|
|
|
|
|
|
|
g_hash_table_destroy (priv->saving_source_table);
|
|
|
|
g_list_free (priv->sources_to_load);
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
if (priv->clips_table != NULL) {
|
|
|
|
g_hash_table_foreach (priv->clips_table,
|
2012-11-19 17:19:17 +00:00
|
|
|
(GHFunc) list_table_destroyer, NULL);
|
2015-09-24 04:42:16 +00:00
|
|
|
g_hash_table_destroy (priv->clips_table);
|
2012-11-19 17:19:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->layers_table != NULL)
|
|
|
|
g_hash_table_destroy (priv->layers_table);
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
if (priv->track_elements_table != NULL) {
|
|
|
|
g_hash_table_destroy (priv->track_elements_table);
|
2012-11-19 17:19:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (ges_pitivi_formatter_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_pitivi_formatter_class_init (GESPitiviFormatterClass * klass)
|
|
|
|
{
|
|
|
|
GESFormatterClass *formatter_klass;
|
|
|
|
GObjectClass *object_class;
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (ges_pitivi_formatter_debug, "ges_pitivi_formatter",
|
|
|
|
GST_DEBUG_FG_YELLOW, "ges pitivi formatter");
|
|
|
|
|
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
|
|
|
formatter_klass = GES_FORMATTER_CLASS (klass);
|
|
|
|
|
|
|
|
formatter_klass->can_load_uri = pitivi_can_load_uri;
|
2013-03-22 21:43:30 +00:00
|
|
|
formatter_klass->save_to_uri = NULL;
|
2012-11-19 17:19:17 +00:00
|
|
|
formatter_klass->load_from_uri = load_pitivi_file_from_uri;
|
|
|
|
object_class->finalize = ges_pitivi_formatter_finalize;
|
2012-12-17 22:26:23 +00:00
|
|
|
|
|
|
|
ges_formatter_class_register_metas (formatter_klass, "pitivi",
|
2012-12-28 22:10:17 +00:00
|
|
|
"Legacy Pitivi project files", "xptv", "text/x-xptv",
|
2012-12-17 22:26:23 +00:00
|
|
|
DOUBLE_VERSION, GST_RANK_MARGINAL);
|
2012-11-19 17:19:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_pitivi_formatter_init (GESPitiviFormatter * self)
|
|
|
|
{
|
|
|
|
GESPitiviFormatterPrivate *priv;
|
|
|
|
|
2018-09-06 01:55:02 +00:00
|
|
|
self->priv = ges_pitivi_formatter_get_instance_private (self);
|
2012-11-19 17:19:17 +00:00
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
priv->track_elements_table =
|
2012-11-19 17:19:17 +00:00
|
|
|
g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
|
(GDestroyNotify) g_hash_table_destroy);
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
priv->clips_table =
|
2012-11-19 17:19:17 +00:00
|
|
|
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
|
|
|
|
|
|
|
priv->layers_table =
|
2013-03-16 22:05:04 +00:00
|
|
|
g_hash_table_new_full (g_int_hash, g_str_equal, g_free, gst_object_unref);
|
2012-11-19 17:19:17 +00:00
|
|
|
|
|
|
|
priv->sources_table =
|
|
|
|
g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
|
(GDestroyNotify) g_hash_table_destroy);
|
|
|
|
|
|
|
|
priv->source_uris =
|
|
|
|
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
|
|
|
|
|
|
|
priv->sources_to_load = NULL;
|
|
|
|
|
|
|
|
/* Saving context */
|
|
|
|
priv->saving_source_table =
|
|
|
|
g_hash_table_new_full (g_str_hash, g_int_equal, g_free, g_free);
|
|
|
|
priv->nb_sources = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
GESPitiviFormatter *
|
|
|
|
ges_pitivi_formatter_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (GES_TYPE_PITIVI_FORMATTER, NULL);
|
|
|
|
}
|