static GESExtractable *
ges_project_extract (GESAsset * project, GError ** error)
{
- GESTimeline *timeline = ges_timeline_new ();
+ GESTimeline *timeline = g_object_new (GES_TYPE_TIMELINE, NULL);
if (_load_project (GES_PROJECT (project), timeline, error))
return GES_EXTRACTABLE (timeline);
/**
* GESProject::asset-added:
- * @formatter: the #GESProject
+ * @project: the #GESProject
* @asset: The #GESAsset that has been added to @project
*/
_signals[ASSET_ADDED_SIGNAL] =
/**
* GESProject::asset-removed:
- * @formatter: the #GESProject
+ * @project: the #GESProject
* @asset: The #GESAsset that has been removed from @project
*/
_signals[ASSET_REMOVED_SIGNAL] =
GESTimeline *
ges_timeline_new (void)
{
- return g_object_new (GES_TYPE_TIMELINE, NULL);
+ GESProject *project = ges_project_new (NULL);
+
+ return GES_TIMELINE (ges_asset_extract (GES_ASSET (project), NULL));
}
/**
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
track = GES_TRACK (ges_audio_track_new ());
layer = ges_layer_new ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
GST_DEBUG ("Create a layer");
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
GST_DEBUG ("Create a layer");
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
GST_DEBUG ("Create a layer");
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
GST_DEBUG ("Create a layer");
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
g_signal_connect (timeline, "select-tracks-for-object",
ges_init ();
layer = ges_layer_new ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
fail_unless (ges_timeline_add_layer (timeline, layer));
pipeline = ges_test_create_pipeline (timeline);
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
ASSERT_OBJECT_REFCOUNT (timeline, "timeline", 1);
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = ges_layer_new ();
audio_track = GES_TRACK (ges_audio_track_new ());
video_track = GES_TRACK (ges_video_track_new ());
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
track_video = GES_TRACK (ges_video_track_new ());
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
track_video = GES_TRACK (ges_video_track_new ());
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = ges_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
track_video = GES_TRACK (ges_video_track_new ());
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_timeline_append_layer (timeline);
layer1 = ges_timeline_append_layer (timeline);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
/* Our timeline
*
ges_init ();
/* Timeline and 1 Layer */
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_layer_new ();
/* The default priority is 0 */
ges_init ();
/* Timeline and 3 Layer */
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer1 = (GESLayer *) ges_layer_new ();
layer2 = (GESLayer *) ges_layer_new ();
layer3 = (GESLayer *) ges_layer_new ();
fail_unless (GES_IS_ASSET (asset));
GST_DEBUG ("Create timeline");
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
assert_is_type (timeline, GES_TYPE_TIMELINE);
GST_DEBUG ("Create layers");
fail_unless (GES_IS_ASSET (asset));
GST_DEBUG ("Create timeline");
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
assert_is_type (timeline, GES_TYPE_TIMELINE);
GST_DEBUG ("Create first layer");
fail_unless (GES_IS_ASSET (asset));
GST_DEBUG ("Create timeline");
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
assert_is_type (timeline, GES_TYPE_TIMELINE);
GST_DEBUG ("Create first layer");
fail_unless (GES_IS_ASSET (asset));
GST_DEBUG ("Create timeline");
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
assert_is_type (timeline, GES_TYPE_TIMELINE);
GST_DEBUG ("Append a layer to the timeline");
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
GstMessage *message;
GESLayer *layer, *layer1;
GESTrack *track = GES_TRACK (ges_audio_track_new ());
- GESTimeline *timeline = ges_timeline_new ();
+ GESTimeline *timeline = create_timeline_sync (FALSE);
GESPipeline *pipeline = ges_test_create_pipeline (timeline);
ges_timeline_add_track (timeline, track);
GESLayer *layer, *layer1;
GESTrack *track = GES_TRACK (ges_video_track_new ());
GESTrack *track_audio = GES_TRACK (ges_audio_track_new ());
- GESTimeline *timeline = ges_timeline_new ();
+ GESTimeline *timeline = create_timeline_sync (FALSE);
GESPipeline *pipeline = ges_test_create_pipeline (timeline);
ges_timeline_add_track (timeline, track);
fail_unless (track != NULL);
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
/* This is the simplest scenario ever */
/* Timeline and 1 Layer */
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
fail_unless (ges_timeline_add_layer (timeline, layer));
track = GES_TRACK (ges_video_track_new ());
ges_init ();
/* Timeline and 1 Layer */
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
fail_unless (ges_timeline_add_layer (timeline, layer));
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_new_any ());
ges_init ();
/* Timeline and 1 Layer */
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
g_signal_connect (G_OBJECT (layer), "notify::valid",
return TRUE;
}
+
+static void
+_project_loaded_cb (GESProject * project, GESTimeline * timeline, GMainLoop * l)
+{
+ GST_DEBUG_OBJECT (project, "Loaded");
+ g_main_loop_quit (l);
+}
+
+GESTimeline *
+create_timeline_sync (gboolean audio_video)
+{
+ GMainLoop *l;
+ GESAsset *project;
+ GESTimeline *timeline;
+
+ if (audio_video)
+ timeline = ges_timeline_new_audio_video ();
+ else
+ timeline = ges_timeline_new ();
+
+ project = ges_extractable_get_asset (GES_EXTRACTABLE (timeline));
+
+ l = g_main_loop_new (NULL, FALSE);
+ g_signal_connect (project, "loaded", G_CALLBACK (_project_loaded_cb), l);
+ g_main_loop_run (l);
+ g_main_loop_unref (l);
+
+ return timeline;
+}
gboolean
play_timeline (GESTimeline * timeline);
+
+/* This function is needed to avoid having an extra refcount when creating a blanck
+ * timeline and while the project::loaded signal has not been emited, as this is
+ * done on idle. This function will wait for that signal to be emited before
+ * returning the new timeline*/
+GESTimeline * create_timeline_sync (gboolean audio_video);
+
#define gnl_object_check(gnlobj, start, duration, mstart, mduration, priority, active) { \
guint64 pstart, pdur, inpoint, pprio, pact; \
g_object_get (gnlobj, "start", &pstart, "duration", &pdur, \
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
track = GES_TRACK (ges_audio_track_new ());
fail_unless (track != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_track (timeline, track));
track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_track (timeline, track));
g_main_loop_run (mainloop);
/* the asset is now loaded */
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
assets = ges_project_list_assets (project, GES_TYPE_CLIP);
assert_equals_int (g_list_length (assets), 1);
track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_track (timeline, track));
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
/* Our timeline
*
ges_init ();
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
g_object_set (timeline, "snapping-distance", (guint64) 3, NULL);
/* Our timeline
G_TYPE_INT, 1000, NULL);
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
ges_timeline_add_track (timeline, trackv);
layer = ges_layer_new ();
fail_unless (ges_timeline_add_layer (timeline, layer));
ges_init ();
+ timeline = create_timeline_sync (FALSE);
track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL);
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new ();
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
ges_init ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
track = GES_TRACK (ges_video_track_new ());
layer = ges_layer_new ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (track != NULL);
fail_unless (layer != NULL);
fail_unless (timeline != NULL);
track = GES_TRACK (ges_video_track_new ());
layer = ges_layer_new ();
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (track != NULL);
fail_unless (layer != NULL);
fail_unless (timeline != NULL);
mainloop = g_main_loop_new (NULL, FALSE);
- timeline = ges_timeline_new_audio_video ();
+ timeline = create_timeline_sync (TRUE);
fail_unless (timeline != NULL);
layer = ges_layer_new ();
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (GES_IS_TIMELINE (timeline));
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track));
layer = ges_layer_new ();
fail_unless (layer != NULL);
- timeline = ges_timeline_new ();
+ timeline = create_timeline_sync (FALSE);
fail_unless (timeline != NULL);
fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, a));