Question

sp<MetaData> MP3Extractor::getTrackMetaData(size_t index, uint32_t flags) {
    ALOGE("%s\t%d",__FUNCTION__,__LINE__);

    if (mInitCheck != OK || index != 0) {
        return NULL;
    }

    return mMeta;
}

Why this function is required in the MP3Extractor?

Was it helpful?

Solution

MediaExtractor is a module that implements container or file-format parsing of a multiplexed data. In a file there will be multiple tracks which correspond to specific data like video or audio. Similarly, in a MP3 file, there could be multiple tracks which are identified by their index. The index in the function corresponds to a specific track of interest.

Now, why is this function required? Since MP3Extractor is another extractor in the framework, it has to support this function, the reason for which follows. Let's consider the player as an example. AwesomePlayer is a player engine which sets up the entire pipeline.

In this process, the player engine would setup the extractor first and then try to create a down-stream component like a decoder to consume the data. The decoder is specific to a track which is identified by the index. To create a decoder, one requires to know the characteristics of the data which is represented or captured in meta i.e. metadata which will be employed to create and initialize the down-stream component.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top