mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
timeline: emit snapping-started with new valid time
Only emit snapping-ended if we have a valid snap time. Moreover, we should emit a new snapping-started even if we are snapping at the same location. This is because a new snap will always correspond to a new edit, possibly involving different snapping elements, which a user would want to know about. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
This commit is contained in:
parent
39097f5574
commit
cda1cfa0df
2 changed files with 14 additions and 17 deletions
|
@ -1048,15 +1048,10 @@ ges_timeline_emit_snapping (GESTimeline * timeline, GESTrackElement * elem1,
|
|||
|
||||
g_assert (elem1 != elem2);
|
||||
|
||||
if (last_snap_ts != snap_time) {
|
||||
if (GST_CLOCK_TIME_IS_VALID (last_snap_ts))
|
||||
g_signal_emit (timeline, ges_timeline_signals[SNAPING_ENDED], 0,
|
||||
priv->last_snaped1, priv->last_snaped2, (last_snap_ts));
|
||||
|
||||
/* We want the snap start signal to be emited anyway */
|
||||
timeline->priv->last_snap_ts = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
||||
if (!GST_CLOCK_TIME_IS_VALID (timeline->priv->last_snap_ts)) {
|
||||
priv->last_snaped1 = elem1;
|
||||
priv->last_snaped2 = elem2;
|
||||
timeline->priv->last_snap_ts = snap_time;
|
||||
|
@ -1064,8 +1059,6 @@ ges_timeline_emit_snapping (GESTimeline * timeline, GESTrackElement * elem1,
|
|||
elem1, elem2, snap_time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Accept @self == NULL, making it use default framerate */
|
||||
void
|
||||
timeline_get_framerate (GESTimeline * self, gint * fps_n, gint * fps_d)
|
||||
|
|
|
@ -366,6 +366,7 @@ class TestEditing(common.GESSimpleTimelineTest):
|
|||
]
|
||||
])
|
||||
|
||||
# snap to 20
|
||||
clip.props.start = 18
|
||||
self.assertTimelineTopology([
|
||||
[ # Unique layer
|
||||
|
@ -375,6 +376,7 @@ class TestEditing(common.GESSimpleTimelineTest):
|
|||
])
|
||||
self.assertEqual(self.snapped_at, [20])
|
||||
|
||||
# no snapping
|
||||
clip.props.start = 30
|
||||
self.assertTimelineTopology([
|
||||
[ # Unique layer
|
||||
|
@ -384,6 +386,7 @@ class TestEditing(common.GESSimpleTimelineTest):
|
|||
])
|
||||
self.assertEqual(self.snapped_at, [20, Gst.CLOCK_TIME_NONE])
|
||||
|
||||
# snap to 20
|
||||
clip.props.start = 18
|
||||
self.assertTimelineTopology([
|
||||
[ # Unique layer
|
||||
|
@ -391,8 +394,8 @@ class TestEditing(common.GESSimpleTimelineTest):
|
|||
(GES.TestClip, 20, 10),
|
||||
]
|
||||
])
|
||||
self.assertEqual(self.snapped_at, [20, Gst.CLOCK_TIME_NONE,
|
||||
Gst.CLOCK_TIME_NONE, 20])
|
||||
self.assertEqual(self.snapped_at, [20, Gst.CLOCK_TIME_NONE, 20])
|
||||
# snap to 20 again
|
||||
clip.props.start = 19
|
||||
self.assertTimelineTopology([
|
||||
[ # Unique layer
|
||||
|
@ -400,8 +403,9 @@ class TestEditing(common.GESSimpleTimelineTest):
|
|||
(GES.TestClip, 20, 10),
|
||||
]
|
||||
])
|
||||
self.assertEqual(self.snapped_at, [20, Gst.CLOCK_TIME_NONE,
|
||||
Gst.CLOCK_TIME_NONE, 20])
|
||||
self.assertEqual(
|
||||
self.snapped_at,
|
||||
[20, Gst.CLOCK_TIME_NONE, 20, Gst.CLOCK_TIME_NONE, 20])
|
||||
|
||||
def test_rippling_snaps(self):
|
||||
self.timeline.props.auto_transition = True
|
||||
|
|
Loading…
Reference in a new issue