AnsweredAssumed Answered

H.264 hardware decoding in Android

Question asked by Javier Rodriguez on Feb 11, 2013
Latest reply on May 23, 2013 by Karina Valencia Aguilar
Branched to a new discussion

Hi there!

 

Currently I am working with the  Android R13.4 GA and I need to decode a H.264 raw stream. I have googled in order to find information about how to solve it and all the people say that I should use the library libstagefright.so.

 

This library is installed within the system folder but I do not know how to "open" it.

 

I have tried to build the ffmpeg project with stagefright support because the program that I am developing implements the ffmpeg library so I thought that it could be a very good idea to intregrate it into the ffmpeg project.

 

Well, after 2 - 3 weeks, I have finally compiled the ffmpeg project with the stagefright support (I hope so...) but I have a problem because if I try to link with the ndk platform libraries (android-ndk-r8d/platform/android-9/arch-arm/usr/lib) It compiles and links successfully but if I try to do that with the system libraries distributed with the BSP (Android R13.4 GA), it fails, throwing me the next linking errors.

 

/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/avcodec/libavcodec/libstagefright.o: in function Stagefright_init(AVCodecContext*):jni/..//submodules/externals/build/ffmpeg/../../ffmpeg/libavcodec/libstagefright.cpp:317: error: undefined reference to 'android::OMXCodec::Create(android::sp<android::IOMX> const&, android::sp<android::MetaData> const&, bool, android::sp<android::MediaSource> const&, char const*, unsigned int)'

 

/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/avcodec/libavcodec/RefBase.o: in function android::RefBase::weakref_type::attemptIncStrong(void const*):jni/..//submodules/externals/build/ffmpeg/../../ffmpeg/libavcodec/RefBase.cpp:420: error: undefined reference to 'android_atomic_cmpxchg'

 

/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/objs/avcodec/libavcodec/RefBase.o: in function android::RefBase::weakref_type::attemptIncWeak(void const*):jni/..//submodules/externals/build/ffmpeg/../../ffmpeg/libavcodec/RefBase.cpp:482: error: undefined reference to 'android_atomic_cmpxchg'

 

I have been looking for a solution and I have found that the first reference exists in the library "libstagefright.so" and the last 2 references correspond to the library "libcutils.so". Both are installed in /system/lib in the BSP or in android-ndk-r8d/platform/android-9/arch-arm/usr/lib.


Obviously, I think that the real problem is that the BSP Libraries are different from the ndk libraries (Android version?) and do not contain these references, If that is true, how could I do to compile it??? Because I have tested the Android default video player and It can reproduce the big buck bunny at 1080p smoothly...

 

Of course, I have read the powerpoint distributed by freescale

 

Multimedia with VPU&IPU HW acceleration in Android

 

But It does not throws any light to how to solve the problem. I need how to comunicate with the stagefright API?????.

 

I have spent 4 week trying to make run this stuff and I am a bit desperated.

 

Thank you very much.

Outcomes