Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
TrackMatrix translations not working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TrackMatrix translations not working?




I've got two movies that I would like to play together, with a smaller movie inset into a larger one.


I'm using InsertTrackSegment to do this, and it works great. The smaller movie appears in the top left corner of the bigger one, and plays fine.

However, I would like to be able to set the location of the inset movie (e.g. to offset it from the edge a little, or to put it in other corners).

I assumed that SetTrackMatrix would let me do this, but it doesn't seem to be having any effect for me. Am I just using it incorrectly, or is there another way to do this?

Code follows below:

    NSArray *theInsetMovieTracks = [theInsetQTMovie tracks];
    int i;
    for(i = 0; i < [theInsetMovieTracks count]; i++)
    {

QTTrack *theQTTrack = [theInsetMovieTracks objectAtIndex:i];
NSString *mediaType = [[theQTTrack trackAttributes] objectForKey:QTTrackMediaTypeAttribute];


        NSLog(@"Adding track %d of type %@", i, mediaType);

        Track theTrack = [theQTTrack quickTimeTrack];
        Track destinationTrack = NULL;


theError = AddEmptyTrackToMovie(theTrack, theBackgroundMovie, backgroundMovieDataRef, backgroundMovieDataRefType, &destinationTrack);

if(theError != noErr)
{
NSLog(@"WARNING: AddEmptyTrackToMovie failed: %d", theError);
return -1;
}


        TimeValue srcIn = 0;
        TimeValue srcDuration = GetTrackDuration (theTrack);
        TimeValue dstIn = 0;

        theError = InsertTrackSegment(
                                  theTrack,
                                  destinationTrack,
                                  srcIn,
                                  srcDuration,
                                  dstIn );

        if(theError != noErr)
        {
            NSLog(@"WARNING: InsertTrackSegment failed: %d", theError);
            return -1;
        }

if([mediaType isEqual:QTStringForOSType(VideoMediaType)])
{
NSLog(@"Setting inset track offset to %d, %d", (int) offsets.x, (int)offsets.y);
// Set a track matrix
MatrixRecord matrixRecord;
SetIdentityMatrix(&matrixRecord);
// set the x and y offsets
TranslateMatrix(&matrixRecord, (int)offsets.x, (int) offsets.y);
SetTrackMatrix(destinationTrack, &matrixRecord);


theError = GetMoviesError();
if(theError != noErr)
{
NSLog(@"WARNING: Could not set the track matrix: % d", theError);
return -1;
}
}
}




_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.