QTKit problems - add audio to movie blits to screen!?!
QTKit problems - add audio to movie blits to screen!?!
- Subject: QTKit problems - add audio to movie blits to screen!?!
- From: Lunatic Senator <email@hidden>
- Date: Sat, 7 Jan 2006 03:15:24 -0800
The following line of code causes the last frame written to the
QTMovie to be blasted to the screen. The frame, curiously enough, is
blasted to the top left corner of the main monitor (QuickDraw 0,0)
despite the fact that the rest of the time I'm using an imaging model
that has 0.0, 0.0 at the lower left corner of the main monitor...
The application uses QTKit to build a new movie from scratch, adding
piles of rendered frames, then going back and adding a chunk of audio
to cover the frames thus rendered, rinse, repeat until finished, then
finalizes (QTMovie writeToFile) and calls it a night.
The code:
[_movie insertSegmentOfMovie:audio
fromRange:audioRange
scaledToRange:destRange];
"audio" is a QTMovie * that points to a movie which was created from
an audio file (MP3, or a AAC, or maybe a WAV or AIFF).
"atTime" is a NSTimeInterval that contains the location in-time of
where to add the audio. The video frames have already been added using
a loop with the following code at its core:
NSImage * image =
[[NSImage alloc] initWithData: [bitmapImage TIFFRepresentation]];
[_movie addImage:image forDuration:curTime withAttributes:myDict];
[image release];
The entire code surrounding adding the audio segment is as flows:
- (void) addAudioToMovie: (QTMovie *) audio atTime: (NSTimeInterval) whence
{
NSLog(@"QCMovieRenderer addAudioToMovie: %.8lx atTime:%.2f", audio, whence);
QTTime duration = [audio duration];
QTTimeRange audioRange = QTMakeTimeRange(QTZeroTime, duration);
QTTimeRange destRange =
QTMakeTimeRange(QTMakeTimeWithTimeInterval(whence), duration);
NSTimeInterval tm;
QTGetTimeInterval(duration, &tm);
NSLog(@"adding audio for %@ at %.2f-%.2f (%.2f)", [[audio
attributeForKey: QTMovieFileNameAttribute] lastPathComponent], whence,
whence+tm, tm);
[_movie insertSegmentOfMovie:audio fromRange:audioRange
scaledToRange:destRange];
}
Clues?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden