gstreamer/gstreamer-sharp/MiniObject.custom

51 lines
1.4 KiB
Text

protected MiniObject () : base ()
{
}
public MiniObject (GLib.Value val) : base () {
Raw = gst_value_dup_mini_object (ref val);
}
public static explicit operator GLib.Value (MiniObject o) {
GLib.Value val = new GLib.Value (new GLib.GType (gstsharp_g_type_from_instance (o.Handle)));
gst_value_set_mini_object (ref val, o.Handle);
return val;
}
public void SetGValue (ref GLib.Value val) {
gst_value_set_mini_object (ref val, Handle);
}
[DllImport ("gstreamersharpglue-0.10.dll") ]
private static extern IntPtr gstsharp_g_type_from_instance (IntPtr o);
[DllImport ("gstreamer-0.10.dll") ]
private static extern IntPtr gst_value_dup_mini_object (ref GLib.Value v);
[DllImport ("gstreamer-0.10.dll") ]
private static extern void gst_value_set_mini_object (ref GLib.Value v, IntPtr o);
/* FIXME: This is not optimal! */
public void MakeWritable() {
if (IsWritable)
return;
IntPtr copy = gst_mini_object_copy (Raw);
Raw = copy;
/* ^--- Takes a second ref, not good */
Unref (Raw);
/* ^--- Sets Owned = false, wrong! */
Owned = true;
}
[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_mini_object_copy (IntPtr raw);
public Gst.MiniObject Copy() {
IntPtr raw_ret = gst_mini_object_copy (Handle);
GLib.GType type = new GLib.GType (gstsharp_g_type_from_instance (raw_ret));
Gst.MiniObject ret = raw_ret == IntPtr.Zero ? null : (Gst.MiniObject) GLib.Opaque.GetOpaque (raw_ret, (Type) type, true);
return ret;
}