adjusting playback rate dynamically

I am working on some vj patch which allows to playback visuals/movies manually sync’ed to live audio. Basically, a number of keyframes is identified beforehand, and those can be used as jump points during the performance.

Now, whenever a keyframe is manually selected and the playback jumps to that frame, I would like to calculate the actual playback rate which could optional be used from then on as playback rate of the movie. E.g. when jumping to the second keyframe ahead of time would result in an actual playback rate >1.