timeline-element: stop using edit vmethods

These were all redirecting to essentially ges_timeline_element_edit
anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
This commit is contained in:
Henry Wilkes 2020-04-20 14:56:55 +01:00
parent bac0df294e
commit aefc992ef1
4 changed files with 33 additions and 155 deletions

View file

@ -89,11 +89,6 @@
static GList *ges_clip_create_track_elements_func (GESClip * clip,
GESTrackType type);
static gboolean _ripple (GESTimelineElement * element, GstClockTime start);
static gboolean _ripple_end (GESTimelineElement * element, GstClockTime end);
static gboolean _roll_start (GESTimelineElement * element, GstClockTime start);
static gboolean _roll_end (GESTimelineElement * element, GstClockTime end);
static gboolean _trim (GESTimelineElement * element, GstClockTime start);
static void _compute_height (GESContainer * container);
struct _GESClipPrivate
@ -1627,11 +1622,6 @@ ges_clip_class_init (GESClipClass * klass)
g_object_class_install_property (object_class, PROP_DURATION_LIMIT,
properties[PROP_DURATION_LIMIT]);
element_class->ripple = _ripple;
element_class->ripple_end = _ripple_end;
element_class->roll_start = _roll_start;
element_class->roll_end = _roll_end;
element_class->trim = _trim;
element_class->set_start = _set_start;
element_class->set_duration = _set_duration;
element_class->set_inpoint = _set_inpoint;
@ -2357,45 +2347,6 @@ ges_clip_get_supported_formats (GESClip * clip)
return clip->priv->supportedformats;
}
gboolean
_ripple (GESTimelineElement * element, GstClockTime start)
{
return ges_container_edit (GES_CONTAINER (element), NULL,
ges_timeline_element_get_layer_priority (element),
GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, start);
}
static gboolean
_ripple_end (GESTimelineElement * element, GstClockTime end)
{
return ges_container_edit (GES_CONTAINER (element), NULL,
ges_timeline_element_get_layer_priority (element),
GES_EDIT_MODE_RIPPLE, GES_EDGE_END, end);
}
gboolean
_roll_start (GESTimelineElement * element, GstClockTime start)
{
return ges_container_edit (GES_CONTAINER (element), NULL,
ges_timeline_element_get_layer_priority (element),
GES_EDIT_MODE_ROLL, GES_EDGE_START, start);
}
gboolean
_roll_end (GESTimelineElement * element, GstClockTime end)
{
return ges_container_edit (GES_CONTAINER (element), NULL,
ges_timeline_element_get_layer_priority (element),
GES_EDIT_MODE_ROLL, GES_EDGE_END, end);
}
gboolean
_trim (GESTimelineElement * element, GstClockTime start)
{
return ges_container_edit (GES_CONTAINER (element), NULL, -1,
GES_EDIT_MODE_TRIM, GES_EDGE_START, start);
}
/**
* ges_clip_add_asset:
* @clip: A #GESClip

View file

@ -292,21 +292,6 @@ _child_group_priority_changed (GESTimelineElement * child,
/****************************************************
* GESTimelineElement vmethods *
****************************************************/
static gboolean
_trim (GESTimelineElement * group, GstClockTime start)
{
GESTimeline *timeline = GES_TIMELINE_ELEMENT_TIMELINE (group);
if (timeline == NULL) {
GST_DEBUG ("Not in a timeline yet");
return FALSE;
}
return timeline_tree_trim (timeline_get_tree (timeline), group,
0, GST_CLOCK_DIFF (start, _START (group)), GES_EDGE_START,
ges_timeline_get_snapping_distance (timeline));
}
static gboolean
_set_priority (GESTimelineElement * element, guint32 priority)
@ -704,7 +689,6 @@ ges_group_class_init (GESGroupClass * klass)
object_class->get_property = ges_group_get_property;
object_class->set_property = ges_group_set_property;
element_class->trim = _trim;
element_class->set_duration = _set_duration;
element_class->set_inpoint = _set_inpoint;
element_class->set_max_duration = _set_max_duration;

View file

