mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
Also use the copy-on-unref workaround for the message-owned Structure here instead of always copying
This commit is contained in:
parent
5a58c3dc24
commit
02e2d6e3fc
1 changed files with 14 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue