[SDL] Re: OS X: SDL as subclass of NSView?

Follower follower at myrealbox.com
Fri Jul 18 07:47:01 PDT 2003


Hi all,

 > > Is it possible to have SDL draw into a custom NSView?
 > [snip]
 > It wouldn't be too difficult to have a SDL_NSVIEWID= hack similar
 > to what other folks are doing.
 > [snip]
 > I could put together the necessary pieces and
 > a demo application. Let me know.
Funny this should come up within a day of me encountering the same issue...

My situation:

I'm trying to get wxWindows to embed a pygame (Python libsdl bindings) 
window to play MPEG video with libsmpeg on Mac OS X 10.2.. (Yeah, I 
know, I like the easy life... :-) )

I got the video playing, but couldn't get the video frame embedded.

Anyway, I discovered the "window id hack" and got it working on a 
Windows machine but not on my OS X machine. I then discovered that the 
reason for that is that the Mac OS X libsdl doesn't implement it.

I took a look at the code and was thinking "hmmm, this isn't a one line 
fix", so personally, I'd be really thankful if Darrell could "put 
together the necessary pieces". :-)

As it turns out there's an issue on the OS X wxPython side of things too 
because it doesn't implement the required 'GetHandle' method. I've found 
some code that apparently adds this at the wxWindows level, but haven't 
tried it yet. (I was figuring I'd find out what libsdl needed, only to 
discover that it didn't include the window id hack.)

I probably can't be much help other than as a tester, but if someone has 
the skills + knowledge to implement it I'd be grateful.

Oh, I thought I'd make a comment about libsmpeg while I'm here. I've 
gotten it to work on OS X 10.2 as far as basic playback is concerned but 
only if the video is being playeback at (0,0) offset. If you try and 
offset it within the frame it doesn't display the video, although it 
plays the audio. I thought it might have been a wxPython issue, but I 
tried calling the SMPEG_MoveDisplay (I think) routine within the 
plaympeg demo and it doesn't work there either, so it looks like it's an 
issue with libsmpeg.

I remember seeing a comment about the co-ordinate directions from the 
point of origin of the Mac OS X graphics being different, so was 
wondering if that might be an issue.

Anyway, just providing a data point on that issue.

Hope this encouragement or notes are helpful for someone... :-)

--Phil.

P.S. On a related note, I'm looking at trying to get things running 
under the Aqua X11 environment in the interim, anyone had experience 
with that?





More information about the SDL mailing list