@ -1420,13 +1420,8 @@ ges_timeline_element_set_priority (GESTimelineElement * self, guint32 priority)
* @start: The new start time of @self in ripple mode
*
* Edits the start time of an element within its timeline in ripple mode.
* The element is shifted to @start, and later elements are also shifted
* by the same amount (see #GES_EDIT_MODE_RIPPLE). An edit may fail if it
* would place the timeline in an unsupported configuration.
*
* Note that if the element's timeline has a
* #GESTimeline:snapping-distance set, then the start time may be set
* to the edge of some element in the neighbourhood of @start.
* See ges_timeline_element_edit() with #GES_EDIT_MODE_RIPPLE and
* #GES_EDGE_NONE.
*
* Returns: %TRUE if the ripple edit of @self completed, %FALSE on
* failure.
@ -1438,17 +1433,13 @@ ges_timeline_element_ripple (GESTimelineElement * self, GstClockTime start)
g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE);
/* FIXME: why are we calling a vmethod to ripple, when
* ges_timeline_element_edit() with a GESEditMode of RIPPLE does not do
* so? */
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
if (klass->ripple)
return klass->ripple (self, start);
GST_WARNING_OBJECT (self, "No ripple virtual method implementation"
" on class %s. Can not ripple to %" GST_TIME_FORMAT,
G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start));
return ges_timeline_element_edit (self, NULL, -1, GES_EDIT_MODE_RIPPLE,
GES_EDGE_NONE, start);
return FALSE;
}
@ -1459,15 +1450,8 @@ ges_timeline_element_ripple (GESTimelineElement * self, GstClockTime start)
* @end: The new end time of @self in ripple mode
*
* Edits the end time of an element within its timeline in ripple mode.
* The element's duration time is shifted until its end time matches @end,
* and later elements have their start time shifted by the same amount
* (see #GES_EDIT_MODE_RIPPLE). An edit may fail if it would place the
* duration time out of bounds, or if it would place the timeline in an
* unsupported configuration.
*
* Note that if the element's timeline has a
* #GESTimeline:snapping-distance set, then the end time may be set
* to the edge of some element in the neighbourhood of @end.
* See ges_timeline_element_edit() with #GES_EDIT_MODE_RIPPLE and
* #GES_EDGE_END.
*
* Returns: %TRUE if the ripple edit of @self completed, %FALSE on
* failure.
@ -1479,20 +1463,13 @@ ges_timeline_element_ripple_end (GESTimelineElement * self, GstClockTime end)
g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE);
/* FIXME: why are we calling a vmethod to ripple_end, when
* ges_timeline_element_edit() with a GESEditMode of RIPPLE does not do
* so? */
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
if (klass->ripple_end) {
if (klass->ripple_end)
return klass->ripple_end (self, end);
}
GST_WARNING_OBJECT (self, "No ripple virtual method implementation"
" on class %s. Can not ripple end to %" GST_TIME_FORMAT,
G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (end));
return FALSE;
return ges_timeline_element_edit (self, NULL, -1, GES_EDIT_MODE_RIPPLE,
GES_EDGE_END, end);
}
/**
@ -1501,15 +1478,8 @@ ges_timeline_element_ripple_end (GESTimelineElement * self, GstClockTime end)
* @start: The new start time of @self in roll mode
*
* Edits the start time of an element within its timeline in roll mode.
* The element is trimmed to @start, and any other element whose end edge
* matched the start edge of the element is also trimmed to @start (see
* #GES_EDIT_MODE_ROLL). An edit may fail if it would place an in-point
* time or duration time out of bounds, or if it would place the timeline
* in an unsupported configuration.
*
* Note that if the element's timeline has a
* #GESTimeline:snapping-distance set, then the start time may be set
* to the edge of some element in the neighbourhood of @start.
* See ges_timeline_element_edit() with #GES_EDIT_MODE_ROLL and
* #GES_EDGE_START.
*
* Returns: %TRUE if the roll edit of @self completed, %FALSE on failure.
*/
@ -1520,20 +1490,13 @@ ges_timeline_element_roll_start (GESTimelineElement * self, GstClockTime start)
g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE);
/* FIXME: why are we calling a vmethod to roll_start, when
* ges_timeline_element_edit() with a GESEditMode of ROLL does not do
* so? */
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
if (klass->roll_start) {
if (klass->roll_start)
return klass->roll_start (self, start);
}
GST_WARNING_OBJECT (self, "No ripple virtual method implementation"
" on class %s. Can not roll to %" GST_TIME_FORMAT,
G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start));
return FALSE;
return ges_timeline_element_edit (self, NULL, -1, GES_EDIT_MODE_ROLL,
GES_EDGE_START, start);
}
/**
@ -1542,15 +1505,8 @@ ges_timeline_element_roll_start (GESTimelineElement * self, GstClockTime start)
* @end: The new end time of @self in roll mode
*
* Edits the end time of an element within its timeline in roll mode.
* The end of the element is trimmed to @end, and any other element whose
* start edge matched the end edge of the element is also trimmed to @end
* (see #GES_EDIT_MODE_ROLL). An edit may fail if it would place an
* in-point time or duration time out of bounds, or if it would place the
* timeline in an unsupported configuration.
*
* Note that if the element's timeline has a
* #GESTimeline:snapping-distance set, then the end time may be set
* to the edge of some element in the neighbourhood of @end.
* See ges_timeline_element_edit() with #GES_EDIT_MODE_ROLL and
* #GES_EDGE_END.
*
* Returns: %TRUE if the roll edit of @self completed, %FALSE on failure.
*/
@ -1561,19 +1517,13 @@ ges_timeline_element_roll_end (GESTimelineElement * self, GstClockTime end)
g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE);
/* FIXME: why are we calling a vmethod to roll_end, when
* ges_timeline_element_edit() with a GESEditMode of ROLL does not do
* so? */
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
if (klass->roll_end)
return klass->roll_end (self, end);
GST_WARNING_OBJECT (self, "No ripple virtual method implementation"
" on class %s. Can not roll end to %" GST_TIME_FORMAT,
G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (end));
return FALSE;
return ges_timeline_element_edit (self, NULL, -1, GES_EDIT_MODE_ROLL,
GES_EDGE_END, end);
}
/**
@ -1582,15 +1532,8 @@ ges_timeline_element_roll_end (GESTimelineElement * self, GstClockTime end)
* @start: The new start time of @self in trim mode
*
* Edits the start time of an element within its timeline in trim mode.
* The element is shifted to @start, and its in-point time is similarly
* shifted to ensure that its internal content will appear at the same
* timeline time when it is played (see #GES_EDIT_MODE_TRIM). An edit may
* fail if it would place the in-point time out of bounds, or if it would
* place the timeline in an unsupported configuration.
*
* Note that if the element's timeline has a
* #GESTimeline:snapping-distance set, then the start time may be set
* to the edge of some element in the neighbourhood of @start.
* See ges_timeline_element_edit() with #GES_EDIT_MODE_TRIM and
* #GES_EDGE_START.
*
* Returns: %TRUE if the trim edit of @self completed, %FALSE on failure.
*/
@ -1601,19 +1544,13 @@ ges_timeline_element_trim (GESTimelineElement * self, GstClockTime start)
g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE);
/* FIXME: why are we calling a vmethod to trim, when
* ges_timeline_element_edit() with a GESEditMode of TRIM does not do
* so? */
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
if (klass->trim)
return klass->trim (self, start);
GST_WARNING_OBJECT (self, "No ripple virtual method implementation"
" on class %s. Can not trim to %" GST_TIME_FORMAT,
G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start));
return FALSE;
return ges_timeline_element_edit (self, NULL, -1, GES_EDIT_MODE_TRIM,
GES_EDGE_START, start);
}
/**

View file

@ -192,11 +192,17 @@ struct _GESTimelineElement
* element in response to what the new value will be. A return of %FALSE
* means that the property should not be set.
* @set_priority: Method called just before the
* #GESTimelineElement:in-point is set.
* @ripple_end: Method to ripple an object on its #GES_EDGE_END edge.
* @roll_start: Method to roll an object on its #GES_EDGE_START edge.
* @roll_end: Method to roll an object on its #GES_EDGE_END edge.
* @trim: Method to trim an object.
* #GESTimelineElement:priority is set.
* @ripple: Set this method to overwrite a redirect to
* ges_timeline_element_edit() in ges_timeline_element_ripple().
* @ripple_end: Set this method to overwrite a redirect to
* ges_timeline_element_edit() in ges_timeline_element_ripple_end().
* @roll: Set this method to overwrite a redirect to
* ges_timeline_element_edit() in ges_timeline_element_roll().
* @roll_end: Set this method to overwrite a redirect to
* ges_timeline_element_edit() in ges_timeline_element_roll_end().
* @trim: Set this method to overwrite a redirect to
* ges_timeline_element_edit() in ges_timeline_element_trim().
* @deep_copy: Prepare @copy for pasting as a copy of @self. At least by
* copying the children properties of @self into @copy.
* @paste: Paste @self, which is the @copy prepared by @deep_copy, into