向android stagefright增加软解码库

[复制链接]
 楼主| xiaxia0316 发表于 2013-5-30 16:54 | 显示全部楼层 |阅读模式

在stagefright中,加入了可增加软解码库的plugin:SoftOMXPlugin,可以自己加入软解码。




看文件SoftOMXPlugin.cpp

首先要增加kComponents[],标示自己的软解码库。




在这个文件中,最关键的是 SoftOMXPlugin::makeComponentInstance()

根据提供的component name在kComponents[]找到对应的结构

        AString libName = "libstagefright_soft_";
        libName.append(kComponents[i].mLibNameSuffix);
        libName.append(".so");

        void *libHandle = dlopen(libName.c_str(), RTLD_NOW);


看代码:这里dlopen对应的库,可见软解码库的名字必须起成libstagefright_soft_kComponents[i].mLibNameSuffix.so,这样才能正常打开。



        CreateSoftOMXComponentFunc createSoftOMXComponent =
            (CreateSoftOMXComponentFunc)dlsym(
                    libHandle,
                    "_Z22createSoftOMXComponentPKcPK16OMX_CALLBACKTYPE"
                    "PvPP17OMX_COMPONENTTYPE");


sp<SoftOMXComponent> codec =
            (*createSoftOMXComponent)(name, callbacks, appData, component);


在库中找到createSoftOMXComponent函数并调用。



eagller 发表于 2013-5-31 11:55 | 显示全部楼层
:victory:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

57

主题

127

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部