TrackVideoTransition: Avoid switching from crossfade to other types

This now exposes a bug in the TimelineTransition, since it will have
a transition type different from its track objects.
This commit is contained in:
Edward Hervey 2010-07-06 18:54:33 +02:00
parent f3c0d88e79
commit 9fa220c0c0
2 changed files with 32 additions and 16 deletions

View file

@ -322,12 +322,14 @@ void
ges_track_video_transition_set_type (GESTrackVideoTransition * self,
GESVideoTransitionType type)
{
if (((type == GES_VIDEO_TRANSITION_TYPE_CROSSFADE)
&& (self->type != GES_VIDEO_TRANSITION_TYPE_CROSSFADE))
|| ((type != GES_VIDEO_TRANSITION_TYPE_CROSSFADE)
&& (self->type = GES_VIDEO_TRANSITION_TYPE_CROSSFADE))) {
GST_DEBUG ("%p %d => %d", self, self->type, type);
if (self->type && (self->type != type) &&
((type == GES_VIDEO_TRANSITION_TYPE_CROSSFADE) ||
(self->type == GES_VIDEO_TRANSITION_TYPE_CROSSFADE))) {
GST_WARNING
("Changing between 'crossfade' and other types is not supported\n");
("Changing between 'crossfade' and other types is not supported");
return;
}
self->type = type;

View file

@ -128,25 +128,39 @@ GST_START_TEST (test_transition_properties)
gnl_object_check (trackobject->gnlobject, 420, 510, 120, 510, 0, TRUE);
/* test changing vtype */
g_object_set (object, "vtype", GES_VIDEO_TRANSITION_TYPE_CROSSFADE, NULL);
assert_equals_int (GES_TIMELINE_TRANSITION (object)->vtype,
GES_VIDEO_TRANSITION_TYPE_CROSSFADE);
assert_equals_int (GES_TRACK_VIDEO_TRANSITION (trackobject)->type,
GES_VIDEO_TRANSITION_TYPE_CROSSFADE);
g_object_set (object, "vtype", 1, NULL);
assert_equals_int (GES_TIMELINE_TRANSITION (object)->vtype, 1);
assert_equals_int (GES_TRACK_VIDEO_TRANSITION (trackobject)->type, 1);
g_object_set (object, "vtype", 8, NULL);
assert_equals_int (GES_TIMELINE_TRANSITION (object)->vtype, 8);
assert_equals_int (GES_TRACK_VIDEO_TRANSITION (trackobject)->type, 8);
GST_DEBUG ("Setting to crossfade");
g_object_set (object, "vtype", GES_VIDEO_TRANSITION_TYPE_CROSSFADE, NULL);
assert_equals_int (GES_TIMELINE_TRANSITION (object)->vtype,
GES_VIDEO_TRANSITION_TYPE_CROSSFADE);
assert_equals_int (GES_TRACK_VIDEO_TRANSITION (trackobject)->type,
GES_VIDEO_TRANSITION_TYPE_CROSSFADE);
/* Check that changing from crossfade to anything else fails (it should
* still be using crossfade */
GST_DEBUG ("Setting back to 1 (should fail)");
g_object_set (object, "vtype", 1, NULL);
/* FIXME : This should succeed */
assert_equals_int (GES_TIMELINE_TRANSITION (object)->vtype,
GES_VIDEO_TRANSITION_TYPE_CROSSFADE);
assert_equals_int (GES_TRACK_VIDEO_TRANSITION (trackobject)->type,
GES_VIDEO_TRANSITION_TYPE_CROSSFADE);
GST_DEBUG ("Releasing track object");
ges_timeline_object_release_track_object (object, trackobject);
g_object_set (object, "vtype", 1, NULL);
GST_DEBUG ("creating track object");
trackobject = ges_timeline_object_create_track_object (object, track);
fail_unless (trackobject != NULL);
fail_unless (ges_track_object_set_track (trackobject, track));
/* The new track object should have taken the previously set transition
* type (in this case 1) */
GST_DEBUG ("Setting to vtype:1");
assert_equals_int (GES_TRACK_VIDEO_TRANSITION (trackobject)->type, 1);
assert_equals_int (GES_TIMELINE_TRANSITION (object)->vtype, 1);
g_object_unref (object);
g_object_unref (track);
}