Hi Everyone,
I would like to thank the VLC for all the recent fixes in 0.9.0 and the JVLC bindings team for thier help. After several weeks of learning how to compile the code using cygwin and my slow but persistant picking at the code and some help from a good friend I was able to get the jvlc bindings to work under windows xp & 2000 (I have not tried Vista yet).
During the process I had to understand and overcome (so far) the following issues:
1. Video pops out of JVLC canvas (extension of awt Canvas).
2. Once #1 was fixed the video appeared in the canvas but when the window was moved the video stayed in place.
3. Video after fixing #2 appears to display quickly then disappear.
4. 0.9.0 of vlc did not display video properly in XP & Windows 2000 it seemed to move through the video very quickly and no sound was heard.
#4 was fixed by the much appreciated help from the vlc team.
#1, #2 & #3 I put in a work around with help from another friend but seemed to indicate that perhaps the JVLC bindings team was using some code developed for vlc not quite understanding what the code was intended to do.
The crux of the problem is in the a section of code in the events.c file under the modules/video_output/directx folder. When the paint() method is called in the JVLCCanvas class (under bindings/java/org/videolan/jvlc folder) it eventually invokes the Control function and the case VOUT_REPARENT is executed. In there the usage of :
1. WS_OVERLAPPEDWINDOW | WS_SIZEBOX for the windows style cause the video to pop out of the canvas.
2. The fact that the hparent was set to 0 and SetParent was called with the second argument to zero caused the Video to stay in place instead of move with the Canvas when the window with the canvas was moved.
3. SetWindowPos was called caused the video in the canvas to disappear.
So there you have it. The major issue now is what can be done to the Control function so it can be used by both the vlc.exe and the jvlc bindings. The following questions need to be answered that were generated during the troubleshooting process:
1. p_vout->p_sys->hparent = 0;
Why is hparent being manually set to 0 (the desktop) between mutex lock/unlock statement rather than use SetParent to do this like the code 4 lines later does?
2. SetParent( p_vout->p_sys->hwnd, 0 );
Why is the parent being set to the desktop? This causes the JVLC code to leave the video in one place after the window containing the video canvas is moved.
3. p_vout->p_sys->i_window_style = WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
Why is the window_style always being forced to these values? The comment at the beginning of the case code also says 'Change window style, borders and title bar' but why would reparenting always make these changes. The code in the DirectXWindowCreate method uses different styles depending on whether the window is decorated or not and whether it is a child window or not.
4. SetWindowPos( p_vout->p_sys->hwnd, 0, point.x, point.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
Why is the window position setting the width and height to 0? This causes the window to effectively disappear.
5.When is the VOUT_REPARENT case code being called?
That is, what scenarios in the VLC.exe execution cause this case code to be executed? The JVLC code appears to be executing this code to cause repaint operations and that seems a little odd. It does not appear that this section of the events.c code is designed for being executed independently of the VLC.exe file; this may be contributing to, or even causing, the problems that the JVLC code is experiencing.
6. When is the control method itself being called?
What scenarios in the VLC.exe execution cause the control method to be executed?
I modified the code to work for me but I am afraid it will not work for the vlc.exe. So the VLC & JVLC teams need to discuss and come up with a fix that works for both usages (vlc.exe and jvlc bindings).
Thanks,
Tony
P.S. I almost forgot. I could not find a registration link on the jvlc trac site and my login for trac for vlc did not work so had to post this lengthy message. Sorry.