Fix MiniObject bindings
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 12 Apr 2009 18:55:11 +0000 (20:55 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 12 Apr 2009 18:55:11 +0000 (20:55 +0200)
gstreamer-sharp/Gstreamer.metadata
gstreamer-sharp/MiniObject.custom

index 4fcc5a1..b35cf57 100644 (file)
   <attr path="/api/namespace/boxed[@name='MiniObject']" name="opaque">true</attr>
   <attr path="/api/namespace/boxed[@name='MiniObject']" name="abstract">1</attr>
   <remove-attr path="/api/namespace/boxed[@name='MiniObject']" name="parent" />
-  <remove-node path="/api/namespace/boxed[@name='MiniObject']/constructor[@cname='gst_mini_object_new']" />
+  <attr path="/api/namespace/boxed[@name='MiniObject']/field[@name='Refcount']" name="hidden">1</attr>
+  <attr path="/api/namespace/boxed[@name='MiniObject']/field[@name='Flags']" name="writeable">true</attr>
+  <attr path="/api/namespace/boxed[@name='MiniObject']/field[@name='Flags']" name="type">GstMiniObjectFlags</attr>
+  <attr path="/api/namespace/boxed[@name='MiniObject']/method[@cname='gst_mini_object_copy']" name="owned">true</attr>
+  <attr path="/api/namespace/boxed[@name='MiniObject']/method[@cname='gst_mini_object_make_writable']" name="hidden">1</attr>
+  <attr path="/api/namespace/boxed[@name='MiniObject']/method[@cname='gst_mini_object_replace']" name="hidden">1</attr>
+
+  <attr path="/api/namespace/callback[@name='MiniObjectCopyFunction']" name="hidden">1</attr>
+
+  <attr path="/api/namespace/callback[@name='MiniObjectFinalizeFunction']" name="hidden">1</attr>
 
   <attr path="/api/namespace/object[@name='Object']/field[@name='Refcount']" name="hidden">1</attr>
   <attr path="/api/namespace/object[@name='Object']/method[@name='DefaultError']" name="hidden">1</attr>
index 4706791..0d641a1 100644 (file)
@@ -1,4 +1,4 @@
-protected MiniObject () : base (IntPtr.Zero)
+protected MiniObject () : base ()
 {
 }
 
@@ -25,3 +25,17 @@ private static extern IntPtr gstsharp_g_value_type (ref GLib.Value val);
 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);
+
+/* 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;
+}
+