diff --git a/Tests/test_abi.py b/Tests/test_abi.py new file mode 100755 index 0000000000..838801cab6 --- /dev/null +++ b/Tests/test_abi.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import difflib +import sys +import shutil +import subprocess + +reference_abi = subprocess.check_output(sys.argv[1]).decode().split("\n") +launcher = [] +if shutil.which("mono"): + launcher = ["mono", "--debug"] +csharp_abi = subprocess.check_output(launcher + [sys.argv[2]]).decode().split("\n") +print("Comparing output of %s and %s" % (sys.argv[1], sys.argv[2])) + +res = 0 +for line in difflib.unified_diff(reference_abi, csharp_abi): + res = 1 + print(line) + +if res: + files = [(sys.argv[1] + ".res", reference_abi), + (sys.argv[2] + 'res', csharp_abi)] + + for f, vals in files: + with open(f, "w") as _f: + print("Outputing results in " + f) + _f.write("\n".join(vals)) +sys.exit(res) diff --git a/generate_code.py b/generate_code.py index 8a3bc10ea4..fa8b9da65a 100644 --- a/generate_code.py +++ b/generate_code.py @@ -16,6 +16,7 @@ if __name__ == "__main__": parser.add_argument("--gapi-codegen") parser.add_argument("--glue-file", default="") parser.add_argument("--glue-includes", default="") + parser.add_argument("--abi-cs-usings", default="") parser.add_argument("--glue-libname", default="") parser.add_argument("--assembly-name") parser.add_argument("--extra-includes", action='append', default=[]) @@ -38,7 +39,7 @@ if __name__ == "__main__": shutil.copyfile(opts.api_raw, api_xml) if shutil.which('mono'): - launcher = ['mono'] + launcher = ['mono', '--debug'] else: launcher = [] @@ -56,12 +57,16 @@ if __name__ == "__main__": '--gluelib-name=' + opts.glue_libname, '--glue-includes=' + opts.glue_includes, '--assembly-name=' + opts.assembly_name, - '--all-opaque', + '--abi-c-filename=' + os.path.join(opts.out, opts.assembly_name + "-abi.c"), + '--abi-cs-filename=' + os.path.join(opts.out, opts.assembly_name + "-abi.cs"), ] if opts.schema: cmd += ['--schema=' + opts.schema] + if opts.abi_cs_usings: + cmd += ['--abi-cs-usings=' + opts.abi_cs_usings] + cmd += ['-I' + i for i in opts.extra_includes] subprocess.check_call(launcher + cmd) diff --git a/ges/generated/meson.build b/ges/generated/meson.build index a05d4ff34e..0e336438ed 100644 --- a/ges/generated/meson.build +++ b/ges/generated/meson.build @@ -118,7 +118,7 @@ source_gen = custom_target(pkg + '_codegen', generate_api, '--api-raw', '@INPUT@', '--gapi-fixup', gapi_fixup, - '--metadata', metadata_fname, + '--metadata', metadata, '--gapi-codegen', gapi_codegen, '--extra-includes=' + glib_api_includes, '--extra-includes=' + gio_api_includes, @@ -126,9 +126,24 @@ source_gen = custom_target(pkg + '_codegen', '--out', meson.current_build_dir(), '--files', ';'.join(generated_sources), '--assembly-name', pkg, + '--glue-includes', 'ges/ges.h', + '--abi-cs-usings', 'Gst,Gst.Video,Gst.Sdp,Gst.Tags,Gst.Rtsp,Gst.PbUtils,Gst.Net,Gst.FFT,Gst.Controller,Gst.Base,Gst.Audio,Gst.App,GES', ], depend_files: [raw_api_fname], depends: codegen_dependencies + [gst_source_gen]) +c_abi = custom_target(pkg + '_c_abi', + input: raw_api_fname, + output: pkg + '-abi.c', + command: [generate_api, '--fakeglue'], + depends: [source_gen]) + +cs_abi = custom_target(pkg + '_cs_abi', + input: raw_api_fname, + output: pkg + '-abi.cs', + command: [generate_api, '--fakeglue'], + depends: [source_gen]) + + gapis += [join_paths(meson.current_build_dir(), pkg + '-api.xml')] gapis_deps = [source_gen] diff --git a/ges/gst-editing-services.metadata b/ges/gst-editing-services.metadata index a594d196b1..1c45cab11a 100644 --- a/ges/gst-editing-services.metadata +++ b/ges/gst-editing-services.metadata @@ -32,4 +32,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA private private private + GMarkupParser + + true + + + + + + diff --git a/ges/meson.build b/ges/meson.build index 3429b7bce6..2193df0161 100644 --- a/ges/meson.build +++ b/ges/meson.build @@ -1,6 +1,6 @@ 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') +metadata = files(pkg + '.metadata') subdir('generated') @@ -9,12 +9,22 @@ ges_sharp = library(pkg + '-sharp', source_gen, link_with: gst_sharp, dependencies: [glib_sharp_dep, gio_sharp_dep]) -ges_sharp_dep = declare_dependency(dependencies: [glib_sharp_dep, gio_sharp_dep, gst_sharp_dep, - ges_dep], link_with: ges_sharp) +ges_sharp_dep = declare_dependency(dependencies: [glib_sharp_dep, gio_sharp_dep, gst_sharp_dep], link_with: ges_sharp) configure_file( input: pkg + '-sharp.dll.config', output: pkg + '-sharp.dll.config', configuration: configuration_data()) +if add_languages('c', required: false) + c_abi_exe = executable(pkg + '_c_abi', c_abi, + c_args: ['-Wno-deprecated', '-Wno-deprecated-declarations'], + dependencies: [gst_deps, ges_dep]) + + cs_abi_exe = executable(pkg + '_cs_abi', cs_abi, + cs_args: ['-nowarn:169', '-nowarn:108', '-nowarn:114', '-nowarn:0618', '-unsafe'], + dependencies: [ges_sharp_dep]) + + test(pkg + 'abi', diff, args: [c_abi_exe.full_path(), cs_abi_exe.full_path()]) +endif diff --git a/meson.build b/meson.build index e3cf4789ff..639401bb51 100644 --- a/meson.build +++ b/meson.build @@ -47,6 +47,7 @@ gapi_codegen = gapi_codegen.full_path() gacutil = find_program('gacutil') generate_api = find_program('generate_code.py') nuget = find_program('nuget.py') +diff = find_program('Tests/test_abi.py') # TODO Handle monodoc diff --git a/samples/PlaybackTutorial3.cs b/samples/PlaybackTutorial3.cs index 47ecef5893..dc725b0638 100644 --- a/samples/PlaybackTutorial3.cs +++ b/samples/PlaybackTutorial3.cs @@ -93,7 +93,7 @@ namespace GstreamerSharp // This function is called when playbin has created the appsrc element, so we have a chance to configure it. static void SourceSetup (object sender, GLib.SignalArgs args) { - var info = new Gst.Audio.AudioInfo(); + var info = new Gst.Audio.AudioInfo (); var source = new Gst.App.AppSrc(((Element)args.Args [0]).Handle); Console.WriteLine ("Source has been created. Configuring."); AppSource = source; diff --git a/sources/generated/meson.build b/sources/generated/meson.build index 2a64c84d6c..200edd1d05 100644 --- a/sources/generated/meson.build +++ b/sources/generated/meson.build @@ -688,7 +688,6 @@ generated_sources = [ 'Gst.Net_PtpClock.cs', 'Gst.Net_Gst.NetSharp.PtpStatisticsCallbackNative.cs', 'Gst.Net_NetControlMessageMeta.cs', - 'Gst.Net_NtpClock.cs', 'Gst.Net_NetAddressMeta.cs', 'Gst.Net_NetTimePacket.cs', 'Gst.Net_Constants.cs', @@ -719,17 +718,31 @@ gst_source_gen = custom_target('gst_codegen', generate_api, '--api-raw', '@INPUT@', '--gapi-fixup', gapi_fixup, - '--metadata', metadata_fname, + '--metadata', metadata, '--gapi-codegen', gapi_codegen, '--extra-includes=' + glib_api_includes, '--extra-includes=' + gio_api_includes, '--out', meson.current_build_dir(), '--files', ';'.join(generated_sources), '--assembly-name', meson.project_name(), + '--glue-includes', glueincludes, + '--abi-cs-usings', 'Gst,Gst.Video,Gst.Sdp,Gst.Tags,Gst.Rtsp,Gst.PbUtils,Gst.Net,Gst.FFT,Gst.Controller,Gst.Base,Gst.Audio,Gst.App', ], depend_files: [raw_api_fname], depends: codegen_dependencies) +c_abi = custom_target('gst_sharp_c_abi', + input: raw_api_fname, + output: 'gstreamer-sharp-abi.c', + command: [generate_api, '--fakeglue'], + depends: [gst_source_gen]) + +cs_abi = custom_target('gst_sharp_cs_abi', + input: raw_api_fname, + output: 'gstreamer-sharp-abi.cs', + command: [generate_api, '--fakeglue'], + depends: [gst_source_gen]) + gst_api_includes = join_paths(meson.current_build_dir(), 'gstreamer-sharp-api.xml') gapis = [gst_api_includes] gapis_deps = [gst_source_gen] diff --git a/sources/gstreamer-sharp.metadata b/sources/gstreamer-sharp.metadata index 8249af956f..3e447b817e 100644 --- a/sources/gstreamer-sharp.metadata +++ b/sources/gstreamer-sharp.metadata @@ -67,17 +67,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA true true - - - - - - true @@ -87,11 +76,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA true guint32* - true 1 1 - true true @@ -117,16 +104,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - true true true true - - true - 1 @@ -190,6 +173,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA gpointer gpointer 1 + true true gpointer @@ -203,6 +187,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 1 1 AddAudioPadTemplate + GstMeta + GstAudioChannelPosition* + GstAudioChannelPosition* true @@ -271,7 +258,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA true true true - //boxed[@cname='GstVideoCodecFrame'] true gpointer GList* @@ -281,7 +267,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA gint64 gint64 true - true + gpointer + false ref true @@ -323,19 +310,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA guint8* n_length true + guint8* + guint8* + guint8* + guint8* + guint8* + guint8* + guint8* + guint8* + guint8* + guint32* + guint32* + gdouble* + true + + true + true true true - true - true - true - true - true - true + true + true + true + true + true + true diff --git a/sources/meson.build b/sources/meson.build index 748d9d55e1..2cea50447a 100644 --- a/sources/meson.build +++ b/sources/meson.build @@ -1,8 +1,7 @@ raw_api_fname = join_paths(meson.current_source_dir(), meson.project_name() + '-api.raw') -metadata_fname = join_paths(meson.current_source_dir(), meson.project_name() + '.metadata') +metadata = files(meson.project_name() + '.metadata') -glueincludes = 'gst/gst.h,gst/app/app.h,gst/audio/audio.h,gst/base/base.h,gst/controller/controller.h,gst/fft/fft.h,gst/net/net.h,gst/pbutils/gstaudiovisualizer.h,gst/pbutils/pbutils.h,gst/rtp/rtp.h,gst/rtsp/rtsp.h,gst/sdp/sdp.h,gst/tag/tag.h,gst/video/video.h' -gluefile = join_paths(meson.current_build_dir(), 'generate.c') +glueincludes = 'glib.h,gst/gst.h,gst/video/video.h,gst/audio/audio.h,gst/rtsp/rtsp.h,gst/app/app.h,gst/audio/audio.h,gst/base/base.h,gst/controller/controller.h,gst/fft/fft.h,gst/net/net.h,gst/pbutils/gstaudiovisualizer.h,gst/pbutils/pbutils.h,gst/rtp/rtp.h,gst/rtsp/rtsp.h,gst/sdp/sdp.h,gst/tag/tag.h,gst/video/video.h,gst/video/gstvideoaffinetransformationmeta.h,gst/net/gstnetcontrolmessagemeta.h' sources = [ 'custom/Adapter.cs', @@ -42,6 +41,18 @@ gst_sharp = library('gstreamer-sharp', gst_source_gen, sources, gst_sharp_dep = declare_dependency(dependencies: [glib_sharp_dep, gio_sharp_dep], link_with: gst_sharp) +if add_languages('c', required: false) + c_abi_exe = executable('gst_sharp_c_abi', c_abi, + cs_args: ['-nowarn:169', '-nowarn:108', '-nowarn:114', '-unsafe'], + dependencies: [gst_deps]) + + cs_abi_exe = executable('gst_sharp_cs_abi', cs_abi, + cs_args: ['-nowarn:169', '-nowarn:108', '-nowarn:114', '-unsafe'], + dependencies: [gst_sharp_dep]) + + test('gstreamer_sharp_abi', diff, args: [c_abi_exe.full_path(), cs_abi_exe.full_path()]) +endif + configure_file( input: '../out/gstreamer-sharp.dll.config', output: 'gstreamer-sharp.dll.config',