summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@osg.samsung.com>2017-08-29 15:25:18 -0300
committerThibault Saunier <thibault.saunier@osg.samsung.com>2017-08-29 22:20:46 -0300
commit893169175d1e0e69c0fe511975cc5b73ffd55cbd (patch)
tree14cd8fc103221ef73eae25db6a2c971cc84a08b3 /samples
parent473e2f633b8d20007ae245ae23b79ff894311735 (diff)
Generate bindings for GES if avalaible
Diffstat (limited to 'samples')
-rw-r--r--samples/GESExample.cs70
-rw-r--r--samples/meson.build7
2 files changed, 77 insertions, 0 deletions
diff --git a/samples/GESExample.cs b/samples/GESExample.cs
new file mode 100644
index 0000000..6ba2dbd
--- /dev/null
+++ b/samples/GESExample.cs
@@ -0,0 +1,70 @@
+// Authors
+// Copyright (C) 2017 Thibault Saunier <thibault.saunier@osg-samsung.com>
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301 USA
+
+
+using System;
+using Gst;
+using System.Diagnostics;
+
+namespace GESSharp
+{
+ class GESExample
+ {
+ public static void Main (string[] args)
+ {
+ // Initialize Gstreamer
+ Gst.Application.Init();
+
+ // Build the pipeline
+ GES.Global.Init();
+ var pipeline = new GES.Pipeline();
+ var timeline = GES.Timeline.NewAudioVideo();
+ var layer = timeline.AppendLayer();
+
+ pipeline["timeline"] = timeline;
+
+ var clip = new GES.TitleClip();
+ clip.Duration = Constants.SECOND * 5;
+ layer.AddClip(clip);
+ clip.SetChildProperty("text", new GLib.Value("Clip 1"));
+
+ var clip1 = new GES.TitleClip();
+ clip1.Start = Constants.SECOND * 5;
+ clip1.Duration = Constants.SECOND * 5;
+ layer.AddClip(clip1);
+ clip1.SetChildProperty("text", new GLib.Value("Clip 2"));
+
+ timeline.Commit();
+
+ pipeline.SetState(State.Playing);
+ //// Wait until error or EOS
+ var bus = pipeline.Bus;
+ Message msg = null;
+ while (msg == null) {
+ var format = Format.Time;
+ long position;
+ msg = bus.TimedPopFiltered (Gst.Constants.SECOND, MessageType.Eos | MessageType.Error);
+
+ pipeline.QueryPosition (format, out position);
+ Console.WriteLine("position: " + Global.TimeFormat(position)
+ + " / " + Global.TimeFormat(timeline.Duration));
+ }
+ pipeline.SetState(State.Null);
+ }
+ }
+}
diff --git a/samples/meson.build b/samples/meson.build
index 8cf2b5b..5a6db9f 100644
--- a/samples/meson.build
+++ b/samples/meson.build
@@ -33,3 +33,10 @@ foreach example: examples
cs_args: ['-unsafe'], dependencies: deps)
endif
endforeach
+
+if ges_dep.found()
+ executable('ges-example', 'GESExample.cs',
+ cs_args: ['-unsafe'],
+ dependencies: [gst_sharp_dep],
+ link_with: ges_sharp)
+endif