AVILib
AVILib 库来自 Transcode 的大型开源项目,Transcode-1.1.7 下载地址:
http://www.linuxfromscratch.org/blfs/view/svn/multimedia/transcode.html
解压至 $ANDROID_NDK_HOME/sources
cd Transcode-1.1.7/avilib
修改 platform.h 文件,将通过 Android NDK 构建系统而不是 Transcode 项目的 Makefiles 来完成 AVILIB 的编译。
1 /* 2 * platform.h -- platform utilities wrapper for stream handling libraries 3 * (avilib, wavilib) in transcode. 4 * (C) 2007-2010 - Francesco Romani <fromani -at- gmail -dot- com> 5 * 6 * This software is provided 'as-is', without any express or implied 7 * warranty. In no event will the authors be held liable for any damages 8 * arising from the use of this software. 9 * 10 * Permission is granted to anyone to use this software for any purpose, 11 * including commercial applications, and to alter it and redistribute it 12 * freely, subject to the following restrictions: 13 * 14 * 1. The origin of this software must not be misrepresented; you must not 15 * claim that you wrote the original software. If you use this software 16 * in a product, an acknowledgment in the product documentation would be 17 * appreciated but is not required. 18 * 2. Altered source versions must be plainly marked as such, and must not be 19 * misrepresented as being the original software. 20 * 3. This notice may not be removed or altered from any source distribution. 21 */ 22 23 #ifndef PLATFORM_H 24 #define PLATFORM_H 25 26 #ifdef HAVE_CONFIG_H 27 #include "config.h" 28 #endif 29 30 #ifdef OS_DARWIN 31 #include <sys/uio.h> 32 #endif 33 34 #include <sys/types.h> 35 #include <sys/stat.h> 36 #include <fcntl.h> 37 #include <unistd.h> 38 #include <stdint.h> 39 #include <stdlib.h> 40 #include <stdio.h> 41 42 43 /*************************************************************************/ 44 /* POSIX-like I/O handling */ 45 /*************************************************************************/ 46 47 int plat_open(const char *pathname, int flags, int mode); 48 int plat_close(int fd); 49 ssize_t plat_read(int fd, void *buf, size_t count); 50 ssize_t plat_write(int fd, const void *buf, size_t count); 51 int64_t plat_seek(int fd, int64_t offset, int whence); 52 int plat_ftruncate(int fd, int64_t length); 53 54 /*************************************************************************/ 55 /* libc-like memory handling */ 56 /*************************************************************************/ 57 58 void *_plat_malloc(const char *file, int line, size_t size); 59 void *_plat_zalloc(const char *file, int line, size_t size); 60 void *_plat_realloc(const char *file, int line, void *ptr, size_t size); 61 void plat_free(void *ptr); 62 63 #define plat_malloc(size) \ 64 _plat_malloc(__FILE__, __LINE__, size) 65 #define plat_zalloc(size) \ 66 _plat_zalloc(__FILE__, __LINE__, size) 67 #define plat_realloc(p,size) \ 68 _plat_realloc(__FILE__, __LINE__, p, size) 69 70 /*************************************************************************/ 71 /* simple logging facility */ 72 /*************************************************************************/ 73 74 typedef enum platloglevel_ PlatLogLevel; 75 enum platloglevel_ { 76 PLAT_LOG_DEBUG = 0, 77 PLAT_LOG_INFO, 78 PLAT_LOG_WARNING, 79 PLAT_LOG_ERROR, 80 }; 81 82 int plat_log_open(void); 83 int plat_log_send(PlatLogLevel level, 84 const char *tag, const char *fmt, ...); 85 int plat_log_close(void); 86 87 #endif /* PLATFORM_H */
Android NDK 构建系统需要创建 Android.mk 文件的导入模块。
1 LOCAL_PATH := $(call my-dir) 2 3 # 4 # 转码 AVILib 5 # 6 7 # 源文件 8 MY_AVILIB_SRC_FILES := avilib.c platform_posix.c 9 10 # 包含导出路径 11 MY_AVILIB_C_INCLUDES := $(LOCAL_PATH) 12 13 # 14 # AVILib 静态 15 # 16 include $(CLEAR_VARS) 17 18 # 模块名称 19 LOCAL_MODULE := avilib_static 20 21 # 源文件 22 LOCAL_SRC_FILES := $(MY_AVILIB_SRC_FILES) 23 24 # 包含导出路径 25 LOCAL_EXPORT_C_INCLUDES := $(MY_AVILIB_C_INCLUDES) 26 27 # 构建静态库 28 include $(BUILD_STATIC_LIBRARY) 29 30 # 31 # AVILib 共享 32 # 33 include $(CLEAR_VARS) 34 35 #模块名称 36 LOCAL_MODULE := avilib_shared 37 38 # 源文件 39 LOCAL_SRC_FILES := $(MY_AVILIB_SRC_FILES) 40 41 # 包含导出路径 42 LOCAL_EXPORT_C_INCLUDES := $(MY_AVILIB_C_INCLUDES) 43 44 # 构建共享库 45 include $(BUILD_SHARED_LIBRARY)

浙公网安备 33010602011771号