I have a task which involves integration of a video decoder into Stagefright
(Android's multimedia framework). I searched and found the following about creating a new plugin for Stagefright
:
To add support for a new format, you need to:
Develop a new Extractor class, if the container is not supported yet.
Develop a new Decoder class, that implements the interface needed by the
StageFright
core to read the data.Associate the mime-type of the files to read to your new Decoder in the
OMXCodec.cpp
file, in thekDecoderInfo
array.
static const CodecInfo kDecoderInfo[] = {
{MEDIA_MIMETYPE_AUDIO_AAC, "OMX.TI.AAC.decode"},
{MEDIA_MIMETYPE_AUDIO_AAC, "AACDecoder"},
};
The above data is all i could find out on net. Right now i have a simple app that will take a file as an input and render it on the screen using native API's in android. Can anyone please tell me how to proceed further. And from where does all these OMXCodec.cpp
and others come into picture and which directory of my project should i have them in. Please provide solutions regarding the same. Thanks in advance.
From your question, it appears that you are looking at a recommendation which is specific for
Ice-Cream Sandwich
or earlier versions of Android. The first thing you should be clear about is the version of the android i.e.Ice-Cream Sandwich
or before orJellyBean
and after. The integration of codecs is different across different releases of Android.I have already commented on your other question which is specific for
JellyBean
and later (Reference: Android: How to integrate a decoder to multimedia framework)If you would like to integrate your codec in
Ice-Cream Sandwich
or before, the steps are already available in your question. In addition to adding the decoder intokDecoderInfo
list, you may like to setup certain quirks as shown here.For the question on
OMXCodec.cpp
, you can find this file atframeworks/base/media/libstagefright/
in case ofIce-Cream Sandwich
andframeworks/av/media/libstagefright/
in case ofJellyBean
.If you have followed all the steps to integrate the video decoder into the
Stagefright
framework, then the easiest test would be to perform the following:Copy a media file into SD-Card
In
OMXCodec.cpp
, enable logs by removing the comment in this statement//#define LOG_NDEBUG 0
and run amm
in the directory. Copy the rebuiltlibstagefright.so
to/system/lib
on your device.Enable
logcat
and start capturing logs.Goto gallery, select your file and allow the standard player to play your file.
Check your log file if the player has selected your
OMX
component by searching for your component name. If found, your integration of codec intoStagefright
is successful. Else, you will have to debug and find out what is the problem.Postscript:
Based on your queries, I presume you aren't familiar with Android sources. Please refer to androidxref site to become familiar with
AOSP
distributions.Unless you are planning to support a new media file-format, you will not require to support
Extractor
class.MediaExtractor
abstracts a file-format parser and helps to de-multiplex the different tracks in a media file.I hope with this information, you should be able to get your codec integrated and functional in Android.