clip: Add a method to get the priority of the layer it is in

Just an helper method to get the 'priority of a the clip'
This commit is contained in:
Thibault Saunier 2019-02-08 16:44:39 -03:00 committed by Thibault Saunier
parent c901e4289a
commit 1c2784daa6
7 changed files with 17 additions and 28 deletions

View file

@ -61,8 +61,8 @@ neighbour_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
}
}
if (_ges_track_element_get_layer_priority (self->next_source) !=
_ges_track_element_get_layer_priority (self->previous_source)) {
if (GES_TIMELINE_ELEMENT_LAYER_PRIORITY (self->next_source) !=
GES_TIMELINE_ELEMENT_LAYER_PRIORITY (self->previous_source)) {
GST_DEBUG_OBJECT (self, "Destroy changed layer");
g_signal_emit (self, auto_transition_signals[DESTROY_ME], 0);
return;

View file

@ -1018,9 +1018,17 @@ ges_clip_set_layer (GESClip * clip, GESLayer * layer)
g_object_notify_by_pspec (G_OBJECT (clip), properties[PROP_LAYER]);
}
/**
* ges_clip_get_layer_priority:
* @clip: The clip to get the layer priority from
*
* Returns: The priority of the layer @clip is in, -1 if not in a layer.
*/
guint32
ges_clip_get_layer_priority (GESClip * clip)
{
g_return_val_if_fail (GES_IS_CLIP (clip), -1);
if (clip->priv->layer == NULL)
return -1;

View file

@ -162,7 +162,9 @@ GList * ges_clip_find_track_elements (GESClip * clip, GESTrack * tr
GES_API
GESLayer* ges_clip_get_layer (GESClip *clip);
GES_API
gboolean ges_clip_move_to_layer (GESClip *clip, GESLayer *layer);
gboolean ges_clip_move_to_layer (GESClip *clip, GESLayer *layer);
GES_API
guint32 ges_clip_get_layer_priority (GESClip * clip);
/****************************************************
* Effects *

View file

@ -353,7 +353,6 @@ G_GNUC_INTERNAL void _ges_container_set_priority_offset (GESContainer * contai
****************************************************/
G_GNUC_INTERNAL void ges_clip_set_layer (GESClip *clip, GESLayer *layer);
G_GNUC_INTERNAL gboolean ges_clip_is_moving_from_layer (GESClip *clip);
G_GNUC_INTERNAL guint32 ges_clip_get_layer_priority (GESClip *clip);
G_GNUC_INTERNAL void ges_clip_set_moving_from_layer (GESClip *clip, gboolean is_moving);
G_GNUC_INTERNAL GESTrackElement* ges_clip_create_track_element (GESClip *clip, GESTrackType type);
G_GNUC_INTERNAL GList* ges_clip_create_track_elements (GESClip *clip, GESTrackType type);
@ -369,7 +368,6 @@ G_GNUC_INTERNAL void layer_set_priority (GESLayer * layer, guint p
****************************************************/
#define NLE_OBJECT_TRACK_ELEMENT_QUARK (g_quark_from_string ("nle_object_track_element_quark"))
G_GNUC_INTERNAL gboolean ges_track_element_set_track (GESTrackElement * object, GESTrack * track);
G_GNUC_INTERNAL guint32 _ges_track_element_get_layer_priority (GESTrackElement * element);
G_GNUC_INTERNAL void ges_track_element_copy_properties (GESTimelineElement * element,
GESTimelineElement * elementcopy);

View file

@ -1038,7 +1038,7 @@ _create_transitions_on_layer (GESTimeline * timeline, GESLayer * layer,
get_toplevel_container (GES_TIMELINE_ELEMENT (next));
/* Only object that are in that layer and track */
if (_ges_track_element_get_layer_priority (next) != layer_prio ||
if (GES_TIMELINE_ELEMENT_LAYER_PRIORITY (next) != layer_prio ||
(track && track != ges_track_element_get_track (next)))
continue;
@ -1119,7 +1119,7 @@ timeline_create_transitions (GESTimeline * timeline,
track = ges_track_element_get_track (track_element);
layer_node = g_list_find_custom (timeline->layers,
GINT_TO_POINTER (_ges_track_element_get_layer_priority (track_element)),
GINT_TO_POINTER (GES_TIMELINE_ELEMENT_LAYER_PRIORITY (track_element)),
(GCompareFunc) find_layer_by_prio);
_create_transitions_on_layer (timeline,
@ -1197,7 +1197,7 @@ start_tracking_track_element (GESTimeline * timeline,
TrackObjIters *iters;
GESTimelinePrivate *priv = timeline->priv;
guint layer_prio = _ges_track_element_get_layer_priority (trackelement);
guint layer_prio = GES_TIMELINE_ELEMENT_LAYER_PRIORITY (trackelement);
GList *layer_node = g_list_find_custom (timeline->layers,
GINT_TO_POINTER (layer_prio), (GCompareFunc) find_layer_by_prio);
GESLayer *layer = layer_node ? layer_node->data : NULL;
@ -2622,7 +2622,7 @@ trackelement_priority_changed_cb (GESTrackElement * child,
GESTimelinePrivate *priv = timeline->priv;
GList *layer_node = g_list_find_custom (timeline->layers,
GINT_TO_POINTER (_ges_track_element_get_layer_priority (child)),
GINT_TO_POINTER (GES_TIMELINE_ELEMENT_LAYER_PRIORITY (child)),
(GCompareFunc) find_layer_by_prio);
GESLayer *layer = layer_node ? layer_node->data : NULL;
TrackObjIters *iters = g_hash_table_lookup (priv->obj_iters,

View file

@ -828,15 +828,6 @@ ges_track_element_get_all_control_bindings (GESTrackElement * trackelement)
return priv->bindings_hashtable;
}
guint32
_ges_track_element_get_layer_priority (GESTrackElement * element)
{
if (_PRIORITY (element) < LAYER_HEIGHT + MIN_NLE_PRIO)
return 0;
return (_PRIORITY (element) - MIN_NLE_PRIO) / LAYER_HEIGHT;
}
/**
* ges_track_element_get_track:
* @object: a #GESTrackElement

View file

@ -499,16 +499,6 @@ GST_START_TEST (test_group_in_group)
GST_END_TEST;
static guint32
ges_clip_get_layer_priority (GESClip * clip)
{
GESLayer *layer = ges_clip_get_layer (clip);
if (layer == NULL)
return -1;
return ges_layer_get_priority (layer);
}
GST_START_TEST (test_group_in_group_layer_moving)
{
GESAsset *asset;