mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-05 18:22:23 +00:00
clip: allow for neither track nor type in search
Previously, either the track or track_type arguments had to be specified in order to find **any** track elements. Now, you can specify neither, which will match any track element, of the specified type.
This commit is contained in:
parent
b6fb2ed531
commit
f1d29e10e6
1 changed files with 24 additions and 28 deletions
|
@ -1637,23 +1637,26 @@ ges_clip_add_asset (GESClip * clip, GESAsset * asset)
|
||||||
* all tracks
|
* all tracks
|
||||||
* @track_type: The track-type of the track element to search for, or
|
* @track_type: The track-type of the track element to search for, or
|
||||||
* #GES_TRACK_TYPE_UNKNOWN to match any track type
|
* #GES_TRACK_TYPE_UNKNOWN to match any track type
|
||||||
* @type: The type of track element to search for, or %NULL to match any
|
* @type: The type of track element to search for, or %G_TYPE_NONE to
|
||||||
* type
|
* match any type
|
||||||
*
|
*
|
||||||
* Finds the #GESTrackElement-s controlled by the clip that match the
|
* Finds the #GESTrackElement-s controlled by the clip that match the
|
||||||
* given criteria. You must give either @track (not %NULL) or @track_type
|
* given criteria. If @track is given as %NULL and @track_type is given as
|
||||||
* (not #GES_TRACK_TYPE_UNKNOWN) in order to find any elements. If @track
|
* #GES_TRACK_TYPE_UNKNOWN, then the search will match all elements in any
|
||||||
* is given, and @track_type is not, then only the track elements in
|
* track, including those with no track, and of any
|
||||||
* @track are searched for. Otherwise, if @track_type is given, and @track
|
* #GESTrackElement:track-type. Otherwise, if @track is not %NULL, but
|
||||||
* is not, then only the track elements whose #GESTrackElement:track-type
|
* @track_type is #GES_TRACK_TYPE_UNKNOWN, then only the track elements in
|
||||||
* matches @track_type are searched for. If both are given, then the track
|
* @track are searched for. Otherwise, if @track_type is not
|
||||||
* elements that match **either** criteria are searched for (so if you
|
* #GES_TRACK_TYPE_UNKNOWN, but @track is %NULL, then only the track
|
||||||
* wish to only find all the elements in a given track, you should give
|
* elements whose #GESTrackElement:track-type matches @track_type are
|
||||||
* the track as @track, but should not give the track's
|
* searched for. Otherwise, when both are given, the track elements that
|
||||||
* #GESTrack:track-type as @track_type because this would also select
|
* match **either** criteria are searched for. Therefore, if you wish to
|
||||||
* elements from other tracks of the same type).
|
* only find elements in a specific track, you should give the track as
|
||||||
|
* @track, but you should not give the track's #GESTrack:track-type as
|
||||||
|
* @track_type because this would also select elements from other tracks
|
||||||
|
* of the same type.
|
||||||
*
|
*
|
||||||
* You may also give @type to further restrict the search to track
|
* You may also give @type to _further_ restrict the search to track
|
||||||
* elements of the given @type.
|
* elements of the given @type.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (element-type GESTrackElement): A list of all
|
* Returns: (transfer full) (element-type GESTrackElement): A list of all
|
||||||
|
@ -1666,9 +1669,7 @@ ges_clip_find_track_elements (GESClip * clip, GESTrack * track,
|
||||||
GESTrackType track_type, GType type)
|
GESTrackType track_type, GType type)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GESTrack *tmptrack;
|
|
||||||
GESTrackElement *otmp;
|
GESTrackElement *otmp;
|
||||||
GESTrackElement *foundElement;
|
|
||||||
|
|
||||||
GList *ret = NULL;
|
GList *ret = NULL;
|
||||||
|
|
||||||
|
@ -1682,19 +1683,14 @@ ges_clip_find_track_elements (GESClip * clip, GESTrack * track,
|
||||||
if ((type != G_TYPE_NONE) && !G_TYPE_CHECK_INSTANCE_TYPE (tmp->data, type))
|
if ((type != G_TYPE_NONE) && !G_TYPE_CHECK_INSTANCE_TYPE (tmp->data, type))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tmptrack = ges_track_element_get_track (otmp);
|
/* TODO 2.0: an AND condition, using a condition like the above type
|
||||||
/* TODO 2.0: an AND condition would have made more sense here */
|
* check would have made more sense here. Especially when both
|
||||||
/* FIXME: if neither the track nor the track_type are given, we should
|
* track != NULL and track_type != GES_TRACK_TYPE_UNKNOWN are given */
|
||||||
* still match the elements that match the given type (currently the
|
if ((track == NULL && track_type == GES_TRACK_TYPE_UNKNOWN) ||
|
||||||
* list will be empty if only the type is given) */
|
(track != NULL && ges_track_element_get_track (otmp) == track) ||
|
||||||
if (((track != NULL && tmptrack == track)) ||
|
|
||||||
(track_type != GES_TRACK_TYPE_UNKNOWN
|
(track_type != GES_TRACK_TYPE_UNKNOWN
|
||||||
&& ges_track_element_get_track_type (otmp) == track_type)) {
|
&& ges_track_element_get_track_type (otmp) == track_type))
|
||||||
|
ret = g_list_append (ret, gst_object_ref (otmp));
|
||||||
foundElement = GES_TRACK_ELEMENT (tmp->data);
|
|
||||||
|
|
||||||
ret = g_list_append (ret, gst_object_ref (foundElement));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue