ges-clip: Remove the unlocked TrackElement APIs

Remove APIs:
  ges_track_element_set_locked
  ges_track_element_is_locked

Those APIs where really not nice to use and were causing more issues
than solving them. If 2 time related properties of TimelineElement must
be different, then those element can *not* have the same parent.

Plus, with the new ges_container_group () API, we will recreate 1
GESClip containing the proper GESTimelineElements if it is the thing
to do.
This commit is contained in:
Thibault Saunier 2013-03-22 19:44:28 -03:00
parent 6775097e66
commit cdd00ed207
5 changed files with 39 additions and 143 deletions

View file

@ -100,8 +100,6 @@ GES_TYPE_TRACK
GESTrackElement
GESTrackElementClass
ges_track_element_set_active
ges_track_element_set_locked
ges_track_element_is_locked
ges_track_element_get_track
ges_track_element_get_gnlobject
ges_track_element_get_element

View file

@ -987,8 +987,7 @@ ges_clip_edit (GESClip * clip, GList * layers,
}
for (tmp = GES_CONTAINER_CHILDREN (clip); tmp; tmp = g_list_next (tmp)) {
if (ges_track_element_is_locked (tmp->data)
&& GES_IS_SOURCE (tmp->data)) {
if (GES_IS_SOURCE (tmp->data)) {
ret &= ges_track_element_edit (tmp->data, layers, mode, edge, position);
break;
}
@ -1155,7 +1154,6 @@ ges_clip_get_supported_formats (GESClip * clip)
gboolean
_ripple (GESTimelineElement * element, GstClockTime start)
{
GList *tmp;
gboolean ret = TRUE;
GESTimeline *timeline;
GESClip *clip = GES_CLIP (element);
@ -1167,14 +1165,12 @@ _ripple (GESTimelineElement * element, GstClockTime start)
return FALSE;
}
for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = g_list_next (tmp)) {
if (ges_track_element_is_locked (tmp->data)) {
ret = timeline_ripple_object (timeline, GES_TRACK_ELEMENT (tmp->data),
NULL, GES_EDGE_NONE, start);
/* As we work only with locked objects, the changes will be reflected
* to others controlled TrackElements */
break;
}
if (GES_CONTAINER_CHILDREN (element)) {
GESTrackElement *track_element =
GES_TRACK_ELEMENT (GES_CONTAINER_CHILDREN (element)->data);
ret = timeline_ripple_object (timeline, track_element, NULL, GES_EDGE_NONE,
start);
}
return ret;
@ -1183,7 +1179,6 @@ _ripple (GESTimelineElement * element, GstClockTime start)
static gboolean
_ripple_end (GESTimelineElement * element, GstClockTime end)
{
GList *tmp;
gboolean ret = TRUE;
GESTimeline *timeline;
GESClip *clip = GES_CLIP (element);
@ -1195,14 +1190,12 @@ _ripple_end (GESTimelineElement * element, GstClockTime end)
return FALSE;
}
for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = g_list_next (tmp)) {
if (ges_track_element_is_locked (tmp->data)) {
ret = timeline_ripple_object (timeline, GES_TRACK_ELEMENT (tmp->data),
NULL, GES_EDGE_END, end);
/* As we work only with locked objects, the changes will be reflected
* to others controlled TrackElements */
break;
}
if (GES_CONTAINER_CHILDREN (element)) {
GESTrackElement *track_element =
GES_TRACK_ELEMENT (GES_CONTAINER_CHILDREN (element)->data);
ret = timeline_ripple_object (timeline, track_element, NULL, GES_EDGE_END,
end);
}
return ret;
@ -1211,7 +1204,6 @@ _ripple_end (GESTimelineElement * element, GstClockTime end)
gboolean
_roll_start (GESTimelineElement * element, GstClockTime start)
{
GList *tmp;
gboolean ret = TRUE;
GESTimeline *timeline;
@ -1224,14 +1216,12 @@ _roll_start (GESTimelineElement * element, GstClockTime start)
return FALSE;
}
for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = g_list_next (tmp)) {
if (ges_track_element_is_locked (tmp->data)) {
ret = timeline_roll_object (timeline, GES_TRACK_ELEMENT (tmp->data),
NULL, GES_EDGE_START, start);
/* As we work only with locked objects, the changes will be reflected
* to others controlled TrackElements */
break;
}
if (GES_CONTAINER_CHILDREN (element)) {
GESTrackElement *track_element =
GES_TRACK_ELEMENT (GES_CONTAINER_CHILDREN (element)->data);
ret = timeline_roll_object (timeline, track_element, NULL, GES_EDGE_START,
start);
}
return ret;
@ -1240,7 +1230,6 @@ _roll_start (GESTimelineElement * element, GstClockTime start)
gboolean
_roll_end (GESTimelineElement * element, GstClockTime end)
{
GList *tmp;
gboolean ret = TRUE;
GESTimeline *timeline;
@ -1253,14 +1242,12 @@ _roll_end (GESTimelineElement * element, GstClockTime end)
}
for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = g_list_next (tmp)) {
if (ges_track_element_is_locked (tmp->data)) {
ret = timeline_roll_object (timeline, GES_TRACK_ELEMENT (tmp->data),
NULL, GES_EDGE_END, end);
/* As we work only with locked objects, the changes will be reflected
* to others controlled TrackElements */
break;
}
if (GES_CONTAINER_CHILDREN (element)) {
GESTrackElement *track_element =
GES_TRACK_ELEMENT (GES_CONTAINER_CHILDREN (element)->data);
ret = timeline_roll_object (timeline, track_element,
NULL, GES_EDGE_END, end);
}
return ret;
@ -1269,7 +1256,6 @@ _roll_end (GESTimelineElement * element, GstClockTime end)
gboolean
_trim (GESTimelineElement * element, GstClockTime start)
{
GList *tmp;
gboolean ret = TRUE;
GESTimeline *timeline;
@ -1282,12 +1268,12 @@ _trim (GESTimelineElement * element, GstClockTime start)
return FALSE;
}
for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = g_list_next (tmp)) {
if (ges_track_element_is_locked (tmp->data)) {
ret = timeline_trim_object (timeline, GES_TRACK_ELEMENT (tmp->data),
NULL, GES_EDGE_START, start);
break;
}
if (GES_CONTAINER_CHILDREN (element)) {
GESTrackElement *track_element =
GES_TRACK_ELEMENT (GES_CONTAINER_CHILDREN (element)->data);
ret = timeline_trim_object (timeline, track_element, NULL, GES_EDGE_START,
start);
}
return ret;

View file

@ -1408,18 +1408,12 @@ timeline_ripple_object (GESTimeline * timeline, GESTrackElement * obj,
new_start = _START (trackelement) + offset;
clip = add_moving_clip (mv_ctx, trackelement);
if (ges_track_element_is_locked (trackelement) == TRUE) {
/* Make sure not to move 2 times the same Clip */
if (g_list_find (moved_clips, clip) == NULL) {
_set_start0 (GES_TIMELINE_ELEMENT (trackelement), new_start);
moved_clips = g_list_prepend (moved_clips, clip);
}
} else {
/* Make sure not to move 2 times the same Clip */
if (g_list_find (moved_clips, clip) == NULL) {
_set_start0 (GES_TIMELINE_ELEMENT (trackelement), new_start);
moved_clips = g_list_prepend (moved_clips, clip);
}
}
g_list_free (moved_clips);
_set_start0 (GES_TIMELINE_ELEMENT (obj), position);
@ -1444,18 +1438,12 @@ timeline_ripple_object (GESTimeline * timeline, GESTrackElement * obj,
new_start = _START (trackelement) + offset;
clip = add_moving_clip (mv_ctx, trackelement);
if (ges_track_element_is_locked (trackelement) == TRUE) {
/* Make sure not to move 2 times the same Clip */
if (g_list_find (moved_clips, clip) == NULL) {
_set_start0 (GES_TIMELINE_ELEMENT (trackelement), new_start);
moved_clips = g_list_prepend (moved_clips, clip);
}
} else {
/* Make sure not to move 2 times the same Clip */
if (g_list_find (moved_clips, clip) == NULL) {
_set_start0 (GES_TIMELINE_ELEMENT (trackelement), new_start);
moved_clips = g_list_prepend (moved_clips, clip);
}
}
g_list_free (moved_clips);

View file

@ -63,7 +63,6 @@ struct _GESTrackElementPrivate
GESTrack *track;
gboolean valid;
gboolean locked; /* If TRUE, then moves in sync with its controlling
* GESClip */
@ -75,7 +74,6 @@ enum
{
PROP_0,
PROP_ACTIVE,
PROP_LOCKED,
PROP_TRACK_TYPE,
PROP_TRACK,
PROP_LAST
@ -123,10 +121,6 @@ static gboolean _set_priority (GESTimelineElement * element, guint32 priority);
static void _deep_copy (GESTimelineElement * element,
GESTimelineElement * copy);
static inline void
ges_track_element_set_locked_internal (GESTrackElement * object,
gboolean locked);
static GParamSpec **default_list_children_properties (GESTrackElement * object,
guint * n_properties);
@ -140,9 +134,6 @@ ges_track_element_get_property (GObject * object, guint property_id,
case PROP_ACTIVE:
g_value_set_boolean (value, ges_track_element_is_active (track_element));
break;
case PROP_LOCKED:
g_value_set_boolean (value, ges_track_element_is_locked (track_element));
break;
case PROP_TRACK_TYPE:
g_value_set_flags (value, track_element->priv->track_type);
break;
@ -164,10 +155,6 @@ ges_track_element_set_property (GObject * object, guint property_id,
case PROP_ACTIVE:
ges_track_element_set_active (track_element, g_value_get_boolean (value));
break;
case PROP_LOCKED:
ges_track_element_set_locked_internal (track_element,
g_value_get_boolean (value));
break;
case PROP_TRACK_TYPE:
track_element->priv->track_type = g_value_get_flags (value);
break;
@ -241,17 +228,6 @@ ges_track_element_class_init (GESTrackElementClass * klass)
g_object_class_install_property (object_class, PROP_ACTIVE,
properties[PROP_ACTIVE]);
/**
* GESTrackElement:locked:
*
* If %TRUE, then moves in sync with its controlling #GESClip
*/
properties[PROP_LOCKED] =
g_param_spec_boolean ("locked", "Locked",
"Moves in sync with its controling Clip", TRUE, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_LOCKED,
properties[PROP_LOCKED]);
properties[PROP_TRACK_TYPE] = g_param_spec_flags ("track-type", "Track Type",
"The track type of the object", GES_TYPE_TRACK_TYPE,
GES_TRACK_TYPE_UNKNOWN, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
@ -305,7 +281,6 @@ ges_track_element_init (GESTrackElement * self)
priv->pending_duration = GST_SECOND;
priv->pending_priority = 1;
priv->pending_active = TRUE;
priv->locked = TRUE;
priv->properties_hashtable = NULL;
priv->bindings_hashtable = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
@ -814,52 +789,6 @@ ges_track_element_get_element (GESTrackElement * object)
return object->priv->element;
}
static inline void
ges_track_element_set_locked_internal (GESTrackElement * object,
gboolean locked)
{
object->priv->locked = locked;
}
/**
* ges_track_element_set_locked:
* @object: a #GESTrackElement
* @locked: whether the object is lock to its parent
*
* Set the locking status of the @object in relationship to its controlling
* #GESClip. If @locked is %TRUE, then this object will move synchronously
* with its controlling #GESClip.
*/
void
ges_track_element_set_locked (GESTrackElement * object, gboolean locked)
{
g_return_if_fail (GES_IS_TRACK_ELEMENT (object));
GST_DEBUG_OBJECT (object, "%s object", locked ? "Locking" : "Unlocking");
ges_track_element_set_locked_internal (object, locked);
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_LOCKED]);
}
/**
* ges_track_element_is_locked:
* @object: a #GESTrackElement
*
* Let you know if object us locked or not (moving synchronously).
*
* Returns: %TRUE if the object is moving synchronously to its controlling
* #GESClip, else %FALSE.
*/
gboolean
ges_track_element_is_locked (GESTrackElement * object)
{
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE);
return object->priv->locked;
}
/**
* ges_track_element_is_active:
* @object: a #GESTrackElement

View file

@ -126,11 +126,6 @@ GstElement * ges_track_element_get_gnlobject (GESTrackElement * object);
GstElement * ges_track_element_get_element (GESTrackElement * object);
void ges_track_element_set_locked (GESTrackElement * object,
gboolean locked);
gboolean ges_track_element_is_locked (GESTrackElement * object);
gboolean ges_track_element_set_active (GESTrackElement * object,
gboolean active);