示例#1
0
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
void SMEngine::startEngine(){

    widgetMap.insert("inputWidget", new InputWidget());
    widgetMap.insert("infoWidget", new InfoWidget());
    widgetMap.insert("dialogWidget", new DialogWidget());
    //widgetMap.insert("initialWidget", new InitialWidget(smGui));
    SMEngine::personData = new QList< QMap<QString, QString> >;
    SMEngine::widgetData = new QList< QMap<QString, QString> >;
    Logger::getInstance().log("SMEngine initialized", loglevel);
    parseXMLFile("fileName");   //TODO: change signature
    QVBoxLayout *layout = new QVBoxLayout();
    connectSlots();
}
示例#3
0
bool CProjectFileParser::parseProjectFile( std::string &name )
{
    QFile file( name.c_str() );
    if( !file.open( QIODevice::ReadOnly ) )
        return false;

    if( !parseXMLFile( file ) )
    {
        file.close();
        return false;
    }

    file.close();

    return true;
}
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;
}
示例#5
0
void SMEngine::startEngine(){

    //this should happen in the utterance-class
    SMEngine::personData = new QList< QMap<QString, QString> >;
    SMEngine::widgetData = new QList< QMap<QString, QString> >;
    SMEngine::resultMap = new QMap<QString, QString>;

    parseXMLFile("fileName");   //TODO: change signature
    // initialize the layout to take new widgets
    layout = new QVBoxLayout();
    // a list to store the information which widgets a currently displayed
    currentWidgets = new QList<QString>;
    createControlWidget();
    // time to get connected
    connectSlots();
    layout = new QVBoxLayout();
    Logger::getInstance().log("SMEngine->STARTENGINE: initialized", loglevel);

}
示例#6
0
int SMEngine::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: showMe(); break;
        case 1: setLabel((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 2: setWidget((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
        case 3: setLayout((*reinterpret_cast< QLayout*(*)>(_a[1]))); break;
        case 4: breakIsOver(); break;
        case 5: yesClicked(); break;
        case 6: noClicked(); break;
        case 7: confirnClicked(); break;
        case 8: skipClicked(); break;
        case 9: createGuiWithList((*reinterpret_cast< QList<QMap<QString,QString> >*(*)>(_a[1]))); break;
        case 10: createInputGuiWithDataSet((*reinterpret_cast< QMap<QString,QString>(*)>(_a[1]))); break;
        case 11: repaintGui(); break;
        case 12: changeWidget((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 13: changeWidget((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 14: parseXMLFile((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 15: showInfoWidget((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 16: showInputWidget(); break;
        case 17: addLayout(); break;
        case 18: addWidgetToLayout((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 19: addWidgetToLayout((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 20: toggleFirstUse((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 21: finished(); break;
        case 22: executeSpec((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 23: acceptButton(); break;
        case 24: saveToDom((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 25: timeOut(); break;
        case 26: emitClickSignal((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 27;
    }
    return _id;
}
示例#7
0
status_t MediaCodecList::includeXMLFile(const char **attrs) {
    const char *href = NULL;
    size_t i = 0;
    while (attrs[i] != NULL) {
        if (!strcmp(attrs[i], "href")) {
            if (attrs[i + 1] == NULL) {
                return -EINVAL;
            }
            href = attrs[i + 1];
            ++i;
        } else {
            return -EINVAL;
        }
        ++i;
    }

    // For security reasons and for simplicity, file names can only contain
    // [a-zA-Z0-9_.] and must start with  media_codecs_ and end with .xml
    for (i = 0; href[i] != '\0'; i++) {
        if (href[i] == '.' || href[i] == '_' ||
                (href[i] >= '0' && href[i] <= '9') ||
                (href[i] >= 'A' && href[i] <= 'Z') ||
                (href[i] >= 'a' && href[i] <= 'z')) {
            continue;
        }
        ALOGE("invalid include file name: %s", href);
        return -EINVAL;
    }

    AString filename = href;
    if (!filename.startsWith("media_codecs_") ||
        !filename.endsWith(".xml")) {
        ALOGE("invalid include file name: %s", href);
        return -EINVAL;
    }
    filename.insert(mHrefBase, 0);

    parseXMLFile(filename.c_str());
    return mInitCheck;
}
示例#8
0
void FrmReports::previewItem(QListWidgetItem* item)
{
    QString strName, strAuthor,strPixmap,strDescription;
    if (!parseXMLFile(item->text(),strName,strAuthor,strPixmap,strDescription)) {
        emit showError(tr("Could not preview this item!"));
    } else {

        //TODO: add label for name and code herer
        if (!strName.isEmpty())
            this->lbName->setText(strName);
        else
            this->lbName->setText(qApp->translate("empty", strEmpty));

        if (!strAuthor.isEmpty())
            this->lbAuthor->setText(strAuthor);
        else
            this->lbAuthor->setText(qApp->translate("empty", strEmpty));

        if (!strPixmap.isEmpty()) {
            QPixmap pm;
            if (!pm.loadFromData(QByteArray::fromBase64(strPixmap.toAscii())) || pm.isNull())
                this->lbPixmap->setText(qApp->translate("empty", strEmpty));
            else
                this->lbPixmap->setPixmap(pm);
        }
        else
            this->lbPixmap->clear();

        if (!strDescription.isEmpty())
            this->textDescription->setText(strDescription);
        else
            this->textDescription->setText(qApp->translate("empty", strEmpty));

        if (!frame->isVisible())
            frame->show();
    }
}
示例#9
0
void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml) {
    // get href_base
    char *href_base_end = strrchr(codecs_xml, '/');
    if (href_base_end != NULL) {
        mHrefBase = AString(codecs_xml, href_base_end - codecs_xml + 1);
    }

    mInitCheck = OK; // keeping this here for safety
    mCurrentSection = SECTION_TOPLEVEL;
    mDepth = 0;

    OMXClient client;
    mInitCheck = client.connect();
    if (mInitCheck != OK) {
        return;
    }
    mOMX = client.interface();
    parseXMLFile(codecs_xml);
    mOMX.clear();

    if (mInitCheck != OK) {
        mCodecInfos.clear();
        return;
    }

    for (size_t i = mCodecInfos.size(); i-- > 0;) {
        const MediaCodecInfo &info = *mCodecInfos.itemAt(i).get();

        if (info.mCaps.size() == 0) {
            // No types supported by this component???
            ALOGW("Component %s does not support any type of media?",
                  info.mName.c_str());

            mCodecInfos.removeAt(i);
#if LOG_NDEBUG == 0
        } else {
            for (size_t type_ix = 0; type_ix < info.mCaps.size(); ++type_ix) {
                AString mime = info.mCaps.keyAt(type_ix);
                const sp<MediaCodecInfo::Capabilities> &caps = info.mCaps.valueAt(type_ix);

                ALOGV("%s codec info for %s: %s", info.mName.c_str(), mime.c_str(),
                        caps->getDetails()->debugString().c_str());
                ALOGV("    flags=%d", caps->getFlags());
                {
                    Vector<uint32_t> colorFormats;
                    caps->getSupportedColorFormats(&colorFormats);
                    AString nice;
                    for (size_t ix = 0; ix < colorFormats.size(); ix++) {
                        if (ix > 0) {
                            nice.append(", ");
                        }
                        nice.append(colorFormats.itemAt(ix));
                    }
                    ALOGV("    colors=[%s]", nice.c_str());
                }
                {
                    Vector<MediaCodecInfo::ProfileLevel> profileLevels;
                    caps->getSupportedProfileLevels(&profileLevels);
                    AString nice;
                    for (size_t ix = 0; ix < profileLevels.size(); ix++) {
                        if (ix > 0) {
                            nice.append(", ");
                        }
                        const MediaCodecInfo::ProfileLevel &pl =
                            profileLevels.itemAt(ix);
                        nice.append(pl.mProfile);
                        nice.append("/");
                        nice.append(pl.mLevel);
                    }
                    ALOGV("    levels=[%s]", nice.c_str());
                }
            }
#endif
        }
    }
	// for CTS 
#ifdef MTK_AOSP_ENHANCEMENT
#ifndef MTK_WMA_PLAYBACK_SUPPORT
		const char* wma_name = "OMX.MTK.AUDIO.DECODER.WMA";
		deleteByType(wma_name);
#endif
#ifndef MTK_SWIP_WMAPRO
		const char* wmapro_name = "OMX.MTK.AUDIO.DECODER.WMAPRO";
		deleteByType(wmapro_name);
#endif
#ifndef MTK_AUDIO_RAW_SUPPORT
		const char* pcm_name = "OMX.MTK.AUDIO.DECODER.RAW";
		deleteByType(pcm_name);
#endif
#ifndef MTK_AUDIO_DDPLUS_SUPPORT
		const char* DDPLUS_name1 = "OMX.dolby.ac3.decoder";
		deleteByType(DDPLUS_name1);
		const char* DDPLUS_name2 = "OMX.dolby.ec3.decoder";
		deleteByType(DDPLUS_name2);
#endif
#ifndef MTK_AUDIO_APE_SUPPORT
		const char* ape_name = "OMX.MTK.AUDIO.DECODER.APE";
		deleteByType(ape_name);
#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
}