[Libav-user] Error when creating .so file using .c program and ffmpeg using android NDK

prathap prathap.malempati at gmail.com
Thu May 30 06:53:34 CEST 2013


Hi everybody 

when i am trying to create .so file using .c file and ffmpeg and android NDK
i got this errors 


Install        : libmylib.so => libs/armeabi-v7a/libmylib.so
Install        : libmylib.so => libs/armeabi/libmylib.so
Compile x86    : mylib <= mylib.c
cc1: error: unrecognized command line option '-mfloat-abi=softfp'
cc1: error: unrecognized command line option '-mfpu=neon'
jni/mylib.c:1:0: error: bad value (armv7-a) for -march= switch
make: *** [obj/local/x86/objs/mylib/mylib.o] Error 1

----------------------------------------------------------------------------------------------------------------------


My android.mk file is 

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS = -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib
-L$(LOCAL_PATH)/../obj/local/armeabi/ -lavformat -lavcodec -lpostproc
-lswscale -lavutil -llog -ljnigraphics -lz -ldl -lgcc
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ffmpeg
LOCAL_SRC_FILES := mylib.c
LOCAL_CFLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon
LOCAL_MODULE := mylib
#LOCAL_SRC_FILES := mylib.c

include $(BUILD_SHARED_LIBRARY)

LOCAL_PATH := $(call my-dir)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ffmpeg
include $(all-subdir-makefiles)

-----------------------------------------------------------------------------------------------------------------------


My .c program is like this 


#include <jni.h>
#include <android/log.h>
#include <com_myffmpegtest_MainActivity.h>

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libswscale/swscale.h>
#include <libavutil/avstring.h>

#define LOG_TAG "mylib"
#define LOGI(...)  __android_log_print(ANDROID_LOG_INFO, LOG_TAG,
__VA_ARGS__)
#define LOGE(...)  __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,
__VA_ARGS__)

JNIEXPORT jint JNICALL Java_com_myffmpegtest_MainActivity_logFileInfo
(JNIEnv *env, jclass this, jstring filename)
{
    av_register_all();

    AVFormatContext *pFormatCtx;
    const jbyte *str;
    str = (*env)->GetStringUTFChars(env, filename, NULL);

    if(avformat_open_input(&pFormatCtx, str, NULL, NULL)!=0)
    {
        LOGE("Can't open file '%s'\n", str);
        return 1;
    }
    else
    {
        LOGI("File was opened\n");
        LOGI("File '%s', Codec %s",
           pFormatCtx->filename,
            pFormatCtx->iformat->name
        );
    }
    return 0;
}

-------------------------------------------------------------------------------------------------------------------


Thanks for you suggestions  

Regards 
Prathap.M 



--
View this message in context: http://libav-users.943685.n4.nabble.com/Error-when-creating-so-file-using-c-program-and-ffmpeg-using-android-NDK-tp4657764.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list