diff --git a/sources/Makefile.am b/sources/Makefile.am index cd9aeb73cb..13de6e11da 100644 --- a/sources/Makefile.am +++ b/sources/Makefile.am @@ -4,7 +4,7 @@ METADATA = $(ASSEMBLY_NAME).metadata DLL = $(top_srcdir)/out/$(ASSEMBLY_NAME).dll DLLMAP = $(top_srcdir)/out/$(ASSEMBLY_NAME).dll.config -sources = +sources = custom/*.cs build_sources = AssemblyInfo.cs $(sources) diff --git a/sources/custom/Message.cs b/sources/custom/Message.cs new file mode 100644 index 0000000000..bd810816ed --- /dev/null +++ b/sources/custom/Message.cs @@ -0,0 +1,72 @@ +// Copyright (C) 2013 Stephan Sundermann +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +namespace Gst { + + using System; + using System.Runtime.InteropServices; + + partial class Message + { + [DllImport ("gstreamer-1.0") ] + 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; + + gst_message_parse_error (Handle, out err, out dbg); + + if (dbg != IntPtr.Zero) + debug = GLib.Marshaller.Utf8PtrToString (dbg); + else + debug = null; + + if (err == IntPtr.Zero) + throw new Exception (); + + error = new GLib.GException (err); + } + + [DllImport("gstreamer-1.0", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gst_message_get_stream_status_object(IntPtr raw); + + [DllImport("gstreamer-1.0", CallingConvention = CallingConvention.Cdecl)] + static extern void gst_message_set_stream_status_object(IntPtr raw, IntPtr value); + + public GLib.Value StreamStatusObject { + get { + Update (); + 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 { + Update (); + 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)); + Marshal.FreeHGlobal (native_value); + } + } + } +} \ No newline at end of file diff --git a/sources/gst-sharp.metadata b/sources/gst-sharp.metadata index a59a77d462..239d6582d7 100644 --- a/sources/gst-sharp.metadata +++ b/sources/gst-sharp.metadata @@ -9,8 +9,6 @@ gpointer true - - true gpointer gpointer @@ -38,7 +36,7 @@ /api/namespace/class[@name='Parse'] - /api/namespace/boxed[@cname='GstCaps'] + /api/namespace/struct[@cname='GstCaps'] /api/namespace/class[@cname='GstDebug'] @@ -57,10 +55,15 @@ /api/namespace/object[@cname='GstRegistry'] /api/namespace/struct[@cname='GstPoll'] - /api/namespace/boxed[@cname='GstMessage'] - /api/namespace/boxed[@cname='GstEvent'] - /api/namespace/boxed[@cname='GstQuery'] + /api/namespace/struct[@cname='GstMessage'] + /api/namespace/struct[@cname='GstEvent'] + /api/namespace/struct[@cname='GstQuery'] /api/namespace/object[@cname='GstPad'] true + + + true + true + true