From b1f6e5bbe275a498c6608451c86df8fab15eae97 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 20 Jul 2014 03:32:48 +0200 Subject: [PATCH] Fix compilation errors --- sources/Makefile.am | 4 +- sources/custom/Buffer.cs | 50 +++++++++++++++++++ sources/custom/Iterator.cs | 2 +- sources/glue/Makefile.am | 2 + sources/gstreamer-sharp-api.raw | 74 ++++++++++++++-------------- sources/gstreamer-sharp.metadata | 103 +++++++++++---------------------------- 6 files changed, 121 insertions(+), 114 deletions(-) create mode 100644 sources/custom/Buffer.cs diff --git a/sources/Makefile.am b/sources/Makefile.am index fbc8607..87b95e5 100644 --- a/sources/Makefile.am +++ b/sources/Makefile.am @@ -35,11 +35,11 @@ generated-stamp: $(API) $(GAPI_CODEGEN) --generate $(srcdir)/$(API) $(GLIB_SHARP_CFLAGS) \ --outdir=generated \ --glue-filename=$(GLUEDIR)/generated.c --gluelib-name=libgstreamersharpglue-1.0.0.dll \ - --glue-includes=gst/gst.h,`cd $(GST_INCLUDEDIR);find gst -type f -name "*.h" | tr "\n" ","` \ + --glue-includes=gst/gst.h,`cd $(GST_INCLUDEDIR);find gst -type f -name "*.h" -not -path "gst/gl/*" | tr "\n" ","` \ --assembly-name=$(ASSEMBLY_NAME) && touch generated-stamp $(DLL): $(build_sources) generated-stamp - $(CSC) -nowarn:169 -unsafe -target:library $(GLIB_SHARP_LIBS) \ + $(CSC) -nowarn:169 -nowarn:108 -nowarn:114 -unsafe -target:library $(GLIB_SHARP_LIBS) \ $(build_sources) generated/*/*.cs -out:$(DLL) install-data-local: diff --git a/sources/custom/Buffer.cs b/sources/custom/Buffer.cs new file mode 100644 index 0000000..3ebdea1 --- /dev/null +++ b/sources/custom/Buffer.cs @@ -0,0 +1,50 @@ +// Copyright (C) 2014 Stephan Sundermann +// +// 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 + +namespace Gst { + using System; + using System.Collections; + using System.Runtime.InteropServices; + + partial class Buffer { + [DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern UIntPtr gst_buffer_extract(IntPtr raw, UIntPtr offset, byte[] dest, UIntPtr size); + + public ulong Extract(ulong offset, ref byte[] dest) { + UIntPtr raw_ret = gst_buffer_extract(Handle, new UIntPtr (offset), dest, new UIntPtr ((ulong)dest.Length)); + ulong ret = (ulong) raw_ret; + return ret; + } + + [DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gst_buffer_extract_dup(IntPtr raw, UIntPtr offset, UIntPtr size, out IntPtr dest, out UIntPtr dest_size); + + public ulong ExtractDup(ulong offset, ulong size, out byte[] dest) { + UIntPtr native_dest_size; + IntPtr ptr; + gst_buffer_extract_dup(Handle, new UIntPtr (offset), new UIntPtr (size), out ptr, out native_dest_size); + + byte[] bytes = new byte[(ulong)native_dest_size]; + Marshal.Copy (ptr, bytes, 0, (int)native_dest_size); + + dest = bytes; + GLib.Marshaller.Free (ptr); + + return (ulong) native_dest_size; + } + } +} diff --git a/sources/custom/Iterator.cs b/sources/custom/Iterator.cs index 4a32278..4028c8c 100644 --- a/sources/custom/Iterator.cs +++ b/sources/custom/Iterator.cs @@ -114,7 +114,7 @@ namespace Gst { ~Iterator () { if (Raw != IntPtr.Zero) - Free (); + Free (Handle); } } diff --git a/sources/glue/Makefile.am b/sources/glue/Makefile.am index 6423a58..6b1b079 100644 --- a/sources/glue/Makefile.am +++ b/sources/glue/Makefile.am @@ -8,6 +8,8 @@ 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 diff --git a/sources/gstreamer-sharp-api.raw b/sources/gstreamer-sharp-api.raw index 8736c0f..145ab37 100644 --- a/sources/gstreamer-sharp-api.raw +++ b/sources/gstreamer-sharp-api.raw @@ -16241,18 +16241,18 @@ - - - - - - - - + + + + + + + + - - - + + + @@ -16544,9 +16544,9 @@ - - - + + + @@ -16632,8 +16632,8 @@ - - + + @@ -16704,14 +16704,14 @@ - - - - + + + + - - - + + + @@ -16720,17 +16720,17 @@ - + - - + + - - - - + + + + @@ -17447,7 +17447,7 @@ -