File: timeline.c

package info (click to toggle)
gstreamer-editing-services1.0 1.22.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,944 kB
  • sloc: ansic: 61,405; python: 4,140; lex: 57; makefile: 30
file content (97 lines) | stat: -rw-r--r-- 3,520 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* 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
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include <ges/ges.h>


#define NUM_OBJECTS 1000

gint
main (gint argc, gchar * argv[])
{
  guint i;
  GESAsset *asset;
  GESTimeline *timeline;
  GESLayer *layer;
  GESContainer *container;
  GstClockTime start, start_ripple, end, end_ripple, max_rippling_time = 0,
      min_rippling_time = GST_CLOCK_TIME_NONE;

  gst_init (&argc, &argv);
  ges_init ();
  asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);

  layer = ges_layer_new ();
  timeline = ges_timeline_new_audio_video ();
  ges_timeline_add_layer (timeline, layer);

  start = gst_util_get_timestamp ();
  container = GES_CONTAINER (ges_layer_add_asset (layer, asset, 0,
          0, 1000, GES_TRACK_TYPE_UNKNOWN));

  for (i = 1; i < NUM_OBJECTS; i++)
    ges_layer_add_asset (layer, asset, i * 1000, 0,
        1000, GES_TRACK_TYPE_UNKNOWN);
  end = gst_util_get_timestamp ();
  gst_print ("%" GST_TIME_FORMAT " - adding %d clip to the timeline\n",
      GST_TIME_ARGS (end - start), i);

  start_ripple = gst_util_get_timestamp ();
  for (i = 1; i < 501; i++) {
    start = gst_util_get_timestamp ();
    ges_container_edit (container, NULL, 0, GES_EDIT_MODE_NORMAL,
        GES_EDGE_NONE, i * 1000);
    end = gst_util_get_timestamp ();
    max_rippling_time = MAX (max_rippling_time, end - start);
    min_rippling_time = MIN (min_rippling_time, end - start);
  }
  end_ripple = gst_util_get_timestamp ();
  gst_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
      GST_TIME_FORMAT " min: %" GST_TIME_FORMAT "\n",
      GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
      GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));


  min_rippling_time = GST_CLOCK_TIME_NONE;
  max_rippling_time = 0;
  ges_layer_set_auto_transition (layer, TRUE);
  start_ripple = gst_util_get_timestamp ();
  for (i = 1; i < 501; i++) {
    start = gst_util_get_timestamp ();
    ges_container_edit (container, NULL, 0, GES_EDIT_MODE_NORMAL,
        GES_EDGE_NONE, i * 1000);
    end = gst_util_get_timestamp ();
    max_rippling_time = MAX (max_rippling_time, end - start);
    min_rippling_time = MIN (min_rippling_time, end - start);
  }
  end_ripple = gst_util_get_timestamp ();
  gst_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
      GST_TIME_FORMAT " min: %" GST_TIME_FORMAT " (with auto-transition on)\n",
      GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
      GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));

  start = gst_util_get_timestamp ();
  gst_object_unref (timeline);
  end = gst_util_get_timestamp ();
  gst_print ("%" GST_TIME_FORMAT " - freeing the timeline\n",
      GST_TIME_ARGS (end - start));

  return 0;
}