Re: QTKit for creating movies
Re: QTKit for creating movies
- Subject: Re: QTKit for creating movies
- From: Tim Monroe <email@hidden>
- Date: Mon, 26 Sep 2005 15:40:36 -0700
On Sep 25, 2005, at 10:03 PM, Edwin Vane wrote:
I doubt anybody can answer this but I thought I'd at least try...
Ah, the eternal pessimist....
I have a movie with a single video track loaded into an application I'm
writing using QTKit in
which I'm going to add a soundtrack. The media for this track is a
custom media type (ie, I wrote a derived media handler for it). I'm
basically porting older code that uses the normal QT API so I have
a version of code that does indeed work (ie, I can add tracks to a
movie
and play them back). However, with the QTKit, my soundtrack never
plays back.
By comparing the debug output of my component in both QTKit settings
and
normal QT settings, I see the sequence of component calls is not the
same. In fact, with QTKit, I continually get MediaIdle calls with the
'time' parameter set to -1.
So my question: is there anything fancy I must do (to perhaps the
QTMovieView) to make newly added tracks play back correctly when using
QTKit?
For curiosity, here's the code I use to add a track (with empty media).
It was adapted from the Apple Technote for adding tracks to QTMovies.
Media gets added later one sample at a time between a pair of calls to
Begin/End Media Edits.
emusTrack = NewMovieTrack([self quickTimeMovie], 0, 0, kFullVolume);
require (GetMoviesError() == noErr, NEWTRACK_ERROR);
// Create a track with 'EMus' data with the dataRef being the
movie's
// default data ref.
emusMedia = NewTrackMedia(emusTrack, 'EMus', 1000, NULL, 0);
require (GetMoviesError() == noErr, TRACKMEDIA_ERROR);
InsertMediaIntoTrack (emusTrack, 0, 0, duration.timeValue,
(1L<<16));
require (GetMoviesError() == noErr, INSERTMEDIA_ERROR);
newTrack = [QTTrack trackWithQuickTimeTrack:emusTrack error:nil];
The difference is I use the movie's default data ref (which I hope is
what happens when I specify NULL as the media data ref).
I would suspect the problem is that you are calling
InsertMediaIntoTrack at the wrong time. As is stands, you are basically
inserting nothing into the track, as the media was just created and has
no samples in it. (To verify this, try looking at duration.timeValue
just before you call InsertMediaIntoTrack; my guess is that it's 0.)
I think you need to call InsertMediaIntoTrack *after* you have added
the sample data to the media.
Tim Monroe
QuickTime Engineering
email@hidden
_______________________________________________
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