GESTimeline: implementation of save_to/load_from uri

This commit is contained in:
Brandon Lewis 2010-09-29 12:43:47 +01:00 committed by Edward Hervey
parent 4f0136c5ac
commit 27481c3c26
3 changed files with 78 additions and 20 deletions

View file

@ -210,7 +210,7 @@ ges_timeline_add_track
ges_timeline_remove_track ges_timeline_remove_track
ges_timeline_get_track_for_pad ges_timeline_get_track_for_pad
ges_timeline_load_from_uri ges_timeline_load_from_uri
ges_timeline_save ges_timeline_save_to_uri
ges_timeline_get_tracks ges_timeline_get_tracks
<SUBSECTION Standard> <SUBSECTION Standard>
ges_timeline_get_type ges_timeline_get_type
@ -443,6 +443,7 @@ GES_TIMELINE_TITLE_SOURCE_GET_CLASS
GESTimelineTextOverlay GESTimelineTextOverlay
GESTimelineTextOverlayClass GESTimelineTextOverlayClass
ges_timeline_text_overlay_new ges_timeline_text_overlay_new
ges_timeline_new_from_uri
<SUBSECTION Standard> <SUBSECTION Standard>
ges_tl_text_overlay_get_type ges_tl_text_overlay_get_type
GES_IS_TIMELINE_TEXT_OVERLAY GES_IS_TIMELINE_TEXT_OVERLAY

View file

@ -223,41 +223,99 @@ ges_timeline_new (void)
} }
/** /**
* ges_timeline_load_from_uri: * ges_timeline_new_from_uri:
* @uri: The URI to load from * @uri: the URI to load from
* *
* Creates a timeline from the contents of given uri. * Creates a timeline from the given URI.
* *
* NOT_IMPLEMENTED ! * Returns: A new timeline if the uri was loaded successfully, or NULL if the
* * uri could not be loaded
* Returns: A new #GESTimeline if loading was successful, else NULL.
*/ */
GESTimeline * GESTimeline *
ges_timeline_load_from_uri (gchar * uri) ges_timeline_new_from_uri (gchar * uri)
{ {
/* FIXME : IMPLEMENT */ GESTimeline *ret;
return NULL;
ret = ges_timeline_new ();
if (!ges_timeline_load_from_uri (ret, uri)) {
g_object_unref (ret);
return NULL;
}
return ret;
}
/**
* ges_timeline_load_from_uri:
* @timeline: an empty #GESTimeline into which to load the formatter
* @uri: The URI to load from
*
* Loads the contents of URI into the given timeline.
*
* Returns: TRUE if the timeline was loaded successfully, or FALSE if the uri
* could not be loaded.
*/
gboolean
ges_timeline_load_from_uri (GESTimeline * timeline, gchar * uri)
{
GESFormatter *p = NULL;
gboolean ret = FALSE;
if (!(p = ges_formatter_new_for_uri (uri))) {
GST_ERROR ("unsupported uri '%s'", uri);
goto fail;
}
if (!ges_formatter_load_from_uri (p, timeline, uri)) {
GST_ERROR ("error deserializing formatter");
goto fail;
}
ret = TRUE;
fail:
if (p)
g_object_unref (p);
return ret;
} }
/** /**
* ges_timeline_save: * ges_timeline_save_to_uri:
* @timeline: a #GESTimeline * @timeline: a #GESTimeline
* @uri: The location to save to * @uri: The location to save to
* *
* Saves the timeline to the given location * Saves the timeline to the given location
* *
* NOT_IMPLEMENTED !
*
* Returns: TRUE if the timeline was successfully saved to the given location, * Returns: TRUE if the timeline was successfully saved to the given location,
* else FALSE. * else FALSE.
*/ */
gboolean gboolean
ges_timeline_save (GESTimeline * timeline, gchar * uri) ges_timeline_save_to_uri (GESTimeline * timeline, gchar * uri)
{ {
/* FIXME : IMPLEMENT */ GESFormatter *p = NULL;
return FALSE; gboolean ret = FALSE;
if (!(p = ges_formatter_new_for_uri (uri))) {
GST_ERROR ("unsupported uri '%s'", uri);
goto fail;
}
if (!ges_formatter_save_to_uri (p, timeline, uri)) {
GST_ERROR ("error serializing formatter");
goto fail;
}
ret = TRUE;
fail:
if (p)
g_object_unref (p);
return ret;
} }
static void static void

View file

@ -83,11 +83,10 @@ struct _GESTimelineClass {
GType ges_timeline_get_type (void); GType ges_timeline_get_type (void);
GESTimeline* ges_timeline_new (void); GESTimeline* ges_timeline_new (void);
GESTimeline* ges_timeline_new_from_uri (gchar *uri);
gboolean ges_timeline_load_from_uri (GESTimeline *timeline, gchar *uri);
GESTimeline* ges_timeline_load_from_uri (gchar *uri); gboolean ges_timeline_save_to_uri (GESTimeline *timeline, gchar *uri);
gboolean ges_timeline_save (GESTimeline *timeline, gchar *uri);
gboolean ges_timeline_add_layer (GESTimeline *timeline, GESTimelineLayer *layer); gboolean ges_timeline_add_layer (GESTimeline *timeline, GESTimelineLayer *layer);
gboolean ges_timeline_remove_layer (GESTimeline *timeline, GESTimelineLayer *layer); gboolean ges_timeline_remove_layer (GESTimeline *timeline, GESTimelineLayer *layer);