timeline-element: Add a method to get the TrackType it interacts with

API:
  + ges_timeline_element_get_track_types
This commit is contained in:
Thibault Saunier 2015-06-23 13:27:00 +02:00
parent 87b790a9da
commit 54be29e9ed
5 changed files with 48 additions and 0 deletions

View file

@ -468,6 +468,7 @@ ges_timeline_element_set_child_property
ges_timeline_element_get_child_property
ges_timeline_element_add_child_property
ges_timeline_element_remove_child_property
ges_timeline_element_get_track_types
GES_TIMELINE_ELEMENT_PARENT
GES_TIMELINE_ELEMENT_TIMELINE
GES_TIMELINE_ELEMENT_START

View file

@ -265,6 +265,24 @@ _lookup_child (GESTimelineElement * self, const gchar * prop_name,
(self, prop_name, child, pspec);
}
static GESTrackType
_get_track_types (GESTimelineElement * object)
{
GESTrackType types = GES_TRACK_TYPE_UNKNOWN;
GList *tmp, *children = ges_container_get_children (GES_CONTAINER (object),
TRUE);
for (tmp = children; tmp; tmp = tmp->next) {
if (GES_IS_TRACK_ELEMENT (tmp->data)) {
types |= ges_timeline_element_get_track_types (tmp->data);
}
}
g_list_free_full (children, gst_object_unref);
return types ^ GES_TRACK_TYPE_UNKNOWN;
}
/******************************************
* *
* GObject virtual methods implementation *
@ -363,6 +381,7 @@ ges_container_class_init (GESContainerClass * klass)
element_class->set_inpoint = _set_inpoint;
element_class->list_children_properties = _list_children_properties;
element_class->lookup_child = _lookup_child;
element_class->get_track_types = _get_track_types;
/* No default implementations */
klass->remove_child = NULL;

View file

@ -1649,3 +1649,20 @@ ges_timeline_element_remove_child_property (GESTimelineElement * self,
{
return g_hash_table_remove (self->priv->children_props, pspec);
}
/**
* ges_timeline_element_get_track_types:
* @self: A #GESTimelineElement
*
* Gets all the TrackTypes @self will interact with
*
* Since: 1.6.0
*/
GESTrackType
ges_timeline_element_get_track_types (GESTimelineElement * self)
{
g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self));
g_return_if_fail (GES_TIMELINE_ELEMENT_GET_CLASS (self)->get_track_types);
return GES_TIMELINE_ELEMENT_GET_CLASS (self)->get_track_types (self);
}

View file

@ -190,6 +190,7 @@ struct _GESTimelineElementClass
GParamSpec** (*list_children_properties) (GESTimelineElement * self, guint *n_properties);
gboolean (*lookup_child) (GESTimelineElement *self, const gchar *prop_name,
GObject **child, GParamSpec **pspec);
GESTrackType (*get_track_types) (GESTimelineElement * self);
/*< private > */
/* Padding for API extension */
@ -276,6 +277,8 @@ gboolean ges_timeline_element_add_child_property (GESTimelineElement * self,
gboolean ges_timeline_element_remove_child_property(GESTimelineElement * self,
GParamSpec *pspec);
GESTrackType ges_timeline_element_get_track_types (GESTimelineElement * self);
G_END_DECLS
#endif /* _GES_TIMELINE_ELEMENT_H_ */

View file

@ -101,6 +101,7 @@ static gboolean _set_inpoint (GESTimelineElement * element,
static gboolean _set_duration (GESTimelineElement * element,
GstClockTime duration);
static gboolean _set_priority (GESTimelineElement * element, guint32 priority);
GESTrackType _get_track_types (GESTimelineElement * object);
static GParamSpec **default_list_children_properties (GESTrackElement * object,
guint * n_properties);
@ -279,6 +280,7 @@ ges_track_element_class_init (GESTrackElementClass * klass)
element_class->set_duration = _set_duration;
element_class->set_inpoint = _set_inpoint;
element_class->set_priority = _set_priority;
element_class->get_track_types = _get_track_types;
element_class->deep_copy = ges_track_element_copy_properties;
klass->create_gnl_object = ges_track_element_create_gnl_object_func;
@ -503,6 +505,12 @@ _set_priority (GESTimelineElement * element, guint32 priority)
return TRUE;
}
GESTrackType
_get_track_types (GESTimelineElement * object)
{
return ges_track_element_get_track_type (GES_TRACK_ELEMENT (object));
}
/**
* ges_track_element_set_active:
* @object: a #GESTrackElement