From: Thibault Saunier Date: Tue, 29 Aug 2017 18:25:18 +0000 (-0300) Subject: Generate bindings for GES if avalaible X-Git-Tag: 1.19.3~483^2~115 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=893169175d1e0e69c0fe511975cc5b73ffd55cbd;p=platform%2Fupstream%2Fgstreamer.git Generate bindings for GES if avalaible --- diff --git a/ges/generated/meson.build b/ges/generated/meson.build new file mode 100644 index 0000000..487de28 --- /dev/null +++ b/ges/generated/meson.build @@ -0,0 +1,136 @@ +generated_sources = [ + 'GLib_GLibSharp.AsyncReadyCallbackNative.cs', + 'GtkSharp_ObjectManager.cs', + 'GES_AssetAddedHandler.cs', + 'GES_Error.cs', + 'GES_SourceClip.cs', + 'GES_OperationClip.cs', + 'GES_GroupAddedHandler.cs', + 'GES_ClipAddedHandler.cs', + 'GES_Clip.cs', + 'GES_TrackRemovedHandler.cs', + 'GES_Layer.cs', + 'GES_ClipRemovedHandler.cs', + 'GES_ControlBindingRemovedHandler.cs', + 'GES_Global.cs', + 'GES_ControlBindingAddedHandler.cs', + 'GES_Pipeline.cs', + 'GES_VideoUriSource.cs', + 'GES_CreateTrackElementsFunc.cs', + 'GES_MetaFlag.cs', + 'GES_ChildRemovedHandler.cs', + 'GES_Asset.cs', + 'GES_ImageSource.cs', + 'GES_LayerRemovedHandler.cs', + 'GES_AssetRemovedHandler.cs', + 'GES_IMetaContainer.cs', + 'GES_Group.cs', + 'GES_TextVAlign.cs', + 'GES_SnappingEndedHandler.cs', + 'GES_CreateElementForGapFunc.cs', + 'GES_TransitionClip.cs', + 'GES_Track.cs', + 'GES_GESSharp.FormatterCanLoadURIMethodNative.cs', + 'GES_BaseEffect.cs', + 'GES_ChildrenControlMode.cs', + 'GES_OverlayClip.cs', + 'GES_ClipAsset.cs', + 'GES_GESSharp.CreateTrackElementFuncNative.cs', + 'GES_PitiviFormatter.cs', + 'GES_AudioTestSource.cs', + 'GES_UriClip.cs', + 'GES_AudioTrack.cs', + 'GES_Container.cs', + 'GES_IExtractable.cs', + 'GES_VideoTransition.cs', + 'GES_GESSharp.FormatterLoadFromURIMethodNative.cs', + 'GES_AudioSource.cs', + 'GES_BaseXmlFormatter.cs', + 'GES_AssetLoadingReturn.cs', + 'GES_CreateTrackElementFunc.cs', + 'GES_Timeline.cs', + 'GES_FormatterCanLoadURIMethod.cs', + 'GES_ExtractableCheckId.cs', + 'GES_EffectClip.cs', + 'GES_TestClip.cs', + 'GES_TitleSource.cs', + 'GES_FormatterSaveToURIMethod.cs', + 'GES_LoadedHandler.cs', + 'GES_Operation.cs', + 'GES_VideoStandardTransitionType.cs', + 'GES_GESSharp.FillTrackElementFuncNative.cs', + 'GES_LayerAddedHandler.cs', + 'GES_GESSharp.ExtractableCheckIdNative.cs', + 'GES_Source.cs', + 'GES_EditMode.cs', + 'GES_AssetLoadingHandler.cs', + 'GES_TextHAlign.cs', + 'GES_TitleClip.cs', + 'GES_Transition.cs', + 'GES_VideoTestSource.cs', + 'GES_AudioUriSource.cs', + 'GES_ChildAddedHandler.cs', + 'GES_TimelineElement.cs', + 'GES_CommandLineFormatter.cs', + 'GES_GESSharp.CreateTrackElementsFuncNative.cs', + 'GES_TrackType.cs', + 'GES_Project.cs', + 'GES_GESSharp.CreateElementForGapFuncNative.cs', + 'GES_UriSourceAsset.cs', + 'GES_MetaContainerAdapter.cs', + 'GES_ExtractableAdapter.cs', + 'GES_XmlFormatter.cs', + 'GES_TrackAddedHandler.cs', + 'GES_EffectAsset.cs', + 'GES_AudioTransition.cs', + 'GES_Formatter.cs', + 'GES_SnappingStartedHandler.cs', + 'GES_FillTrackElementFunc.cs', + 'GES_Effect.cs', + 'GES_UriClipAsset.cs', + 'GES_MultiFileSource.cs', + 'GES_TextOverlay.cs', + 'GES_VideoSource.cs', + 'GES_Constants.cs', + 'GES_TextOverlayClip.cs', + 'GES_TrackElementRemovedHandler.cs', + 'GES_FormatterLoadFromURIMethod.cs', + 'GES_PipelineFlags.cs', + 'GES_VideoTrack.cs', + 'GES_BaseEffectClip.cs', + 'GES_TrackElement.cs', + 'GES_TrackElementAddedHandler.cs', + 'GES_BaseTransitionClip.cs', + 'GES_TrackElementAsset.cs', + 'GES_VideoTestPattern.cs', + 'GES_Edge.cs', + 'GES_GESSharp.FormatterSaveToURIMethodNative.cs', + 'GES_DeepNotifyHandler.cs', + 'GES_MetaForeachFunc.cs', + 'GES_GESSharp.MetaForeachFuncNative.cs', + 'GES_NotifyMetaHandler.cs', +] + +source_gen = custom_target(pkg + '_codegen', + input: raw_api_fname, + output: generated_sources, + command: [ + generate_api, + '--api-raw', '@INPUT@', + '--gapi-fixup', gapi_fixup, + '--metadata', metadata_fname, + '--gapi-codegen', gapi_codegen, + '--extra-includes=' + glib_api_includes, + '--extra-includes=' + gio_api_includes, + '--extra-includes=' + gst_api_includes, + '--glue-file', gluefile, + '--glue-includes', glueincludes, + '--out', meson.current_build_dir(), + '--files', ';'.join(generated_sources), + '--assembly-name', pkg, + '--glue-libname', 'libgessharpglue-' + apiversion + '.dll', + ], + depend_files: [raw_api_fname], + depends: codegen_dependencies + [gst_source_gen]) + + diff --git a/ges/gst-editing-services-api.raw b/ges/gst-editing-services-api.raw new file mode 100644 index 0000000..cbf8793 --- /dev/null +++ b/ges/gst-editing-services-api.raw @@ -0,0 +1,3905 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + missing glib:type-name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ges/gst-editing-services-sharp.dll.config b/ges/gst-editing-services-sharp.dll.config new file mode 100644 index 0000000..f6f7333 --- /dev/null +++ b/ges/gst-editing-services-sharp.dll.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ges/gst-editing-services.metadata b/ges/gst-editing-services.metadata new file mode 100644 index 0000000..a594d19 --- /dev/null +++ b/ges/gst-editing-services.metadata @@ -0,0 +1,35 @@ + + + + + + + + + GInitiallyUnowned + GObject + + true + true + private + private + private + private + diff --git a/ges/meson.build b/ges/meson.build new file mode 100644 index 0000000..b077d44 --- /dev/null +++ b/ges/meson.build @@ -0,0 +1,39 @@ +pkg = 'gst-editing-services' +raw_api_fname = join_paths(meson.current_source_dir(), pkg + '-api.raw') +metadata_fname = join_paths(meson.current_source_dir(), pkg + '.metadata') +snk = join_paths(meson.current_source_dir(), '../', meson.project_name() + '.snk') + +glueincludes = 'ges/ges.h' +gluefile = join_paths(meson.current_build_dir(), 'generate.c') + +sources = [ + 't.cs' +] + +subdir('generated') + +# Install with gacutil_install.py from gtk-sharp. +ges_sharp = library(pkg + '-sharp', source_gen, sources, + cs_args: ['-nowarn:169', '-nowarn:108', '-nowarn:114', '-unsafe', + '-keyfile:' + snk], + link_with: gst_sharp, + dependencies: [glib_sharp_dep, gio_sharp_dep]) + +gluegen = custom_target(pkg + 'gluegen', + input: raw_api_fname, + output: 'generate.c', + command: [generate_api, '--fakeglue'], + depends: [source_gen]) + +library('gessharpglue-1.0.0', gluegen, dependencies: gst_deps + [ges_dep]) + +ges_sharp_dep = declare_dependency(dependencies: [glib_sharp_dep, gio_sharp_dep, gst_sharp_dep, + ges_dep], link_with: ges_sharp) +meson.add_install_script(gacutil_install, meson.project_name(), gst_sharp.full_path()) + +configure_file( + input: pkg + '-sharp.dll.config', + output: pkg + '-sharp.dll.config', + configuration: configuration_data()) + + diff --git a/meson.build b/meson.build index 64f88a1..a61fdf4 100644 --- a/meson.build +++ b/meson.build @@ -80,7 +80,14 @@ foreach dep: [ fallback: dep.get(1))] endforeach +ges_dep = dependency('gst-editing-services-' + apiversion, version: gst_required_version, + fallback: ['gst-editing-services', 'ges_dep']) + subdir('sources') +if ges_dep.found() + subdir('ges') +endif + subdir('samples') bindinate = find_program('bindinate', required: false) @@ -92,4 +99,11 @@ if bindinate.found() '--merge-with=GstApp-1.0,GstAudio-1.0,GstBase-1.0,GstController-1.0,GstFft-1.0,GstNet-1.0,GstPbutils-1.0,GstRiff-1.0,GstRtp-1.0,GstRtsp-1.0,GstSdp-1.0,GstTag-1.0,GstVideo-1.0', '--gir=Gst-1.0'] ) + python3 = import('python3').find_python() + run_target('update-ges-bindings', + command: ['sh', '-c', + '''bindinate --name=gst-editing-services --regenerate=true --gir=GES-1.0 && mv @0@/sources/gst-editing-services-sharp-api.raw @0@/ges/gst-editing-services-api.raw '''.format( + meson.current_source_dir()) + ] + ) endif 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 +// +// 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 diff --git a/sources/custom/Value.cs b/sources/custom/Value.cs index 3171ab5..5885f93 100644 --- a/sources/custom/Value.cs +++ b/sources/custom/Value.cs @@ -649,4 +649,4 @@ namespace Gst private static extern void gst_value_array_append_value (ref GLib.Value val, ref GLib.Value el); } -} \ No newline at end of file +} diff --git a/sources/generated/meson.build b/sources/generated/meson.build index 6216cec..4f89d8f 100644 --- a/sources/generated/meson.build +++ b/sources/generated/meson.build @@ -713,7 +713,7 @@ generated_sources = [ 'Gst.Rtp_RTPBaseAudioPayload.cs' ] -source_gen = custom_target('gst_codegen', +gst_source_gen = custom_target('gst_codegen', input: raw_api_fname, output: generated_sources, command: [ @@ -734,3 +734,4 @@ source_gen = custom_target('gst_codegen', depend_files: [raw_api_fname], depends: codegen_dependencies) +gst_api_includes = join_paths(meson.current_build_dir(), 'gstreamer-sharp-api.xml') diff --git a/sources/gstreamer-sharp.metadata b/sources/gstreamer-sharp.metadata index 8db661a..2b0a85f 100644 --- a/sources/gstreamer-sharp.metadata +++ b/sources/gstreamer-sharp.metadata @@ -102,7 +102,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - /api/namespace/class[@cname='GstApplication'] + /api/namespace/class[@cname='GstApplication'] diff --git a/sources/meson.build b/sources/meson.build index d6b10e0..b16ce9a 100644 --- a/sources/meson.build +++ b/sources/meson.build @@ -36,7 +36,7 @@ sources = [ subdir('generated') # Install with gacutil_install.py from gtk-sharp. -gst_sharp = library('gstreamer-sharp', source_gen, sources, +gst_sharp = library('gstreamer-sharp', gst_source_gen, sources, cs_args: ['-nowarn:169', '-nowarn:108', '-nowarn:114', '-unsafe', '-keyfile:' + snk], dependencies: [glib_sharp_dep, gio_sharp_dep]) @@ -45,7 +45,7 @@ gluegen = custom_target('gluegen', input: raw_api_fname, output: 'generate.c', command: [generate_api, '--fakeglue'], - depends: [source_gen]) + depends: [gst_source_gen]) library('gstreamersharpglue-1.0.0', gluegen, 'glue/gobject.c', dependencies: gst_deps)