The BMediaFile class is a class that is useful for handling files that contain media data. It is used for both reading and writing such files.
Reading a file with BMediafile
In the case of reading, it takes care of identifying which extractor to use. Most of this work is done in the constructor. An explanation of a prototypical example follows. (there are other constructors as well)
BMediaFile::BMediaFile(BDataIO * dataIO)
This function needs to identify the type of the file. It does this by iterating through the add-ons that have been published in /boot/home/config/add-ons/media/extractors and /boot/beos/system/add-ons/media/extractors. (see alsoOpenBeOS.ExtractorWriterAPI)
An instance of each extractor is asked to identify the file by calling the SetSource function and then the Sniff function on the extractor. (see also OpenBeOS.ExtractorWriterAPI.ProposedAPI)
The quality factors returned are compared to find the extractor which is "best". This extractor will be used to open the file and also to determine the mime type for the file. Note: this seems to be independent of the Tracker "mime type". Note: there is no current mechanism for breaking ties. Proposal: a linear ordering of the extractors. Proposal: a priority attribute on the extractor's file.
...