Hi,
In [email protected]
“Re: [ruby-gnome2-devel-en] Release manager” on Wed, 26 Mar 2008
14:47:07 +0100,
Sjoerd S. [email protected] wrote:
We should use GOBJ2RVAL.
Hmm, well GstObjects need a bit of special handling. See the points about
floating i made earlier. If we can get GOBJ2RVAL to support sinking objects
where needed then that could work.
It can be done in our bindings. I hope you look our bindings
before you say “look my bindings, look my bindings, …”.
Index: test/test_object.rb
— test/test_object.rb (revision 2869)
+++ test/test_object.rb (working copy)
@@ -1,13 +1,6 @@
class TestObject < Test::Unit::TestCase
include GstTestUtils
- def test_floating
- sink = create_element(“fakesink”)
- assert(sink.floating?)
- sink.sink
- assert(!sink.floating?)
- end
- def test_name
sink = create_element(“fakesink”, “my-fakesink”)
assert_equal(“my-fakesink”, sink.name)
Index: src/rbgst-object.c
===================================================================
— src/rbgst-object.c (revision 2869)
+++ src/rbgst-object.c (working copy)
@@ -24,21 +24,33 @@
#define SELF(self) (RVAL2GST_OBJ(self))
+extern VALUE rbgobj_get_value_from_gobject(GObject* gobj, gboolean
alloc);
+
+static RGConvertTable table = {0};
+
/* Class: Gst::Object
- Basis for the GST object hierarchy.
*/
-/*
-
-
-
- Checks if the Gst::Object::FLAG_FLOATING flag is set on the object.
-
-
- Returns: true if the flag is set, false otherwise.
- */
static VALUE
-object_is_floating(VALUE self)
+rbgst_object_instance2robj(gpointer instance)
{
- return CBOOL2RVAL(GST_OBJECT_IS_FLOATING(SELF(self)));
- VALUE object;
-
- object = rbgobj_get_value_from_gobject(instance, FALSE);
- if (!NIL_P(object))
- return object;
-
- object = rbgobj_get_value_from_gobject(instance, TRUE);
- if (NIL_P(object))
- return object;
-
- if (GST_OBJECT_IS_FLOATING(instance)) {
- gst_object_ref(instance);
- gst_object_sink(instance);
- }
-
- return object;
}
static VALUE
@@ -47,23 +59,19 @@
return CBOOL2RVAL(gst_object_set_name(SELF(self),
RVAL2CSTR(name)));
}
-static VALUE
-object_sink(VALUE self)
-{
- gst_object_sink(SELF(self));
- return Qnil;
-}
-
void
Init_gst_object(void)
{
VALUE cGstObject;
- table.type = GST_TYPE_OBJECT;
- table.instance2robj = rbgst_object_instance2robj;
-
- RG_DEF_CONVERSION(&table);
- cGstObject = G_DEF_CLASS(GST_TYPE_OBJECT, “Object”, mGst);
-
rb_define_method(cGstObject, “floating?”, object_is_floating,0);
rb_define_method(cGstObject, “set_name”, object_set_name, 1);
-
rb_define_method(cGstObject, “sink”, object_sink, 0);
G_DEF_SETTERS(cGstObject);
I use it just for now because I’m working step by step. It
will be removed in the feature. But your bindings completely
use it. It will not be removed from your bindings in the
feature.
Well just as much as yours and nothing that can’t be changed in either 
Did you look ours? Ours use GOBJ2RVAL except for we didn’t
update. Ours doesn’t need to change it because we doesn’t
need it.
Basically i’m just wondering why you took the old 0.8 bindings as a starting
point instead of my 0.10 ones… But we don’t have to discuss that further if
you don’t want too.
I mentioned that yours have several problems. They are
serious implement design problems for us.
Nice. I’d still recommend looking at how my bindings cope with these things
though 
BTW, do you have a test case for the problem? We can’t
commit our fix until we confirm the problem and our fix the
problem.
top of my head that will hit this case 100%.
As I mentioned above, we can’t commit our fix until we
confirm the problem and our fix the problem.
Again, have a look at my bindings for a way to fix this or just wait a bit for
the merging patchset.
I hope that you submit test cases with the patchset.
Thanks,
kou