Re: [Pyobjc-dev] using PyObjCPointers (howto?)
Brought to you by:
ronaldoussoren
|
From: scott h. <sc...@ya...> - 2008-01-31 16:55:13
|
I'm working with PyObjC version 2.0 per the Leopard distribution.
QTTrack.quickTimeMovie and QTMedia.quickTimeMovie both return
PyObjCPointers. For example, suppose movie is a QTMovie:
>>> track = movie.tracks()[0]
track = movie.tracks()[0]
>>> media = track.media()
media = track.media()
>>> pprint((movie, track, media))
pprint((movie, track, media))
(<QTMovie: 0x1a6bc30 time scale = 600, duration = 52049, rate =
0.000000, tracks = { 0x1bf0c30 0x1bf0ec0 }>,
<QTTrack: 0x1bf0c30 Size = { 240, 320 }, QTMedia = 0x1f97a00>,
<QTMedia: 0x1f97a00 type = 'vide', time scale = 1500, duration =
130000>)
>>> qtm = media.quickTimeMedia()
qtm = media.quickTimeMedia()
2008-01-31 11:19:37.248 Python[7943:613] PyObjCPointer created: at
0xcbef4 of type ^{MediaType}
>>> qtm
qtm
<PyObjCPointer object at 0x27601c0>
>>>
FWIW there are other indications that QTKit is not completely wrapped.
For example, none of the QTMovie.movieWith... class methods appear to
be available in PyObjC (e.g. movieWithFile, movieWithURL). Instance
methods like initWithFile are available, so the absence of class
methods is not a showstopper.
I'm targeting 10.5 and beyond. QTKit doesn't yet let me get at the
media bits in ways that I need in my application. AudioUnits may be
applicable, but I haven't had a chance to come up to speed with them.
Thanks,
Scott
On Jan 31, 2008, at 4:33 AM, Ronald Oussoren wrote:
>
> On 30 Jan, 2008, at 23:33, Scott Herzinger wrote:
>
>> I'm looking for an idiom by which I can use a given PyObjCPointer,
>> that I get back from some Cocoa API, as a Carbon object (or pointer
>> thereto). My specific requirement currently is to take a
>> PyObjCPointer that I get back from a QTKit API, and use its
>> referent as a Carbon.Qt.Media object.
>
> PyObjCPointer objects are an indication of an incomplete wrapping of
> a framework. Which method returns a PyObjCPointer and in which
> version of PyObjC?
>
> In PyObjC2 a PyObjCPointer has an "pointerAsInteger" atrribute that
> returns the numeric value of the pointer, I don't remember if
> PyObjC1 has the same attribute. With that value and ctypes you can
> contruct a Carbon.QT object.
>
> BTW. What OS release are you targetting? Apple is clearly stearing
> away from the Carbon QuickTime API's in favour of QTKit (no 64-bit
> support in the Carbon API, no new development as well).
>
> Ronald
|