Merge remote-tracking branch 'origin/0.10'

Conflicts:
	common
This commit is contained in:
Thibault Saunier 2012-07-01 20:54:42 -04:00
commit 7eed7ef46c
4 changed files with 56 additions and 45 deletions

View file

@ -793,16 +793,6 @@ ges_formatter_new_for_uri
ges_formatter_can_load_uri
ges_formatter_can_save_uri
ges_formatter_update_source_uri
<SUBSECTION Standard>
ges_formatter_get_type
GES_FORMATTER
GES_FORMATTER_CLASS
GES_FORMATTER_GET_CLASS
GES_IS_FORMATTER
GES_IS_FORMATTER_CLASS
GES_TYPE_FORMATTER
<SUBSECTION Private>
GESFormatterPrivate
ges_formatter_load
ges_formatter_save
ges_formatter_set_data
@ -812,6 +802,18 @@ GESFormatterCanLoadURIMethod
GESFormatterCanSaveURIMethod
GESFormatterLoadMethod
GESFormatterSaveMethod
<SUBSECTION>
ges_formatter_emit_loaded
<SUBSECTION Standard>
GES_FORMATTER
GES_FORMATTER_CLASS
GES_FORMATTER_GET_CLASS
GES_IS_FORMATTER
GES_IS_FORMATTER_CLASS
GES_TYPE_FORMATTER
<SUBSECTION Private>
ges_formatter_get_type
GESFormatterPrivate
</SECTION>
<SECTION>

View file

