Also use the copy-on-unref workaround for the message-owned Structure here instead of always copying

This commit is contained in:
Sebastian Dröge 2009-04-22 11:54:49 +02:00
parent 5a58c3dc24
commit 02e2d6e3fc

View file

@ -67,17 +67,29 @@ public uint Seqnum {
}
private Gst.Structure cached_structure = null;
[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_message_get_structure (IntPtr raw);
public Gst.Structure Structure {
get {
IntPtr raw_ret = gst_structure_copy (gst_message_get_structure (Handle));
Gst.Structure ret = raw_ret == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Structure), false);
if (cached_structure != null)
return cached_structure;
IntPtr raw_ret = gst_message_get_structure (Handle);
Gst.Structure ret = raw_ret == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Structure), true);
ret.FreeNative = false;
cached_structure = ret;
return ret;
}
}
~Message () {
cached_structure.CreateNativeCopy ();
cached_structure = null;
}
[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_eos (IntPtr src);