mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
examples: c: Sensibly simplify the simple example
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/252>
This commit is contained in:
parent
b24d1918f8
commit
cb4dab37a1
1 changed files with 14 additions and 25 deletions
|
@ -28,9 +28,9 @@ main (int argc, gchar ** argv)
|
||||||
GOptionContext *ctx;
|
GOptionContext *ctx;
|
||||||
GESPipeline *pipeline;
|
GESPipeline *pipeline;
|
||||||
GESTimeline *timeline;
|
GESTimeline *timeline;
|
||||||
GESTrack *tracka, *trackv;
|
GESLayer *layer1;
|
||||||
GESLayer *layer1, *layer2;
|
|
||||||
GESUriClip *src;
|
GESUriClip *src;
|
||||||
|
gchar *uri;
|
||||||
GMainLoop *mainloop;
|
GMainLoop *mainloop;
|
||||||
|
|
||||||
gint inpoint = 0, duration = 10;
|
gint inpoint = 0, duration = 10;
|
||||||
|
@ -72,33 +72,22 @@ main (int argc, gchar ** argv)
|
||||||
|
|
||||||
/* Create an Audio/Video pipeline with two layers */
|
/* Create an Audio/Video pipeline with two layers */
|
||||||
pipeline = ges_pipeline_new ();
|
pipeline = ges_pipeline_new ();
|
||||||
|
timeline = ges_timeline_new_audio_video ();
|
||||||
|
layer1 = ges_timeline_append_layer (timeline);
|
||||||
|
|
||||||
timeline = ges_timeline_new ();
|
if (!ges_pipeline_set_timeline (pipeline, timeline)) {
|
||||||
|
g_error ("Could not set timeline to pipeline");
|
||||||
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))
|
|
||||||
return -1;
|
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 */
|
/* Play the pipeline */
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
mainloop = g_main_loop_new (NULL, FALSE);
|
mainloop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue