mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
timeline-element: make start and duration EXPLICIT_NOTIFY
The properties will only have their signal emitted when they change in value, even when g_object_set, etc, methods are used. The _set_start method already did this, but start was missing the EXPLICIT_NOTIFY flag. There should be no need to check that the property has changed in ->set_start or ->set_duration
This commit is contained in:
parent
658e64432d
commit
eb8e429c80
3 changed files with 31 additions and 16 deletions
|
@ -409,7 +409,8 @@ ges_timeline_element_class_init (GESTimelineElementClass * klass)
|
|||
* to any source content.
|
||||
*/
|
||||
properties[PROP_START] = g_param_spec_uint64 ("start", "Start",
|
||||
"The position in the timeline", 0, G_MAXUINT64, 0, G_PARAM_READWRITE);
|
||||
"The position in the timeline", 0, G_MAXUINT64, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GESTimelineElement:in-point:
|
||||
|
@ -444,7 +445,8 @@ ges_timeline_element_class_init (GESTimelineElementClass * klass)
|
|||
*/
|
||||
properties[PROP_DURATION] =
|
||||
g_param_spec_uint64 ("duration", "Duration", "The play duration", 0,
|
||||
G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE);
|
||||
G_MAXUINT64, GST_CLOCK_TIME_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GESTimelineElement:max-duration:
|
||||
|
@ -1081,6 +1083,8 @@ ges_timeline_element_set_start (GESTimelineElement * self, GstClockTime start)
|
|||
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
|
||||
if (klass->set_start) {
|
||||
gint res = klass->set_start (self, start);
|
||||
if (res == FALSE)
|
||||
return FALSE;
|
||||
if (res == TRUE && emit_notify) {
|
||||
self->start = start;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_START]);
|
||||
|
@ -1089,7 +1093,7 @@ ges_timeline_element_set_start (GESTimelineElement * self, GstClockTime start)
|
|||
GST_DEBUG_OBJECT (self, "New start: %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GES_TIMELINE_ELEMENT_START (self)));
|
||||
|
||||
return ! !res;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_WARNING_OBJECT (self, "No set_start virtual method implementation"
|
||||
|
@ -1236,6 +1240,9 @@ ges_timeline_element_set_duration (GESTimelineElement * self,
|
|||
|
||||
g_return_val_if_fail (GES_IS_TIMELINE_ELEMENT (self), FALSE);
|
||||
|
||||
if (duration == self->duration)
|
||||
return TRUE;
|
||||
|
||||
toplevel = ges_timeline_element_get_toplevel_parent (self);
|
||||
if (self->timeline &&
|
||||
!ELEMENT_FLAG_IS_SET (self, GES_TIMELINE_ELEMENT_SET_SIMPLE) &&
|
||||
|
@ -1264,12 +1271,14 @@ ges_timeline_element_set_duration (GESTimelineElement * self,
|
|||
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
|
||||
if (klass->set_duration) {
|
||||
gint res = klass->set_duration (self, duration);
|
||||
if (res == FALSE)
|
||||
return FALSE;
|
||||
if (res == TRUE && emit_notify) {
|
||||
self->duration = duration;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DURATION]);
|
||||
}
|
||||
|
||||
return ! !res;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_WARNING_OBJECT (self, "No set_duration virtual method implementation"
|
||||
|
|
|
@ -168,12 +168,24 @@ struct _GESTimelineElement
|
|||
* @set_parent: Method called just before the #GESTimelineElement:parent
|
||||
* is set.
|
||||
* @set_start: Method called just before the #GESTimelineElement:start is
|
||||
* set. A return of -1 means that the subclass handled emitting the notify
|
||||
* signal and the base class should return %TRUE.
|
||||
* @set_duration: Method called just before the
|
||||
* #GESTimelineElement:duration is set. A return of -1 means that the
|
||||
* subclass handled emitting the notify signal and the base class should
|
||||
* return %TRUE.
|
||||
* set. This method should check whether the #GESTimelineElement:start can
|
||||
* be changed to the new value and to otherwise prepare the element in
|
||||
* response to what the new value will be. A return of %FALSE means that
|
||||
* the property should not be set. A return of %TRUE means that the
|
||||
* property should be set to the value given to the setter and a notify
|
||||
* emitted. A return of -1 means that the property should not be set but
|
||||
* the setter should still return %TRUE (normally because the method
|
||||
* already handled setting the value, potentially to a snapped value, and
|
||||
* emitted the notify signal).
|
||||
* #GESTimelineElement:duration is set. This method should check
|
||||
* whether the #GESTimelineElement:duration can be changed to the new
|
||||
* value and to otherwise prepare the element in response to what the new
|
||||
* value will be. A return of %FALSE means that the property should not be
|
||||
* set. A return of %TRUE means that the property should be set to the
|
||||
* value given to the setter and a notify emitted. A return of -1 means
|
||||
* that the property should not be set but the setter should still return
|
||||
* %TRUE (normally because the method already handled setting the value,
|
||||
* potentially to a snapped value, and emitted the notify signal).
|
||||
* @set_inpoint: Method called just before the
|
||||
* #GESTimelineElement:in-point is set to a new value. This method should
|
||||
* not set the #GESTimelineElement:in-point itself, but should check
|
||||
|
|
|
@ -580,9 +580,6 @@ _set_start (GESTimelineElement * element, GstClockTime start)
|
|||
|
||||
g_return_val_if_fail (object->priv->nleobject, FALSE);
|
||||
|
||||
if (G_UNLIKELY (start == _START (object)))
|
||||
return -1;
|
||||
|
||||
g_object_set (object->priv->nleobject, "start", start, NULL);
|
||||
|
||||
return TRUE;
|
||||
|
@ -628,9 +625,6 @@ _set_duration (GESTimelineElement * element, GstClockTime duration)
|
|||
duration > _INPOINT (object) + _MAXDURATION (element))
|
||||
duration = _MAXDURATION (element) - _INPOINT (object);
|
||||
|
||||
if (G_UNLIKELY (duration == _DURATION (object)))
|
||||
return -1;
|
||||
|
||||
g_object_set (priv->nleobject, "duration", duration, NULL);
|
||||
|
||||
_update_control_bindings (element, ges_timeline_element_get_inpoint (element),
|
||||
|
|
Loading…
Reference in a new issue