As you can guess from the title of the question, we must simultaneously decode and display several (for example, eight) videos in H.264 format (and keep them in sync all the time, but this other question at another time). Videos usually have a value of 25 FPS with 640x480 resolution.
I am going to provide a little background before I get to the bottom of the problem.
The function should be baked into a fairly large C # 3.5 application (WinForms). Video captures will occupy rectangles in the application - managed code should be able to specify where each video will be drawn, as well as size.
We get H264 packets in C # and run them in our own H264 decoder to get YUV12 image data.
An early attempt was to convert YUV12 images to RGB24 and BitBlt's of them in HWND, transferred to native code from C #. While functional, all BitBlt'ing was supposed to happen in the user interface stream, which made him afraid when displaying more than a few videos (on a 2.6 GHz dual-core processor).
The current attempt will launch a single-threaded processor core at startup, and the download will balance the decoding / display of the video across these streams. The performance of this is legibility (I believe the task manager is much more interesting than the displayed videos). UI-wise, it leaves much to be desired.
Millisecond, we started drawing on HWND, created in a user interface thread (for example, a panel docked in a WinForms control) from a thread other than the UI, we began to get all kinds of funky behaviors due to error-free security from WinForms. This led us to create HWND in our own code and attract those for which C # provided rectangles onto which they should be drawn in screen coordinates.
G! CanOfWorms.Open ().
Problem. When a C # application receives focus, it jumps to the top of the Z-Order and hides the video window. Decision. Put the video window Always On Top.
Problem. When the user switches to another application, the video windows are still on top. Decision. Define the activation and deactivation of the C # application and accordingly show / hide the video windows.
Problem: the user says: "I want my videos to play on one monitor when I edit a Word document in another!" Solution: tell the user that he will shut up, and that Word sucks in any case.
Problem: I get fired.
etc .. and others.
I assume the problem is that we created HWNDs for a thread other than the UI, and want to "simulate" those that are embedded in a C # application.
Any thoughts / suggestions? Am I completely having lunch here?
I am more than open to use a completely different approach, if one exists (for this project, a lot of training is required - winning the lottery will have a greater probability than me, choosing the best approach at every step along the way).