Performing “Low-Level” Edits
Low-level edits are a separate set of editing calls that don’t involve the clipboard or selection metaphors. They’re called “low level” because instead of operating at the conceptual level of “paste the contents of the clipboard into the user’s current selection,” they work at the level of “insert a segment from movie M1, ranging from time A to time B, into movie M2 at time C.”
Note
By way of comparison, although QuickTime has two sets of editing functions, Sun’s Java Media Framework has no editing API at all.
How do I do that?
This version reimplements doCopy( ),
doCut( ), and doPaste( ) to use
low-level editing calls on the Movie instead of
cut/copy/paste-type calls on the MovieController.
First, LowLevelQTEditor needs a static
Movie, called copiedMovie, to
keep track of what’s on its virtual
“clipboard” so that it can be
shared across the new doCopy( ), doCut(), and doPaste( ) methods:
public void doCopy( ) throws QTException { copiedMovie = new Movie( ); TimeInfo selection = movie.getSelection( ); movie.insertSegment (copiedMovie, selection.time, selection.duration, 0); } public void doCut( ) throws QTException { copiedMovie = new Movie( ); TimeInfo selection = movie.getSelection( ); movie.insertSegment (copiedMovie, selection.time, selection.duration, 0); movie.deleteSegment (selection.time, selection.duration); controller.movieChanged( ); } public void doPaste( ) throws QTException { if (copiedMovie = = null) return; copiedMovie.insertSegment (movie, ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access