How to display smooth video in FireMonkey (FMX, FM3)?

Has anyone understood how to display smooth video (i.e. a series of bitmap images) in a FireMonkey, HD or 3D application? In VCL, you can write to the canvas from the stream, and this will work fine, but it does not work in FMX. To make matters worse, it’s obvious that the only reliable way is to use TImage, and it seems that it is being updated from the main thread (the menu and video temporarily open). In all EMB examples, I could find all the entries in TImage from the main thread or use Synchronize (). These limitations make FMX unsuitable for decent video display, so I'm looking to hack or possibly bypass FMX. I am using XE5 / C ++, but welcome any suggestions. The target OS is both Windows 7+ and OS X. Thank you!

+7
c ++ multithreading video firemonkey firemonkey-fm3
source share
2 answers

Further studies, including some negotiations with a wandering developer , unfortunately made it clear that, due to concurrency FM restrictions, all access to the GPU should go through the main stream, and therefore drawing will always be limited. As a result, I decided that FM was not suitable for my needs, and I overestimate my options.

0
source share

How about linking TPaintbox to your video form to your form. In the OnPaint method, you simply draw the next frame onto the paintbox canvas. Now put the TTimer on the form, set the interval to the desired frame rate. In the OnTimer event for the timer just write paintbox1.repaint

This should give you regular frames no matter what else the program does.

For added security, you can increase the frame number in the OnTimer event. Now in the paintbox paint method, you know what frame to draw. This means that you will not skip frames if something else calls the drawing method, as well as a timer - you just recolor the same frame for an additional call to OnPaint.

I use this to select marching ants, although I take it one step further and use a canvas overlay so that I can independently paint the selection and base paintbox canvas to remove the need to repaint the main canvas when the selection changes. This requires API calls, but I think you won’t need it unless you are making a video with transparent color.

0
source share

All Articles