[vlc-devel] [RFC PATCH] drawable-hwnd command line parameter

Joonas Koivunen joonas.koivunen at gmail.com
Mon Apr 11 17:28:55 CEST 2011

2011/4/11 Rémi Denis-Courmont <remi at remlab.net>:
> Le lundi 11 avril 2011 14:17:52 Joonas Koivunen, vous avez écrit :
>> I'm no C programmer, so getting a quality patch for this is going to
>> take a indeterminable time. From what I've understood it might be
>> better to rewrite video_output/drawable.c to support this
>> functionality? Could this functionality perhaps be added in the
>> current http://wiki.videolan.org/VoutRework ?
> Does it actually work? I would expect a run-time assertion failure due to
> mismatched variable types.

There's a compile-time warning when I assign the int to void* but
nothing else. Note that this is in the context of:

 1. (start your app which can tell you an hwnd of a panel or another
gui component container that is backed up by a native window)
 2. launch "vlc -I dummy --drawable-hwnd 1234132 file.movie"
 3. it just works, parented, centered, maximized in the container you
specified using hwnd

As there's no qt4 for example using the "drawable-hwnd" to store a
pointer it will have no problems. Basically it's just the same as
you'd do in Linux with --drawable-xid. As I said before, while this
hack actually works in the above setup it'll most likely cause
breakage in other uses.

This patch is mainly to demo that yes, cross prosess hwnd sharing does
work without any use of DuplicateHandle et al. apis. Unless someone
else can patch up modules/video_out/drawable.c to include this
functionality I will later on attempt to make this patch includeable
in the master. At the moment we need this functionality internally and
I just couldn't figure out how could I express the "drawable-hwnd" as
a pointer and an integer in drawable.c for the variable system.

Proper implementation would also need some kind of validation of hwnd
argument. Basic validation could perhaps be done with GetWindowLong or
something similar that queries the window's properties.

> --
> Rémi Denis-Courmont
> http://www.remlab.info/
> http://fi.linkedin.com/in/remidenis

-- Joonas Koivunen

More information about the vlc-devel mailing list