androidandroid-ndkandroid-sourcestagefright

Android: How to build and replace modified AOSP code


I am starting to work with stage fright frame work to implement hardware decoder in android prior to Jelly bean in my video conferencing application.
I have downloaded and built the android source code in Mac system. I am not clear with the whole idea of working with AOSP. And my questions are (with respect to stagefright framework)

  1. Where can I find the libstagefright.so after AOSP build ?.

  2. If I use the OMX codec in my class for decode, how should I link the libstagefright.so to native code of my application ? If I build my native code by copying the libstagefright.so and linking it via make file is that the way ?

  3. How can I use it in my application ? If I load it via System.loadLibrary(" "), will it work ??

UPDATE:
I have tried the suggestion from Ganesh. But when I tried to build the project with NDK it is not taking the headers included as LOCAL_C_INCLUDES.

Here is my android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS := -llog
LOCAL_MODULE := custom_decoder

LOCAL_C_INCLUDES := $(LOCAL_PATH)\includes \
                    frameworks/av/media/libstagefright/include \
                    frameworks/native/include/media/openmax \
                    frameworks/base/include/media/stagefright

LOCAL_SHARED_LIBRARIES := \
                    libstagefright libstagefright_omx libstagefright_foundation libutils liblog

LOCAL_SRC_FILES := custom_decoder_jni.cpp custom_decoder.cpp

include $(BUILD_SHARED_LIBRARY)

the error is shown from custom_decoder.h when it is reading the includes of AOSP.

 fatal error: DataSource.h: No such file or directory. 

I haven"t included any AOSP .so in my project(as per Ganesh's suggestion in comment 2). Should I do that?

What else should I do to get it built......


Solution

  • To answer your specific queries,

    1. libstagefright.so is built and installed at /system/lib

    2. I presume you are employing the libstagefright.so in native code. With this assumption, you don't have to copy. I presume you are building your module as a loadable library i.e. .so file. Hence, if you can identify the dependency on libstagefright.so through LOCAL_SHARED_LIBRARIES as well as including the header files, it should be more than sufficient for building your module. Please refer to this example of building a FLAC encoder where similar dependencies have been handled.

    3. By application, if you are referring to a Java application which interacts with a JNI layer, then point 2 should be more than sufficient. However, if you are creating a native layer application, I would recommend you to follow stagefright command line utility's makefile.