Generate bindings for GES if avalaible

This commit is contained in:
Thibault Saunier 2017-08-29 15:25:18 -03:00
parent 473e2f633b
commit 893169175d
12 changed files with 4220 additions and 5 deletions

136
ges/generated/meson.build Normal file
View file

@ -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])

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
<configuration>
<!-- Linux -->
<dllmap dll="libgessharpglue-1.0.dll" target="libgessharpglue-1.0.0.so" os="linux"/>
<dllmap dll="libges-1.0-0.dll" target="libges-1.0.so" os="linux"/>
<!-- Mac OS X -->
<dllmap dll="libgessharpglue-1.0.dll" target="libgessharpglue-1.0.0.so" os="osx"/>
<dllmap dll="libges-1.0-0.dll" target="libges-1.0.dylib" os="osx"/>
</configuration>

View file

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.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
-->
<metadata>
<remove-node path="/api/namespace/object[@cname='GESSmartAdder']"/>
<remove-node path="/api/namespace/object/method[@cname='ges_uri_clip_is_image']"/>
<remove-node path="/api/namespace/object/method[@cname='ges_uri_clip_set_is_image']"/>
<!--FIXME- This fix should not be needed (ie. bindinator is messing with us).-->
<attr path="/api/namespace/object[@parent='GObject.InitiallyUnowned']" name="parent">GInitiallyUnowned</attr>
<attr path="/api/namespace/object[@parent='GObject.Object']" name="parent">GObject</attr>
<attr path="/api/namespace/object[@cname='GESGlobal']/method[@cname='ges_init_check']" name="hidden">true</attr>
<attr path="/api/namespace/object[@name='TimelineElement']/field[@cname='asset']" name="hidden">true</attr>
<attr path="/api/namespace/object[@name='TimelineElement']/field[@cname='parent']" name="access">private</attr>
<attr path="/api/namespace/object[@name='TimelineElement']/field[@cname='parent_instance']" name="access">private</attr>
<attr path="/api/namespace/object[@name='Layer']/field[@cname='parent']" name="access">private</attr>
<attr path="/api/namespace/object[@name='Formatter']/field[@cname='parent']" name="access">private</attr>
</metadata>

39
ges/meson.build Normal file
View file

@ -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())

View file

@ -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

70
samples/GESExample.cs Normal file
View file

@ -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);
}
}
}

View file

@ -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

View file

@ -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')

View file

@ -102,7 +102,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
<add-node path="/api/namespace[@name='Gst']">
<class name="Application" cname="GstApplication" disable_void_ctor="1"/>
</add-node>
<move-node path="/api/namespace//object[@name='Global']//method[contains(@cname, 'init') or starts-with(@cname, 'gst_version')]">/api/namespace/class[@cname='GstApplication']</move-node>
<move-node path="/api/namespace//object[@name='Global']//method[contains(@cname, 'gst_init') or starts-with(@cname, 'gst_version')]">/api/namespace/class[@cname='GstApplication']</move-node>
<add-node path="/api/namespace[@name='Gst']">
<class name="Value" cname="GstValue" disable_void_ctor="1"/>

View file

@ -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)