[Pythonmac-SIG] Newbie question about shared libraries and QuickTime

Jack Jansen Jack.Jansen@oratrix.com
Tue, 5 Mar 2002 12:24:47 +0100


On Tuesday, March 5, 2002, at 07:50 , Donovan Preston wrote:
>> 2. It looks like not all of QuickTime has been implemented in the 
>> shared library. Of course, the function(s) that I'm looking for is one 
>> that's not included. Is where I need to take the source for the 
>> library (_Qtmodule.c) and add the missing functions, and then 
>> recompile it?
>
> Good news: It's possible that the function you are looking for may have 
> been turned into a Method of an Object by bgen, which generates the 
> Python wrappers for the toolbox APIs. For example, Apple may have an 
> API which looks like this:
>
> FooRef CreateFooRef();
> void DoSomethingWithAFooRef(FooRef theRef);
> void DestroyFooRef(FooRef theRef);
>
> bgen will turn "DoSomethingWithAFooRef" into a method of the FooRef 
> object that is created by CreateFooRef. So in python, you might do:
>
> myFooRef = CreateFooRef()
> myFooRef.DoSomethingWithAFooRef()
>
> (DestroyFooRef will be automatically called when the reference count 
> drops to zero.)
>
> Or, The function you are looking for may not be visible because it's 
> not implemented, which you can tell by looking in the "Blacklist" 
> section of the bgen module which generates the Python wrappers. In the 
> QuickTime module's case,  it's in Modules/qt/qtscan.py. (In the source 
> distribution of Python) Anything in the BlackListNames section will not 
> be wrapped (although the function may be wrapped by hand) and any 
> function which contains one of the types in BlackListTypes will not be 
> wrapped automatically.

My strategy for which routines/types are blacklisted is pretty simple:
if is_easy_to_fix(it):
	fix(it)
elif I_need_it_myself(it):
	fix(it)
	test(it) # :-)
else:
	blacklist.append(it)

Quicktime is so big that I could probably spend months to make it fully 
accessible. But: by all means submit a bug report to sourceforge if you 
find something missing that you would like to use. And this doesn't only 
hold for quicktime: also for all the other toolbox modules. And if 
there's a toolbox that's missing and that you would really like covered: 
same thing!

> In my experience, the QuickTime module is fairly tough to use from 
> Python mostly because it's such a complex API and the automatic bgen 
> wrapping doesn't always get the semantics of how to use the functions 
> properly. Since bgen often generates perfectly valid looking code that 
> may never be tested, it's tough to know what's in a working state and 
> what's not.

For such cases you should definitely file a bug report!
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -