Hi All,
I'm trying to write a component to handle mplayer as an external "player" specifically in this case to use a webcam in both Linux and Windows (possibly OSX too) although potentially there are lots of uses of this I'm sure. This sort of gets around platform variances on hardware and supporting code - there are instances of a Linux component that does this on the CCR and there is a similar derivative class someone wrote a long time go to do the same on Windows (cmplayer.pas).
Anyway, the point is I'm trying to use the "-wid" option to avoid opening an external window and therefore need the relevant widgetset handle to pass on the command line to player.
In Windows this is the BGRAVirtualScreen.Handle but in Linux the following code appears to get the handle of the container window and not the component
GDK_WINDOW_XWINDOW(GetControlWindow(PGtkWidget(BGRAVirtualScreen1.Handle)));
I've attached a simple test program to show the problem - works in windows and semi-works in Linux but overlays the whole window rather than just the virtual bitmap area so what's the code to get the equivalent of the BGRAVirtualScreen handle on Linux (and ideally on OSX)?
To run the example in Linux you'll need to install mplayer via your package manager (sudo apt-get install mplayer orwhatever your distro requires etc and it's assuming the path is in "/usr/bin"). In Windows the command is pointing to mplayer.exe in a "mplayer" subfolder of the project folder (if it's not there you'll get an utf8 process exception unless you change the path to wherever you've extracted it after downloading it).
TheBlackSheep
Edit: I forgot to mention, depending on the specific's of the webcam you might need to change the command line options to mplayer - these work with mine (a really cheap webcam from PCWorld) but they're fairly generic. You can test them by just playing around with the cmdline from a terminal in Linux (or command prompt in Win32) until it works for you (and Google is of course your friend here).
Also, there are plenty of other commands to allow mplayer to operate "behind the scenes" without any visible representation (other than the view window) - so you can play all manner of video's, audio etc. directly from a Lazarus application.
For Win32 - you don't need the GUI "SMPlayer" (that sort of defeats the point of doing this) - just download the binaries here;
http://oss.netfarm.it/mplayer-win32.phpjust choose the appropriate version for your processor (AMD, Intel - P3 or P4 etc) at the bottom of the initial page before scrolling down this page - where it currently says "Build (r34401)"
Have fun!