在eclipse下android ndk直接编译librtmp。

需要openssl的libcrypto.a,libssl.a

jni目录下

文件夹librtmp

文件夹openssl

文件Android.mk

Android.mk中

LOCAL_PATH:= $(call my-dir)
include $(LOCAL_PATH)/openssl/Android.mk
include $(LOCAL_PATH)/librtmp/Android.mk

openssl目录下

include,libcrypto.a,libssl.a,Android.mk

Android.mk中

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
	libcrypto.a \

LOCAL_MODULE := crypto
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)


include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
	libssl.a \

LOCAL_MODULE := ssl
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)

librtmp目录下

文件夹librtmp

文件Android.mk

Android.mk中

subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
		librtmp \
	))

SSL := $(LOCAL_PATH)/openssl
ifndef SSL
$(error "You must define SSL before starting")
endif

include $(LOCAL_PATH)/librtmp/librtmp/Android.mk
librtmp下就是源码和Android.mk

Android.mk中

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_C_INCLUDES += $(NDK_PROJECT_PATH)/librtmp \
	$(SSL)/include
LOCAL_SRC_FILES:= \
	amf.c \
	hashswf.c \
	log.c \
	parseurl.c \
	rtmp.c
LOCAL_SHARED_LIBRARIES  := crypto 
LOCAL_SHARED_LIBRARIES  += ssl
#LOCAL_CFLAGS += -I$(SSL)/include -DUSE_OPENSSL
LOCAL_LDLIBS += -L$(SSL)
LOCAL_LDLIBS += -lssl -lcrypto -lz
LOCAL_MODULE := librtmp

include $(BUILD_SHARED_LIBRARY)


右键运行,就可以编译通过
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