mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:26:14 +00:00
title: Do not concider inpoints
It does not make sense for titles Handle element with no inpoint handling in the timeline Fixes https://phabricator.freedesktop.org/T7319
This commit is contained in:
parent
dff6df8d21
commit
7d34e33ac4
5 changed files with 31 additions and 15 deletions
|
@ -726,7 +726,7 @@ ges_timeline_element_set_inpoint (GESTimelineElement * self,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_WARNING_OBJECT (self, "No set_inpoint virtual method implementation"
|
GST_DEBUG_OBJECT (self, "No set_inpoint virtual method implementation"
|
||||||
" on class %s. Can not set inpoint %" GST_TIME_FORMAT,
|
" on class %s. Can not set inpoint %" GST_TIME_FORMAT,
|
||||||
G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (inpoint));
|
G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (inpoint));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1581,6 +1581,7 @@ ges_timeline_trim_object_simple (GESTimeline * timeline,
|
||||||
{
|
{
|
||||||
GESTimelineElement *toplevel;
|
GESTimelineElement *toplevel;
|
||||||
GESChildrenControlMode old_mode;
|
GESChildrenControlMode old_mode;
|
||||||
|
gboolean use_inpoint;
|
||||||
toplevel = ges_timeline_element_get_toplevel_parent (element);
|
toplevel = ges_timeline_element_get_toplevel_parent (element);
|
||||||
|
|
||||||
if (position < _START (toplevel) && _START (toplevel) < _START (element)) {
|
if (position < _START (toplevel) && _START (toplevel) < _START (element)) {
|
||||||
|
@ -1616,17 +1617,26 @@ ges_timeline_trim_object_simple (GESTimeline * timeline,
|
||||||
/* Calculate new values */
|
/* Calculate new values */
|
||||||
position = MIN (position, start + duration);
|
position = MIN (position, start + duration);
|
||||||
|
|
||||||
if (inpoint + position < start) {
|
use_inpoint =
|
||||||
GST_INFO_OBJECT (timeline, "Track element %s inpoint would be negative,"
|
GES_TIMELINE_ELEMENT_GET_CLASS (track_element)->set_inpoint ? TRUE :
|
||||||
" not trimming", GES_TIMELINE_ELEMENT_NAME (track_element));
|
FALSE;
|
||||||
|
|
||||||
|
if (use_inpoint && inpoint + position < start) {
|
||||||
|
GST_ERROR_OBJECT (timeline, "Track element %s inpoint %" GST_TIME_FORMAT
|
||||||
|
" would be negative,"
|
||||||
|
" not trimming", GES_TIMELINE_ELEMENT_NAME (track_element),
|
||||||
|
GST_TIME_ARGS (inpoint));
|
||||||
gst_object_unref (toplevel);
|
gst_object_unref (toplevel);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inpoint = inpoint + position - start;
|
inpoint = inpoint + position - start;
|
||||||
real_dur = _END (element) - position;
|
real_dur = _END (element) - position;
|
||||||
duration = CLAMP (real_dur, 0, max_duration > inpoint ?
|
if (use_inpoint)
|
||||||
max_duration - inpoint : G_MAXUINT64);
|
duration = CLAMP (real_dur, 0, max_duration > inpoint ?
|
||||||
|
max_duration - inpoint : G_MAXUINT64);
|
||||||
|
else
|
||||||
|
duration = real_dur;
|
||||||
|
|
||||||
|
|
||||||
/* If we already are at max duration or duration == 0 do no useless work */
|
/* If we already are at max duration or duration == 0 do no useless work */
|
||||||
|
|
|
@ -144,7 +144,9 @@ static void
|
||||||
ges_title_clip_class_init (GESTitleClipClass * klass)
|
ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GESClipClass *timobj_class = GES_CLIP_CLASS (klass);
|
GESTimelineElementClass *timeline_element_class =
|
||||||
|
GES_TIMELINE_ELEMENT_CLASS (klass);
|
||||||
|
GESClipClass *clip_class = GES_CLIP_CLASS (klass);
|
||||||
GESContainerClass *container_class = GES_CONTAINER_CLASS (klass);
|
GESContainerClass *container_class = GES_CONTAINER_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESTitleClipPrivate));
|
g_type_class_add_private (klass, sizeof (GESTitleClipPrivate));
|
||||||
|
@ -211,7 +213,8 @@ ges_title_clip_class_init (GESTitleClipClass * klass)
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS |
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS |
|
||||||
GES_PARAM_NO_SERIALIZATION));
|
GES_PARAM_NO_SERIALIZATION));
|
||||||
|
|
||||||
timobj_class->create_track_element = ges_title_clip_create_track_element;
|
clip_class->create_track_element = ges_title_clip_create_track_element;
|
||||||
|
timeline_element_class->set_inpoint = NULL;
|
||||||
|
|
||||||
container_class->child_added = _child_added;
|
container_class->child_added = _child_added;
|
||||||
container_class->child_removed = _child_removed;
|
container_class->child_removed = _child_removed;
|
||||||
|
|
|
@ -157,14 +157,17 @@ ges_title_source_class_init (GESTitleSourceClass * klass)
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_CLASS (klass);
|
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_CLASS (klass);
|
||||||
GESTrackElementClass *track_element_class = GES_TRACK_ELEMENT_CLASS (klass);
|
GESTrackElementClass *track_element_class = GES_TRACK_ELEMENT_CLASS (klass);
|
||||||
|
GESTimelineElementClass *timeline_element_class =
|
||||||
|
GES_TIMELINE_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESTitleSourcePrivate));
|
g_type_class_add_private (klass, sizeof (GESTitleSourcePrivate));
|
||||||
|
|
||||||
object_class->get_property = ges_title_source_get_property;
|
object_class->get_property = ges_title_source_get_property;
|
||||||
object_class->set_property = ges_title_source_set_property;
|
object_class->set_property = ges_title_source_set_property;
|
||||||
object_class->dispose = ges_title_source_dispose;
|
object_class->dispose = ges_title_source_dispose;
|
||||||
track_element_class->lookup_child = _lookup_child;
|
|
||||||
|
|
||||||
|
timeline_element_class->set_inpoint = NULL;
|
||||||
|
track_element_class->lookup_child = _lookup_child;
|
||||||
source_class->create_source = ges_title_source_create_source;
|
source_class->create_source = ges_title_source_create_source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ GST_START_TEST (test_title_source_properties)
|
||||||
"in-point", (guint64) 12, NULL);
|
"in-point", (guint64) 12, NULL);
|
||||||
assert_equals_uint64 (_START (clip), 42);
|
assert_equals_uint64 (_START (clip), 42);
|
||||||
assert_equals_uint64 (_DURATION (clip), 51);
|
assert_equals_uint64 (_DURATION (clip), 51);
|
||||||
assert_equals_uint64 (_INPOINT (clip), 12);
|
assert_equals_uint64 (_INPOINT (clip), 0);
|
||||||
|
|
||||||
ges_layer_add_clip (layer, GES_CLIP (clip));
|
ges_layer_add_clip (layer, GES_CLIP (clip));
|
||||||
ges_timeline_commit (timeline);
|
ges_timeline_commit (timeline);
|
||||||
|
@ -77,10 +77,10 @@ GST_START_TEST (test_title_source_properties)
|
||||||
/* Check that trackelement has the same properties */
|
/* Check that trackelement has the same properties */
|
||||||
assert_equals_uint64 (_START (trackelement), 42);
|
assert_equals_uint64 (_START (trackelement), 42);
|
||||||
assert_equals_uint64 (_DURATION (trackelement), 51);
|
assert_equals_uint64 (_DURATION (trackelement), 51);
|
||||||
assert_equals_uint64 (_INPOINT (trackelement), 12);
|
assert_equals_uint64 (_INPOINT (trackelement), 0);
|
||||||
|
|
||||||
/* And let's also check that it propagated correctly to GNonLin */
|
/* And let's also check that it propagated correctly to GNonLin */
|
||||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 12,
|
nle_object_check (ges_track_element_get_nleobject (trackelement), 42, 51, 0,
|
||||||
51, MIN_NLE_PRIO, TRUE);
|
51, MIN_NLE_PRIO, TRUE);
|
||||||
|
|
||||||
/* Change more properties, see if they propagate */
|
/* Change more properties, see if they propagate */
|
||||||
|
@ -89,14 +89,14 @@ GST_START_TEST (test_title_source_properties)
|
||||||
ges_timeline_commit (timeline);
|
ges_timeline_commit (timeline);
|
||||||
assert_equals_uint64 (_START (clip), 420);
|
assert_equals_uint64 (_START (clip), 420);
|
||||||
assert_equals_uint64 (_DURATION (clip), 510);
|
assert_equals_uint64 (_DURATION (clip), 510);
|
||||||
assert_equals_uint64 (_INPOINT (clip), 120);
|
assert_equals_uint64 (_INPOINT (clip), 0);
|
||||||
assert_equals_uint64 (_START (trackelement), 420);
|
assert_equals_uint64 (_START (trackelement), 420);
|
||||||
assert_equals_uint64 (_DURATION (trackelement), 510);
|
assert_equals_uint64 (_DURATION (trackelement), 510);
|
||||||
assert_equals_uint64 (_INPOINT (trackelement), 120);
|
assert_equals_uint64 (_INPOINT (trackelement), 0);
|
||||||
|
|
||||||
/* And let's also check that it propagated correctly to GNonLin */
|
/* And let's also check that it propagated correctly to GNonLin */
|
||||||
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
nle_object_check (ges_track_element_get_nleobject (trackelement), 420, 510,
|
||||||
120, 510, MIN_NLE_PRIO + 0, TRUE);
|
0, 510, MIN_NLE_PRIO + 0, TRUE);
|
||||||
|
|
||||||
ges_container_remove (GES_CONTAINER (clip),
|
ges_container_remove (GES_CONTAINER (clip),
|
||||||
GES_TIMELINE_ELEMENT (trackelement));
|
GES_TIMELINE_ELEMENT (trackelement));
|
||||||
|
|
Loading…
Reference in a new issue