Re: making Python GStreamer plugins work
- From: muppet <scott asofyet org>
- To: pygtk daa com au, in7y118 public uni-hamburg de
- Cc: GTK Dev List <gtk-devel-list gnome org>, gstreamer-devel lists sourceforge net
- Subject: Re: making Python GStreamer plugins work
- Date: Fri, 29 Apr 2005 21:55:57 -0400
On Apr 29, 2005, at 8:53 PM, Benjamin Otte wrote:
- And here's the crux of the patch and where the most nastiness comes
from: Allow classes that are derived in Python to be created with
g_object_new from all C code. And handle the refcounting issues, too.
It works, but it's ugly. See the patch for implementation details.
I believe the object creation and destruction process for this kind of
objects requires some support from GObject to work nicely that
currently
just does not exist.
I don't claim to recall or understand the details of how pygtk creates
objects, but i don't agree that there's support missing from GObject
for C-driven creation of instances implemented by a scripting language.
In gtk2-perl, all perl-derived GObject types are created by calling
Glib::Object::new(), a no-frills wrapper for g_object_new(). The GType
system does its work, normally, and when it gets to the instance-init
function for the perl-derived type(s), the standard function for
marshaling a GObject to perl creates the initial wrapper and bolts it
to the C object. This ensures that the wrapper exists in your
INIT_INSTANCE so you can add data to the instance.
See gperl_new_object() (the wrapper setup and management) and the
binding for g_object_new() in GObject.xs:
http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Glib/
GObject.xs?rev=1.47&view=auto
and gperl_type_instance_init() in GType.xs:
http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Glib/
GType.xs?rev=1.67&view=auto
gtk2-perl also also supports base-init functions; we originally added
them to support the GStreamer bindings. ;-)
See gperl_type_base_init(), also in GType.xs. It uses a trick with a
seen-instance hash to make sure we don't base-init the same class on a
given instance twice.
Don't know if this will be helpful, but it can't hurt to offer.
Besides, i got several of the ideas from reading pygtk's sources, and
feel i should give something back. :-)
(for the uninitiated --- xs is a meta-language that is like a
combination of python's .defs and .overrides files, with embedded
documentation and C code snippets. keywords like CODE and OUTPUT
expand to a lot of boilerplate that isn't generally very interesting.)
--
"Ears! They help us -- Ears! They help us hear th--
Ea--E--E--E--Ears!"
-- A Sesame Street singing toy, with Yvonne gleefully pressing
the button over and over and over and over and...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]