diff options
Diffstat (limited to 'samples')
-rw-r--r-- | samples/GESExample.cs | 70 | ||||
-rw-r--r-- | samples/meson.build | 7 |
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 |