• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: QTTrack is awfully limiting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QTTrack is awfully limiting


  • Subject: Re: QTTrack is awfully limiting
  • From: Jaime Magiera <email@hidden>
  • Date: Fri, 28 Dec 2007 17:15:47 -0500


On Dec 28, 2007, at 3:57 PM, Nathaniel Gottlieb-Graham wrote:

I may be daft, but there doesn't seem to be any way to create a QTTrack with a movie in it. The only real way that I can see to add anything to a QTTrack is the addImage:forDuration:withAttributes: method, which takes NSImages, and can't be fed QTMovies or anything like that. Am I just missing something obvious, or will I have to resort to some ugly hack like adding a new track for every image of a movie I want to overlay?


Hello,

I think it might be best to reconsider your understanding of QuickTime Tracks. QuickTime movies have tracks that are composed of "samples" of a particular type per track. So, there are VideoTracks, Audio tracks, Text tracks, etc. It's unclear what your goal is, but if you wanted to get the content of one movie and put it in another, you would create a QTTrack of that particular media type in the result movie, then copy the samples of the source track in the source movie to the new track. You would have to do this with each track in the movie that you wanted the content of. Below is an example for audio tracks...

- (OSErr)copyAudioTrackFromMovie: (QTMovie*)inMovie toMovie: (QTMovie*)outMovie
{
OSErr error = 0;
NSArray *audioTracks = [inMovie tracksOfMediaType: QTMediaTypeSound];
int i;


for (i = 0; i > [audioTracks count], i++)
{
Track sourceTrack = [[audioTracks objectAtIndex: i] quickTimeTrack];
Track outTrack = NewMovieTrack([outMovie quickTimeMovie], 0, 0, GetTrackVolume(sourceTrack));//copy the volume over..
Media sourceMedia = NewTrackMedia(outTrack, SoundMediaType, [[inMovie attributeForKey: QTMovieTimeScaleAttribute] longValue], NULL, 0);
error = BeginMediaEdits(sourceMedia);
error = InsertTrackSegment(sourceTrack, outTrack, GetTrackOffset(sourceTrack), GetTrackDuration(sourceTrack), 0);// insert it at the start of the Dest movie..
error = EndMediaEdits(sourceMedia);
error = CopyTrackSettings(sourceTrack, outTrack);//make the track settings the same..
}
return error;
}


QTTrack is not very limited at all. In fact, each release of the framework provides more and more functionality For example, you can now add Chapters to a QTMovie with a single addChapter call. Sometimes developers have to revert to the Track primitive. That's becoming rarer and rarer though.

hope that helps. This should actually move to the QuickTime list though.

Jaime
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >QTTrack is awfully limiting (From: Nathaniel Gottlieb-Graham <email@hidden>)

  • Prev by Date: Re: QTTrack is awfully limiting
  • Next by Date: Re: Building a dynamic class factory ( +load init order)
  • Previous by thread: Re: QTTrack is awfully limiting
  • Next by thread: Propagating Variable Arguments to Another Method
  • Index(es):
    • Date
    • Thread