@ -39,8 +39,8 @@
* Support for saving or loading new formats can be added by creating a subclass of
* #GESFormatter and implement the various vmethods of #GESFormatterClass.
*
* Note that subclasses should call project_loaded wen they are done loading
* a project.
* Note that subclasses should call ges_formatter_project_loaded when they are done
* loading a project.
**/
#include <gst/gst.h>
@ -75,9 +75,6 @@ static gboolean default_can_save_uri (const gchar * uri);
static void discovery_error_cb (GESTimeline * timeline,
GESTimelineFileSource * tfs, GError * error, GESFormatter * formatter);
static gboolean project_loaded (GESFormatter * formatter,
GESTimeline * timeline);
enum
{
SOURCE_MOVED_SIGNAL,
@ -122,7 +119,6 @@ ges_formatter_class_init (GESFormatterClass * klass)
klass->load_from_uri = load_from_uri;
klass->save_to_uri = save_to_uri;
klass->update_source_uri = NULL;
klass->project_loaded = project_loaded;
}
static void
@ -340,6 +336,7 @@ ges_formatter_load (GESFormatter * formatter, GESTimeline * timeline)
{
GESFormatterClass *klass;
formatter->timeline = timeline;
klass = GES_FORMATTER_GET_CLASS (formatter);
if (klass->load)
@ -410,6 +407,7 @@ ges_formatter_load_from_uri (GESFormatter * formatter, GESTimeline * timeline,
G_CALLBACK (discovery_error_cb), formatter);
if (klass->load_from_uri) {
ges_timeline_enable_update (timeline, FALSE);
formatter->timeline = timeline;
ret = klass->load_from_uri (formatter, timeline, uri);
ges_timeline_enable_update (timeline, TRUE);
}
@ -469,15 +467,6 @@ ges_formatter_save_to_uri (GESFormatter * formatter, GESTimeline *
timeline, const gchar * uri)
{
GESFormatterClass *klass = GES_FORMATTER_GET_CLASS (formatter);
GList *layers;
/* Saving an empty timeline is not allowed */
/* FIXME : Having a ges_timeline_is_empty() would be more efficient maybe */
layers = ges_timeline_get_layers (timeline);
g_return_val_if_fail (layers != NULL, FALSE);
g_list_foreach (layers, (GFunc) g_object_unref, NULL);
g_list_free (layers);
if (klass->save_to_uri)
return klass->save_to_uri (formatter, timeline, uri);
@ -600,11 +589,22 @@ discovery_error_cb (GESTimeline * timeline,
}
}
static gboolean
project_loaded (GESFormatter * formatter, GESTimeline * timeline)
/*< protected >*/
/**
* ges_formatter_emit_loaded:
* @formatter: The #GESFormatter from which to emit the "project-loaded" signal
*
* Emits the "loaded" signal. This method should be called by sublasses when
* the project is fully loaded.
*
* Returns: %TRUE if the signale could be emitted %FALSE otherwize
*/
gboolean
ges_formatter_emit_loaded (GESFormatter * formatter)
{
GST_INFO_OBJECT (formatter, "Emit project loaded");
g_signal_emit (formatter, ges_formatter_signals[LOADED_SIGNAL], 0, timeline);
g_signal_emit (formatter, ges_formatter_signals[LOADED_SIGNAL], 0,
formatter->timeline);
return TRUE;
}

View file

@ -55,8 +55,11 @@ struct _GESFormatter {
/*< private >*/
GESFormatterPrivate *priv;
/*< protected >*/
GESTimeline *timeline;
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING];
gpointer _ges_reserved[GES_PADDING - 1];
};
typedef gboolean (*GESFormatterCanLoadURIMethod) (const gchar * uri);
@ -137,7 +140,6 @@ typedef gboolean (*GESFormatterLoadedMethod) (GESFormatter *formatter,
* @save_to_uri: class method to serialize data to a URI
* @update_source_uri: virtual method to specify that a source has moved, and thus its URI
* must be set to its new location (specified by the user)
* @project_loaded: Must be called by subclasses when done loading a project
*
* GES Formatter class. Override the vmethods to implement the formatter functionnality.
*/
@ -150,7 +152,6 @@ struct _GESFormatterClass {
GESFormatterLoadFromURIMethod load_from_uri;
GESFormatterSaveToURIMethod save_to_uri;
GESFormatterSourceMovedMethod update_source_uri;
GESFormatterLoadedMethod project_loaded;
/*< private >*/
/* FIXME : formatter name */
@ -185,6 +186,10 @@ gboolean
ges_formatter_update_source_uri (GESFormatter * formatter,
GESTimelineFileSource * source, gchar * new_uri);
/*< protected >*/
gboolean
ges_formatter_emit_loaded (GESFormatter * formatter);
/* Non-standard methods. WILL BE DEPRECATED */
gboolean ges_formatter_load (GESFormatter * formatter,
GESTimeline * timeline);

View file

@ -560,7 +560,7 @@ create_tracks (GESFormatter * self)
GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
GList *tracks = NULL;
tracks = ges_timeline_get_tracks (priv->timeline);
tracks = ges_timeline_get_tracks (self->timeline);
GST_DEBUG ("Creating tracks, current number of tracks %d",
g_list_length (tracks));
@ -584,11 +584,11 @@ create_tracks (GESFormatter * self)
priv->tracka = ges_track_audio_raw_new ();
priv->trackv = ges_track_video_raw_new ();
if (!ges_timeline_add_track (priv->timeline, priv->trackv)) {
if (!ges_timeline_add_track (self->timeline, priv->trackv)) {
return FALSE;
}
if (!ges_timeline_add_track (priv->timeline, priv->tracka)) {
if (!ges_timeline_add_track (self->timeline, priv->tracka)) {
return FALSE;
}
@ -807,12 +807,8 @@ track_object_added_cb (GESTimelineObject * object,
g_hash_table_steal (props_table, "current-formatter");
priv->sources_to_load = g_list_remove (priv->sources_to_load, object);
if (!priv->sources_to_load) {
GESFormatterClass *klass = GES_FORMATTER_GET_CLASS (formatter);
klass->project_loaded (GES_FORMATTER (formatter),
formatter->priv->timeline);
}
if (!priv->sources_to_load)
ges_formatter_emit_loaded (GES_FORMATTER (formatter));
}
if (lockedstr && !g_strcmp0 (lockedstr, "(bool)False"))
@ -909,7 +905,7 @@ make_source (GESFormatter * self, GList * reflist, GHashTable * source_table)
if (!(layer = g_hash_table_lookup (priv->layers_table, &prio))) {
layer = ges_timeline_layer_new ();
g_object_set (layer, "auto-transition", TRUE, "priority", prio, NULL);
ges_timeline_add_layer (priv->timeline, layer);
ges_timeline_add_layer (self->timeline, layer);
g_hash_table_insert (priv->layers_table, g_memdup (&prio,
sizeof (guint64)), layer);
}
@ -1068,7 +1064,6 @@ load_pitivi_file_from_uri (GESFormatter * self,
g_object_set (layer, "auto-transition", TRUE, NULL);
g_hash_table_insert (priv->layers_table, prio, layer);
priv->timeline = timeline;
g_object_set (layer, "priority", (gint32) 0, NULL);
if (!ges_timeline_add_layer (timeline, layer)) {
@ -1101,9 +1096,18 @@ load_pitivi_file_from_uri (GESFormatter * self,
return FALSE;
}
if (!make_timeline_objects (self)) {
GST_ERROR ("Couldn't deserialise the project properly");
return FALSE;
/* If there are no timeline objects to load we should emit
* 'project-loaded' signal.
*/
if (!g_hash_table_size (priv->timeline_objects_table)) {
ges_formatter_emit_loaded (self);
} else {
if (!make_timeline_objects (self)) {
GST_ERROR ("Couldn't deserialise the project properly");
return FALSE;
}
}
xmlXPathFreeContext (priv->xpathCtx);