ffmpeg移植改接口调用 |

发布时间:2016-12-10 1:37:25 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"ffmpeg移植改接口调用 |",主要涉及到ffmpeg移植改接口调用 |方面的内容,对于ffmpeg移植改接口调用 |感兴趣的同学可以参考一下。

//jni build ------------------------ Jni/Android.mk : LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) PATH_TO_FFMPEG_SOURCE:=$(LOCAL_PATH)/ffmpeg -L/usr/android-x264/include  LOCAL_C_INCLUDES += $(PATH_TO_FFMPEG_SOURCE) LOCAL_LDLIBS := -lffmpeg -llog -ljnigraphics -lz -ldl -lgcc  LOCAL_MODULE    := hello-jni LOCAL_SRC_FILES := hello-jni.c  include $(BUILD_SHARED_LIBRARY) ------------------------- ffmpeg-jni.c : //---定义java函数,为了Java中方法调用----- jstring Java_com_example_hellojni_HelloJni_FFMpegTasks(JNIEnv * env, jobject this) {      LOGI("goto function video_gen()");      char const *str;     int a=4;     char *arg[4];      arg[0]="ffmpeg";      arg[1]="-i";      arg[2]="/sdcard/data/pic.avi";     arg[3]="/sdcard/data/pic2.avi";//"http://192.168.1.108:8090/feed1.ffm";     __android_log_print(ANDROID_LOG_INFO, "JNIMsg","============");     __android_log_print(ANDROID_LOG_INFO, "filePath",arg[2]);     int ret = video_gen(a,arg);     str="Using FFMPEG doing your job";     return (*env)->NewStringUTF(env,str); } ------------------------- //---ffmpeg build--- ------------------------------- Android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_WHOLE_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc libswscale libavfilter libavdevice LOCAL_MODULE := ffmpeg LOCAL_SRC_FILES += cmdutils.c cmdutils.h ffmpeg.c cmdutils_common_opts.h LOCAL_LDLIBS += -llog include $(BUILD_SHARED_LIBRARY) include $(call all-makefiles-under,$(LOCAL_PATH)) ---------------- +    config : --------------------- ======================================== x264 build.sh: export NDK=/usr/Android/android-ndk-r8b export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt export PLATFORM=$NDK/platforms/android-8/arch-arm  export PREFIX=/usr/android-x264 ./configure --prefix=$PREFIX \ --enable-static \ --enable-pic \ --enable-shared \ --disable-asm \ --disable-cli \ --host=arm-linux \ --cross-prefix=$PREBUILT/linux-x86/bin/arm-linux-androideabi- \ --sysroot=$PLATFORM ------------------------------------------ x264-ffmpeg  build: config: #!/bin/bash PREBUILT=/usr/Android/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 PLATFORM=/usr/Android/android-ndk-r8b/platforms/android-9/arch-arm ./configure --target-os=linux \ --arch=arm  \ --enable-version3 \ --enable-gpl \ --enable-nonfree \ --enable-shared \ --enable-stripping \ --enable-ffmpeg \ --disable-ffplay \ --disable-ffserver \ --disable-ffprobe \ --disable-symver \ --enable-encoders \ --enable-decoders \ --enable-libx264 \ --enable-muxers \ --disable-devices \ --enable-protocols \ --enable-protocol=file \ --enable-avfilter \ --enable-network \ --enable-avdevice \ --disable-asm  \ --enable-cross-compile \ --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \ --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ --strip=$PREBUILT/bin/arm-linux-androideabi-strip \ --extra-cflags="-fPIC -DANDROID -I/usr/android-x264/include" \ --extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl" \ sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h sed -i 's/HAVE_CBRT 0/HAVE_CBRT 1/g' config.h sed -i 's/HAVE_CBRTF 0/HAVE_CBRTF 1/g' config.h sed -i 's/HAVE_ISINF 0/HAVE_ISINF 1/g' config.h sed -i 's/HAVE_ISNAN 0/HAVE_ISNAN 1/g' config.h sed -i 's/HAVE_SINF 0/HAVE_SINF 1/g' config.h sed -i 's/HAVE_RINT 0/HAVE_RINT 1/g' config.h --------------------------------------- android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_WHOLE_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc libswscale libavfilter libavdevice LOCAL_MODULE := ffmpeg LOCAL_SRC_FILES += cmdutils.c cmdutils.h ffmpeg.c cmdutils_common_opts.h LOCAL_LDLIBS += -llog -L/usr/android-x264/lib -lx264 include $(BUILD_SHARED_LIBRARY) include $(call all-makefiles-under,$(LOCAL_PATH)) ================== FFMPEG 库添加到platforms ; 源码提供头文件;

上一篇:js正则基础(1)
下一篇:判断二进制数中1的个数

相关文章

相关评论