Added some custom code for Message Fixed some metadata

This commit is contained in:
Stephan Sundermann 2013-07-11 15:20:51 +02:00
parent a8c7682238
commit 4b10c322fe
3 changed files with 82 additions and 7 deletions

View file

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

72
sources/custom/Message.cs Normal file
View file

@ -0,0 +1,72 @@
// Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.com>
//
// 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 <http://www.gnu.org/licenses/>.
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);
}
}
}
}

View file

@ -9,8 +9,6 @@
<attr path="/api/namespace/object[@cname='GstPadTemplate']/property[@name='Caps']" name="type">gpointer</attr>
<!-- Error with array -->
<attr path="/api/namespace/object[@cname='GstGlobal']/method[@cname='gst_formats_contains']" name="hidden">true</attr>
<!-- Handle is missing in GstBuffer -->
<attr path="/api/namespace/boxed[@cname='GstBuffer']/method[@cname='gst_buffer_set_size']" name="hidden">true</attr>
<!-- MiniObject issues -->
<attr path="/api/namespace/struct[@cname='GstMiniObject']/field[@cname='copy']" name="type">gpointer</attr>
<attr path="/api/namespace/struct[@cname='GstMiniObject']/field[@cname='free']" name="type">gpointer</attr>
@ -38,7 +36,7 @@
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_parse')]">/api/namespace/class[@name='Parse']</move-node>
<remove-node path="/api/namespace/object[@name='Global']//method[@cname = 'gst_caps_from_string']" />
<move-node path="/api/namespace/object[@name='Global']//method[contains(@cname, 'caps')]">/api/namespace/boxed[@cname='GstCaps']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[contains(@cname, 'caps')]">/api/namespace/struct[@cname='GstCaps']</move-node>
<add-node path="/api/namespace[@name='Gst']"><class name="Debug" cname="GstDebug" disable_void_ctor="1"></class></add-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_debug')]">/api/namespace/class[@cname='GstDebug']</move-node>
@ -57,10 +55,15 @@
<move-node path="/api/namespace/object[@name='Global']//method[contains(@cname, 'registry')]">/api/namespace/object[@cname='GstRegistry']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_poll')]">/api/namespace/struct[@cname='GstPoll']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_message')]">/api/namespace/boxed[@cname='GstMessage']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_event')]">/api/namespace/boxed[@cname='GstEvent']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_query')]">/api/namespace/boxed[@cname='GstQuery']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_message')]">/api/namespace/struct[@cname='GstMessage']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_event')]">/api/namespace/struct[@cname='GstEvent']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_query')]">/api/namespace/struct[@cname='GstQuery']</move-node>
<move-node path="/api/namespace/object[@name='Global']//method[starts-with(@cname, 'gst_pad')]">/api/namespace/object[@cname='GstPad']</move-node>
<attr path="/api/namespace/object[@name='Global']" name ="hidden">true</attr>
<!-- Things implemented on our own -->
<attr path="/api/namespace/struct[@cname='GstMessage']/method[@cname='gst_message_parse_error']" name="hidden">true</attr>
<attr path="/api/namespace/struct[@cname='GstMessage']/method[@cname='gst_message_get_stream_status_object']" name="hidden">true</attr>
<attr path="/api/namespace/struct[@cname='GstMessage']/method[@cname='gst_message_set_stream_status_object']" name="hidden">true</attr>
</metadata>