ADC Home > Reference Library > Technical Q&As > QuickTime > Movie Basics >
|
Q: I understand the basic steps of editing QuickTime media, but would like to clarify some finer points. When using InsertMediaIntoTrack what happens to the media already in that track? I'm not quite sure what it means when you call GetTrackMedia to get some media from a track, does this remove the media? If I want to edit a track should I remove some media then re-insert it? A: The confusion surrounding the word "media" is understandable. The term Media normally refers to things like audio or video, but when using the QuickTime API, functions including the word "media," such as GetTrackMedia, are usually referring to a data structure. The media data structure contains references to the actual sample data, such as video frames or audio samples, but it doesn't contain the sample data itself. This is a very important concept to remember as you continue working with QuickTime. When you use the GetTrackMedia API, you're really locating the media data structure used by a particular track. When you add new sample data to the media, by using an API such as AddMediaSample, the sample is typically appended to the existing sample data, and a reference to that data is appended to the media data structure. You can also just add a reference or references to existing sample data by using APIs such as AddMediaSampleReference or AddMediaSampleReferences. These references are also appended to the media structure. You can't add references in the middle of the media structure. Instead, a track can contain an edit list. This track edit list specifies which media segments play in what order. To add samples in the middle of a track, you append the samples to the media and insert a track segment that references that part of the media. InsertMediaIntoTrack does NOT insert a media data structure into a track. It inserts a track segment that refers to a segment of the media. You can use this function to insert a segment from the end of the media structure into the middle of a track; the two are independent. You don't edit the media directly; you modify the edit list in the track that points to the media. When you save the movie, you can choose to flatten it. This flattening procedure edits the media for you - QuickTime reorders the data samples so they're stored in the order they're displayed, interleaving data from different tracks so the movie can play in sync, and removing any unreferenced data from the media structure. Your original sample data is unaffected by this flattening process - QuickTime creates a new file containing only the referenced sample data. QuickTime Programming Summary : Editing Movies
|
|