How to create a stagefright plugin

I have a task that includes integrating a video decoder into Stagefright (Android multimedia environment). I searched and found the following about creating a new plugin for Stagefright :

To add support for the new format, you need to:

  • Develop a new Extractor class if the container is not yet supported.

  • Develop a new decoder class that implements the interface needed by the Stagefright core to read data.

  • Associate the MIME type of the data files for the new decoder in the OMXCodec.cpp file in the OMXCodec.cpp array.

  static const CodecInfo kDecoderInfo[] = { {MEDIA_MIMETYPE_AUDIO_AAC, "OMX.TI.AAC.decode"}, {MEDIA_MIMETYPE_AUDIO_AAC, "AACDecoder"}, }; 

The above data is all I can find out on the net. Right now I have a simple application that will take the file as input and display it on the screen using the native API in android. Can someone please tell me how to move on. And where do all these OMXCodec.cpp and others come from in the picture and in which directory of my project should I use them. Please provide solutions regarding the same. Thanks in advance.

+4
source share
1 answer

From your question, it looks like you are looking at a recommendation specific to Ice-Cream Sandwich or earlier versions of Android. The first thing you should know about is the version of android ie Ice-Cream Sandwich before or JellyBean and after. Codec integration differs across Android versions.

I already commented on your other question specific to JellyBean and later (link: Android: how to integrate a decoder into a multimedia infrastructure )

If you want to integrate your codec into Ice-Cream Sandwich or earlier, the steps are already available in your question. In addition to adding a decoder to the kDecoderInfo list kDecoderInfo you can configure some quirks as shown here .

For a question about OMXCodec.cpp you can find this file on frameworks/base/media/libstagefright/ in the case of Ice-Cream Sandwich and frameworks/av/media/libstagefright/ in the case of JellyBean .

If you followed all the steps to integrate a video decoder into a Stagefright structure, the simplest test would be to do the following:

  • Copy the media file to the SD card

  • In OMXCodec.cpp enable the logs by deleting the comment in this statement //#define LOG_NDEBUG 0 and run mm in the directory. Copy the restored libstagefright.so to /system/lib on your device.

  • Turn on logcat and start logcat .

  • Open the gallery, select your file and allow standard players to play the file.

  • Check the log file if the player selected your OMX component by searching for the name of your component. If you find your stagefright codec integration will succeed. Otherwise, you will have to debug and find out what the problem is.

P.S:

  • Based on your requests, I suppose you are not familiar with Android sources. Please refer to androidxref for AOSP distributions.

  • If you do not plan to support the new media file format, you do not need to support the Extractor class. MediaExtractor abstracts the file format parser and helps demultiplex the various tracks in the media file.

I hope that with this information you can integrate and use your codec in Android.

+10
source

All Articles