How to register a OMX core for adding a new decoder

3.8k views Asked by At

I'm referring to the post:

Android: How to integrate a decoder to multimedia framework

Following it i have registered my new decoder (Which is currently not supported by Android) in media_codecs.xml.

The Step 2 of the above post requires me to perform OMX core registration. However, Since i'm really new to this topic, i'm not able to follow the step 2.

I have the working code of the decoder in C and is already ported to android.

So i request if anybody can provide information on:

  • A step-by-step guide to preform OMX code registration for a decoder that is currently not supported by android.

  • Where should i place my working C code in the source tree and how to specify the compiler to compile it

  • Lastly, i would like to tell that i'm working on ICS code and the
    output of the decoders source code is YUV420.

Anyone please provide pointers towards the above queries. Thanks in advance.

1

There are 1 answers

7
Ganesh On BEST ANSWER

If your don't plan to have your own OMX Core, then you can consider adding your codec to the SoftOMXComponent plugin itself as described below.

Note: This answer assumes that you have the ability to recompile a portion of AOSP code and can replace the rebuilt libraries on your platform.

Step 1: Registration of OMX Component

In SoftOMXComponent source file as shown here, add your component name as shown below

{ "OMX.sam.custom.h264.decoder", "sam_h264dec", "video_decoder.avc" }

Here "OMX.sam.custom.h264.decoder" represents your component name, "sam_h264dec" represents the suffix of the name of the library stored in the file system (more below) and "video_decoder.avc" represents the role of your decoder, which in this example is a H.264 video decoder.

Step 2: Generation of library

Your OMX component should be built as a dynamically loadable library whose name would be "libstagefright_soft_sam_h264dec.so" and should be placed at /system/lib of your file system.

Step 3: Creation of the component

The Stagefright framework code will look for a symbol named createSoftOMXComponent to create the component. Hence, your codec library mentioned in Step 2 should support this function.

With these steps and assuming your codec is OMX compatible with Android extensions, you should be able to integrate your decoder.

Tip 1: If you wish that your component is always selected, please ensure that your component name as described in Step 1 is registered at the very top of kComponents array in the shown reference.

Tip 2: If you wish to know more on the topic of generation of the dynamically loadable library, you could refer to the GSM Decoder code as shown here.