[Qt-interest] running phonon video from separate process?
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Mon Dec 22 16:39:01 CET 2008
Bart van Deenen wrote on Monday, December 22, 2008 3:53 PM:
>> ...
>> You get the native window IDs using the Qt API
>> (http://doc.trolltech.com/4.4/qwidget.html#winId). On Windows you
>> would then use the win32 call SetParent().
>> ...
> I think that since the child application that I'm going to write is
> just a Qt application with a Phonon VideoWindow that the
> QWidget::winId() function combined with setParent() will make a
> complete crossplatform solution. Looks very good.
Pay attention! Don't confuse the Qt setParent() method (http://doc.trolltech.com/4.4/qwidget.html#setParent - which is indeed cross-platform) with the win32 API call SetParent (note the capital 'S'), which is off course platform-dependent ;)
The Qt setParent takes another QWidget * as argument, that is it only works within the same application. If you really want to re-parent another application (running in a separate process, as is your goal) you need to use platform-dependent code, such as the win32 SetParent (which takes a platform-specific window identifier).
So (at least on Windows, I guess) it does not really matter whether the application to be embedded is written in Qt or not (and the fact that Google Earth is written in Qt is pure coincidence ;)
> On the subject of inter process communication: is there anything
> awesome crossplatform in the Qt libraries?
What about the previous approach which I suggested previously (http://doc.trolltech.com/4.4/qsharedmemory.html - which also falls into the category IPC)? Assuming that both processes run on the same machine this should the fastest way, it does not use any sockets etc. (even though when using RPC-like communication (QtBus?) on the same machine the packets don't stumble down the whole TCP/IP stack either - clever "RPC" implementations might use shared memory under the hood as well when run on the same machine).
And the example (http://doc.trolltech.com/4.4/ipc-sharedmemory.html) I gave you does exactly what you need (more or less ;): it displays a QImage, loaded in a different process.
Another approach could be using the ActiveQt Framework (http://doc.trolltech.com/4.4/activeqt.html - Windows only), if you happen to have a commercial Qt license. But then the COM object (e.g. Windows Media Player?) wouldn't run in a separate process anymore... but I have never used that framework myself and am not a COM expert...
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list