天天看點

OMX plug-in分析

OMX core & OMX component

Methods

•OMX core methods

The OpenMAX Specification lists the following 9 methods that belong to the OMX core. All of the methods must be present in the library 1)OMX_Init 2)OMX_Deinit 3)OMX_GetHandle 4)OMX_FreeHandle 5)OMX_ComponentNameEnum 6)OMX_GetComponentsOfRole 7)OMX_GetRolesOfComponent 8)OMX_SetupTunnel 9)OMX_GetContentPipe

•multiple OMX cores? (codecs_v2/omx/omx_mastercore/...)

1)OMX_MasterInit 2)OMX_MasterDeinit 3)OMX_MasterGetHandle 4)OMX_...FreeHandle 5)OMX_...ComponentNameEnum 6)OMX_...GetComponentsOfRole 7)OMX_...GetRolesOfComponent 8)OMX_...SetupTunnel 9)OMX_...GetContentPipe NOTE:The implementation of the config parser API in an OMX core plugin library is optional, however – it is strongly recommended. ( OMXConfigParser)

The OMX core library wrapper

•Method 1(Pre-built):

–The code for the OMX core wrapper interface template for this case is provided in: •.../codecs_v2/omx/omx_core_plugins/template/src –Modification : •#define OMX_CORE_LIBRAY “ “lib_prebuilt_omxcore_no_wrapper.so” –The template code needs to be copied to an appropriate place in the directory structure of vendor‘s code that will enable the creation of “lib_omxcore_plus_wrapper.so”(NOTE:it will load .so once)

•Method 2(simultaneously):

–The code for the OMX core wrapper interface for this case is provided in: •.../codecs_v2/omx/omx_sharedlibrary/interface/src –This code needs to be copied to an appropriate place in the directory structure of vendor's code that will enable the creation of “lib_omxcore_and_simultaneous_wrapper.so”

Dynamic loading and registration of OMX cores

•Configuration file MUST have an extension “.cfg” and needs to be placed in “/system/etc” Android device directory. –(0xa054369c,0x22c5,0x412e,0x19,0x17,0x87,0x4c,0x1a,0x19,0xd4,0x5f), "libomx_ core_vendorXYZ.so“ • NOTE: The OsclUuid provided is the unique API ID that identifies theOMX core interface and cannot be modified:

How to load Vender’s OMX .so

•/system/etc/01_qcomm_omx.cfg中UUID,”libqcom_omx.so” •Libqcom_omx.so是封裝過的,會加載libOMXcore.so,見Method 1。 •在Qc_omx_core.c中OMX_GetHandle()中 –omx_core_load_cmp_library() •extern omx_core_cb_type core[]; //按照index動态加載,加載後component_init執行個體化dec或enc對象,初始化OMX接口。 –在Qc_registry_table.c中注冊omx_core_cb_type core[]; •our project: –Video部分(method 2): …vendor/qcom/opensource/omx/mm-video/… –libOmxVdec.so 所有內建到一個so中 –libOmxVenc.so –Audio部分(method 1):…external/opencore/codecs_v2/audio….先生成靜态庫,之後做封裝 –libOmxMp3Dec.so –libOmxMp3Enc.so –libOmxAacDec.so –libOmxAacEnc.so

•Two major components of the video decoder

–OMX core library •Exposes the top-level interface for the application to use the video decoder and encoder •Built as a dynamic library (.so) (for example:libomx_ core_vendorXYZ.so) –Decoder/Encoder library •Built as dynamic library, responsible for interfacing with kernel driver, and implements all OMX decoder component interfaces (for example:libOmxMp3Dec.so libOmxMp3Enc.so libOmxAacDec.so libOmxAacEnc.so etc.) •Source code path –User space •<root>\vendor\qcom-opensource\omx\mm-video\vidc\vdec •<root>\vendor\qcom-opensource\omx\mm-video\vidc\venc –Kernel driver •<root>\kernel\drivers\video\msm\vidc\1080p (for DDL / Resource Tracker / Firmware Manager) •<root>\kernel\drivers\video\msm\vidc\common (for VCD only)   TIPS: 1.Video codec interface is same to Audio codec in SW side 2.HD codec interface is VIDC_IO_OUT(REG_965480, xxxx); VIDC_IO_OUT(REG_639999, xxxx); ...... Directly programmed by APPS,no DSP/Modem interface required