I have a video decoder which is ported to android and is successfully working as a standalone application, however i want to integrate this code to android multimedia framework. So, this code i have added to android's media framework. That is i have added it to root/media/libstagefright/codecs/myDecoder
.
I have written an Android.mk
under myDecoder folder that i have added and placed the source code of my decoder and the compilation is successful and i'm able to run it in an emulator.
Now, I have read that the new MediaCodec
API in android allows us to access and use the codecs available in android source.
My question is, now that i have integrated my decoder to android source code:
Is it possible for me to use my decoder to decode an input stream and render it on the device screen?
My decoder has a Function that should be invoked for decoding a stream. This function takes the path of the input stream as a parameter.
Should i modify something in my source code of the decoder to match the requirements of the MediaCodec
API.
Any help regarding the same will be really helpful to me.
-Regards.
MediaCodec
internally employsACodec
abstraction which talks to an underlyingOMX
component. Hence, your codec should be registered an anOMX
component inmedia_codecs.xml
file of your platform.To ensure that your custom codec is picked up always, you can ensure that your codec is registered as the very first component in the
media_codecs.xml
file for the specifictype
of codec you wish to employ.Apart from this, as long as your codec supports standard
OMX
functionalities andAndroid
specific extensions likeNative Buffer
usage etc, it should work fine.Note: I presume your application takes of providing the input and consuming the output from the
MediaCodec
.