Do not use glue anymore!

This is not needed anymore as ABI compatible structures are now generated
and used by the code generator.
This commit is contained in:
Thibault Saunier 2017-08-30 23:52:29 -03:00
parent 8193dd746c
commit 9c289eb563
15 changed files with 32 additions and 109 deletions

View file

@ -183,7 +183,6 @@ AC_SUBST(GST_INCLUDEDIR)
AC_CONFIG_FILES([
Makefile
sources/Makefile
sources/glue/Makefile
samples/Makefile
sources/AssemblyInfo.cs
gstreamer-sharp-1.0.pc

View file

@ -14,9 +14,9 @@ if __name__ == "__main__":
parser.add_argument("--gapi-fixup")
parser.add_argument("--metadata")
parser.add_argument("--gapi-codegen")
parser.add_argument("--glue-file")
parser.add_argument("--glue-includes")
parser.add_argument("--glue-libname")
parser.add_argument("--glue-file", default='')
parser.add_argument("--glue-includes", default='')
parser.add_argument("--glue-libname", default='')
parser.add_argument("--assembly-name")
parser.add_argument("--extra-includes", action='append', default=[])
parser.add_argument("--out")

View file

@ -123,12 +123,9 @@ source_gen = custom_target(pkg + '_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])

View file

@ -3,29 +3,14 @@ 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')
ges_sharp = library(pkg + '-sharp', source_gen, sources,
ges_sharp = library(pkg + '-sharp', source_gen,
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)

View file

@ -19,7 +19,6 @@ glib_sharp = gtk_sharp.get_variable('glib_sharp')
gio_sharp_dep = gtk_sharp.get_variable('gio_sharp_dep')
gio_sharp = gtk_sharp.get_variable('gio_sharp')
gio_glue = gtk_sharp.get_variable('gio_glue')
gapi_fixup = gtk_sharp.get_variable('gapi_fixup')
gapi_codegen = gtk_sharp.get_variable('gapi_codegen')
@ -78,9 +77,7 @@ endif
meson.add_install_script(nuget, '--package-name', 'GstSharp',
'--assembly', gst_sharp.full_path(),
'--native', gst_glue.full_path(),
'--assembly', gio_sharp.full_path(),
'--native', gio_glue.full_path(),
'--assembly', glib_sharp.full_path(),
'--project-url', 'https://gstreamer.freedesktop.org/modules/gstreamer-sharp.html',
'--icon-url', 'https://gstreamer.freedesktop.org/images/header-logo-top.png',

View file

@ -1,6 +1,5 @@
<configuration>
<!-- Linux -->
<dllmap dll="libgstreamersharpglue-1.0.0.dll" target="libgstreamersharpglue-1.0.0.so" os="linux"/>
<dllmap dll="libgstreamer-1.0-0.dll" target="libgstreamer-1.0.so" os="linux"/>
<dllmap dll="libgstaudio-1.0-0.dll" target="libgstaudio-1.0.so" os="linux"/>
<dllmap dll="libgstbase-1.0-0.dll" target="libgstbase-1.0.so" os="linux"/>
@ -18,7 +17,6 @@
<dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0.so" os="linux"/>
<dllmap dll="libgthread-2.0-0.dll" target="libgthread-2.0.so" os="linux"/>
<!-- Mac OS X -->
<dllmap dll="libgstreamersharpglue-1.0.0.dll" target="libgstreamersharpglue-1.0.0.so" os="osx"/>
<dllmap dll="libgstreamer-1.0-0.dll" target="libgstreamer-1.0.dylib" os="osx"/>
<dllmap dll="libgstaudio-1.0-0.dll" target="libgstaudio-1.0.dylib" os="osx"/>
<dllmap dll="libgstbase-1.0-0.dll" target="libgstbase-1.0.dylib" os="osx"/>

View file

@ -27,4 +27,4 @@ namespace GstreamerSharp
pipeline.SetState (State.Null);
}
}
}
}

View file

@ -202,8 +202,6 @@ namespace Gst
Connect (o, name, false, handler);
}
static int g_closure_sizeof = gstsharp_g_closure_sizeof ();
public static void Connect (GLib.Object o, string name,
bool after, Delegate handler)
{
@ -226,16 +224,14 @@ namespace Gst
if (!SignalInfo.IsValidDelegate (handler))
throw new Exception ("Invalid delegate");
IntPtr closure = g_closure_new_simple (g_closure_sizeof, IntPtr.Zero);
// Let's allocate 64bytes for the GClosure, it should be more than necessary.
IntPtr closure = g_closure_new_simple (64, IntPtr.Zero);
g_closure_set_meta_marshal (closure, (IntPtr)GCHandle.Alloc (k), marshalHandler);
uint signalId = g_signal_connect_closure (o.Handle, name, closure, after);
SignalHandlers.Add (k, new SignalInfo (signalId, closure, handler));
}
}
[DllImport ("libgstreamersharpglue-1.0.0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int gstsharp_g_closure_sizeof ();
public static void Disconnect (GLib.Object o, string name, Delegate handler)
{
ObjectSignalKey k = new ObjectSignalKey (o, name);
@ -333,7 +329,11 @@ namespace Gst
public static object Emit (GLib.Object o, string name, params object[] parameters)
{
SignalQuery query;
IntPtr type = gstsharp_g_type_from_instance (o.Handle);
IntPtr type;
unsafe {
// GType is the first field of GTypeInstance->g_class
type = (*(IntPtr*) ((GLib.Object.GTypeInstance*) o.Handle)->g_class);
}
GType gtype = new GType (type);
string signal_name, signal_detail;
uint signal_detail_quark = 0;
@ -424,9 +424,6 @@ namespace Gst
return ret;
}
[DllImport ("libgstreamersharpglue-1.0.0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gstsharp_g_type_from_instance (IntPtr o);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int g_signal_handler_disconnect (IntPtr o, uint handler_id);

View file

@ -26,8 +26,6 @@ namespace Gst {
static extern void gst_message_parse_error (IntPtr msg, out IntPtr err, out IntPtr debug);
public void ParseError (out GLib.GException error, out string debug) {
if (Type != MessageType.Error)
throw new ArgumentException ();
IntPtr err;
IntPtr dbg;
@ -53,15 +51,11 @@ namespace Gst {
public GLib.Value StreamStatusObject {
get {
if(Type != MessageType.StreamStatus)
throw new ArgumentException ();
IntPtr raw_ret = gst_message_get_stream_status_object(Handle);
GLib.Value ret = (GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (GLib.Value));
return ret;
}
set {
if(Type != MessageType.StreamStatus)
throw new ArgumentException ();
IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
gst_message_set_stream_status_object(Handle, native_value);
value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));

View file

@ -31,6 +31,19 @@ namespace Gst {
public class PropertyNotFoundException : Exception {}
[StructLayout (LayoutKind.Sequential)]
struct GstObject {
IntPtr _lock;
public string name;
public Object parent;
public uint flags;
IntPtr controlBindings;
public int control_rate;
public int last_sync;
private IntPtr[] _gstGstReserved;
}
partial class Object
{
private Dictionary <string, bool> PropertyNameCache = new Dictionary<string, bool> ();

View file

@ -724,8 +724,6 @@ gst_source_gen = custom_target('gst_codegen',
'--gapi-codegen', gapi_codegen,
'--extra-includes=' + glib_api_includes,
'--extra-includes=' + gio_api_includes,
'--glue-file', gluefile,
'--glue-includes', glueincludes,
'--out', meson.current_build_dir(),
'--files', ';'.join(generated_sources),
'--assembly-name', meson.project_name(),

View file

@ -1,22 +0,0 @@
lib_LTLIBRARIES = libgstreamersharpglue-1.0.0.la
libgstreamersharpglue_1_0_0_la_SOURCES = gobject.c
nodist_libgstreamersharpglue_1_0_0_la_SOURCES = generated.c
libgstreamersharpglue_1_0_0_la_LDFLAGS = -module -avoid-version -no-undefined
libgstreamersharpglue_1_0_0_la_LIBADD = $(GST_LIBS)
libgstreamersharpglue_1_0_0_la_CPPFLAGS = -DGST_USE_UNSTABLE_API
INCLUDES = $(GST_CFLAGS) -I$(top_srcdir)
libgstreamersharpglue.dll: $(libgstreamersharpglue_1_0_0_la_OBJECTS) libgstreamersharpglue.rc libgstreamersharpglue.def
./build-dll libgstreamersharpglue $(VERSION)
CLEANFILES = lib*.a lib*.dll generated.c
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST =

View file

@ -1,34 +0,0 @@
//
// Authors:
// Sebastian Dröge <sebastian.droege@collabora.co.uk>
//
// Copyright (C) 2009 Sebastian Dröge
//
// 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
#include <glib-object.h>
gint
gstsharp_g_closure_sizeof (void)
{
return sizeof (GClosure);
}
GType
gstsharp_g_type_from_instance (GTypeInstance * instance)
{
return G_TYPE_FROM_INSTANCE (instance);
}

View file

@ -139,6 +139,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
<attr path="/api/namespace/boxed[@cname='GstVideoCodecState']/field[@cname='padding']" name="type">gpointer</attr>
<attr path="/api/namespace/object[@cname='GstVideoDecoder']/field[@cname='padding']" name="type">gpointer</attr>
<attr path="/api/namespace/object[@cname='GstVideoDecoder']/class_struct/field[@cname='padding']" name="type">gpointer</attr>
<attr path="/api/namespace/object[@cname='GstVideoEncoder']/field[@cname='padding']" name="type">gpointer</attr>
<attr path="/api/namespace/struct[@cname='GstByteReader']" name="opaque">1</attr>
<remove-node path="/api/namespace//struct[@cname='GstByteReader']//method"/>
<attr path="//struct[@name='VideoGLTextureUploadMeta']//field[@cname='user_data_copy' or @cname='user_data_free']" name="hidden">true</attr>

View file

@ -41,13 +41,13 @@ gst_sharp = library('gstreamer-sharp', gst_source_gen, sources,
'-keyfile:' + snk],
dependencies: [glib_sharp_dep, gio_sharp_dep])
gluegen = custom_target('gluegen',
input: raw_api_fname,
output: 'generate.c',
command: [generate_api, '--fakeglue'],
depends: [gst_source_gen])
#gluegen = custom_target('gluegen',
#input: raw_api_fname,
#output: 'generate.c',
#command: [generate_api, '--fakeglue'],
#depends: [gst_source_gen])
gst_glue = library('gstreamersharpglue-1.0.0', gluegen, 'glue/gobject.c', dependencies: gst_deps)
#gst_glue = library('gstreamersharpglue-1.0.0', gluegen, 'glue/gobject.c', dependencies: gst_deps)
gst_sharp_dep = declare_dependency(dependencies: [glib_sharp_dep, gio_sharp_dep],
link_with: gst_sharp)