1 /* Gstreamer Editing Services
3 * Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
24 #define NUM_OBJECTS 1000
27 main (gint argc, gchar * argv[])
31 GESTimeline *timeline;
33 GESContainer *container;
34 GstClockTime start, start_ripple, end, end_ripple, max_rippling_time = 0,
35 min_rippling_time = GST_CLOCK_TIME_NONE;
37 gst_init (&argc, &argv);
39 asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
41 layer = ges_layer_new ();
42 timeline = ges_timeline_new_audio_video ();
43 ges_timeline_add_layer (timeline, layer);
45 start = gst_util_get_timestamp ();
46 container = GES_CONTAINER (ges_layer_add_asset (layer, asset, 0,
47 0, 1000, GES_TRACK_TYPE_UNKNOWN));
49 for (i = 1; i < NUM_OBJECTS; i++)
50 ges_layer_add_asset (layer, asset, i * 1000, 0,
51 1000, GES_TRACK_TYPE_UNKNOWN);
52 end = gst_util_get_timestamp ();
53 gst_print ("%" GST_TIME_FORMAT " - adding %d clip to the timeline\n",
54 GST_TIME_ARGS (end - start), i);
56 start_ripple = gst_util_get_timestamp ();
57 for (i = 1; i < 501; i++) {
58 start = gst_util_get_timestamp ();
59 ges_container_edit (container, NULL, 0, GES_EDIT_MODE_NORMAL,
60 GES_EDGE_NONE, i * 1000);
61 end = gst_util_get_timestamp ();
62 max_rippling_time = MAX (max_rippling_time, end - start);
63 min_rippling_time = MIN (min_rippling_time, end - start);
65 end_ripple = gst_util_get_timestamp ();
66 gst_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
67 GST_TIME_FORMAT " min: %" GST_TIME_FORMAT "\n",
68 GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
69 GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));
72 min_rippling_time = GST_CLOCK_TIME_NONE;
73 max_rippling_time = 0;
74 ges_layer_set_auto_transition (layer, TRUE);
75 start_ripple = gst_util_get_timestamp ();
76 for (i = 1; i < 501; i++) {
77 start = gst_util_get_timestamp ();
78 ges_container_edit (container, NULL, 0, GES_EDIT_MODE_NORMAL,
79 GES_EDGE_NONE, i * 1000);
80 end = gst_util_get_timestamp ();
81 max_rippling_time = MAX (max_rippling_time, end - start);
82 min_rippling_time = MIN (min_rippling_time, end - start);
84 end_ripple = gst_util_get_timestamp ();
85 gst_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
86 GST_TIME_FORMAT " min: %" GST_TIME_FORMAT " (with auto-transition on)\n",
87 GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
88 GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));
90 start = gst_util_get_timestamp ();
91 gst_object_unref (timeline);
92 end = gst_util_get_timestamp ();
93 gst_print ("%" GST_TIME_FORMAT " - freeing the timeline\n",
94 GST_TIME_ARGS (end - start));