DSP

NKD编译opus-1.2.1

2019-07-13 20:11发布


opus-1.2.1

官网:http://www.opus-codec.org opus-1.2.1下载

NDK编译

下载完opus-1.2.1后解压,进入解压后的目录新建目录Android,在Android目录内创建Android.mkbuild.sh两个文件。内容如下。

Android.mk

LOCAL_PATH := $(call my-dir)/.. include $(CLEAR_VARS) APP_ABI := armeabi APP_CPPFLAGS +=-std=c++11 APP_STL := gnustl_shared APP_PLATFORM :=android-14 include $(LOCAL_PATH)/celt_sources.mk include $(LOCAL_PATH)/silk_sources.mk include $(LOCAL_PATH)/opus_sources.mk LOCAL_MODULE := opus # Fixed point sources SILK_SOURCES += $(SILK_SOURCES_FIXED) # ARM build CELT_SOURCES += $(CELT_SOURCES_ARM) SILK_SOURCES += $(SILK_SOURCES_ARM) LOCAL_SRC_FILES := $(CELT_SOURCES) $(SILK_SOURCES) $(OPUS_SOURCES) $(OPUS_SOURCES_FLOAT) LOCAL_LDLIBS := -lm -llog LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/silk $(LOCAL_PATH)/silk/fixed $(LOCAL_PATH)/celt LOCAL_CFLAGS := -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -O3 -fno-math-errno LOCAL_CPPFLAGS := -DBSD=1 LOCAL_CPPFLAGS += -ffast-math -O3 -funroll-loops include $(BUILD_SHARED_LIBRARY)

build.sh

#!/bin/bash ndk-build APP_BUILD_SCRIPT=Android.mk NDK_PROJECT_PATH=. 执行build.sh后就会进行编译了。(确保ndk已配置到环境变量中,否则指明ndk的路径。在cygwin中,使用ndk-build.cmd

其他