mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
auto-transitions: Do not remove auto transitions when moving neighboor from the same group
Differential Revision: https://phabricator.freedesktop.org/D1097
This commit is contained in:
parent
96a8c6db0c
commit
716c0dbe8d
2 changed files with 47 additions and 2 deletions
|
@ -40,6 +40,23 @@ neighbour_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
|
||||||
GESAutoTransition * self)
|
GESAutoTransition * self)
|
||||||
{
|
{
|
||||||
gint64 new_duration;
|
gint64 new_duration;
|
||||||
|
GESTimelineElement *parent =
|
||||||
|
ges_timeline_element_get_toplevel_parent (GES_TIMELINE_ELEMENT (clip));
|
||||||
|
|
||||||
|
if (!g_strcmp0 (g_param_spec_get_name (arg), "priority") && parent) {
|
||||||
|
GESTimelineElement *prev_topparent =
|
||||||
|
ges_timeline_element_get_toplevel_parent (GES_TIMELINE_ELEMENT
|
||||||
|
(self->next_source));
|
||||||
|
GESTimelineElement *next_topparent =
|
||||||
|
ges_timeline_element_get_toplevel_parent (GES_TIMELINE_ELEMENT
|
||||||
|
(self->previous_source));
|
||||||
|
|
||||||
|
if (parent == prev_topparent && parent == next_topparent) {
|
||||||
|
GST_DEBUG_OBJECT (self,
|
||||||
|
"Moving all inside the same group, nothing to do");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_ges_track_element_get_layer_priority (self->next_source) !=
|
if (_ges_track_element_get_layer_priority (self->next_source) !=
|
||||||
_ges_track_element_get_layer_priority (self->previous_source)) {
|
_ges_track_element_get_layer_priority (self->previous_source)) {
|
||||||
|
@ -150,7 +167,7 @@ ges_auto_transition_new (GESTrackElement * transition,
|
||||||
|
|
||||||
g_signal_connect (previous_source, "notify::start",
|
g_signal_connect (previous_source, "notify::start",
|
||||||
G_CALLBACK (neighbour_changed_cb), self);
|
G_CALLBACK (neighbour_changed_cb), self);
|
||||||
g_signal_connect (previous_source, "notify::priority",
|
g_signal_connect_after (previous_source, "notify::priority",
|
||||||
G_CALLBACK (neighbour_changed_cb), self);
|
G_CALLBACK (neighbour_changed_cb), self);
|
||||||
g_signal_connect (next_source, "notify::start",
|
g_signal_connect (next_source, "notify::start",
|
||||||
G_CALLBACK (neighbour_changed_cb), self);
|
G_CALLBACK (neighbour_changed_cb), self);
|
||||||
|
|
|
@ -30,7 +30,7 @@ Gst.init(None)
|
||||||
GES.init()
|
GES.init()
|
||||||
|
|
||||||
|
|
||||||
class TestCopyPaste(unittest.TestCase):
|
class TestGroup(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.timeline = GES.Timeline.new_audio_video()
|
self.timeline = GES.Timeline.new_audio_video()
|
||||||
|
@ -121,3 +121,31 @@ class TestCopyPaste(unittest.TestCase):
|
||||||
clips = self.layer.get_clips()
|
clips = self.layer.get_clips()
|
||||||
self.assertEqual(len(clips), 3)
|
self.assertEqual(len(clips), 3)
|
||||||
self.assertEqual(clips[1].props.start, 10)
|
self.assertEqual(clips[1].props.start, 10)
|
||||||
|
|
||||||
|
def test_move_clips_between_layers_with_auto_transition(self):
|
||||||
|
self.timeline.props.auto_transition = True
|
||||||
|
layer2 = self.timeline.append_layer()
|
||||||
|
clip1 = GES.TestClip.new()
|
||||||
|
clip1.props.start = 0
|
||||||
|
clip1.props.duration = 30
|
||||||
|
|
||||||
|
clip2 = GES.TestClip.new()
|
||||||
|
clip2.props.start = 20
|
||||||
|
clip2.props.duration = 20
|
||||||
|
|
||||||
|
self.layer.add_clip(clip1)
|
||||||
|
self.layer.add_clip(clip2)
|
||||||
|
|
||||||
|
clips = self.layer.get_clips()
|
||||||
|
self.assertEqual(len(clips), 4)
|
||||||
|
self.assertEqual(layer2.get_clips(), [])
|
||||||
|
|
||||||
|
group = GES.Container.group(clips)
|
||||||
|
self.assertIsNotNone(group)
|
||||||
|
|
||||||
|
self.assertTrue(clip1.edit(
|
||||||
|
self.timeline.get_layers(), 1, GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE, 0))
|
||||||
|
self.assertEqual(self.layer.get_clips(), [])
|
||||||
|
|
||||||
|
clips = layer2.get_clips()
|
||||||
|
self.assertEqual(len(clips), 4)
|
||||||
|
|
Loading…
Reference in a new issue