mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 13:38:48 +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") ]
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
static extern IntPtr gst_message_get_structure (IntPtr raw);
|
static extern IntPtr gst_message_get_structure (IntPtr raw);
|
||||||
|
|
||||||
public Gst.Structure Structure {
|
public Gst.Structure Structure {
|
||||||
get {
|
get {
|
||||||
IntPtr raw_ret = gst_structure_copy (gst_message_get_structure (Handle));
|
if (cached_structure != null)
|
||||||
Gst.Structure ret = raw_ret == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Structure), false);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~Message () {
|
||||||
|
cached_structure.CreateNativeCopy ();
|
||||||
|
cached_structure = null;
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport ("gstreamer-0.10.dll") ]
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
static extern IntPtr gst_message_new_eos (IntPtr src);
|
static extern IntPtr gst_message_new_eos (IntPtr src);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue