2010-11-05 11:12:24 +00:00
|
|
|
/* GStreamer Editing Services
|
|
|
|
* Copyright (C) 2010 Thibault Saunier <tsaunier@gnome.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
2011-02-01 20:22:04 +00:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
2010-11-05 11:12:24 +00:00
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:25:20 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2010-11-05 11:12:24 +00:00
|
|
|
*/
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
#include "test-utils.h"
|
2010-11-05 11:12:24 +00:00
|
|
|
#include <ges/ges.h>
|
|
|
|
#include <gst/check/gstcheck.h>
|
|
|
|
|
2011-02-08 14:29:21 +00:00
|
|
|
void
|
2013-02-15 02:34:48 +00:00
|
|
|
deep_prop_changed_cb (GESTrackElement * track_element, GstElement * element,
|
2011-02-08 14:29:21 +00:00
|
|
|
GParamSpec * spec);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
2010-11-05 11:12:24 +00:00
|
|
|
GST_START_TEST (test_effect_basic)
|
|
|
|
{
|
2013-01-26 15:40:51 +00:00
|
|
|
GESEffect *effect;
|
2010-11-05 11:12:24 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
2013-01-26 15:40:51 +00:00
|
|
|
effect = ges_effect_new ("agingtv");
|
2010-11-05 11:12:24 +00:00
|
|
|
fail_unless (effect != NULL);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (effect);
|
2010-11-15 22:32:23 +00:00
|
|
|
}
|
2010-11-05 11:12:24 +00:00
|
|
|
|
2010-11-15 22:32:23 +00:00
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
GST_START_TEST (test_add_effect_to_clip)
|
2010-11-15 22:32:23 +00:00
|
|
|
{
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
GESTrack *track_audio, *track_video;
|
2013-03-01 01:27:50 +00:00
|
|
|
GESEffect *effect;
|
2013-01-17 03:58:28 +00:00
|
|
|
GESTestClip *source;
|
2010-11-15 22:32:23 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
timeline = ges_timeline_new ();
|
|
|
|
layer = (GESTimelineLayer *) ges_simple_timeline_layer_new ();
|
|
|
|
track_audio = ges_track_audio_raw_new ();
|
|
|
|
track_video = ges_track_video_raw_new ();
|
|
|
|
|
|
|
|
ges_timeline_add_track (timeline, track_audio);
|
|
|
|
ges_timeline_add_track (timeline, track_video);
|
|
|
|
ges_timeline_add_layer (timeline, layer);
|
|
|
|
|
2013-01-17 03:58:28 +00:00
|
|
|
source = ges_test_clip_new ();
|
2010-11-15 22:32:23 +00:00
|
|
|
|
|
|
|
g_object_set (source, "duration", 10 * GST_SECOND, NULL);
|
|
|
|
|
|
|
|
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
2013-01-20 15:42:29 +00:00
|
|
|
(GESClip *) source, 0);
|
2010-11-15 22:32:23 +00:00
|
|
|
|
|
|
|
|
2011-01-18 19:05:54 +00:00
|
|
|
GST_DEBUG ("Create effect");
|
2013-03-01 01:27:50 +00:00
|
|
|
effect = ges_effect_new ("agingtv");
|
2011-01-18 19:05:54 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (GES_IS_EFFECT (effect));
|
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (source),
|
|
|
|
GES_TIMELINE_ELEMENT (effect)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect)) !=
|
|
|
|
NULL);
|
2011-01-18 19:05:54 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
assert_equals_int (GES_TRACK_ELEMENT (effect)->active, TRUE);
|
2010-11-15 22:32:23 +00:00
|
|
|
|
2013-02-08 20:25:25 +00:00
|
|
|
ges_timeline_layer_remove_clip (layer, (GESClip *) source);
|
2010-11-15 22:32:23 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (timeline);
|
2010-11-05 11:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2011-01-31 10:32:14 +00:00
|
|
|
GST_START_TEST (test_get_effects_from_tl)
|
|
|
|
{
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
GESTrack *track_video;
|
2013-03-01 01:27:50 +00:00
|
|
|
GESEffect *effect, *effect1, *effect2;
|
2013-01-17 03:58:28 +00:00
|
|
|
GESTestClip *source;
|
2011-01-31 10:32:14 +00:00
|
|
|
GList *effects, *tmp = NULL;
|
|
|
|
gint effect_prio = -1;
|
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
timeline = ges_timeline_new ();
|
|
|
|
layer = (GESTimelineLayer *) ges_simple_timeline_layer_new ();
|
|
|
|
track_video = ges_track_video_raw_new ();
|
|
|
|
|
|
|
|
ges_timeline_add_track (timeline, track_video);
|
|
|
|
ges_timeline_add_layer (timeline, layer);
|
|
|
|
|
2013-01-17 03:58:28 +00:00
|
|
|
source = ges_test_clip_new ();
|
2011-01-31 10:32:14 +00:00
|
|
|
|
|
|
|
g_object_set (source, "duration", 10 * GST_SECOND, NULL);
|
|
|
|
|
|
|
|
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
2013-01-20 15:42:29 +00:00
|
|
|
(GESClip *) source, 0);
|
2011-01-31 10:32:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
GST_DEBUG ("Create effect");
|
2013-03-01 01:27:50 +00:00
|
|
|
effect = ges_effect_new ("agingtv");
|
|
|
|
effect1 = ges_effect_new ("agingtv");
|
|
|
|
effect2 = ges_effect_new ("agingtv");
|
2011-01-31 10:32:14 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (GES_IS_EFFECT (effect));
|
|
|
|
fail_unless (GES_IS_EFFECT (effect1));
|
|
|
|
fail_unless (GES_IS_EFFECT (effect2));
|
2011-01-31 10:32:14 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (source),
|
|
|
|
GES_TIMELINE_ELEMENT (effect)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect)) ==
|
|
|
|
track_video);
|
2011-01-31 10:32:14 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (source),
|
|
|
|
GES_TIMELINE_ELEMENT (effect1)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect1)) ==
|
|
|
|
track_video);
|
2011-01-31 10:32:14 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (source),
|
|
|
|
GES_TIMELINE_ELEMENT (effect2)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect2)) ==
|
|
|
|
track_video);
|
2013-03-01 01:27:50 +00:00
|
|
|
assert_equals_int (GES_CONTAINER_HEIGHT (source), 4);
|
2011-01-31 10:32:14 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
effects = ges_clip_get_top_effects (GES_CLIP (source));
|
2011-02-16 16:45:05 +00:00
|
|
|
fail_unless (g_list_length (effects) == 3);
|
2011-01-31 10:32:14 +00:00
|
|
|
for (tmp = effects; tmp; tmp = tmp->next) {
|
2013-01-20 15:42:29 +00:00
|
|
|
gint priority = ges_clip_get_top_effect_position (GES_CLIP (source),
|
2013-01-26 15:35:19 +00:00
|
|
|
GES_BASE_EFFECT (tmp->data));
|
2011-01-31 10:32:14 +00:00
|
|
|
fail_unless (priority > effect_prio);
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (GES_IS_EFFECT (tmp->data));
|
2011-01-31 10:32:14 +00:00
|
|
|
effect_prio = priority;
|
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (tmp->data);
|
2011-01-31 10:32:14 +00:00
|
|
|
}
|
|
|
|
g_list_free (effects);
|
|
|
|
|
2013-02-08 20:25:25 +00:00
|
|
|
ges_timeline_layer_remove_clip (layer, (GESClip *) source);
|
2011-01-31 10:32:14 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (timeline);
|
2011-01-31 10:32:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
GST_START_TEST (test_effect_clip)
|
2011-02-01 20:22:04 +00:00
|
|
|
{
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
GESTrack *track_audio, *track_video;
|
2013-01-25 18:51:02 +00:00
|
|
|
GESEffectClip *effect_clip;
|
2013-03-01 01:27:50 +00:00
|
|
|
GESEffect *effect, *effect1;
|
2011-02-01 20:22:04 +00:00
|
|
|
GList *effects, *tmp;
|
2013-01-20 15:42:29 +00:00
|
|
|
gint i, clip_height;
|
2011-02-01 20:22:04 +00:00
|
|
|
gint effect_prio = -1;
|
|
|
|
/* FIXME the order of track type is not well defined */
|
2011-02-03 15:03:10 +00:00
|
|
|
guint track_type[4] = { GES_TRACK_TYPE_AUDIO,
|
|
|
|
GES_TRACK_TYPE_VIDEO, GES_TRACK_TYPE_VIDEO,
|
|
|
|
GES_TRACK_TYPE_AUDIO
|
|
|
|
};
|
2011-02-01 20:22:04 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
timeline = ges_timeline_new ();
|
|
|
|
layer = (GESTimelineLayer *) ges_simple_timeline_layer_new ();
|
|
|
|
track_audio = ges_track_audio_raw_new ();
|
|
|
|
track_video = ges_track_video_raw_new ();
|
|
|
|
|
|
|
|
ges_timeline_add_track (timeline, track_audio);
|
|
|
|
ges_timeline_add_track (timeline, track_video);
|
|
|
|
ges_timeline_add_layer (timeline, layer);
|
|
|
|
|
|
|
|
GST_DEBUG ("Create effect");
|
2013-03-14 16:53:25 +00:00
|
|
|
effect_clip = ges_effect_clip_new ("agingtv", "audiopanorama");
|
2011-02-01 20:22:04 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
g_object_set (effect_clip, "duration", 25 * GST_SECOND, NULL);
|
2011-02-01 20:22:04 +00:00
|
|
|
|
|
|
|
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
2013-01-20 15:42:29 +00:00
|
|
|
(GESClip *) effect_clip, 0);
|
2011-02-01 20:22:04 +00:00
|
|
|
|
2013-03-14 16:53:25 +00:00
|
|
|
effect = ges_effect_new ("agingtv");
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
|
|
|
|
GES_TIMELINE_ELEMENT (effect)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_if (ges_track_add_element (track_video, GES_TRACK_ELEMENT (effect)));
|
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect)) ==
|
|
|
|
track_video);
|
2011-02-03 15:03:10 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
g_object_get (effect_clip, "height", &clip_height, NULL);
|
|
|
|
assert_equals_int (clip_height, 3);
|
2011-02-03 15:03:10 +00:00
|
|
|
|
2013-03-14 16:53:25 +00:00
|
|
|
effect1 = ges_effect_new ("audiopanorama");
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
|
|
|
|
GES_TIMELINE_ELEMENT (effect1)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_if (ges_track_add_element (track_audio, GES_TRACK_ELEMENT (effect1)));
|
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect1)) ==
|
|
|
|
track_audio);
|
2011-02-03 15:03:10 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
g_object_get (effect_clip, "height", &clip_height, NULL);
|
|
|
|
assert_equals_int (clip_height, 4);
|
2011-02-01 20:22:04 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
effects = ges_clip_get_top_effects (GES_CLIP (effect_clip));
|
2011-02-01 20:22:04 +00:00
|
|
|
for (tmp = effects, i = 0; tmp; tmp = tmp->next, i++) {
|
2013-01-20 15:42:29 +00:00
|
|
|
gint priority = ges_clip_get_top_effect_position (GES_CLIP (effect_clip),
|
2013-01-26 15:35:19 +00:00
|
|
|
GES_BASE_EFFECT (tmp->data));
|
2011-02-01 20:22:04 +00:00
|
|
|
fail_unless (priority > effect_prio);
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (GES_IS_EFFECT (tmp->data));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (tmp->data))->
|
|
|
|
type == track_type[i]);
|
2011-02-04 10:44:19 +00:00
|
|
|
effect_prio = priority;
|
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (tmp->data);
|
2011-02-04 10:44:19 +00:00
|
|
|
}
|
|
|
|
g_list_free (effects);
|
|
|
|
|
2013-02-08 20:25:25 +00:00
|
|
|
ges_timeline_layer_remove_clip (layer, (GESClip *) effect_clip);
|
2011-02-04 10:44:19 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (timeline);
|
2011-02-04 10:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
GST_START_TEST (test_priorities_clip)
|
2011-02-04 10:44:19 +00:00
|
|
|
{
|
2013-03-01 01:27:50 +00:00
|
|
|
gint i;
|
|
|
|
GList *effects, *tmp;
|
2011-02-04 10:44:19 +00:00
|
|
|
GESTimeline *timeline;
|
|
|
|
GESTimelineLayer *layer;
|
2013-01-25 18:51:02 +00:00
|
|
|
GESEffectClip *effect_clip;
|
2013-03-01 01:27:50 +00:00
|
|
|
GESTrack *track_audio, *track_video;
|
|
|
|
GESEffect *effect, *effect1, *audio_effect = NULL, *video_effect = NULL;
|
|
|
|
|
2011-02-04 10:44:19 +00:00
|
|
|
gint effect_prio = -1;
|
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
timeline = ges_timeline_new ();
|
|
|
|
layer = (GESTimelineLayer *) ges_simple_timeline_layer_new ();
|
|
|
|
track_audio = ges_track_audio_raw_new ();
|
|
|
|
track_video = ges_track_video_raw_new ();
|
|
|
|
|
|
|
|
ges_timeline_add_track (timeline, track_audio);
|
|
|
|
ges_timeline_add_track (timeline, track_video);
|
|
|
|
ges_timeline_add_layer (timeline, layer);
|
|
|
|
|
|
|
|
GST_DEBUG ("Create effect");
|
2013-03-14 16:53:25 +00:00
|
|
|
effect_clip = ges_effect_clip_new ("agingtv", "audiopanorama");
|
2011-02-04 10:44:19 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
g_object_set (effect_clip, "duration", 25 * GST_SECOND, NULL);
|
2011-02-04 10:44:19 +00:00
|
|
|
|
|
|
|
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
2013-01-20 15:42:29 +00:00
|
|
|
(GESClip *) effect_clip, 0);
|
2011-02-04 10:44:19 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
for (tmp = GES_CONTAINER_CHILDREN (effect_clip); tmp; tmp = tmp->next) {
|
|
|
|
if (ges_track_element_get_track_type (GES_TRACK_ELEMENT (tmp->data)) ==
|
|
|
|
GES_TRACK_TYPE_AUDIO)
|
|
|
|
audio_effect = tmp->data;
|
|
|
|
else if (ges_track_element_get_track_type (GES_TRACK_ELEMENT (tmp->data)) ==
|
|
|
|
GES_TRACK_TYPE_VIDEO)
|
|
|
|
video_effect = tmp->data;
|
|
|
|
else
|
|
|
|
g_assert (0);
|
|
|
|
}
|
|
|
|
fail_unless (GES_IS_EFFECT (audio_effect));
|
|
|
|
fail_unless (GES_IS_EFFECT (video_effect));
|
|
|
|
|
|
|
|
/* FIXME This is ridiculus, both effects should have the same priority (0) */
|
|
|
|
assert_equals_int (_PRIORITY (audio_effect), 0);
|
|
|
|
assert_equals_int (_PRIORITY (video_effect), 1);
|
|
|
|
assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 2);
|
|
|
|
|
2013-03-14 16:53:25 +00:00
|
|
|
effect = ges_effect_new ("agingtv");
|
2013-03-01 01:27:50 +00:00
|
|
|
GST_DEBUG ("Adding effect to the effect clip %" GST_PTR_FORMAT, effect);
|
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
|
|
|
|
GES_TIMELINE_ELEMENT (effect)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_if (ges_track_add_element (track_video, GES_TRACK_ELEMENT (effect)));
|
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect)) ==
|
|
|
|
track_video);
|
2013-03-01 01:27:50 +00:00
|
|
|
assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 3);
|
|
|
|
|
2013-03-14 16:53:25 +00:00
|
|
|
effect1 = ges_effect_new ("audiopanorama");
|
2013-03-01 01:27:50 +00:00
|
|
|
GST_DEBUG ("Adding effect1 to the effect clip %" GST_PTR_FORMAT, effect1);
|
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
|
|
|
|
GES_TIMELINE_ELEMENT (effect1)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_if (ges_track_add_element (track_audio, GES_TRACK_ELEMENT (effect1)));
|
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect1)) ==
|
|
|
|
track_audio);
|
2011-02-04 10:44:19 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (ges_clip_set_top_effect_priority (GES_CLIP (effect_clip),
|
|
|
|
GES_BASE_EFFECT (effect1), 0));
|
|
|
|
assert_equals_int (_PRIORITY (effect), 3);
|
|
|
|
assert_equals_int (_PRIORITY (effect1), 0);
|
|
|
|
assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 4);
|
2011-02-04 10:44:19 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (ges_clip_set_top_effect_priority (GES_CLIP (effect_clip),
|
|
|
|
GES_BASE_EFFECT (effect1), 3));
|
|
|
|
assert_equals_int (_PRIORITY (effect), 2);
|
|
|
|
assert_equals_int (_PRIORITY (effect1), 3);
|
|
|
|
assert_equals_int (GES_CONTAINER_HEIGHT (effect_clip), 4);
|
2011-02-04 10:44:19 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
effects = ges_clip_get_top_effects (GES_CLIP (effect_clip));
|
2011-02-04 10:44:19 +00:00
|
|
|
for (tmp = effects, i = 0; tmp; tmp = tmp->next, i++) {
|
2013-01-20 15:42:29 +00:00
|
|
|
gint priority = ges_clip_get_top_effect_position (GES_CLIP (effect_clip),
|
2013-01-26 15:35:19 +00:00
|
|
|
GES_BASE_EFFECT (tmp->data));
|
2011-02-04 10:44:19 +00:00
|
|
|
fail_unless (priority > effect_prio);
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (GES_IS_EFFECT (tmp->data));
|
2011-02-01 20:22:04 +00:00
|
|
|
effect_prio = priority;
|
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (tmp->data);
|
2011-02-01 20:22:04 +00:00
|
|
|
}
|
|
|
|
g_list_free (effects);
|
|
|
|
|
2013-02-08 20:25:25 +00:00
|
|
|
ges_timeline_layer_remove_clip (layer, (GESClip *) effect_clip);
|
2011-02-01 20:22:04 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (timeline);
|
2011-02-01 20:22:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
GST_START_TEST (test_effect_set_properties)
|
2011-02-08 09:25:41 +00:00
|
|
|
{
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
GESTrack *track_video;
|
2013-01-25 18:51:02 +00:00
|
|
|
GESEffectClip *effect_clip;
|
2013-03-01 01:27:50 +00:00
|
|
|
GESTrackElement *effect;
|
2011-02-25 16:10:00 +00:00
|
|
|
guint scratch_line, n_props, i;
|
2011-02-25 11:13:03 +00:00
|
|
|
gboolean color_aging;
|
2011-02-25 16:10:00 +00:00
|
|
|
GParamSpec **pspecs, *spec;
|
|
|
|
GValue val = { 0 };
|
|
|
|
GValue nval = { 0 };
|
2011-02-08 09:25:41 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
timeline = ges_timeline_new ();
|
|
|
|
layer = (GESTimelineLayer *) ges_simple_timeline_layer_new ();
|
|
|
|
track_video = ges_track_video_raw_new ();
|
|
|
|
|
|
|
|
ges_timeline_add_track (timeline, track_video);
|
|
|
|
ges_timeline_add_layer (timeline, layer);
|
|
|
|
|
|
|
|
GST_DEBUG ("Create effect");
|
2013-01-25 18:51:02 +00:00
|
|
|
effect_clip = ges_effect_clip_new ("agingtv", NULL);
|
2011-02-08 09:25:41 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
g_object_set (effect_clip, "duration", 25 * GST_SECOND, NULL);
|
2011-02-08 09:25:41 +00:00
|
|
|
|
|
|
|
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
2013-01-20 15:42:29 +00:00
|
|
|
(GESClip *) effect_clip, 0);
|
2011-02-08 09:25:41 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
effect = GES_TRACK_ELEMENT (ges_effect_new ("agingtv"));
|
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
|
|
|
|
GES_TIMELINE_ELEMENT (effect)));
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_if (ges_track_add_element (track_video, effect));
|
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect)) ==
|
|
|
|
track_video);
|
2011-02-08 09:25:41 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
ges_track_element_set_child_properties (effect,
|
2011-02-25 11:13:03 +00:00
|
|
|
"GstAgingTV::scratch-lines", 17, "color-aging", FALSE, NULL);
|
2013-03-01 01:27:50 +00:00
|
|
|
ges_track_element_get_child_properties (effect,
|
2011-02-25 11:13:03 +00:00
|
|
|
"GstAgingTV::scratch-lines", &scratch_line,
|
|
|
|
"color-aging", &color_aging, NULL);
|
|
|
|
fail_unless (scratch_line == 17);
|
|
|
|
fail_unless (color_aging == FALSE);
|
2011-02-08 09:25:41 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
pspecs = ges_track_element_list_children_properties (effect, &n_props);
|
2011-12-30 16:16:29 +00:00
|
|
|
fail_unless (n_props == 7);
|
2011-02-25 16:10:00 +00:00
|
|
|
|
|
|
|
spec = pspecs[0];
|
|
|
|
i = 1;
|
|
|
|
while (g_strcmp0 (spec->name, "scratch-lines")) {
|
|
|
|
spec = pspecs[i++];
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_init (&val, G_TYPE_UINT);
|
|
|
|
g_value_init (&nval, G_TYPE_UINT);
|
|
|
|
g_value_set_uint (&val, 10);
|
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
ges_track_element_set_child_property_by_pspec (effect, spec, &val);
|
|
|
|
ges_track_element_get_child_property_by_pspec (effect, spec, &nval);
|
2011-02-25 16:10:00 +00:00
|
|
|
fail_unless (g_value_get_uint (&nval) == 10);
|
|
|
|
|
|
|
|
for (i = 0; i < n_props; i++) {
|
|
|
|
g_param_spec_unref (pspecs[i]);
|
|
|
|
}
|
2011-05-06 20:21:22 +00:00
|
|
|
g_free (pspecs);
|
2011-02-25 16:10:00 +00:00
|
|
|
|
2013-02-08 20:25:25 +00:00
|
|
|
ges_timeline_layer_remove_clip (layer, (GESClip *) effect_clip);
|
2011-02-08 09:25:41 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (timeline);
|
2011-02-08 09:25:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
static void
|
|
|
|
effect_added_cb (GESClip * clip, GESBaseEffect * trop, gboolean * effect_added)
|
2011-02-08 13:04:39 +00:00
|
|
|
{
|
|
|
|
GST_DEBUG ("Effect added");
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (GES_IS_CLIP (clip));
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless (GES_IS_EFFECT (trop));
|
|
|
|
*effect_added = TRUE;
|
2011-02-08 13:04:39 +00:00
|
|
|
}
|
|
|
|
|
2011-02-08 14:29:21 +00:00
|
|
|
void
|
2013-02-15 02:34:48 +00:00
|
|
|
deep_prop_changed_cb (GESTrackElement * track_element, GstElement * element,
|
2011-02-08 14:29:21 +00:00
|
|
|
GParamSpec * spec)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("%s property changed", g_param_spec_get_name (spec));
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (GES_IS_TRACK_ELEMENT (track_element));
|
2011-02-08 14:29:21 +00:00
|
|
|
fail_unless (GST_IS_ELEMENT (element));
|
|
|
|
}
|
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
GST_START_TEST (test_clip_signals)
|
2011-02-08 13:04:39 +00:00
|
|
|
{
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESTimelineLayer *layer;
|
|
|
|
GESTrack *track_video;
|
2013-01-25 18:51:02 +00:00
|
|
|
GESEffectClip *effect_clip;
|
2013-03-01 01:27:50 +00:00
|
|
|
GESEffect *effect;
|
2012-12-19 13:37:02 +00:00
|
|
|
GValue val = { 0, };
|
2013-03-01 01:27:50 +00:00
|
|
|
gboolean effect_added = FALSE;
|
2011-02-08 13:04:39 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
timeline = ges_timeline_new ();
|
|
|
|
layer = (GESTimelineLayer *) ges_simple_timeline_layer_new ();
|
|
|
|
track_video = ges_track_video_raw_new ();
|
|
|
|
|
|
|
|
ges_timeline_add_track (timeline, track_video);
|
|
|
|
ges_timeline_add_layer (timeline, layer);
|
|
|
|
|
|
|
|
GST_DEBUG ("Create effect");
|
2013-01-25 18:51:02 +00:00
|
|
|
effect_clip = ges_effect_clip_new ("agingtv", NULL);
|
2013-03-01 01:27:50 +00:00
|
|
|
g_signal_connect (effect_clip, "child-added", (GCallback) effect_added_cb,
|
|
|
|
&effect_added);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
2013-01-20 15:42:29 +00:00
|
|
|
g_object_set (effect_clip, "duration", 25 * GST_SECOND, NULL);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
|
|
|
ges_simple_timeline_layer_add_object ((GESSimpleTimelineLayer *) (layer),
|
2013-01-20 15:42:29 +00:00
|
|
|
(GESClip *) effect_clip, 0);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
2013-03-01 01:27:50 +00:00
|
|
|
effect = ges_effect_new ("agingtv");
|
|
|
|
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
|
|
|
|
GES_TIMELINE_ELEMENT (effect)));
|
|
|
|
fail_unless (effect_added);
|
|
|
|
g_signal_handlers_disconnect_by_func (effect_clip, effect_added_cb,
|
|
|
|
&effect_added);
|
2013-03-14 16:53:25 +00:00
|
|
|
fail_if (ges_track_add_element (track_video, GES_TRACK_ELEMENT (effect)));
|
|
|
|
fail_unless (ges_track_element_get_track (GES_TRACK_ELEMENT (effect)) ==
|
|
|
|
track_video);
|
2013-03-01 01:27:50 +00:00
|
|
|
g_signal_connect (effect, "deep-notify", (GCallback) deep_prop_changed_cb,
|
|
|
|
effect);
|
|
|
|
|
|
|
|
ges_track_element_set_child_properties (GES_TRACK_ELEMENT (effect),
|
2011-02-25 11:13:03 +00:00
|
|
|
"GstAgingTV::scratch-lines", 17, NULL);
|
2012-12-19 13:37:02 +00:00
|
|
|
|
|
|
|
g_value_init (&val, G_TYPE_UINT);
|
2013-03-01 01:27:50 +00:00
|
|
|
ges_track_element_get_child_property (GES_TRACK_ELEMENT (effect),
|
2012-12-19 13:37:02 +00:00
|
|
|
"GstAgingTV::scratch-lines", &val);
|
|
|
|
fail_unless (G_VALUE_HOLDS_UINT (&val));
|
|
|
|
g_value_unset (&val);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
2013-02-08 20:25:25 +00:00
|
|
|
ges_timeline_layer_remove_clip (layer, (GESClip *) effect_clip);
|
2011-02-08 13:04:39 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (timeline);
|
2011-02-08 13:04:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2010-11-05 11:12:24 +00:00
|
|
|
static Suite *
|
|
|
|
ges_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("ges");
|
|
|
|
TCase *tc_chain = tcase_create ("effect");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
|
|
|
|
tcase_add_test (tc_chain, test_effect_basic);
|
2013-01-20 15:42:29 +00:00
|
|
|
tcase_add_test (tc_chain, test_add_effect_to_clip);
|
2011-01-31 10:32:14 +00:00
|
|
|
tcase_add_test (tc_chain, test_get_effects_from_tl);
|
2013-01-20 15:42:29 +00:00
|
|
|
tcase_add_test (tc_chain, test_effect_clip);
|
|
|
|
tcase_add_test (tc_chain, test_priorities_clip);
|
2013-03-01 01:27:50 +00:00
|
|
|
tcase_add_test (tc_chain, test_effect_set_properties);
|
2013-01-20 15:42:29 +00:00
|
|
|
tcase_add_test (tc_chain, test_clip_signals);
|
2010-11-05 11:12:24 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
int nf;
|
|
|
|
|
|
|
|
Suite *s = ges_suite ();
|
|
|
|
SRunner *sr = srunner_create (s);
|
|
|
|
|
|
|
|
gst_check_init (&argc, &argv);
|
|
|
|
|
|
|
|
srunner_run_all (sr, CK_NORMAL);
|
|
|
|
nf = srunner_ntests_failed (sr);
|
|
|
|
srunner_free (sr);
|
|
|
|
|
|
|
|
return nf;
|
|
|
|
}
|