InsertTrackSegment
TheInsertTrackSegmentfunction copies part of one track to another. You specify the starting time and duration of the source segment and the time in the destination track at which to place the information.
pascal OSErr InsertTrackSegment (Track srcTrack, Track dstTrack, TimeValue srcIn, TimeValue srcDuration, TimeValue dstIn);
srcTrack- Specifies the source track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as
NewMovieTrackandGetMovieTrack(described on page 2-136 and page 2-188, respectively).dstTrack- Specifies the destination track for this operation. The
InsertTrackSegmentfunction places a copy of the segment, which is obtained from the source track, into this destination track. Theinparameter specifies where the segment is inserted.srcIn- Specifies the start of the segment in the source track. The
srcDurationparameter specifies the segment's duration. This time value must be expressed in the time scale of the movie that contains the source track.srcDuration- Specifies the duration of the segment in the source track. This time
value must be expressed in the time scale of the movie that contains the source track.dstIn- Contains a time value specifying where the segment is to be inserted. This time value must be expressed in the time scale of the movie that contains the destination track.
DESCRIPTION
TheInsertTrackSegmentfunction does not change the source track. However, the duration of the destination track is extended to accommodate the inserted segment. This may also change the duration of the movie that contains the destination track.You can use this function to copy data within a single track. If you are not copying data from one location in a track to a different point in the same track, make sure that the two tracks are of the same type. For example, you cannot copy a segment from a sound track into a video track.
In addition, if the source and destination tracks are associated with different media data files, this function copies samples from the source to the destination using the
AddMediaSamplefunction. Therefore, the Movie Toolbox must be able to write to the destination media. In this case, your application must call theBeginMediaEditsfunction before callingInsertTrackSegment. At the end of the editing session, your application must call theEndMediaEditsfunction. See "Adding Samples to Media Structures" beginning on page 2-254 for more information about these functions.If you have assigned a progress function to the movie that contains the destination track, the Movie Toolbox calls that progress function during long copy operations.
ERROR CODES
File Manager errors
invalidTrack -2009 This track is corrupted or invalid mediaTypesDontMatch -2018 These media structures don't match progressProcAborted -2019 Your progress function returned an error