mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
ges: Add API to get the TrackObject-s contained in a Track
Sort the track_objects list API: ges_track_get_objects
This commit is contained in:
parent
49e547d8fb
commit
c191715608
2 changed files with 42 additions and 2 deletions
|
@ -335,6 +335,26 @@ ges_track_set_caps (GESTrack * track, const GstCaps * caps)
|
||||||
/* FIXME : update all trackobjects ? */
|
/* FIXME : update all trackobjects ? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* FIXME : put the compare function in the utils */
|
||||||
|
|
||||||
|
static gint
|
||||||
|
objects_start_compare (GESTrackObject * a, GESTrackObject * b)
|
||||||
|
{
|
||||||
|
if (a->start == b->start) {
|
||||||
|
if (a->priority < b->priority)
|
||||||
|
return -1;
|
||||||
|
if (a->priority > b->priority)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (a->start < b->start)
|
||||||
|
return -1;
|
||||||
|
if (a->start > b->start)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ges_track_add_object:
|
* ges_track_add_object:
|
||||||
* @track: a #GESTrack
|
* @track: a #GESTrack
|
||||||
|
@ -383,14 +403,32 @@ ges_track_add_object (GESTrack * track, GESTrackObject * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_ref_sink (object);
|
g_object_ref_sink (object);
|
||||||
|
track->priv->trackobjects =
|
||||||
track->priv->trackobjects = g_list_append (track->priv->trackobjects, object);
|
g_list_insert_sorted (track->priv->trackobjects, object,
|
||||||
|
(GCompareFunc) objects_start_compare);
|
||||||
g_signal_emit (track, ges_track_signals[TRACK_OBJECT_ADDED], 0,
|
g_signal_emit (track, ges_track_signals[TRACK_OBJECT_ADDED], 0,
|
||||||
GES_TRACK_OBJECT (object));
|
GES_TRACK_OBJECT (object));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GList *
|
||||||
|
ges_track_get_objects (GESTrack * track)
|
||||||
|
{
|
||||||
|
GList *ret = NULL;
|
||||||
|
GList *tmp;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GES_IS_TRACK (track), NULL);
|
||||||
|
|
||||||
|
for (tmp = track->priv->trackobjects; tmp; tmp = tmp->next) {
|
||||||
|
ret = g_list_prepend (ret, tmp->data);
|
||||||
|
g_object_ref (tmp->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = g_list_reverse (ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ges_track_remove_object:
|
* ges_track_remove_object:
|
||||||
* @track: a #GESTrack
|
* @track: a #GESTrack
|
||||||
|
|
|
@ -98,6 +98,8 @@ gboolean ges_track_remove_object (GESTrack * track,
|
||||||
GESTrack *ges_track_video_raw_new (void);
|
GESTrack *ges_track_video_raw_new (void);
|
||||||
GESTrack *ges_track_audio_raw_new (void);
|
GESTrack *ges_track_audio_raw_new (void);
|
||||||
|
|
||||||
|
GList* ges_track_get_objects (GESTrack *track);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* _GES_TRACK */
|
#endif /* _GES_TRACK */
|
||||||
|
|
Loading…
Reference in a new issue