H.264 hardware decoding in Android

cancel
Showing results for 
Search instead for 
Did you mean: 

H.264 hardware decoding in Android

Jump to solution
9,797 Views
javierrodriguez
Contributor III

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&amp;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.

Labels (3)
1 Solution
469 Views
karina_valencia
NXP Apps Support
NXP Apps Support
Re: H.264 hardware decoding in Android

Junping MaoEmployee

Hi,

    The android GA release already has the support to stagefright, you could use  command "setprop media.omxgm.enable-player 0" to enable stagefright to try your task.

View solution in original post

0 Kudos
5 Replies
469 Views
elvischen
Contributor I

Hi there!

I also meet the almost same problem and I also studied the Multimedia with VPU&IPU HW acceleration in Android

document.

May I ask whether freescale provides the VPU's API for developers to directly interact with the VPU,

Or developers have to implement the procedure in function of "OMXCodec::allocateOutputBuffersFromNativeWindow()"

where locates at /frameworks/base/media/libstagefright/OMXCodec.cpp?

0 Kudos
470 Views
karina_valencia
NXP Apps Support
NXP Apps Support
Re: H.264 hardware decoding in Android

Junping MaoEmployee

Hi,

    The android GA release already has the support to stagefright, you could use  command "setprop media.omxgm.enable-player 0" to enable stagefright to try your task.

View solution in original post

0 Kudos
469 Views
daiane_angolini
NXP Employee
NXP Employee

it´s a relief.

0 Kudos
469 Views
daiane_angolini
NXP Employee
NXP Employee

Have you tried to play some movie using Gallery?

0 Kudos
469 Views
javierrodriguez
Contributor III

Hi Daiane,

When I said "Android default video player" I wanted to say the video player asociated to the Android Gallery. There, the video big buck bunny at 1080p plays smoothly.

Otherwise, I have solved the linking problems. I was made a mistake triying to link with the gingerbread libraries instead of linking with ice cream sandwich.

Thank you very much.