timeline: Add a method to retrieve a pad from a track

It allows user to easily get the proxied pad from a track.

API:
  + ges_timeline_get_pad_for_track
This commit is contained in:
Thibault Saunier 2014-08-13 13:15:02 +02:00
parent cc84b63305
commit b752eea818
3 changed files with 35 additions and 0 deletions

View file

@ -363,6 +363,7 @@ ges_timeline_is_updating
ges_timeline_get_tracks
ges_timeline_get_layers
ges_timeline_get_track_for_pad
ges_timeline_get_pad_for_track
ges_timeline_get_duration
ges_timeline_get_project
ges_timeline_get_auto_transition

View file

@ -2961,6 +2961,39 @@ ges_timeline_get_track_for_pad (GESTimeline * timeline, GstPad * pad)
return NULL;
}
/**
* ges_timeline_get_pad_for_track:
* @timeline: The #GESTimeline
* @track: The #GESTrack
*
* Search the #GstPad corresponding to the given @timeline's @track.
*
* Returns: (transfer none): The corresponding #GstPad if it is found,
* or %NULL if there is an error.
*/
GstPad *
ges_timeline_get_pad_for_track (GESTimeline * timeline, GESTrack * track)
{
GList *tmp;
LOCK_DYN (timeline);
for (tmp = timeline->priv->priv_tracks; tmp; tmp = g_list_next (tmp)) {
TrackPrivate *tr_priv = (TrackPrivate *) tmp->data;
if (track == tr_priv->track) {
if (tr_priv->ghostpad)
gst_object_ref (tr_priv->ghostpad);
UNLOCK_DYN (timeline);
return tr_priv->ghostpad;
}
}
UNLOCK_DYN (timeline);
return NULL;
}
/**
* ges_timeline_get_tracks:
* @timeline: a #GESTimeline

View file

@ -114,6 +114,7 @@ gboolean ges_timeline_add_track (GESTimeline *timeline, GESTrack *track);
gboolean ges_timeline_remove_track (GESTimeline *timeline, GESTrack *track);
GESTrack * ges_timeline_get_track_for_pad (GESTimeline *timeline, GstPad *pad);
GstPad * ges_timeline_get_pad_for_track (GESTimeline * timeline, GESTrack *track);
GList *ges_timeline_get_tracks (GESTimeline *timeline);
gboolean ges_timeline_commit (GESTimeline * timeline);