2009-04-12 18:55:11 +00:00
|
|
|
protected MiniObject () : base ()
|
2009-04-07 09:27:20 +00:00
|
|
|
{
|
|
|
|
}
|
2009-04-11 15:52:50 +00:00
|
|
|
|
2009-04-11 15:57:11 +00:00
|
|
|
public static MiniObject NewFromValue (GLib.Value val) {
|
|
|
|
IntPtr type = gstsharp_g_value_type (ref val);
|
|
|
|
GLib.GType gtype = new GLib.GType (type);
|
2009-04-11 15:52:50 +00:00
|
|
|
|
2009-04-11 15:57:11 +00:00
|
|
|
return (MiniObject) GLib.Opaque.GetOpaque (gst_value_get_mini_object (ref val), (Type) gtype, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static explicit operator GLib.Value (MiniObject o) {
|
|
|
|
GLib.Value val = new GLib.Value (new GLib.GType (gstsharp_g_type_from_instance (o.Handle)));
|
2009-04-11 15:52:50 +00:00
|
|
|
|
2009-04-11 15:57:11 +00:00
|
|
|
gst_value_set_mini_object (ref val, o.Handle);
|
2009-04-11 15:52:50 +00:00
|
|
|
|
2009-04-11 15:57:11 +00:00
|
|
|
return val;
|
|
|
|
}
|
2009-04-11 15:52:50 +00:00
|
|
|
|
2009-04-11 15:57:11 +00:00
|
|
|
[DllImport ("gstreamersharpglue-0.10.dll") ]
|
|
|
|
private static extern IntPtr gstsharp_g_type_from_instance (IntPtr o);
|
|
|
|
[DllImport ("gstreamersharpglue-0.10.dll") ]
|
|
|
|
private static extern IntPtr gstsharp_g_value_type (ref GLib.Value val);
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
private static extern IntPtr gst_value_get_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);
|
2009-04-12 18:55:11 +00:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
|