コード例 #1
0
ファイル: MediaCodecList.cpp プロジェクト: 4Fwolf/mt6572_x201
MediaCodecList::MediaCodecList()
    : mInitCheck(NO_INIT) {
    FILE *file = fopen("/etc/media_codecs.xml", "r");

    if (file == NULL) {
        ALOGW("unable to open media codecs configuration xml file.");
        return;
    }

    parseXMLFile(file);

    if (mInitCheck == OK) {
        // These are currently still used by the video editing suite.

        addMediaCodec(true /* encoder */, "AACEncoder", "audio/mp4a-latm");

        addMediaCodec(
                false /* encoder */, "OMX.google.raw.decoder", "audio/raw");
    }
	
	// for CTS 
#ifndef ANDROID_DEFAULT_CODE
#ifdef MTK_REMOVE_WMA_COMPONENT
		ALOGD("ASF BUILD OPTION IS CLOSED");
		const char* wma_name = "OMX.MTK.AUDIO.DECODER.WMA";
		size_t indexForWma = findCodecByName(wma_name);
		if(indexForWma >= 0)
			mCodecInfos.removeAt(indexForWma);
#endif
#ifndef MTK_AUDIO_RAW_SUPPORT
		ALOGD("PCM Component BUILD OPTION IS CLOSED");
		const char* pcm_name = "OMX.MTK.AUDIO.DECODER.RAW";
		size_t indexForRaw = findCodecByName(pcm_name);
		if(indexForRaw >= 0)
			mCodecInfos.removeAt(indexForRaw);
#endif
#endif

#if 0
    for (size_t i = 0; i < mCodecInfos.size(); ++i) {
        const CodecInfo &info = mCodecInfos.itemAt(i);

        AString line = info.mName;
        line.append(" supports ");
        for (size_t j = 0; j < mTypes.size(); ++j) {
            uint32_t value = mTypes.valueAt(j);

            if (info.mTypes & (1ul << value)) {
                line.append(mTypes.keyAt(j));
                line.append(" ");
            }
        }

        ALOGI("%s", line.c_str());
    }
#endif

    fclose(file);
    file = NULL;
}
コード例 #2
0
status_t MediaCodecList::addMediaCodecFromAttributes(
        bool encoder, const char **attrs) {
    const char *name = NULL;
    const char *type = NULL;

    size_t i = 0;
    while (attrs[i] != NULL) {
        if (!strcmp(attrs[i], "name")) {
            if (attrs[i + 1] == NULL) {
                return -EINVAL;
            }
            name = attrs[i + 1];
            ++i;
        } else if (!strcmp(attrs[i], "type")) {
            if (attrs[i + 1] == NULL) {
                return -EINVAL;
            }
            type = attrs[i + 1];
            ++i;
        } else {
            return -EINVAL;
        }

        ++i;
    }

    if (name == NULL) {
        return -EINVAL;
    }

    addMediaCodec(encoder, name, type);

    return OK;
}
コード例 #3
0
MediaCodecList::MediaCodecList()
    : mInitCheck(NO_INIT) {
    FILE *file;

    file = fopen("/system/etc/media_codecs.xml", "r");
    if (file == NULL) {
        /* Also try the old /etc/media_codecs.xml path */
        file = fopen("/etc/media_codecs.xml", "r");
        if (file == NULL) {
            ALOGW("unable to open media codecs configuration xml file.");
            return;
        }
    }

    parseXMLFile(file);

    if (mInitCheck == OK) {
        // These are currently still used by the video editing suite.

        addMediaCodec(true /* encoder */, "AACEncoder", "audio/mp4a-latm");

        addMediaCodec(
                false /* encoder */, "OMX.google.raw.decoder", "audio/raw");
    }

#if 0
    for (size_t i = 0; i < mCodecInfos.size(); ++i) {
        const CodecInfo &info = mCodecInfos.itemAt(i);

        AString line = info.mName;
        line.append(" supports ");
        for (size_t j = 0; j < mTypes.size(); ++j) {
            uint32_t value = mTypes.valueAt(j);

            if (info.mTypes & (1ul << value)) {
                line.append(mTypes.keyAt(j));
                line.append(" ");
            }
        }

        ALOGI("%s", line.c_str());
    }
#endif

    fclose(file);
    file = NULL;
}