formatter: Add a "loaded" signal

API: GESFormatter::loaded signal
API: GESFormatter->project_loaded VMethod
This commit is contained in:
Thibault Saunier 2012-01-07 13:28:15 -03:00
parent 5672ac8159
commit f5c861ddc3
3 changed files with 39 additions and 0 deletions

View file

@ -753,6 +753,7 @@ GESFormatterClass
GESFormatterLoadFromURIMethod
GESFormatterSaveToURIMethod
GESFormatterSourceMovedMethod
GESFormatterLoadedMethod
ges_default_formatter_new
ges_formatter_load_from_uri
ges_formatter_save_to_uri

View file

@ -38,6 +38,9 @@
*
* 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.
**/
#include <gst/gst.h>
@ -71,9 +74,13 @@ 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,
LOADED_SIGNAL,
LAST_SIGNAL
};
@ -98,6 +105,15 @@ ges_formatter_class_init (GESFormatterClass * klass)
G_SIGNAL_RUN_LAST, 0, NULL, NULL, ges_marshal_VOID__OBJECT, G_TYPE_NONE,
1, GES_TYPE_TIMELINE_FILE_SOURCE);
/**
* GESFormatter::loaded:
* @formatter: the #GESFormatter that is done loading a project.
*/
ges_formatter_signals[LOADED_SIGNAL] =
g_signal_new ("loaded", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, ges_marshal_VOID__OBJECT, G_TYPE_NONE,
1, GES_TYPE_TIMELINE);
object_class->dispose = ges_formatter_dispose;
klass->can_load_uri = default_can_load_uri;
@ -105,6 +121,7 @@ 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
@ -535,3 +552,11 @@ discovery_error_cb (GESTimeline * timeline,
tfs);
}
}
static gboolean
project_loaded (GESFormatter * formatter, GESTimeline * timeline)
{
g_signal_emit (formatter, ges_formatter_signals[LOADED_SIGNAL], 0, timeline);
return TRUE;
}

View file

@ -117,6 +117,17 @@ typedef gboolean (*GESFormatterLoadMethod) (GESFormatter * formatter,
typedef gboolean (*GESFormatterSourceMovedMethod) (GESFormatter *formatter,
GESTimelineFileSource *tfs, gchar *new_uri);
/**
* GESFormatterLoadedMethod
* @formatter: The #GESFormatter that is done loading
* @timeline: The #GESTimeline that has finnished to load
*
* This method should be called by sublcasses when they are done
* loading @timeline
*/
typedef gboolean (*GESFormatterLoadedMethod) (GESFormatter *formatter,
GESTimeline *timeline);
/**
* GESFormatterClass:
* @parent_class: the parent class structure
@ -126,6 +137,7 @@ typedef gboolean (*GESFormatterSourceMovedMethod) (GESFormatter *formatte
* @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.
*/
@ -138,6 +150,7 @@ struct _GESFormatterClass {
GESFormatterLoadFromURIMethod load_from_uri;
GESFormatterSaveToURIMethod save_to_uri;
GESFormatterSourceMovedMethod update_source_uri;
GESFormatterLoadedMethod project_loaded;
/*< private >*/
/* FIXME : formatter name */