Android Decoder Component Load

Source: Internet
Author: User

Reprint: http://blog.sina.com.cn/s/blog_645b74b90101djrj.html

The previous blog has drawn the Android Openbinder frame diagram, recently also looked at some OpenMAX il data, know IL client to complete the audio and video playback first need to complete some initialization work, such as IL The client will load the corresponding component in accordance with the OpenMAX framework, which will refine this section to see how Android loads the dynamic so library.

    One: The first is the management of plug-ins, including codec vendor plug-ins and Google's own soft plug-in, the approximate process is as follows:new A OMX, loaded two sets of plug-ins, of which the right is Google's own plug-in Softomxplugin, the left is the implementation of various manufacturers Vendorplugin, we look at the right plug-in, Omxmaster uses a container variable mpluginbycomponent to record the type of decoder managed by each plug-in, and we look at the Softomxplugin managed codec type in a struct array, as follows:
Static Const struct {    Const Char*Mname; Const Char*Mlibnamesuffix; Const Char*Mrole;} Kcomponents[]= {    { "OMX.google.aac.decoder","Aacdec","AUDIO_DECODER.AAC" },    { "OMX.google.aac.encoder","Aacenc","AUDIO_ENCODER.AAC" },    { "OMX.google.amrnb.decoder","Amrdec","Audio_decoder.amrnb" },    { "OMX.google.amrnb.encoder","Amrnbenc","Audio_encoder.amrnb" },    { "OMX.google.amrwb.decoder","Amrdec","AUDIO_DECODER.AMRWB" },    { "OMX.google.amrwb.encoder","Amrwbenc","AUDIO_ENCODER.AMRWB" },    { "OMX.google.h264.decoder","H264dec","VIDEO_DECODER.AVC" },    { "OMX.google.h264.encoder","H264enc","VIDEO_ENCODER.AVC" },    { "OMX.google.g711.alaw.decoder","G711dec","Audio_decoder.g711alaw" },    { "OMX.google.g711.mlaw.decoder","G711dec","Audio_decoder.g711mlaw" },    { "OMX.google.h263.decoder","Mpeg4dec","video_decoder.h263" },    { "OMX.google.h263.encoder","Mpeg4enc","video_encoder.h263" },    { "OMX.google.mpeg4.decoder","Mpeg4dec","VIDEO_DECODER.MPEG4" },    { "OMX.google.mpeg4.encoder","Mpeg4enc","VIDEO_ENCODER.MPEG4" },    { "OMX.google.mp3.decoder","Mp3dec","Audio_decoder.mp3" },    { "OMX.google.vorbis.decoder","Vorbisdec","Audio_decoder.vorbis" },    { "OMX.google.vpx.decoder","Vpxdec","VIDEO_DECODER.VPX" },    { "OMX.google.raw.decoder","Rawdec","Audio_decoder.raw" },    { "OMX.google.flac.encoder","Flacenc","Audio_encoder.flac" },};

Two: According to the mime of the audio and video, find the corresponding plugin, and then select the corresponding decoder (the corresponding so library), and through the Dlopen function to open the dynamic link library, and get to the handle, and finally through the handle to get the address of the specific function pointer in the dynamic library, make the call, the relationship is as follows:

To get the function pointer, and then create a concrete codec instance, we look at the implementation of this function in the decoder SoftAAC.cpp and SoftAAC2.cpp:
Android::softomxcomponent *Createsoftomxcomponent (Const Char*name,ConstOmx_callbacktype *callbacks, Omx_ptr appData, Omx_componenttype**component) {    return NewANDROID::SOFTAAC2 (name, callbacks, AppData, component);} Android::softomxcomponent*Createsoftomxcomponent (Const Char*name,ConstOmx_callbacktype *callbacks, Omx_ptr appData, Omx_componenttype**component) {    return NewANDROID::SOFTAAC (name, callbacks, AppData, component);}
support, dynamic library loading complete, followed by the IL client and component interactive process, including set and get parameters, port data empty and fill, etc., in the middle of the unique nodeid to find the corresponding nodeinstance, Then adjust to the corresponding implementation of the decoder, a brief picture is as follows: encoding and decoding its loading and invocation process is roughly the same, the details do not have too much tracking, in order to put some unimportant details out, often will disrupt the main process, so there is not too much to pursue, since then, this blog to this end.

Android Decoder Component Load

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.