Android: How to build and replace modified AOSP code

浪尽此生 提交于 2019-12-24 03:32:06

问题


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......


回答1:


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.




回答2:


You don't need to rebuild libstagefright.so to use it in your app. You can adb pull the library from your device, or even from an emulator.

Please note that libstagefright communicates with many components in /system/lib, some of which are specific to SoC vendor (e.g. Qualcomm) or ODM (e.g. Samsung). Some uses of Stagefright may require quirks specific to device. This is why OpenMAX IL has not been officially exposed on Android. On the otehr hand, OpneMAX AL has been officially supported since November 2011.

At any rate, libstagefright cannot be directly accessed from Java. If you are looking for a Java solution for video communication, you should first look at the excellent libstreaming library.

The advantage of using libstagefright comes usually when you have you your native (C/C++) library that only has to be connected to an efficient codec.

Here is a nice answer on a related question about Android hardware decoder.



来源:https://stackoverflow.com/questions/24201178/android-how-to-build-and-replace-modified-aosp-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!