Jelly Bean Codec infrastructure, part1

by groleo

By default, Android provides you with libraries that does software encoding/decoding.
If you want to enable platform specific codecs, you’ll first need to write a media_codecs.xml.
That’s a map from MediaCodec onto mime-types and informs libstagefright what codec to use for a specific mime-type.

Now, in your encoder library, you’ll need to call:

// OMXVideoEncoderMPEG4 is the Class Name that implements the Video Encoder
DECLARE_OMX_COMPONENT("OMX.My.VideoEncoder.MPEG4", "video_encoder.mpeg", OMXVideoEncoderMPEG4);

So far, the link between mime-type and what object to use is set.
Now Android has to have a way of calling in the platform specific encoder library.
This is done in OMXMaster.cpp.
Android expects for to be provided by the vendor.
Using dlopen, it gets a handle to the shared library, and calls createOMXPlugin() or android::createOMXPlugin().

Later on, I’ll detail the structure of the object returned by createOMXPlugin().