mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
timeline-element: make max-duration cap in-point
Do not allow the in-point to exceed the max-duration of any timeline element.
This commit is contained in:
parent
d03e0fa8c5
commit
658e64432d
5 changed files with 230 additions and 34 deletions
|
@ -292,8 +292,39 @@ _set_start (GESTimelineElement * element, GstClockTime start)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Whether @clip can have its in-point set to @inpoint because none of
|
||||
* its children have a max-duration below it */
|
||||
gboolean
|
||||
ges_clip_can_set_inpoint_of_child (GESClip * clip, GESTimelineElement * child,
|
||||
GstClockTime inpoint)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
/* don't bother checking if we are setting the value */
|
||||
if (clip->priv->setting_inpoint)
|
||||
return TRUE;
|
||||
|
||||
/* non-core children do not effect our in-point */
|
||||
if (!ELEMENT_FLAG_IS_SET (child, GES_TRACK_ELEMENT_IS_CORE))
|
||||
return TRUE;
|
||||
|
||||
for (tmp = GES_CONTAINER_CHILDREN (clip); tmp; tmp = tmp->next) {
|
||||
GESTimelineElement *child = tmp->data;
|
||||
|
||||
if (ELEMENT_FLAG_IS_SET (child, GES_TRACK_ELEMENT_IS_CORE)
|
||||
&& ges_track_element_has_internal_source (GES_TRACK_ELEMENT (child))) {
|
||||
if (GST_CLOCK_TIME_IS_VALID (child->maxduration)
|
||||
&& child->maxduration < inpoint)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* returns TRUE if we did not break early */
|
||||
static gboolean
|
||||
_set_inpoint (GESTimelineElement * element, GstClockTime inpoint)
|
||||
_set_childrens_inpoint (GESTimelineElement * element, GstClockTime inpoint,
|
||||
gboolean break_on_failure)
|
||||
{
|
||||
GList *tmp;
|
||||
GESClipPrivate *priv = GES_CLIP (element)->priv;
|
||||
|
@ -303,14 +334,31 @@ _set_inpoint (GESTimelineElement * element, GstClockTime inpoint)
|
|||
GESTimelineElement *child = tmp->data;
|
||||
|
||||
if (ELEMENT_FLAG_IS_SET (child, GES_TRACK_ELEMENT_IS_CORE)
|
||||
&& ges_track_element_has_internal_source (GES_TRACK_ELEMENT (child)))
|
||||
_set_inpoint0 (child, inpoint);
|
||||
&& ges_track_element_has_internal_source (GES_TRACK_ELEMENT (child))) {
|
||||
if (!_set_inpoint0 (child, inpoint)) {
|
||||
GST_ERROR_OBJECT ("Could not set the in-point of child %"
|
||||
GES_FORMAT " to %" GST_TIME_FORMAT, GES_ARGS (child),
|
||||
GST_TIME_ARGS (inpoint));
|
||||
if (break_on_failure)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
priv->setting_inpoint = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_set_inpoint (GESTimelineElement * element, GstClockTime inpoint)
|
||||
{
|
||||
if (!_set_childrens_inpoint (element, inpoint, TRUE)) {
|
||||
_set_childrens_inpoint (element, element->inpoint, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_set_duration (GESTimelineElement * element, GstClockTime duration)
|
||||
{
|
||||
|
@ -355,7 +403,11 @@ _set_max_duration (GESTimelineElement * element, GstClockTime maxduration)
|
|||
|
||||
if (ELEMENT_FLAG_IS_SET (child, GES_TRACK_ELEMENT_IS_CORE)
|
||||
&& ges_track_element_has_internal_source (GES_TRACK_ELEMENT (child))) {
|
||||
ges_timeline_element_set_max_duration (child, maxduration);
|
||||
if (!ges_timeline_element_set_max_duration (child, maxduration)) {
|
||||
GST_ERROR_OBJECT ("Could not set the max-duration of child %"
|
||||
GES_FORMAT " to %" GST_TIME_FORMAT, GES_ARGS (child),
|
||||
GST_TIME_ARGS (maxduration));
|
||||
}
|
||||
if (GST_CLOCK_TIME_IS_VALID (child->maxduration)) {
|
||||
new_min = GST_CLOCK_TIME_IS_VALID (new_min) ?
|
||||
MIN (new_min, child->maxduration) : child->maxduration;
|
||||
|
@ -504,13 +556,22 @@ _add_child (GESContainer * container, GESTimelineElement * element)
|
|||
* other core clip. In particular, they are *not* added to the list of
|
||||
* added effects, so we don not increase nb_effects. */
|
||||
|
||||
/* Always add at the same priority, on top of existing effects */
|
||||
_set_priority0 (element, min_prio + priv->nb_effects);
|
||||
|
||||
/* Set the core element to have the same in-point, which we don't
|
||||
* apply to effects */
|
||||
if (ges_track_element_has_internal_source (GES_TRACK_ELEMENT (element)))
|
||||
_set_inpoint0 (element, _INPOINT (container));
|
||||
if (ges_track_element_has_internal_source (GES_TRACK_ELEMENT (element))) {
|
||||
/* adding can fail if the max-duration of the element is smaller
|
||||
* than the current in-point of the clip */
|
||||
if (!_set_inpoint0 (element, _INPOINT (container))) {
|
||||
GST_ERROR_OBJECT (element, "Could not set the in-point of the "
|
||||
"element %" GES_FORMAT " to %" GST_TIME_FORMAT ". Not adding "
|
||||
"as a child", GES_ARGS (element),
|
||||
GST_TIME_ARGS (_INPOINT (container)));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Always add at the same priority, on top of existing effects */
|
||||
_set_priority0 (element, min_prio + priv->nb_effects);
|
||||
} else if (GES_CLIP_CLASS_CAN_ADD_EFFECTS (klass)
|
||||
&& GES_IS_BASE_EFFECT (element)) {
|
||||
GList *tmp;
|
||||
|
|
|
@ -394,6 +394,7 @@ G_GNUC_INTERNAL gboolean ges_clip_is_moving_from_layer (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);
|
||||
G_GNUC_INTERNAL gboolean ges_clip_can_set_inpoint_of_child (GESClip * clip, GESTimelineElement * child, GstClockTime inpoint);
|
||||
|
||||
/****************************************************
|
||||
* GESLayer *
|
||||
|
|
|
@ -453,6 +453,11 @@ ges_timeline_element_class_init (GESTimelineElementClass * klass)
|
|||
* difference in nanoseconds using the time coordinates of the internal
|
||||
* content).
|
||||
*
|
||||
* This will act as a cap on the #GESTimelineElement:in-point of the
|
||||
* element (which is in the same time coordinates), and will sometimes
|
||||
* be used to limit the #GESTimelineElement:duration of the element in
|
||||
* the timeline.
|
||||
*
|
||||
* For example, for a #GESVideoUriSource that references some media
|
||||
* file, this would be the length of the media file.
|
||||
*
|
||||
|
@ -1098,9 +1103,9 @@ ges_timeline_element_set_start (GESTimelineElement * self, GstClockTime start)
|
|||
* @self: A #GESTimelineElement
|
||||
* @inpoint: The in-point, in internal time coordinates
|
||||
*
|
||||
* Sets #GESTimelineElement:in-point for the element. This may fail if
|
||||
* the element does not have enough internal content to last for the
|
||||
* current #GESTimelineElement:duration after @inpoint.
|
||||
* Sets #GESTimelineElement:in-point for the element. If the new in-point
|
||||
* is above the current #GESTimelineElement:max-duration of the element,
|
||||
* this method will fail.
|
||||
*
|
||||
* Returns: %TRUE if @inpoint could be set for @self.
|
||||
*/
|
||||
|
@ -1119,6 +1124,14 @@ ges_timeline_element_set_inpoint (GESTimelineElement * self,
|
|||
if (G_UNLIKELY (inpoint == self->inpoint))
|
||||
return TRUE;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (self->maxduration)
|
||||
&& inpoint > self->maxduration) {
|
||||
GST_WARNING_OBJECT (self, "Can not set an in-point of %" GST_TIME_FORMAT
|
||||
" because it exceeds the element's max-duration: %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (inpoint), GST_TIME_ARGS (self->maxduration));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
|
||||
|
||||
if (klass->set_inpoint) {
|
||||
|
@ -1147,7 +1160,9 @@ ges_timeline_element_set_inpoint (GESTimelineElement * self,
|
|||
* @self: A #GESTimelineElement
|
||||
* @maxduration: The maximum duration, in internal time coordinates
|
||||
*
|
||||
* Sets #GESTimelineElement:max-duration for the element.
|
||||
* Sets #GESTimelineElement:max-duration for the element. If the new
|
||||
* maximum duration is below the current #GESTimelineElement:in-point of
|
||||
* the element, this method will fail.
|
||||
*
|
||||
* Returns: %TRUE if @maxduration could be set for @self.
|
||||
*/
|
||||
|
@ -1166,6 +1181,14 @@ ges_timeline_element_set_max_duration (GESTimelineElement * self,
|
|||
if (G_UNLIKELY (maxduration == self->maxduration))
|
||||
return TRUE;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (maxduration) && self->inpoint > maxduration) {
|
||||
GST_WARNING_OBJECT (self, "Can not set a max-duration of %"
|
||||
GST_TIME_FORMAT " because it lies below the element's in-point: %"
|
||||
GST_TIME_FORMAT, GST_TIME_ARGS (maxduration),
|
||||
GST_TIME_ARGS (self->inpoint));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
klass = GES_TIMELINE_ELEMENT_GET_CLASS (self);
|
||||
|
||||
if (klass->set_max_duration) {
|
||||
|
|
|
@ -600,6 +600,16 @@ _set_inpoint (GESTimelineElement * element, GstClockTime inpoint)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (GES_IS_CLIP (element->parent)
|
||||
&& !ges_clip_can_set_inpoint_of_child (GES_CLIP (element->parent),
|
||||
element, inpoint)) {
|
||||
GST_WARNING_OBJECT (element, "Can not set an in-point of %"
|
||||
GST_TIME_FORMAT " because the parent clip %" GES_FORMAT
|
||||
" would not be able to follow",
|
||||
GST_TIME_ARGS (inpoint), GES_ARGS (element->parent));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_object_set (object->priv->nleobject, "inpoint", inpoint, NULL);
|
||||
_update_control_bindings (element, inpoint, GST_CLOCK_TIME_NONE);
|
||||
|
||||
|
|
|
@ -1121,7 +1121,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
TRUE);
|
||||
fail_unless (ges_timeline_element_set_start (effect, 104));
|
||||
fail_unless (ges_timeline_element_set_duration (effect, 53));
|
||||
fail_unless (ges_timeline_element_set_max_duration (effect, 1));
|
||||
fail_unless (ges_timeline_element_set_max_duration (effect, 400));
|
||||
|
||||
/* adding the effect will change its start and duration, but not its
|
||||
* max-duration (or in-point) */
|
||||
|
@ -1130,7 +1130,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, max_duration);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, max_duration);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, max_duration);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* when setting max_duration of core children, clip will take the
|
||||
* minimum value */
|
||||
|
@ -1139,36 +1139,137 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max - 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, max_duration);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_unless (ges_timeline_element_set_max_duration (child1, new_max - 2));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max - 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_unless (ges_timeline_element_set_max_duration (child0, new_max + 1));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* can not set in-point above max_duration, nor max_duration below
|
||||
* in-point */
|
||||
|
||||
fail_if (ges_timeline_element_set_max_duration (child0, 29));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_if (ges_timeline_element_set_max_duration (child1, 29));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_if (ges_timeline_element_set_max_duration (clip, 29));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* can't set the inpoint to (new_max), even though it is lower than
|
||||
* our own max-duration (new_max + 1) because it is too high for our
|
||||
* sibling child1 */
|
||||
fail_if (ges_timeline_element_set_inpoint (child0, new_max));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_if (ges_timeline_element_set_inpoint (child1, new_max));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_if (ges_timeline_element_set_inpoint (clip, new_max));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* setting below new_max is ok */
|
||||
fail_unless (ges_timeline_element_set_inpoint (child0, 15));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 15, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 15, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 15, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_unless (ges_timeline_element_set_inpoint (child1, 25));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 25, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 25, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 25, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_unless (ges_timeline_element_set_inpoint (clip, 30));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* non-core has no effect */
|
||||
fail_unless (ges_timeline_element_set_max_duration (effect, new_max - 4));
|
||||
fail_unless (ges_timeline_element_set_max_duration (effect, new_max + 500));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, new_max - 4);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, new_max + 500);
|
||||
|
||||
fail_unless (ges_timeline_element_set_max_duration (effect, 1));
|
||||
/* can set the in-point of non-core to be higher than the max_duration
|
||||
* of the clip */
|
||||
fail_unless (ges_timeline_element_set_inpoint (effect, new_max + 2));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, new_max + 2, 20, new_max + 500);
|
||||
|
||||
/* but not higher than our own */
|
||||
fail_if (ges_timeline_element_set_inpoint (effect, new_max + 501));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, new_max + 2, 20, new_max + 500);
|
||||
|
||||
fail_if (ges_timeline_element_set_max_duration (effect, new_max + 1));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, new_max + 2, 20, new_max + 500);
|
||||
|
||||
fail_unless (ges_timeline_element_set_inpoint (effect, 0));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, new_max + 500);
|
||||
|
||||
fail_unless (ges_timeline_element_set_max_duration (effect, 400));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, new_max + 1);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, new_max - 2);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* setting on the clip will set all the core children to the same
|
||||
* value */
|
||||
|
@ -1177,7 +1278,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 180);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, 180);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, 180);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* register child0 as having no internal source, which means its
|
||||
* in-point will be set to 0 and max-duration set to
|
||||
|
@ -1188,7 +1289,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 180);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, 180);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* should not be able to set the max-duration to a valid time */
|
||||
fail_if (ges_timeline_element_set_max_duration (child0, 40));
|
||||
|
@ -1196,7 +1297,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 180);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, 180);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* same with child1 */
|
||||
/* clock time of the clip should now be GST_CLOCK_TIME_NONE */
|
||||
|
@ -1206,7 +1307,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* should not be able to set the max of the clip to anything else
|
||||
* when it has no core children with an internal source */
|
||||
|
@ -1215,7 +1316,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* setting back to having an internal source will not immediately
|
||||
* change the max-duration (unlike in-point) */
|
||||
|
@ -1225,7 +1326,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* can now set the max-duration, which will effect the clip */
|
||||
fail_unless (ges_timeline_element_set_max_duration (child0, 140));
|
||||
|
@ -1233,7 +1334,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 0, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
ges_track_element_set_has_internal_source (GES_TRACK_ELEMENT (child1),
|
||||
TRUE);
|
||||
|
@ -1241,14 +1342,14 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_unless (ges_timeline_element_set_max_duration (child1, 130));
|
||||
|
||||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 130);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, 130);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* removing a child may change the max_duration of the clip */
|
||||
gst_object_ref (child0);
|
||||
|
@ -1261,7 +1362,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 130);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, 130);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* new minimum max-duration for the clip when we remove child1 */
|
||||
fail_unless (ges_container_remove (GES_CONTAINER (clip), child1));
|
||||
|
@ -1269,7 +1370,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, 130);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
/* with no core-children, the max-duration of the clip is set to
|
||||
* GST_CLOCK_TIME_NONE */
|
||||
|
@ -1278,7 +1379,7 @@ GST_START_TEST (test_children_max_duration)
|
|||
CHECK_OBJECT_PROPS_MAX (clip, 5, 30, 20, GST_CLOCK_TIME_NONE);
|
||||
CHECK_OBJECT_PROPS_MAX (child0, 5, 30, 20, 140);
|
||||
CHECK_OBJECT_PROPS_MAX (child1, 5, 30, 20, 130);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 1);
|
||||
CHECK_OBJECT_PROPS_MAX (effect, 5, 0, 20, 400);
|
||||
|
||||
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (clip)));
|
||||
|
||||
|
|
Loading…
Reference in a new issue