0

Mapping between timeline and source frames

So imagine a scenario in which a user has RV open and is using Screening Room to view clips. They have selected three clips and chosen "Play Selected" which puts those three clips back-to-back on the timeline. Suppose each clip is a 50 frame sequence with image files in the range file.0101.exr to file.0150.exr. What we have is a timeline that RV thinks of as going from 1 to 150, with three clips whose frame ranges are 101-150 each.

[101 ...clip1... 150][101 ...clip2... 150][101 ...clip3... 150] <-- series of back-to-back clips

[1.......................................................................................150] <-- timeline as reported by RV's frameStart() and frameEnd()

My App (showing info for currently viewed clip):

[101 ...clip1... 150]   (currentFrame: 101) <-- this is frame 1 of the timeline, but my app doesn't really know that

So how do I map between the timeline and the clip frame ranges? For instance, by tracking frame-changed events and querying sourcesRendered(), I am able to indicate which clip is currently being viewed, and even show its file frame range (via getCurrentAttributes()). Now suppose my remote application lets the user choose a frame to "go to" in RV. The user selects frame 104 (of the first clip because that is what is currently in view). I can't call "setFrame(104)" because that will set the timeline to the fourth frame of the third clip, not the fourth frame of the first clip (which RV thinks of as frame 4). What method is recommended for determining how each clip's frame range maps to the timeline frame range?

4 comments

  • 0
    Avatar
    Jon Morley

    Hi John,

    I think you should take a look at how "Matching Frame Of Next Source" and "Matching Frame Of Previous Source" under the Control menu work. You can see how they were implemented in rvui.mu found in the plugins/Mu directory of your RV install. Take a look at the three methods setMatchedFrame, previousMatchedFrame, and nextMatchedFrame.

    Basically converting global frames to source frames and back can be done using methods like extra_commands.sequenceBoundaries() and extra_commands.sourceFrame(). Please be sure to read about them in the Help -> "Mu Commands API Browser...".

    After you have had a look at all that, please let me know what I can clarify next.

    Thanks,
    Jon

  • 0
    Avatar
    John Cooper

    Thanks, Jon. That helped immensely.

    You are an invaluable resource!

  • 0
    Avatar
    Jon Morley

    Terrific! Please let us know if you have any more questions

Please sign in to leave a comment.