[gst-devel] How to set window ID on Mac OSX

Andreas Schuler andreas at neokast.com
Thu Jun 26 16:41:16 CEST 2008


Thanks for your detailed response. I have taken a closer look at the source
code for osxvideosink and found that it supports an "embed" property (which
is FALSE by default).

I can tell that when TRUE it will emit a message called "have-ns-view",
where it passes a GstGLView object to the callback. This object is an NSView
(part of the Apple Cocoa framework). I have learned that I am supposed to
attach that to a NSWindow.

Unfortunately I am pretty new to programming on the Mac. Thus far I have
been using OS abstraction libraries such as Qt to avoid dealing with
different windowing systems. Qt gives me back a window handle, which turns
out to be integer but I have no idea how to retrieve a NSWindow object from
that.

So if anyone has done this before on the Mac (with or without Qt) I would
greatly appreciate your input.

Thanks,

Andreas

On Wed, Jun 25, 2008 at 5:26 PM, Michael Smith <msmith at xiph.org> wrote:

> On Wed, Jun 25, 2008 at 3:16 PM, Andreas Schuler <andreas at neokast.com>
> wrote:
> > Hi all,
> >
> > I am trying to get an application to run on a Max OSX 10.5.2. I have
> > downloaded and built the latest tar balls and everything seems to be
> running
> > fine when I use gst-launch.
> >
> > >From within my app, which also runs on Windows, I am doing the following
> to
> > set the id of the window I want the video to be rendered on:
> >
> > - get_bus_set_sync_handler to setup my callback
> > - The callback function looks as follows:
>
> That looks good for Win32 and linux. On linux the 'window handle' will
> need to be the XID for the window, but that's just a matter of
> different platform-specific types, not a big problem.
>
> On OSX, you're presumably using osxvideosink (well, you say you're
> using autovideosink, but that'll be selecting osxvideosink
> internally).
>
> osxvideosink doesn't implement GstXOverlay, so you can't do this with
> it. Because of this it won't ever even emit the prepare-xwindow-id
> signal, which is what you're seeing.
>
> osxvideosink has some other interface to set this up, but I don't know
> the details of how it works. You may find looking at the output of
> "gst-inspect-0.10 osxvideosink" to be helpful - it'll tell you what
> signals exist, etc.
>
> If possible, it would be best to make osxvideosink implement the
> GstXOverlay interface - that would let people use more common code
> across different platforms. Looking into whether that's possible is on
> my TODO list, but pretty far down right now - I probably won't get to
> it for a month or two. If you manage to do that sooner, that'd be
> great - patches would be very welcome.
>
> Mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080626/c1ba11c8/attachment.htm>


More information about the gstreamer-devel mailing list