当前位置:编程学习 > wap >>

FFMPEG jni

Android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
PATH_TO_FFMPEG_SOURCE:=$(LOCAL_PATH)/ffmpeg
LOCAL_C_INCLUDES += $(PATH_TO_FFMPEG_SOURCE)
LOCAL_LDLIBS += -lffmpeg
LOCAL_MODULE    := tiger
LOCAL_SRC_FILES := tiger.c
include $(BUILD_SHARED_LIBRARY)


tiger.c
#include<jni.h>
#include<android/log.h>
#include<stdlib.h>
#include<string.h>
#include <ffmpeg/libavcodec/avcodec.h>

#ifdef __cplusplus
extern "C"
{
#endif

//your code


jint Java_com_tigertest_MainActivity_add(JNIEnv* env,jobject thiz,int a,int b){
return a+b;
}

jstring Java_com_tigertest_MainActivity_stringFromJNI(JNIEnv* env,jobject thiz){
 char str[25];
 sprintf(str, "%d", avcodec_version());
 return (*env)->NewStringUTF(env, str);
}

#ifdef __cplusplus
}
#endif

提示出错:
In file included from jni/ffmpeg/libavutil/avutil.h:238:0,
                 from jni/ffmpeg/libavutil/samplefmt.h:24,
                 from jni/ffmpeg/libavcodec/avcodec.h:30,
                 from jni/tiger.c:5:
jni/ffmpeg/libavutil/common.h:40:32: fatal error: libavutil/avconfig.h: No such file or directory
compilation terminated.
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,