2012-04-24 00:54:15 +00:00
|
|
|
/* GStreamer Editing Services
|
|
|
|
*
|
|
|
|
* Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* 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.
|
2012-04-24 00:54:15 +00:00
|
|
|
*/
|
|
|
|
|
2013-01-15 13:52:17 +00:00
|
|
|
#include "test-utils.h"
|
2012-04-24 00:54:15 +00:00
|
|
|
#include <ges/ges.h>
|
|
|
|
#include <gst/check/gstcheck.h>
|
|
|
|
|
2013-06-26 21:08:57 +00:00
|
|
|
#define DEEP_CHECK(element, start, inpoint, duration) \
|
|
|
|
{ \
|
|
|
|
GList *track_elements, *tmp; \
|
|
|
|
\
|
2013-09-08 22:27:04 +00:00
|
|
|
assert_equals_uint64 (_START (element), start); \
|
|
|
|
assert_equals_uint64 (_INPOINT (element), inpoint); \
|
|
|
|
assert_equals_uint64 (_DURATION (element), duration); \
|
2013-06-26 21:08:57 +00:00
|
|
|
\
|
|
|
|
track_elements = GES_CONTAINER_CHILDREN (element); \
|
|
|
|
for (tmp = track_elements; tmp; tmp = tmp->next) { \
|
2013-09-08 22:27:04 +00:00
|
|
|
assert_equals_uint64 (_START (tmp->data), start); \
|
|
|
|
assert_equals_uint64 (_INPOINT (tmp->data), inpoint); \
|
|
|
|
assert_equals_uint64 (_DURATION (tmp->data), duration); \
|
2013-06-26 21:08:57 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2012-04-24 00:54:15 +00:00
|
|
|
GST_START_TEST (test_basic_timeline_edition)
|
|
|
|
{
|
2013-03-22 01:03:09 +00:00
|
|
|
GESAsset *asset;
|
2012-04-24 00:54:15 +00:00
|
|
|
GESTrack *track;
|
|
|
|
GESTimeline *timeline;
|
2013-04-23 23:04:04 +00:00
|
|
|
GESLayer *layer;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *trackelement, *trackelement1, *trackelement2;
|
2013-06-28 15:23:27 +00:00
|
|
|
GESContainer *clip, *clip1, *clip2;
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
2013-03-28 17:51:45 +00:00
|
|
|
track = GES_TRACK (ges_audio_track_new ());
|
2012-04-24 00:54:15 +00:00
|
|
|
fail_unless (track != NULL);
|
|
|
|
|
2013-11-28 18:08:33 +00:00
|
|
|
timeline = ges_timeline_new ();
|
2012-04-24 00:54:15 +00:00
|
|
|
fail_unless (timeline != NULL);
|
|
|
|
fail_unless (ges_timeline_add_track (timeline, track));
|
|
|
|
|
2013-04-23 23:04:04 +00:00
|
|
|
layer = ges_layer_new ();
|
2013-03-22 01:03:09 +00:00
|
|
|
fail_unless (layer != NULL);
|
|
|
|
fail_unless (ges_timeline_add_layer (timeline, layer));
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-03-22 01:03:09 +00:00
|
|
|
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
|
|
|
|
fail_unless (GES_IS_ASSET (asset));
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline
|
|
|
|
*
|
|
|
|
* inpoints 0------- 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip | | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 0------- 10 --------20 50---------60
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
clip = GES_CONTAINER (ges_layer_add_asset (layer, asset, 0, 0, 10,
|
|
|
|
GES_TRACK_TYPE_UNKNOWN));
|
2013-03-22 01:03:09 +00:00
|
|
|
trackelement = GES_CONTAINER_CHILDREN (clip)->data;
|
|
|
|
fail_unless (GES_IS_TRACK_ELEMENT (trackelement));
|
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
clip1 = GES_CONTAINER (ges_layer_add_asset (layer, asset, 10, 0, 10,
|
|
|
|
GES_TRACK_TYPE_UNKNOWN));
|
2013-03-22 01:03:09 +00:00
|
|
|
trackelement1 = GES_CONTAINER_CHILDREN (clip1)->data;
|
|
|
|
fail_unless (GES_IS_TRACK_ELEMENT (trackelement1));
|
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
clip2 = GES_CONTAINER (ges_layer_add_asset (layer, asset, 50, 0, 60,
|
|
|
|
GES_TRACK_TYPE_UNKNOWN));
|
2013-03-22 01:03:09 +00:00
|
|
|
trackelement2 = GES_CONTAINER_CHILDREN (clip2)->data;
|
|
|
|
fail_unless (GES_IS_TRACK_ELEMENT (trackelement2));
|
|
|
|
|
|
|
|
CHECK_OBJECT_PROPS (trackelement, 0, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 50, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Simple rippling clip to: 10
|
2012-04-24 00:54:15 +00:00
|
|
|
*
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* inpoints 0------- 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip | | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 10------- 20 --------30 60---------120
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 10) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 60, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* FIXME find a way to check that we are using the same MovingContext
|
|
|
|
* inside the GESTrack */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 40) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 40, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 80, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Rippling clip1 back to: 20 (getting to the exact same timeline as before
|
2012-04-24 00:54:15 +00:00
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 20) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 60, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Simple move clip to: 27 and clip2 to 35
|
2012-04-24 00:54:15 +00:00
|
|
|
*
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* 0------------
|
2013-02-15 02:34:48 +00:00
|
|
|
* inpoints 0-------|--- clip 0--|----------
|
|
|
|
* | clip1 27 -|-----|-37 clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20-----------30 35-------------120
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_NORMAL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 27) == TRUE);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip2, NULL, -1, GES_EDIT_MODE_NORMAL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 35) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 27, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 35, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Trim start clip to: 32 and clip2 to 35
|
2012-04-24 00:54:15 +00:00
|
|
|
*
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* 5--------
|
2013-02-15 02:34:48 +00:00
|
|
|
* inpoints 0----------- | clip 0--|----------
|
|
|
|
* | clip1 | 32----|-37 clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20-----------30 35-------------120
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 32) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 35, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Ripple end clip to 42
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* 5--------
|
2013-02-15 02:34:48 +00:00
|
|
|
* inpoints 0----------- | clip 0--|----------
|
|
|
|
* | clip1 | 32----|-42 clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20-----------30 35-------------120
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 42) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 35, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* inpoints 0------- 5-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 | | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20-------30 32--------52 ---------112
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip2, NULL, -1, GES_EDIT_MODE_NORMAL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 42) == TRUE);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 52) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 52, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* inpoints 0------- 5-------- 0------------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 | | clip || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20-------40 42--------62 ---------122
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 40) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 42, 5, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-09-08 22:27:04 +00:00
|
|
|
/**
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* inpoints 0------- 3-------- 0------------
|
|
|
|
* | clip1 || clip || clip2 |
|
|
|
|
* time 20-------40 --------62 ---------122
|
|
|
|
*/
|
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_TRIM,
|
|
|
|
GES_EDGE_START, 40) == TRUE);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement, 40, 3, 22);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
/**
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* inpoints 0------- 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20------ 25 ------ 62 ---------122
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 40) == TRUE);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 25) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Make sure that not doing anything when not able to roll */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 65) == TRUE);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 65) == TRUE, 0);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (timeline);
|
2012-04-24 00:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_snapping)
|
|
|
|
{
|
|
|
|
GESTrack *track;
|
|
|
|
GESTimeline *timeline;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *trackelement, *trackelement1, *trackelement2;
|
2013-06-28 15:23:27 +00:00
|
|
|
GESContainer *clip, *clip1, *clip2;
|
2013-04-23 23:04:04 +00:00
|
|
|
GESLayer *layer;
|
2013-01-26 15:31:33 +00:00
|
|
|
GList *trackelements;
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
2013-08-26 23:15:08 +00:00
|
|
|
track = GES_TRACK (ges_video_track_new ());
|
2012-04-24 00:54:15 +00:00
|
|
|
fail_unless (track != NULL);
|
|
|
|
|
2013-11-28 18:08:33 +00:00
|
|
|
timeline = ges_timeline_new ();
|
2012-04-24 00:54:15 +00:00
|
|
|
fail_unless (timeline != NULL);
|
|
|
|
|
|
|
|
fail_unless (ges_timeline_add_track (timeline, track));
|
|
|
|
|
2013-08-26 23:15:08 +00:00
|
|
|
clip = GES_CONTAINER (ges_test_clip_new ());
|
|
|
|
clip1 = GES_CONTAINER (ges_test_clip_new ());
|
|
|
|
clip2 = GES_CONTAINER (ges_test_clip_new ());
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (clip && clip1 && clip2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline
|
|
|
|
* ------------
|
|
|
|
* inpoints 0------- 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20------ 25 ------ 62 ---------122
|
|
|
|
*/
|
2013-02-15 02:34:48 +00:00
|
|
|
g_object_set (clip, "start", (guint64) 25, "duration", (guint64) 37,
|
2012-04-24 00:54:15 +00:00
|
|
|
"in-point", (guint64) 0, NULL);
|
2013-02-15 02:34:48 +00:00
|
|
|
g_object_set (clip1, "start", (guint64) 20, "duration", (guint64) 15,
|
2012-04-24 00:54:15 +00:00
|
|
|
"in-point", (guint64) 0, NULL);
|
2013-02-15 02:34:48 +00:00
|
|
|
g_object_set (clip2, "start", (guint64) 62, "duration", (guint64) 60,
|
2012-04-24 00:54:15 +00:00
|
|
|
"in-point", (guint64) 0, NULL);
|
|
|
|
|
|
|
|
fail_unless ((layer = ges_timeline_append_layer (timeline)) != NULL);
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer), 0);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_layer_add_clip (layer, GES_CLIP (clip)));
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless ((trackelements = GES_CONTAINER_CHILDREN (clip)) != NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
fail_unless ((trackelement =
|
|
|
|
GES_TRACK_ELEMENT (trackelements->data)) != NULL);
|
|
|
|
fail_unless (ges_track_element_get_track (trackelement) == track);
|
|
|
|
assert_equals_uint64 (_DURATION (trackelement), 37);
|
|
|
|
|
2014-02-18 14:14:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement, "track + timeline + clip", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip, "layer + timeline", 2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_layer_add_clip (layer, GES_CLIP (clip1)));
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless ((trackelements = GES_CONTAINER_CHILDREN (clip1)) != NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
fail_unless ((trackelement1 =
|
|
|
|
GES_TRACK_ELEMENT (trackelements->data)) != NULL);
|
|
|
|
fail_unless (ges_track_element_get_track (trackelement1) == track);
|
|
|
|
assert_equals_uint64 (_DURATION (trackelement1), 15);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Same ref logic */
|
2014-02-18 14:14:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement1, "First trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip1, "First clip", 2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_layer_add_clip (layer, GES_CLIP (clip2)));
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless ((trackelements = GES_CONTAINER_CHILDREN (clip2)) != NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
fail_unless ((trackelement2 =
|
|
|
|
GES_TRACK_ELEMENT (trackelements->data)) != NULL);
|
|
|
|
fail_unless (ges_track_element_get_track (trackelement2) == track);
|
|
|
|
assert_equals_uint64 (_DURATION (trackelement2), 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Same ref logic */
|
2014-02-18 14:14:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement2, "First trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip2, "First clip", 2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Snaping to edge, so no move */
|
|
|
|
g_object_set (timeline, "snapping-distance", (guint64) 3, NULL);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 27) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Snaping to edge, so no move */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 27) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* 0----------- 0-------------
|
2013-02-15 02:34:48 +00:00
|
|
|
* inpoints 0-------|-- clip || clip2 |
|
|
|
|
* | clip1 25-|------- 62 -----------122
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20----------30
|
|
|
|
*/
|
|
|
|
g_object_set (timeline, "snapping-distance", (guint64) 0, NULL);
|
2013-02-15 02:34:48 +00:00
|
|
|
ges_timeline_element_set_duration (GES_TIMELINE_ELEMENT (clip1), 10);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* New timeline(the "layers" are just to help reading diagram, nothing else):
|
|
|
|
* ------------
|
|
|
|
* 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 25---------62
|
|
|
|
* inpoints 0----------------------- 10--------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20---------------------- 72 --------122
|
|
|
|
*/
|
|
|
|
/* Rolling involves only neighbour that are currently snapping */
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (ges_timeline_element_roll_end (GES_TIMELINE_ELEMENT (clip1),
|
|
|
|
62));
|
|
|
|
fail_unless (ges_timeline_element_roll_end (GES_TIMELINE_ELEMENT (clip1),
|
2013-01-15 13:52:17 +00:00
|
|
|
72) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 52);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 72, 10, 50);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 25---------62
|
|
|
|
* inpoints 5--------------- 10--------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25------------- 72 --------122
|
|
|
|
*/
|
|
|
|
g_object_set (timeline, "snapping-distance", (guint64) 4, NULL);
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (ges_timeline_element_trim (GES_TIMELINE_ELEMENT (clip1),
|
2013-01-15 13:52:17 +00:00
|
|
|
28) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 25, 5, 47);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 72, 10, 50);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 25---------62
|
|
|
|
* inpoints 5---------- 0---------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25-------- 62 --------122
|
|
|
|
*/
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (ges_timeline_element_roll_start (GES_TIMELINE_ELEMENT (clip2),
|
2013-01-15 13:52:17 +00:00
|
|
|
59) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 25, 5, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* inpoints 0----------5---------- 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip || clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25---------62-------- 99 --------170
|
|
|
|
*/
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (ges_timeline_element_ripple (GES_TIMELINE_ELEMENT (clip1),
|
2013-01-15 13:52:17 +00:00
|
|
|
58) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 62, 5, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 99, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* inpoints 0----------5---------- 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip || clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25---------62-------- 99 110--------170
|
|
|
|
*/
|
2013-02-15 02:34:48 +00:00
|
|
|
ges_timeline_element_set_start (GES_TIMELINE_ELEMENT (clip2), 110);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 62, 5, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 110, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* inpoints 0----------5 5 --------- 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip | | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25---------62 73---------110--------170
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_NORMAL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 72) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 73, 5, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 110, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* inpoints 0----------5---------- 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip || clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25---------62-------- 99 110--------170
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_NORMAL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 58) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 62, 5, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 110, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* inpoints 0----------5---------- 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip || clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25---------62--------110--------170
|
|
|
|
*/
|
2013-09-14 02:19:57 +00:00
|
|
|
g_object_set (clip1, "duration", (guint64) 46, NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 62, 5, 48);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 110, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* inpoints 5----------- 0--------- 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip2 || clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 62---------110--------170--------207
|
|
|
|
*/
|
2013-09-14 02:19:57 +00:00
|
|
|
g_object_set (clip, "start", (guint64) 168, NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 170, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 62, 5, 48);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 110, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Check we didn't lose/screwed any references */
|
2014-02-18 14:14:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement, "First trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement1, "Second trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement2, "Third trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip, "First clip", 2);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip1, "Second clip", 2);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip2, "Third clip", 2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-07-03 16:48:58 +00:00
|
|
|
check_destroyed (G_OBJECT (timeline), G_OBJECT (trackelement),
|
|
|
|
trackelement1, trackelement2, clip, clip1, clip2, layer, NULL);
|
2012-04-24 00:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-04-14 23:30:10 +00:00
|
|
|
static void
|
|
|
|
asset_added_cb (GESProject * project, GESAsset * asset, void *mainloop)
|
|
|
|
{
|
|
|
|
GstDiscovererInfo *info;
|
|
|
|
|
|
|
|
info = ges_uri_clip_asset_get_info (GES_URI_CLIP_ASSET (asset));
|
|
|
|
fail_unless (GST_IS_DISCOVERER_INFO (info));
|
|
|
|
|
|
|
|
g_main_loop_quit ((GMainLoop *) mainloop);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_simple_triming)
|
|
|
|
{
|
|
|
|
GList *assets;
|
|
|
|
GMainLoop *mainloop;
|
|
|
|
GESClipAsset *asset;
|
|
|
|
GESProject *project;
|
|
|
|
GESTimeline *timeline;
|
2013-04-23 23:04:04 +00:00
|
|
|
GESLayer *layer;
|
2013-04-14 23:30:10 +00:00
|
|
|
GESTimelineElement *element;
|
|
|
|
|
|
|
|
gchar *uri = ges_test_file_uri ("audio_video.ogg");
|
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
project = ges_project_new (NULL);
|
|
|
|
|
|
|
|
mainloop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
|
|
|
g_signal_connect (project, "asset-added", (GCallback) asset_added_cb,
|
|
|
|
mainloop);
|
|
|
|
ges_project_create_asset (project, uri, GES_TYPE_URI_CLIP);
|
|
|
|
g_free (uri);
|
|
|
|
|
|
|
|
g_main_loop_run (mainloop);
|
|
|
|
|
|
|
|
/* the asset is now loaded */
|
2013-11-28 18:08:33 +00:00
|
|
|
timeline = ges_timeline_new_audio_video ();
|
2013-04-14 23:30:10 +00:00
|
|
|
assets = ges_project_list_assets (project, GES_TYPE_CLIP);
|
|
|
|
|
|
|
|
assert_equals_int (g_list_length (assets), 1);
|
|
|
|
asset = assets->data;
|
|
|
|
|
2013-04-23 23:04:04 +00:00
|
|
|
layer = ges_layer_new ();
|
2013-04-14 23:30:10 +00:00
|
|
|
ges_timeline_add_layer (timeline, layer);
|
|
|
|
|
2013-04-23 23:04:04 +00:00
|
|
|
ges_layer_add_asset (layer, GES_ASSET (asset), 0, 0, 10,
|
2013-04-14 23:30:10 +00:00
|
|
|
ges_clip_asset_get_supported_formats (asset));
|
|
|
|
|
2013-04-23 23:04:04 +00:00
|
|
|
element = ges_layer_get_clips (layer)->data;
|
2013-04-14 23:30:10 +00:00
|
|
|
|
2013-06-26 21:08:57 +00:00
|
|
|
DEEP_CHECK (element, 0, 0, 10);
|
2013-06-28 15:23:27 +00:00
|
|
|
ges_container_edit (GES_CONTAINER (element), NULL, -1, GES_EDIT_MODE_TRIM,
|
2013-04-14 23:30:10 +00:00
|
|
|
GES_EDGE_START, 5);
|
2013-06-26 21:08:57 +00:00
|
|
|
DEEP_CHECK (element, 5, 5, 5);
|
2013-04-14 23:30:10 +00:00
|
|
|
|
|
|
|
g_main_loop_unref (mainloop);
|
|
|
|
gst_object_unref (timeline);
|
|
|
|
gst_object_unref (project);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2012-04-24 00:54:15 +00:00
|
|
|
GST_START_TEST (test_timeline_edition_mode)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
GESTrack *track;
|
|
|
|
GESTimeline *timeline;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *trackelement, *trackelement1, *trackelement2;
|
2013-06-28 15:23:27 +00:00
|
|
|
GESContainer *clip, *clip1, *clip2;
|
2013-04-23 23:04:04 +00:00
|
|
|
GESLayer *layer, *layer1, *layer2;
|
2013-01-26 15:31:33 +00:00
|
|
|
GList *trackelements, *layers, *tmp;
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
2013-08-26 23:15:08 +00:00
|
|
|
track = GES_TRACK (ges_video_track_new ());
|
2012-04-24 00:54:15 +00:00
|
|
|
fail_unless (track != NULL);
|
|
|
|
|
2013-11-28 18:08:33 +00:00
|
|
|
timeline = ges_timeline_new ();
|
2012-04-24 00:54:15 +00:00
|
|
|
fail_unless (timeline != NULL);
|
|
|
|
|
|
|
|
fail_unless (ges_timeline_add_track (timeline, track));
|
|
|
|
|
2013-08-26 23:15:08 +00:00
|
|
|
clip = GES_CONTAINER (ges_test_clip_new ());
|
|
|
|
clip1 = GES_CONTAINER (ges_test_clip_new ());
|
|
|
|
clip2 = GES_CONTAINER (ges_test_clip_new ());
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
fail_unless (clip && clip1 && clip2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline
|
|
|
|
*
|
|
|
|
* 0-------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 0-------10
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer1: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 10--------20 50---------60
|
|
|
|
*/
|
2013-02-15 02:34:48 +00:00
|
|
|
g_object_set (clip, "start", (guint64) 0, "duration", (guint64) 10,
|
2012-04-24 00:54:15 +00:00
|
|
|
"in-point", (guint64) 0, NULL);
|
2013-02-15 02:34:48 +00:00
|
|
|
g_object_set (clip1, "start", (guint64) 10, "duration", (guint64) 10,
|
2012-04-24 00:54:15 +00:00
|
|
|
"in-point", (guint64) 0, NULL);
|
2013-02-15 02:34:48 +00:00
|
|
|
g_object_set (clip2, "start", (guint64) 50, "duration", (guint64) 60,
|
2012-04-24 00:54:15 +00:00
|
|
|
"in-point", (guint64) 0, NULL);
|
|
|
|
|
|
|
|
fail_unless ((layer = ges_timeline_append_layer (timeline)) != NULL);
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer), 0);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_layer_add_clip (layer, GES_CLIP (clip)));
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless ((trackelements = GES_CONTAINER_CHILDREN (clip)) != NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
fail_unless ((trackelement =
|
|
|
|
GES_TRACK_ELEMENT (trackelements->data)) != NULL);
|
|
|
|
fail_unless (ges_track_element_get_track (trackelement) == track);
|
|
|
|
assert_equals_uint64 (_DURATION (trackelement), 10);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Add a new layer and add clipects to it */
|
2012-04-24 00:54:15 +00:00
|
|
|
fail_unless ((layer1 = ges_timeline_append_layer (timeline)) != NULL);
|
|
|
|
fail_unless (layer != layer1);
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer1), 1);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_layer_add_clip (layer1, GES_CLIP (clip1)));
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless ((trackelements = GES_CONTAINER_CHILDREN (clip1)) != NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
fail_unless ((trackelement1 =
|
|
|
|
GES_TRACK_ELEMENT (trackelements->data)) != NULL);
|
|
|
|
fail_unless (ges_track_element_get_track (trackelement1) == track);
|
|
|
|
assert_equals_uint64 (_DURATION (trackelement1), 10);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_layer_add_clip (layer1, GES_CLIP (clip2)));
|
2013-03-01 01:27:50 +00:00
|
|
|
fail_unless ((trackelements = GES_CONTAINER_CHILDREN (clip2)) != NULL);
|
2013-01-26 15:31:33 +00:00
|
|
|
fail_unless ((trackelement2 =
|
|
|
|
GES_TRACK_ELEMENT (trackelements->data)) != NULL);
|
|
|
|
fail_unless (ges_track_element_get_track (trackelement2) == track);
|
|
|
|
assert_equals_uint64 (_DURATION (trackelement2), 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Simple rippling clip to: 10
|
2012-04-24 00:54:15 +00:00
|
|
|
*
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* inpoints 0-------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 10-------20
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20--------30 60--------120
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 10) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 60, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* FIXME find a way to check that we are using the same MovingContext
|
|
|
|
* inside the GESTimeline */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, 3, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 40) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 40, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 80, 0, 60);
|
2013-06-28 15:23:27 +00:00
|
|
|
layer2 = ges_clip_get_layer (GES_CLIP (clip1));
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer2), 3);
|
2013-02-15 02:34:48 +00:00
|
|
|
/* clip2 should have moved layer too */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_clip_get_layer (GES_CLIP (clip2)) == layer2);
|
2013-02-15 02:34:48 +00:00
|
|
|
/* We got 2 reference to the same clipect, unref them */
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer2);
|
|
|
|
gst_object_unref (layer2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Rippling clip1 back to: 20 (getting to the exact same timeline as before
|
2012-04-24 00:54:15 +00:00
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, 1, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 20) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 60, 0, 60);
|
2013-06-28 15:23:27 +00:00
|
|
|
layer2 = ges_clip_get_layer (GES_CLIP (clip1));
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer2), 1);
|
2013-02-15 02:34:48 +00:00
|
|
|
/* clip2 should have moved layer too */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_clip_get_layer (GES_CLIP (clip2)) == layer2);
|
2013-02-15 02:34:48 +00:00
|
|
|
/* We got 2 reference to the same clipect, unref them */
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer2);
|
|
|
|
gst_object_unref (layer2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Simple move clip to 27 and clip2 to 35
|
2012-04-24 00:54:15 +00:00
|
|
|
*
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* inpoints 0-------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 27-------37
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20--------30 35---------95
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_NORMAL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 27) == TRUE);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip2, NULL, -1, GES_EDIT_MODE_NORMAL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_NONE, 35) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 27, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 35, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
2013-02-15 02:34:48 +00:00
|
|
|
* Simple trimming start clip to: 32
|
2012-04-24 00:54:15 +00:00
|
|
|
*
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 5-------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 0: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 32-------37
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1 | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20--------30 35---------95
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 32) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 35, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Ripple end clip to 35 and move to layer 2
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20--------30 35---------95
|
|
|
|
*
|
|
|
|
* 5------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 2: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 32------35
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, 2, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 35) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 3);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 35, 0, 60);
|
2013-06-28 15:23:27 +00:00
|
|
|
layer = ges_clip_get_layer (GES_CLIP (clip));
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer), 2);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Roll end clip to 50
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20--------30 50---------95
|
|
|
|
*
|
|
|
|
* 5------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 2: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 32------50
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, 2, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 50) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 18);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 50, 15, 45);
|
2013-06-28 15:23:27 +00:00
|
|
|
layer = ges_clip_get_layer (GES_CLIP (clip));
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer), 2);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Some more intensive roll testing */
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
|
gint32 random = g_random_int_range (35, 94);
|
|
|
|
guint64 tck3_inpoint = random - 35;
|
|
|
|
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, random) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, random - 32);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, random, tck3_inpoint, 95 - random);
|
2012-04-24 00:54:15 +00:00
|
|
|
}
|
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Roll end clip back to 35
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20--------30 35---------95
|
|
|
|
*
|
|
|
|
* 5------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 2: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 32------35
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, 2, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 35) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 3);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 35, 0, 60);
|
2013-06-28 15:23:27 +00:00
|
|
|
layer = ges_clip_get_layer (GES_CLIP (clip));
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer), 2);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Ripple clip end to 52
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 0-------- 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20-------30 52---------112
|
|
|
|
*
|
|
|
|
* 5------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 2: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 32------52
|
|
|
|
*
|
|
|
|
*/
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Can not move to the first layer as clip2 should move to a layer with priority < 0 */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, 0, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 52) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 32, 5, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 52, 0, 60)
|
2013-06-28 15:23:27 +00:00
|
|
|
layer = ges_clip_get_layer (GES_CLIP (clip));
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer), 2);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Little check that we have 4 layers in the timeline */
|
|
|
|
layers = ges_timeline_get_layers (timeline);
|
|
|
|
assert_equals_int (g_list_length (layers), 4);
|
|
|
|
|
|
|
|
/* Some refcount checkings */
|
|
|
|
/* We have a reference to each layer in layers */
|
|
|
|
for (tmp = layers; tmp; tmp = tmp->next)
|
|
|
|
ASSERT_OBJECT_REFCOUNT (layer, "Layer", 2);
|
2013-03-16 22:05:04 +00:00
|
|
|
g_list_free_full (layers, gst_object_unref);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* We have 3 references:
|
2013-02-15 02:34:48 +00:00
|
|
|
* track + timeline + clip
|
2012-04-24 00:54:15 +00:00
|
|
|
*/
|
2014-02-18 14:14:40 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement, "First trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement1, "Second trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (trackelement2, "Third trackelement", 4);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip, "First clip", 2);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip1, "Second clip", 2);
|
|
|
|
ASSERT_OBJECT_REFCOUNT (clip2, "Third clip", 2);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Ripple clip end to 52
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 0: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20-------40 62----------112
|
|
|
|
*
|
|
|
|
* 5------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 42------60
|
|
|
|
*
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, 0, GES_EDIT_MODE_RIPPLE,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 40) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 42, 5, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Check that movement between layer has been done properly */
|
2013-06-28 15:23:27 +00:00
|
|
|
layer1 = ges_clip_get_layer (GES_CLIP (clip));
|
|
|
|
layer = ges_clip_get_layer (GES_CLIP (clip1));
|
2013-04-23 23:04:04 +00:00
|
|
|
assert_equals_int (ges_layer_get_priority (layer1), 1);
|
|
|
|
assert_equals_int (ges_layer_get_priority (layer), 0);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_clip_get_layer (GES_CLIP (clip2)) == layer);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer1);
|
2012-04-24 00:54:15 +00:00
|
|
|
/* We have 2 references to @layer that we do not need anymore */ ;
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (layer);
|
|
|
|
gst_object_unref (layer);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Trim clip start to 40
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 0: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20-------40 62---------112
|
|
|
|
*
|
|
|
|
* 0------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 40------62
|
|
|
|
*
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 40) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 40, 3, 22);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
2013-02-15 02:34:48 +00:00
|
|
|
/* Roll clip end to 25
|
2012-04-24 00:54:15 +00:00
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
*
|
|
|
|
* 0-------- 0-----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 0: | clip1 | | clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 20-------25 62---------112
|
|
|
|
*
|
|
|
|
* 0------
|
2013-02-15 02:34:48 +00:00
|
|
|
* layer 1: | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 25------62
|
|
|
|
*
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 25) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Make sure that not doing anything when not able to roll */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 65) == TRUE);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 65) == TRUE, 0);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Snaping to edge, so no move */
|
|
|
|
g_object_set (timeline, "snapping-distance", (guint64) 3, NULL);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 27) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Snaping to edge, so no move */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 27) == TRUE);
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* New timeline:
|
|
|
|
* ------------
|
|
|
|
* 0----------- 0-------------
|
2013-02-15 02:34:48 +00:00
|
|
|
* inpoints 0-------|-- clip || clip2 |
|
|
|
|
* | clip1 25-|------- 62 -----------122
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20----------30
|
|
|
|
*/
|
|
|
|
g_object_set (timeline, "snapping-distance", (guint64) 0, NULL);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 30) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* New timeline
|
|
|
|
* ------------
|
|
|
|
* 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 25---------62
|
|
|
|
* inpoints 0----------------------- 10--------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 20---------------------- 72 --------122
|
|
|
|
*/
|
|
|
|
/* Rolling involves only neighbours that are currently snapping */
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 62) == TRUE);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_END, 72) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 20, 0, 52);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 72, 10, 50);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/* Test Snapping */
|
|
|
|
/**
|
|
|
|
* 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 25---------62
|
|
|
|
* inpoints 5--------------- 10--------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25------------- 72 --------122
|
|
|
|
*/
|
|
|
|
g_object_set (timeline, "snapping-distance", (guint64) 4, NULL);
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip1, NULL, -1, GES_EDIT_MODE_TRIM,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 28) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 25, 5, 47);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 72, 10, 50);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 0----------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip |
|
2012-04-24 00:54:15 +00:00
|
|
|
* 25---------62
|
|
|
|
* inpoints 5---------- 0---------
|
2013-02-15 02:34:48 +00:00
|
|
|
* | clip1 || clip2 |
|
2012-04-24 00:54:15 +00:00
|
|
|
* time 25-------- 62 --------122
|
|
|
|
*/
|
2013-06-28 15:23:27 +00:00
|
|
|
fail_unless (ges_container_edit (clip2, NULL, -1, GES_EDIT_MODE_ROLL,
|
2012-04-24 00:54:15 +00:00
|
|
|
GES_EDGE_START, 59) == TRUE);
|
2013-01-26 15:31:33 +00:00
|
|
|
CHECK_OBJECT_PROPS (trackelement, 25, 0, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement1, 25, 5, 37);
|
|
|
|
CHECK_OBJECT_PROPS (trackelement2, 62, 0, 60);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-06-26 21:08:57 +00:00
|
|
|
GST_START_TEST (test_groups)
|
|
|
|
{
|
|
|
|
GESAsset *asset;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESGroup *group;
|
|
|
|
GESLayer *layer, *layer1, *layer2, *layer3;
|
|
|
|
GESClip *c, *c1, *c2, *c3, *c4, *c5;
|
|
|
|
|
|
|
|
GList *clips = NULL;
|
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
2013-11-28 18:08:33 +00:00
|
|
|
timeline = ges_timeline_new_audio_video ();
|
2013-06-26 21:08:57 +00:00
|
|
|
|
|
|
|
/* Our timeline
|
|
|
|
*
|
|
|
|
* --0------------10-Group-----20---------------30-----------------------70
|
|
|
|
* | +-----------+ |+-----------50 |
|
|
|
|
* L | | C | || C3 | |
|
|
|
|
* | +-----------+ |+-----------+ |
|
|
|
|
* --|-------------------------------------------|-----40----------------|
|
|
|
|
* | +------------+ +-------------+ | +--------60 |
|
|
|
|
* L1 | | C1 | | C2 | | | C4 | |
|
|
|
|
* | +------------+ +-------------+ | +--------+ |
|
|
|
|
* --|-------------------------------------------|-----------------------|
|
|
|
|
* | | +--------+|
|
|
|
|
* L2 | | | c5 ||
|
|
|
|
* | | +--------+|
|
|
|
|
* --+-------------------------------------------+-----------------------+
|
|
|
|
*
|
|
|
|
* L3
|
|
|
|
*
|
|
|
|
* -----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
layer = ges_timeline_append_layer (timeline);
|
|
|
|
layer1 = ges_timeline_append_layer (timeline);
|
|
|
|
layer2 = ges_timeline_append_layer (timeline);
|
|
|
|
layer3 = ges_timeline_append_layer (timeline);
|
|
|
|
assert_equals_int (ges_layer_get_priority (layer3), 3);
|
|
|
|
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
|
|
|
|
|
|
|
|
c = ges_layer_add_asset (layer, asset, 0, 0, 10, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c1 = ges_layer_add_asset (layer1, asset, 10, 0, 10, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c2 = ges_layer_add_asset (layer1, asset, 20, 0, 10, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
clips = g_list_prepend (clips, c);
|
|
|
|
clips = g_list_prepend (clips, c1);
|
|
|
|
clips = g_list_prepend (clips, c2);
|
|
|
|
group = GES_GROUP (ges_container_group (clips));
|
|
|
|
fail_unless (GES_TIMELINE_ELEMENT_TIMELINE (group) == timeline);
|
|
|
|
g_list_free (clips);
|
|
|
|
|
|
|
|
fail_unless (GES_IS_GROUP (group));
|
|
|
|
CHECK_OBJECT_PROPS (c, 0, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (group, 0, 0, 30);
|
|
|
|
|
|
|
|
c3 = ges_layer_add_asset (layer, asset, 30, 0, 20, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c4 = ges_layer_add_asset (layer1, asset, 40, 0, 20, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c5 = ges_layer_add_asset (layer2, asset, 50, 0, 20, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
|
|
|
|
CHECK_OBJECT_PROPS (c3, 30, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
|
|
|
|
check_layer (c, 0);
|
|
|
|
check_layer (c1, 1);
|
|
|
|
check_layer (c2, 1);
|
|
|
|
check_layer (c3, 0);
|
|
|
|
check_layer (c4, 1);
|
|
|
|
check_layer (c5, 2);
|
|
|
|
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, -1,
|
|
|
|
GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 10) == TRUE);
|
|
|
|
|
|
|
|
CHECK_OBJECT_PROPS (c, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 30, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c3, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 50, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 60, 0, 20);
|
|
|
|
check_layer (c, 0);
|
|
|
|
check_layer (c1, 1);
|
|
|
|
check_layer (c2, 1);
|
|
|
|
check_layer (c3, 0);
|
|
|
|
check_layer (c4, 1);
|
|
|
|
check_layer (c5, 2);
|
|
|
|
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, 1,
|
|
|
|
GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 10) == TRUE);
|
|
|
|
CHECK_OBJECT_PROPS (c, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 30, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c3, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 50, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 60, 0, 20);
|
|
|
|
check_layer (c, 1);
|
|
|
|
check_layer (c1, 2);
|
|
|
|
check_layer (c2, 2);
|
|
|
|
check_layer (c3, 1);
|
|
|
|
check_layer (c4, 2);
|
|
|
|
check_layer (c5, 3);
|
|
|
|
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c1), NULL, 2,
|
|
|
|
GES_EDIT_MODE_RIPPLE, GES_EDGE_END, 40) == TRUE);
|
|
|
|
CHECK_OBJECT_PROPS (c, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 20, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 40, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c3, 50, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 60, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 70, 0, 20);
|
|
|
|
check_layer (c, 1);
|
|
|
|
check_layer (c1, 2);
|
|
|
|
check_layer (c2, 2);
|
|
|
|
check_layer (c3, 1);
|
|
|
|
check_layer (c4, 2);
|
|
|
|
check_layer (c5, 3);
|
|
|
|
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c1), NULL, 2,
|
|
|
|
GES_EDIT_MODE_RIPPLE, GES_EDGE_END, 30) == TRUE);
|
|
|
|
CHECK_OBJECT_PROPS (c, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 30, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c3, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 50, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 60, 0, 20);
|
|
|
|
check_layer (c, 1);
|
|
|
|
check_layer (c1, 2);
|
|
|
|
check_layer (c2, 2);
|
|
|
|
check_layer (c3, 1);
|
|
|
|
check_layer (c4, 2);
|
|
|
|
check_layer (c5, 3);
|
|
|
|
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, 0,
|
|
|
|
GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 0) == TRUE);
|
|
|
|
CHECK_OBJECT_PROPS (c, 0, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 20, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c3, 30, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
|
|
|
|
check_layer (c, 0);
|
|
|
|
check_layer (c1, 1);
|
|
|
|
check_layer (c2, 1);
|
|
|
|
check_layer (c3, 0);
|
|
|
|
check_layer (c4, 1);
|
|
|
|
check_layer (c5, 2);
|
|
|
|
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c2), NULL, -1,
|
|
|
|
GES_EDIT_MODE_ROLL, GES_EDGE_END, 40) == TRUE);
|
|
|
|
CHECK_OBJECT_PROPS (c, 0, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 20, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c3, 40, 10, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (group, 0, 0, 40);
|
|
|
|
check_layer (c, 0);
|
|
|
|
check_layer (c1, 1);
|
|
|
|
check_layer (c2, 1);
|
|
|
|
check_layer (c3, 0);
|
2013-09-07 06:11:23 +00:00
|
|
|
check_layer (c4, 1);
|
|
|
|
check_layer (c5, 2);
|
|
|
|
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, 0,
|
|
|
|
GES_EDIT_MODE_TRIM, GES_EDGE_START, 5) == TRUE);
|
|
|
|
CHECK_OBJECT_PROPS (c, 5, 5, 5);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 20, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c3, 40, 10, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (group, 5, 0, 35);
|
|
|
|
check_layer (c, 0);
|
|
|
|
check_layer (c1, 1);
|
|
|
|
check_layer (c2, 1);
|
|
|
|
check_layer (c3, 0);
|
2013-06-26 21:08:57 +00:00
|
|
|
check_layer (c4, 1);
|
|
|
|
check_layer (c5, 2);
|
|
|
|
|
|
|
|
gst_object_unref (timeline);
|
|
|
|
gst_object_unref (asset);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_snapping_groups)
|
|
|
|
{
|
|
|
|
GESAsset *asset;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESGroup *group;
|
|
|
|
GESLayer *layer, *layer1, *layer2, *layer3;
|
|
|
|
GESClip *c, *c1, *c2, *c3, *c4, *c5;
|
|
|
|
|
|
|
|
GList *clips = NULL;
|
|
|
|
|
|
|
|
ges_init ();
|
|
|
|
|
2013-11-28 18:08:33 +00:00
|
|
|
timeline = ges_timeline_new_audio_video ();
|
2013-06-26 21:08:57 +00:00
|
|
|
g_object_set (timeline, "snapping-distance", (guint64) 3, NULL);
|
|
|
|
|
|
|
|
/* Our timeline
|
|
|
|
*
|
|
|
|
* --0------------10-Group-----20---------25-----30----------------------70
|
|
|
|
* | +-----------+ | +-----------50 |
|
|
|
|
* L | | C | | | C3 | |
|
|
|
|
* | +-----------+ | +-----------+ |
|
|
|
|
* --|------------------------------------|------------40----------------|
|
|
|
|
* | +------------+ +--------+ +--------60 |
|
|
|
|
* L1 | | C1 | | C2 | | C4 | |
|
|
|
|
* | +------------+ +--------+ +--------+ |
|
|
|
|
* --|------------------------------------+------------------------------|
|
|
|
|
* | +--------+|
|
|
|
|
* L2 | | c5 ||
|
|
|
|
* | +--------+|
|
|
|
|
* --+-------------------------------------------------------------------+
|
|
|
|
*
|
|
|
|
* L3
|
|
|
|
*
|
|
|
|
* -----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
layer = ges_timeline_append_layer (timeline);
|
|
|
|
layer1 = ges_timeline_append_layer (timeline);
|
|
|
|
layer2 = ges_timeline_append_layer (timeline);
|
|
|
|
layer3 = ges_timeline_append_layer (timeline);
|
|
|
|
assert_equals_int (ges_layer_get_priority (layer3), 3);
|
|
|
|
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
|
|
|
|
|
|
|
|
c = ges_layer_add_asset (layer, asset, 0, 0, 10, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c1 = ges_layer_add_asset (layer1, asset, 10, 0, 10, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c2 = ges_layer_add_asset (layer1, asset, 20, 0, 5, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
clips = g_list_prepend (clips, c);
|
|
|
|
clips = g_list_prepend (clips, c1);
|
|
|
|
clips = g_list_prepend (clips, c2);
|
|
|
|
group = GES_GROUP (ges_container_group (clips));
|
|
|
|
fail_unless (GES_TIMELINE_ELEMENT_TIMELINE (group) == timeline);
|
|
|
|
g_list_free (clips);
|
|
|
|
|
|
|
|
fail_unless (GES_IS_GROUP (group));
|
|
|
|
CHECK_OBJECT_PROPS (c, 0, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
|
|
|
|
CHECK_OBJECT_PROPS (c2, 20, 0, 5);
|
|
|
|
CHECK_OBJECT_PROPS (group, 0, 0, 25);
|
|
|
|
|
|
|
|
c3 = ges_layer_add_asset (layer, asset, 30, 0, 20, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c4 = ges_layer_add_asset (layer1, asset, 40, 0, 20, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
c5 = ges_layer_add_asset (layer2, asset, 50, 0, 20, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
|
|
|
|
CHECK_OBJECT_PROPS (c3, 30, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
|
|
|
|
check_layer (c, 0);
|
|
|
|
check_layer (c1, 1);
|
|
|
|
check_layer (c2, 1);
|
|
|
|
check_layer (c3, 0);
|
|
|
|
check_layer (c4, 1);
|
|
|
|
check_layer (c5, 2);
|
|
|
|
|
|
|
|
/* c2 should snap with C3 and make the group moving to 5 */
|
|
|
|
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, -1,
|
|
|
|
GES_EDIT_MODE_NORMAL, GES_EDGE_NONE, 3) == TRUE);
|
|
|
|
|
|
|
|
DEEP_CHECK (c, 5, 0, 10);
|
|
|
|
DEEP_CHECK (c1, 15, 0, 10);
|
|
|
|
DEEP_CHECK (c2, 25, 0, 5);
|
|
|
|
DEEP_CHECK (c2, 25, 0, 5);
|
|
|
|
DEEP_CHECK (c4, 40, 0, 20);
|
|
|
|
DEEP_CHECK (c5, 50, 0, 20);
|
|
|
|
CHECK_OBJECT_PROPS (group, 5, 0, 25);
|
|
|
|
check_layer (c, 0);
|
|
|
|
check_layer (c1, 1);
|
|
|
|
check_layer (c2, 1);
|
|
|
|
check_layer (c3, 0);
|
|
|
|
check_layer (c4, 1);
|
|
|
|
check_layer (c5, 2);
|
|
|
|
|
|
|
|
|
|
|
|
gst_object_unref (timeline);
|
|
|
|
gst_object_unref (asset);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-08-29 09:35:30 +00:00
|
|
|
static void
|
|
|
|
_set_track_element_width_height (GESTrackElement * trksrc, gint wvalue,
|
|
|
|
gint hvalue)
|
|
|
|
{
|
|
|
|
GValue width = { 0 };
|
|
|
|
GValue height = { 0 };
|
|
|
|
|
|
|
|
g_value_init (&width, G_TYPE_INT);
|
|
|
|
g_value_init (&height, G_TYPE_INT);
|
|
|
|
g_value_set_int (&width, wvalue);
|
|
|
|
g_value_set_int (&height, hvalue);
|
|
|
|
if (wvalue >= 0)
|
|
|
|
ges_track_element_set_child_property (trksrc, "width", &width);
|
|
|
|
if (hvalue >= 0)
|
|
|
|
ges_track_element_set_child_property (trksrc, "height", &height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
check_frame_positionner_size (GESClip * clip, gint width, gint height)
|
|
|
|
{
|
|
|
|
GESTrackElement *trksrc;
|
|
|
|
GValue val_width = { 0 };
|
|
|
|
GValue val_height = { 0 };
|
|
|
|
gint real_width, real_height;
|
|
|
|
|
|
|
|
trksrc = GES_CONTAINER_CHILDREN (clip)->data;
|
|
|
|
if (!GES_IS_VIDEO_SOURCE (trksrc))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_value_init (&val_width, G_TYPE_INT);
|
|
|
|
g_value_init (&val_height, G_TYPE_INT);
|
|
|
|
|
|
|
|
ges_track_element_get_child_property (trksrc, "width", &val_width);
|
|
|
|
ges_track_element_get_child_property (trksrc, "height", &val_height);
|
|
|
|
|
|
|
|
real_width = g_value_get_int (&val_width);
|
|
|
|
real_height = g_value_get_int (&val_height);
|
|
|
|
|
|
|
|
return (width == real_width && height == real_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_scaling)
|
|
|
|
{
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESLayer *layer;
|
|
|
|
GESAsset *asset1, *asset2;
|
|
|
|
GESClip *clip;
|
|
|
|
GESTrack *trackv = GES_TRACK (ges_video_track_new ());
|
|
|
|
GstCaps *caps =
|
|
|
|
gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 1200, "height",
|
|
|
|
G_TYPE_INT, 1000, NULL);
|
|
|
|
|
|
|
|
ges_init ();
|
2013-11-28 18:08:33 +00:00
|
|
|
timeline = ges_timeline_new ();
|
2013-08-29 09:35:30 +00:00
|
|
|
ges_timeline_add_track (timeline, trackv);
|
|
|
|
layer = ges_layer_new ();
|
|
|
|
fail_unless (ges_timeline_add_layer (timeline, layer));
|
|
|
|
|
|
|
|
g_object_set (layer, "auto-transition", TRUE, NULL);
|
|
|
|
|
|
|
|
asset1 = GES_ASSET (ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL));
|
|
|
|
asset2 = GES_ASSET (ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL));
|
|
|
|
|
|
|
|
fail_unless (asset1 != NULL && asset2 != NULL);
|
|
|
|
|
|
|
|
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (timeline),
|
|
|
|
GST_DEBUG_GRAPH_SHOW_ALL, "ges-integration-timeline");
|
|
|
|
|
|
|
|
ges_track_set_restriction_caps (trackv, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
GST_DEBUG ("adding clip, should be 1200 x 1000");
|
|
|
|
clip =
|
|
|
|
ges_layer_add_asset (layer, GES_ASSET (asset1), 0 * GST_SECOND,
|
|
|
|
0 * GST_SECOND, 4 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
gst_object_unref (asset1);
|
|
|
|
g_object_set (clip, "vpattern", (gint) GES_VIDEO_TEST_PATTERN_SMPTE75, NULL);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Our track: 1200 x 1000
|
|
|
|
*
|
|
|
|
* 0--------------0
|
|
|
|
* | width : 1200 |
|
|
|
|
* | height: 1000 |
|
|
|
|
* 0--------------2
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* clip takes the size set on the track as a default */
|
|
|
|
fail_unless (check_frame_positionner_size (clip, 1200, 1000));
|
|
|
|
|
|
|
|
if (GES_IS_VIDEO_SOURCE (GES_CONTAINER_CHILDREN (clip)->data))
|
|
|
|
_set_track_element_width_height (GES_CONTAINER_CHILDREN (clip)->data, 1024,
|
|
|
|
768);
|
|
|
|
|
|
|
|
GST_DEBUG ("Setting clip size, should be 1024 x 768");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline : 1200 x 1000
|
|
|
|
*
|
|
|
|
* 0--------------0
|
|
|
|
* | width : 1024 |
|
|
|
|
* | height: 768 |
|
|
|
|
* 0--------------2
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Clip has to comply to direct orders */
|
|
|
|
fail_unless (check_frame_positionner_size (clip, 1024, 768));
|
|
|
|
|
|
|
|
GST_DEBUG ("Changing caps, should still be 1024 x 768");
|
|
|
|
|
|
|
|
caps =
|
|
|
|
gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 1400, "height",
|
|
|
|
G_TYPE_INT, 1200, NULL);
|
|
|
|
ges_track_set_restriction_caps (trackv, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline : 1400 x 1200
|
|
|
|
*
|
|
|
|
* 0--------------0
|
|
|
|
* | width : 1024 |
|
|
|
|
* | height: 768 |
|
|
|
|
* 0--------------2
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Clip still has to be the same size */
|
|
|
|
fail_unless (check_frame_positionner_size (clip, 1024, 768));
|
|
|
|
|
|
|
|
GST_DEBUG ("Setting width to 0, should be 1400 x 768");
|
|
|
|
|
|
|
|
/* -1 means don't set it, only valid here */
|
|
|
|
if (GES_IS_VIDEO_SOURCE (GES_CONTAINER_CHILDREN (clip)->data))
|
|
|
|
_set_track_element_width_height (GES_CONTAINER_CHILDREN (clip)->data, 0,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline : 1400 x 1200
|
|
|
|
*
|
|
|
|
* 0--------------0
|
|
|
|
* | width : 1400 |
|
|
|
|
* | height: 768 |
|
|
|
|
* 0--------------2
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Clip width was set to 0 so it has to use track width */
|
|
|
|
/* Clip height is still directly set by the user */
|
|
|
|
fail_unless (check_frame_positionner_size (clip, 1400, 768));
|
|
|
|
|
|
|
|
GST_DEBUG ("Setting height to 0, should be 1400 x 1200");
|
|
|
|
|
|
|
|
if (GES_IS_VIDEO_SOURCE (GES_CONTAINER_CHILDREN (clip)->data))
|
|
|
|
_set_track_element_width_height (GES_CONTAINER_CHILDREN (clip)->data, -1,
|
|
|
|
0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline : 1400 x 1200
|
|
|
|
*
|
|
|
|
* 0--------------0
|
|
|
|
* | width : 1400 |
|
|
|
|
* | height: 1200 |
|
|
|
|
* 0--------------2
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Clip width still has to use track width */
|
|
|
|
/* Clip height was set to 0 so it has to use track height */
|
|
|
|
fail_unless (check_frame_positionner_size (clip, 1400, 1200));
|
|
|
|
|
|
|
|
GST_DEBUG ("Removing restriction on track height, should be 1400 x 240");
|
|
|
|
|
|
|
|
caps =
|
|
|
|
gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 1400, "height",
|
|
|
|
G_TYPE_INT, 0, NULL);
|
|
|
|
ges_track_set_restriction_caps (trackv, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline : 1400 x no restriction
|
|
|
|
*
|
|
|
|
* 0--------------0
|
|
|
|
* | width : 1400 |
|
|
|
|
* | height: 240 |
|
|
|
|
* 0--------------2
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Clip width still has to use track width */
|
|
|
|
/* Clip height was set to 0 so it has to use natural clip height */
|
|
|
|
fail_unless (check_frame_positionner_size (clip, 1400, 0));
|
|
|
|
|
|
|
|
GST_DEBUG ("Removing restriction on track width, should be 320 x 240");
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty_simple ("video/x-raw");
|
|
|
|
ges_track_set_restriction_caps (trackv, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Our timeline : no restriction x no restriction
|
|
|
|
*
|
|
|
|
* 0--------------0
|
|
|
|
* | width : 320 |
|
|
|
|
* | height: 240 |
|
|
|
|
* 0--------------2
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Clip width was set to 0 so it has to use natural clip width */
|
|
|
|
/* Clip height was set to 0 so it has to use natural clip height */
|
|
|
|
fail_unless (check_frame_positionner_size (clip, 0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2012-04-24 00:54:15 +00:00
|
|
|
static Suite *
|
|
|
|
ges_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("ges-timeline-edition");
|
|
|
|
TCase *tc_chain = tcase_create ("timeline-edition");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
|
|
|
|
tcase_add_test (tc_chain, test_basic_timeline_edition);
|
|
|
|
tcase_add_test (tc_chain, test_snapping);
|
|
|
|
tcase_add_test (tc_chain, test_timeline_edition_mode);
|
2013-04-14 23:30:10 +00:00
|
|
|
tcase_add_test (tc_chain, test_simple_triming);
|
2013-06-26 21:08:57 +00:00
|
|
|
tcase_add_test (tc_chain, test_groups);
|
|
|
|
tcase_add_test (tc_chain, test_snapping_groups);
|
2013-08-29 09:35:30 +00:00
|
|
|
tcase_add_test (tc_chain, test_scaling);
|
2012-04-24 00:54:15 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2013-05-28 02:10:03 +00:00
|
|
|
GST_CHECK_MAIN (ges);
|