diff --git a/Makefile.am b/Makefile.am index e33bfd2e6e..979caa69ee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,12 @@ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --with-bash-completion-dir=no -SUBDIRS = ges tests tools common m4 pkgconfig docs bindings plugins +if BUILD_EXAMPLES +EXAMPLES_SUBDIRS= examples +else +EXAMPLES_SUBDIRS= +endif + +SUBDIRS = ges tests tools common m4 pkgconfig docs bindings plugins $(EXAMPLES_SUBDIRS) DIST_SUBDIRS = $(SUBDIRS) diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am index 22bf444c77..14602de377 100644 --- a/bindings/python/Makefile.am +++ b/bindings/python/Makefile.am @@ -1,5 +1 @@ SUBDIRS = gi - -if BUILD_EXAMPLES -SUBDIRS += examples -endif diff --git a/bindings/python/examples/Makefile.am b/bindings/python/examples/Makefile.am deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/configure.ac b/configure.ac index 6e36dc65dc..77a38b161c 100644 --- a/configure.ac +++ b/configure.ac @@ -460,7 +460,8 @@ ges/Makefile tests/Makefile tests/check/Makefile tests/benchmarks/Makefile -tests/examples/Makefile +examples/Makefile +examples/c/Makefile tests/validate/Makefile tests/validate/scenarios/Makefile tools/Makefile @@ -476,6 +477,5 @@ bindings/Makefile bindings/python/Makefile bindings/python/gi/Makefile bindings/python/gi/overrides/Makefile -bindings/python/examples/Makefile ) AC_OUTPUT diff --git a/tests/examples/.gitignore b/examples/.gitignore similarity index 100% rename from tests/examples/.gitignore rename to examples/.gitignore diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000000..a32817546c --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = c + +AM_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS) $(GTK_CFLAGS) +AM_LDFLAGS = -export-dynamic +LDADD = $(top_builddir)/ges/libges-@GST_API_VERSION@.la $(GST_PBUTILS_LIBS) $(GST_LIBS) $(GTK_LIBS) diff --git a/tests/examples/Makefile.am b/examples/c/Makefile.am similarity index 93% rename from tests/examples/Makefile.am rename to examples/c/Makefile.am index 4d55a94785..35c9d0e472 100644 --- a/tests/examples/Makefile.am +++ b/examples/c/Makefile.am @@ -17,8 +17,10 @@ noinst_PROGRAMS = \ text_properties \ assets \ multifilesrc \ + play_timeline_with_one_clip \ $(graphical) AM_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS) $(GTK_CFLAGS) AM_LDFLAGS = -export-dynamic LDADD = $(top_builddir)/ges/libges-@GST_API_VERSION@.la $(GST_PBUTILS_LIBS) $(GST_LIBS) $(GTK_LIBS) + diff --git a/tests/examples/assets.c b/examples/c/assets.c similarity index 100% rename from tests/examples/assets.c rename to examples/c/assets.c diff --git a/tests/examples/concatenate.c b/examples/c/concatenate.c similarity index 100% rename from tests/examples/concatenate.c rename to examples/c/concatenate.c diff --git a/tests/examples/ges-ui.c b/examples/c/ges-ui.c similarity index 100% rename from tests/examples/ges-ui.c rename to examples/c/ges-ui.c diff --git a/tests/examples/ges-ui.glade b/examples/c/ges-ui.glade similarity index 100% rename from tests/examples/ges-ui.glade rename to examples/c/ges-ui.glade diff --git a/tests/examples/multifilesrc.c b/examples/c/multifilesrc.c similarity index 100% rename from tests/examples/multifilesrc.c rename to examples/c/multifilesrc.c diff --git a/tests/examples/overlays.c b/examples/c/overlays.c similarity index 100% rename from tests/examples/overlays.c rename to examples/c/overlays.c diff --git a/examples/c/play_timeline_with_one_clip.c b/examples/c/play_timeline_with_one_clip.c new file mode 100644 index 0000000000..745def4257 --- /dev/null +++ b/examples/c/play_timeline_with_one_clip.c @@ -0,0 +1,62 @@ +/* This example can be found in the GStreamer Editing Services git repository in: + * examples/c/play_timeline_with_one_clip.c + */ +#include + +int +main (int argc, char **argv) +{ + GESLayer *layer; + GESTimeline *timeline; + + if (argc == 1) { + g_printerr ("Usage: play_timeline_with_one_clip file:///clip/uri\n"); + + return 1; + } + + gst_init (NULL, NULL); + ges_init (); + + timeline = ges_timeline_new_audio_video (); + layer = ges_timeline_append_layer (timeline); + + { + /* Add a clip with a duration of 5 seconds */ + GESClip *clip = GES_CLIP (ges_uri_clip_new (argv[1])); + + if (clip == NULL) { + g_printerr ("%s can not be used, make sure it is a supported media file", + argv[1]); + + return 1; + } + + g_object_set (clip, "duration", 5 * GST_SECOND, "start", 0, NULL); + ges_layer_add_clip (layer, clip); + } + + /* Commiting the timeline is always necessary for changes + * inside it to be taken into account by the Non Linear Engine */ + ges_timeline_commit (timeline); + + { + /* Play the timeline */ + GESPipeline *pipeline = ges_pipeline_new (); + GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + + ges_pipeline_set_timeline (pipeline, timeline); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + + /* Simple way to just play the pipeline until EOS or an error pops on the bus */ + gst_bus_timed_pop_filtered (bus, 10 * GST_SECOND, + GST_MESSAGE_EOS | GST_MESSAGE_ERROR); + + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + gst_object_unref (bus); + gst_object_unref (pipeline); + } + + + return 0; +} diff --git a/tests/examples/simple1.c b/examples/c/simple1.c similarity index 100% rename from tests/examples/simple1.c rename to examples/c/simple1.c diff --git a/tests/examples/test1.c b/examples/c/test1.c similarity index 100% rename from tests/examples/test1.c rename to examples/c/test1.c diff --git a/tests/examples/test2.c b/examples/c/test2.c similarity index 100% rename from tests/examples/test2.c rename to examples/c/test2.c diff --git a/tests/examples/test3.c b/examples/c/test3.c similarity index 100% rename from tests/examples/test3.c rename to examples/c/test3.c diff --git a/tests/examples/test4.c b/examples/c/test4.c similarity index 100% rename from tests/examples/test4.c rename to examples/c/test4.c diff --git a/tests/examples/text_properties.c b/examples/c/text_properties.c similarity index 100% rename from tests/examples/text_properties.c rename to examples/c/text_properties.c diff --git a/tests/examples/thumbnails.c b/examples/c/thumbnails.c similarity index 100% rename from tests/examples/thumbnails.c rename to examples/c/thumbnails.c diff --git a/tests/examples/transition.c b/examples/c/transition.c similarity index 100% rename from tests/examples/transition.c rename to examples/c/transition.c diff --git a/examples/python/simple.py b/examples/python/simple.py new file mode 100755 index 0000000000..1de9f6e613 --- /dev/null +++ b/examples/python/simple.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +# +# GStreamer +# +# Copyright (C) 2013 Thibault Saunier