Leverages the ImBuf proxy (implemented in imbuf/intern/moviecache.c despite it being used both in the sequencer and movie clip editor) to prefetch frames.
This is done by putting the next N frames in a queue, and a thread renders them one at a time. Note that this may block the main render thread, since only one simultaneous render is possible.
When the max size of the cache is reached, the frame that is the farthest from the playhead is dropped. For now, this patch continues to pre-render frames payhead to playhead+prefetch continuously, even if the last frames keep getting dropped.
Therefore, prefetch_frames should be set low enough in the options so that all these frames fit in the cache. To keep patches small, I'll improve this in further patches once this is accepted.
To test this, change the movie cache size and prefetch frames options in the user prefs (System tab)
Based on 25772c9e1d2d5239e1f7f83f6ea0c4d7d1f1df4a with D4262 applied