From b5c21da0d8e94dc949f619cba7a8ab92ca49ad4c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 9 Sep 2012 21:20:46 -0300 Subject: [PATCH] timelineobject: Implement the GESExtractable interface --- ges/ges-timeline-object.c | 38 ++++++++++++++++++++++++++++++++++++-- ges/ges-timeline-object.h | 1 + 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ges/ges-timeline-object.c b/ges/ges-timeline-object.c index b0e7cac..5122038 100644 --- a/ges/ges-timeline-object.c +++ b/ges/ges-timeline-object.c @@ -78,8 +78,12 @@ static gboolean ges_timeline_object_set_priority_internal (GESTimelineObject * static GESTimelineObject *ges_timeline_object_copy (GESTimelineObject * object, gboolean * deep); -G_DEFINE_ABSTRACT_TYPE (GESTimelineObject, ges_timeline_object, - G_TYPE_INITIALLY_UNOWNED); +static void ges_extractable_interface_init (GESExtractableInterface * iface); + +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GESTimelineObject, ges_timeline_object, + G_TYPE_INITIALLY_UNOWNED, + G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE, + ges_extractable_interface_init)); /* Mapping of relationship between a TimelineObject and the TrackObjects * it controls @@ -136,6 +140,8 @@ struct _GESTimelineObjectPrivate /* The formats supported by this TimelineObject */ GESTrackType supportedformats; + + GESAsset *asset; }; enum @@ -408,6 +414,34 @@ ges_timeline_object_init (GESTimelineObject * self) self->priv->maxduration = G_MAXUINT64; } +static void +extractable_set_asset (GESExtractable * extractable, GESAsset * asset) +{ + GES_TIMELINE_OBJECT (extractable)->asset = asset; +} + +static gboolean +_register_metas (GESExtractableInterface * iface, GObjectClass * class, + GESAsset * asset) +{ + GESMetaContainer *container = GES_META_CONTAINER (asset); + GParamSpecEnum *pspec = + (GParamSpecEnum *) g_object_class_find_property (class, + "supported-formats"); + + ges_meta_container_set_uint (container, + GES_META_TIMELINE_OBJECT_SUPPORTED_FORMATS, pspec->default_value); + + return TRUE; +} + +static void +ges_extractable_interface_init (GESExtractableInterface * iface) +{ + iface->set_asset = extractable_set_asset; + iface->register_metas = _register_metas; +} + /** * ges_timeline_object_create_track_object: * @object: The origin #GESTimelineObject diff --git a/ges/ges-timeline-object.h b/ges/ges-timeline-object.h index f1fa0d8..da7b561 100644 --- a/ges/ges-timeline-object.h +++ b/ges/ges-timeline-object.h @@ -172,6 +172,7 @@ struct _GESTimelineObject { guint32 height; /* the span of priorities this object needs */ guint64 fullduration; /* Full usable duration of the object (-1: no duration) */ + GESAsset *asset; /*< private >*/ GESTimelineObjectPrivate *priv; -- 2.7.4