The BMediaFile class represents a file containing media data. When instantiated a BMediaFile with an entry_ref to an existing media file, it sniffs the file and figures out the right codecs to use when accessing that file.

To read an existing media file, you can then call TrackAt() to instantiate BMediaTrack objects fot the file's tracks; these can in turn be used to decode media data from the file.

You can also write data to the file. In this case, you construct the object by specifying an entry_ref and a media_file_format specification describing the format of the media data you plan to write into the file. You then call CreateTrack() to create each track you want to write into the file. Once each track has been created (but is still empty), you call CommitHeader() to write the file's header to disk, and you can use BMediaTrack functions to write the actual media data into the tracks.

Call CloseFile() when you're finished writing to it (you don't need to call this if you're reading the file).

For an example of how to use BMediaFile to read and write media files, see "Reading and Writing Media Files"


As a general rule, you can't use wildcards in any structures used by BMediaFile functions. You tell BMediaFile what format you have, and BMediaFile will simply tell you whether or not that format is supported.

Creative Commons License
Legal Notice
This work is licensed under a Creative Commons Attribution-Non commercial-No Derivative Works 3.0 License.