gstreamer/gstreamer-sharp/MiniObject.custom
2009-04-16 22:19:59 +02:00

40 lines
1 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;
}