[gst-cvs] gstreamer-sharp: Also use the copy-on-unref workaround for the message-owned Structure here instead of always copying
Sebastian Dröge
slomo at kemper.freedesktop.org
Wed Apr 22 02:55:26 PDT 2009
Module: gstreamer-sharp
Branch: master
Commit: 02e2d6e3fc4ca8a06b0cf0cb6f09aab9206888d9
URL: http://cgit.freedesktop.org/gstreamer/gstreamer-sharp/commit/?id=02e2d6e3fc4ca8a06b0cf0cb6f09aab9206888d9
Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date: Wed Apr 22 11:54:49 2009 +0200
Also use the copy-on-unref workaround for the message-owned Structure here instead of always copying
---
gstreamer-sharp/Message.custom | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/gstreamer-sharp/Message.custom b/gstreamer-sharp/Message.custom
index 8aec26a..2877c0a 100644
--- a/gstreamer-sharp/Message.custom
+++ b/gstreamer-sharp/Message.custom
@@ -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);
More information about the Gstreamer-commits
mailing list