summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2021-05-18 11:31:19 -0400
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-05-21 21:26:19 +0000
commitcb4dab37a104b4d38a0db7ef33eca7bc68f10dee (patch)
tree2d91bd645efb4f0938d06b47cfeaa4fd3ac5366d
parentb24d1918f870bb720e71c24b2713e18ddbbd707f (diff)
examples: c: Sensibly simplify the simple example
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/252>
-rw-r--r--examples/c/simple1.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/examples/c/simple1.c b/examples/c/simple1.c
index e97c84d3..04239684 100644
--- a/examples/c/simple1.c
+++ b/examples/c/simple1.c
@@ -28,9 +28,9 @@ main (int argc, gchar ** argv)
GOptionContext *ctx;
GESPipeline *pipeline;
GESTimeline *timeline;
- GESTrack *tracka, *trackv;
- GESLayer *layer1, *layer2;
+ GESLayer *layer1;
GESUriClip *src;
+ gchar *uri;
GMainLoop *mainloop;
gint inpoint = 0, duration = 10;
@@ -72,33 +72,22 @@ main (int argc, gchar ** argv)
/* Create an Audio/Video pipeline with two layers */
pipeline = ges_pipeline_new ();
+ timeline = ges_timeline_new_audio_video ();
+ layer1 = ges_timeline_append_layer (timeline);
- timeline = ges_timeline_new ();
-
- tracka = GES_TRACK (ges_audio_track_new ());
- trackv = GES_TRACK (ges_video_track_new ());
-
- layer1 = ges_layer_new ();
- layer2 = ges_layer_new ();
- g_object_set (layer2, "priority", 1, NULL);
-
- if (!ges_timeline_add_layer (timeline, layer1) ||
- !ges_timeline_add_layer (timeline, layer2) ||
- !ges_timeline_add_track (timeline, tracka) ||
- !ges_timeline_add_track (timeline, trackv) ||
- !ges_pipeline_set_timeline (pipeline, timeline))
+ if (!ges_pipeline_set_timeline (pipeline, timeline)) {
+ g_error ("Could not set timeline to pipeline");
return -1;
-
- if (1) {
- gchar *uri = gst_filename_to_uri (argv[1], NULL);
- /* Add the main audio/video file */
- src = ges_uri_clip_new (uri);
- g_free (uri);
- g_object_set (src, "start", 0, "in-point", inpoint * GST_SECOND,
- "duration", duration * GST_SECOND, "mute", mute, NULL);
- ges_layer_add_clip (layer1, GES_CLIP (src));
}
+ uri = gst_filename_to_uri (argv[1], NULL);
+ /* Add the main audio/video file */
+ src = ges_uri_clip_new (uri);
+ ges_layer_add_clip (layer1, GES_CLIP (src));
+ g_free (uri);
+ g_object_set (src, "start", 0, "in-point", inpoint * GST_SECOND,
+ "duration", duration * GST_SECOND, "mute", mute, NULL);
+
/* Play the pipeline */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
mainloop = g_main_loop_new (NULL, FALSE);