GNOME Bugzilla – Bug 590348
[audio (and other modules)] can't use pygstminiobject !
Last modified: 2010-10-18 10:01:44 UTC
Due to the way pygstminiobject is written... we can't use that code from external modules (like gst.audio). The attached patch contains a unit test demonstrating the usage of a gst.audio command that: * creates a new gst.Buffer (calling the pygstminiobject code from the *main* 'gst' module) * call gst.audio.buffer_clip (calling the pygstminiobject code... from the 'gst.audio' module). Basically we need to expose the pygstminiobject code as pygobject now does it for pygobject. This is explained in a generic fashion here : http://docs.python.org/extending/extending.html#providing-a-c-api-for-an-extension-module
Created attachment 139610 [details] test_audio.py Put this in testsuite/, and run it from that directory using 'make test_audio.py.check' bilboed@hostia ~/work/devel/gst-python.git/testsuite $ make test_audio.py.check ** ERROR **: Couldn't find a good base type!! aborting... make: *** [test_audio.py.check] Aborted
Created attachment 141332 [details] [review] patch to fix this This fixes it by using a common class key/id that is linked into _gst.so and then can be used by the other modules. pygstminiobject itself is linked into all of them still, that can be changed too.
Created attachment 141342 [details] [review] patch to fix this issue by using only one pygstminiobject This is better -- it also shrinks code size.
Created attachment 141343 [details] [review] patch to fix this issue by using only one pygstminiobject now applies before the gstapp patch
Created attachment 141346 [details] [review] patch to fix this now done with git format-patch
commit e2de828bba15a458f05ccc23d5f28cf9914e8658 Author: Johannes Berg <johannes@sipsolutions.net> Date: Fri Aug 21 16:22:38 2009 +0200 Use only one copy of pygstminiobject. Fixes #590348. Instead of linking pygstminiobject.c into all the modules, we can link it only into _gst and export the symbols for the other modules. This fixes bug #590348 because now the class key/id is common for all modules as a side-effect. Also makes the modules smaller.
This breaks the build on Cygwin and MinGW platforms where all symbols must be resolved at link time; all modules except for _gst fail to link with undefined references to pygstminiobject_new. Another way needs to be found to fix this issue; please reopen.
Re-opening as requested (so it doesn't get missed).
Uh, I didn't get a copy of the original complaint and now only noticed via bug #592473, odd ... So what does it mean "must be resolved at link time"? Can we link the libraries against each other somehow on cygwin/mingw and keep this patch?
(In reply to comment #9) > So what does it mean "must be resolved at link time"? Can we link the libraries > against each other somehow on cygwin/mingw and keep this patch? No, I think your best bet would be to make a libpygst (like libpyglib in pygobject) with pygstminiobject.c (and possibly gst-argtypes.c, as that is also used by all the modules) and link everything against that.
Created attachment 146768 [details] [review] sample patch - does NOT work This patch should give you an idea of what I have in mind. It does NOT work yet because libpygst fails to link due to undefined references to _PyGObject_API. I suppose that means that some type/function registration needs to be added for this to work, but I'll need your help with that.
This is a blocker for the latest pbutils updates (the Discoverer Info are miniobjets).
commit 0238e12e013eaec3782070bcaa6c81543473f60a Author: Edward Hervey <bilboed@bilboed.com> Date: Mon Oct 18 11:59:03 2010 +0200 gst: Make all libraries use shared PyGst_API Fixes #590348 commit 3e73bfc4b292b594cd68eb2b79aa388e072887a8 Author: Edward Hervey <bilboed@bilboed.com> Date: Mon Oct 18 11:50:19 2010 +0200 gst: Export some pygst API to be used by external modules Partially fixes #590348