diff --git a/libmp3lame/BUILD.gn b/libmp3lame/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..dcbf99d3928876f8c3515bea701c06c30751ba79 --- /dev/null +++ b/libmp3lame/BUILD.gn @@ -0,0 +1,107 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +declare_args() { + enable_mp3lame_test = false +} + +config("lame_config") { + defines = [ "HAVE_CONFIG_H=1" ] + cflags = [ + "-O3", + "-Wall", + "-Wno-unused-variable", + "-Wno-absolute-value", + "-Wno-unused-function", + "-Wno-unused-const-variable", + "-Wno-shift-negative-value", + "-Wno-tautological-pointer-compare", + "-MT", + "-MP", + "-pipe", + "-ffast-math", + ] + include_dirs = [ + "//third_party/libmp3lame/libmp3lame", + "//third_party/libmp3lame/libmp3lame/libmp3lame/vector", + "//third_party/libmp3lame/libmp3lame/mpglib/", + "//third_party/libmp3lame/libmp3lame/libmp3lame", + "//third_party/libmp3lame/libmp3lame/include", + "adapted", + ] +} + +LIBMP3LAME_SOURCES = [ + "//third_party/libmp3lame/libmp3lame/libmp3lame/bitstream.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/encoder.c", + "//third_party/libmp3lame/libmp3lame/frontend/amiga_mpega.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/fft.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/gain_analysis.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/id3tag.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/lame.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/newmdct.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/psymodel.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/quantize.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/quantize_pvt.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/set_get.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/vbrquantize.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/reservoir.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/tables.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/takehiro.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/util.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/mpglib_interface.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/VbrTag.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/version.c", + "//third_party/libmp3lame/libmp3lame/libmp3lame/presets.c", + "//third_party/libmp3lame/libmp3lame/mpglib/common.c", + "//third_party/libmp3lame/libmp3lame/mpglib/dct64_i386.c", + "//third_party/libmp3lame/libmp3lame/mpglib/decode_i386.c", + "//third_party/libmp3lame/libmp3lame/mpglib/layer1.c", + "//third_party/libmp3lame/libmp3lame/mpglib/layer2.c", + "//third_party/libmp3lame/libmp3lame/mpglib/layer3.c", + "//third_party/libmp3lame/libmp3lame/mpglib/tabinit.c", + "//third_party/libmp3lame/libmp3lame/mpglib/interface.c", +] + +ohos_static_library("libmp3lame") { + sources = LIBMP3LAME_SOURCES + configs = [ ":lame_config" ] + subsystem_name = "thirdparty" + part_name = "libmp3lame" +} + +ohos_executable("lame") { + sources = [ + "//third_party/libmp3lame/libmp3lame/frontend/brhist.c", + "//third_party/libmp3lame/libmp3lame/frontend/console.c", + "//third_party/libmp3lame/libmp3lame/frontend/get_audio.c", + "//third_party/libmp3lame/libmp3lame/frontend/lame_main.c", + "//third_party/libmp3lame/libmp3lame/frontend/lametime.c", + "//third_party/libmp3lame/libmp3lame/frontend/main.c", + "//third_party/libmp3lame/libmp3lame/frontend/parse.c", + "//third_party/libmp3lame/libmp3lame/frontend/timestatus.c", + ] + configs = [ ":lame_config" ] + deps = [ ":libmp3lame" ] + subsystem_name = "thirdparty" + part_name = "libmp3lame" +} + +group("mp3lame_targets") { + deps = [ ":libmp3lame" ] + if (enable_mp3lame_test) { + deps += [ ":lame" ] + } +} diff --git a/libmp3lame/CHANGELOG.md b/libmp3lame/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..ad536a34187bd35d9159b1999c9a202e65bf5663 --- /dev/null +++ b/libmp3lame/CHANGELOG.md @@ -0,0 +1,3 @@ +# 1.0.0 + +添加BUILD.gn,适配在ohos上的编译 \ No newline at end of file diff --git a/libmp3lame/README.OpenSource b/libmp3lame/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..8dc3e444a6eedacec0978b4fab51b601d7383e84 --- /dev/null +++ b/libmp3lame/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libmp3lame", + "License": "LGPL", + "License File": "COPYING", + "Version Number": "v3.99.5", + "Owner" : "ding_chengjie@hoperun.com", + "Upstream URL": "https://github.com/gypified/libmp3lame", + "Description": "开源mp3编码库,使用MPGLIB解码引擎,专门用于编码 mp3" + } +] diff --git a/libmp3lame/README_zh.md b/libmp3lame/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..d7e5b102030134770691e054c0f80443f4e254bf --- /dev/null +++ b/libmp3lame/README_zh.md @@ -0,0 +1,16 @@ +# libmp3lame 三方库说明 + +## 功能简介 + +libmp3lame是开源mp3编码库,使用MPGLIB解码引擎,专门用于编码 mp3 + +## 使用约束 + +- Rom版本:OpenHarmony3.2 beta1 +- 三方库版本:v3.99.5 +- 当前适配的功能:mp3文件编码 +- License:[LGPL](https://github.com/gypified/libmp3lame/blob/master/COPYING) + +## 集成方式 + +- [系统Rom包集成](./docs/rom_integrate.md) \ No newline at end of file diff --git a/libmp3lame/adapted/config.h b/libmp3lame/adapted/config.h new file mode 100644 index 0000000000000000000000000000000000000000..0d4d132d7b07a3152d1ffe1e771259249c1ef05b --- /dev/null +++ b/libmp3lame/adapted/config.h @@ -0,0 +1,375 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +#ifndef LAME_CONFIG_H +#define LAME_CONFIG_H + +/* debug define */ +/* #undef ABORTFP */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* alot of debug output */ +/* #undef DEBUG */ + +/* allow to compute a more accurate replaygain value */ +/* #undef DECODE_ON_THE_FLY */ + +/* double is faster than float on Alpha */ +/* #undef FLOAT */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* we link against libefence */ +/* #undef HAVE_EFENCE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* add ieee754_float32_t type */ +/* #undef HAVE_IEEE754_FLOAT32_T */ +#ifndef HAVE_IEEE754_FLOAT32_T + typedef float ieee754_float32_t; +#endif + +/* add ieee754_float64_t type */ +/* #undef HAVE_IEEE754_FLOAT64_T */ +#ifndef HAVE_IEEE754_FLOAT64_T + typedef double ieee754_float64_t; +#endif + +/* system has 80 bit floats */ +/* #undef HAVE_IEEE854_FLOAT80 */ + +/* add ieee854_float80_t type */ +/* #undef HAVE_IEEE854_FLOAT80_T */ +#ifndef HAVE_IEEE854_FLOAT80_T + typedef long double ieee854_float80_t; +#endif + +/* add int16_t type */ +#define HAVE_INT16_T 1 +#ifndef HAVE_INT16_T + typedef short int16_t; +#endif + +/* add int32_t type */ +#define HAVE_INT32_T 1 +#ifndef HAVE_INT32_T +#define A_INT32_T int + typedef A_INT32_T int32_t; +#endif + +/* add int64_t type */ +#define HAVE_INT64_T 1 +#ifndef HAVE_INT64_T +#define A_INT64_T long long + typedef A_INT64_T int64_t; +#endif + +/* add int8_t type */ +#define HAVE_INT8_T 1 +#ifndef HAVE_INT8_T + typedef char int8_t; +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SOUNDCARD_H 1 + +/* Define to 1 if the type `long double' works and has more range or precision + than `double'. */ +/* #undef HAVE_LONG_DOUBLE */ + +/* Define to 1 if the type `long double' works and has more range or precision + than `double'. */ +/* #undef HAVE_LONG_DOUBLE_WIDER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* build with mpglib support */ +/* #undef HAVE_MPGLIB */ + +/* have nasm */ +/* #undef HAVE_NASM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NCURSES_TERMCAP_H */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOUNDCARD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* have termcap */ +/* #undef HAVE_TERMCAP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMCAP_H */ + +/* add uint16_t type */ +#define HAVE_UINT16_T 1 +#ifndef HAVE_UINT16_T + typedef unsigned short uint16_t; +#endif + +/* add uint32_t type */ +#define HAVE_UINT32_T 1 +#ifndef HAVE_UINT32_T +#define A_UINT32_T unsigned int + typedef A_UINT32_T uint32_t; +#endif + +/* add uint64_t type */ +#define HAVE_UINT64_T 1 +#ifndef HAVE_UINT64_T +#define A_UINT64_T unsigned long long + typedef A_UINT64_T uint64_t; +#endif + +/* add uint8_t type */ +#define HAVE_UINT8_T 1 +#ifndef HAVE_UINT8_T + typedef unsigned char uint8_t; +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_XMMINTRIN_H */ + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* requested by Frank, seems to be temporary needed for a smooth transition */ +#define LAME_LIBRARY_BUILD 1 + +/* set to 1 if you have libsndfile */ +/* #undef LIBSNDFILE */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* use MMX version of choose_table */ +/* #undef MMX_choose_table */ + +/* no debug build */ +#define NDEBUG 1 + +/* build without hooks for analyzer */ +/* #undef NOANALYSIS */ + +/* Name of package */ +#define PACKAGE "lame" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "lame-dev@lists.sf.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "lame" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "lame 3.99.5" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "lame" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.99.5" + +/* Define to 1 if the C compiler supports function prototypes. */ +#define PROTOTYPES 1 + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `long double', as computed by sizeof. */ +/* #undef SIZEOF_LONG_DOUBLE */ + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `unsigned int', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_INT 4 + +/* The size of `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG 4 + +/* The size of `unsigned long long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* The size of `unsigned short', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_SHORT 2 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* IEEE754 compatible machine */ +/* #undef TAKEHIRO_IEEE754_HACK */ + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* faster log implementation with less but enough precission */ +/* #undef USE_FAST_LOG */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "3.99.5" + +/* Define if using the dmalloc debugging malloc package */ +/* #undef WITH_DMALLOC */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* we're on DEC Alpha */ +/* #undef __DECALPHA__ */ + +/* work around a glibc bug */ +/* #undef __NO_MATH_INLINES */ + +/* Define like PROTOTYPES; this can be used by system headers. */ +#define __PROTOTYPES 1 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +#endif /* LAME_CONFIG_H */ diff --git a/libmp3lame/bundle.json b/libmp3lame/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..0b82d5402ea3a516b9c5ff2d9e5f0086362ab329 --- /dev/null +++ b/libmp3lame/bundle.json @@ -0,0 +1,33 @@ +{ + "name": "@ohos/libmp3lame", + "description": "gypified libmp3lame C library", + "version": "v3.99.5", + "license": "LGPL", + "publishAs": "", + "segment": { + "destPath": "third_party/libmp3lame" + }, + "dirs": {}, + "scripts": {}, + "readmePath": { + "en": "README" + }, + "component": { + "name": "libmp3lame", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": ["standard"], + "rom": "", + "ram": "", + "deps": { + "components": [], + "third_party": [] + }, + "build": { + "sub_component": ["//third_party/libmp3lame:mp3lame_targets"], + "inner_kits": [], + "test": [] + } + } +} diff --git a/libmp3lame/docs/image/result.png b/libmp3lame/docs/image/result.png new file mode 100644 index 0000000000000000000000000000000000000000..e5d24cbdc1104c9723611237842c37d8c9b34c69 Binary files /dev/null and b/libmp3lame/docs/image/result.png differ diff --git a/libmp3lame/docs/rom_integrate.md b/libmp3lame/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..013c5d420f9beebc19c11695a52ac8a193813b79 --- /dev/null +++ b/libmp3lame/docs/rom_integrate.md @@ -0,0 +1,139 @@ +# libmp3lame如何集成到系统Rom + +## 准备源码工程 + +本库是基于OpenHarmony-v3.2-Beta1版本,在RK3568开发板上验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +### 准备系统Rom源码 + +系统源码获取请参考:[OpenHarmony源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta2/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md) + +### 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ``` + cd ~ + git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ``` + tpc_c_cplusplus/libmp3lame #三方库libmp3lame的目录结构如下 + ├── adapted #存放三方库适配需要的代码文件 + ├── docs #存放三方库相关文档的文件夹 + ├── BUILD.gn #构建脚本,支持rom包集成 + ├── bundle.json #三方库组件定义文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将三方库拷贝到OpenHarmony源码的third_party目录下 + + ``` + cp ~/tpc_c_cplusplus/libmp3lame ~/openharmony/third_party -rf + ``` + +### 准备三方库源码 + +``` +cd ~/openharmony/third_party/libmp3lame #进入三方库目录 +git clone https://github.com/gypified/libmp3lame.git #下载三方库源码 +``` + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) 我们默认三方库是属于OpenHarmony的thirdparty子系统,如果需要自己定义子系统参考文档[如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) 新增需要编译的组件,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件中,新增需要编译的组件,如下代码段所示,在thirdparty子系统下面新增libmp3lame组件 + +``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "libmp3lame", + "features": [] + } + ] + } +``` + +## 系统Rom中引入三方库测试程序 + +libmp3lame原生库提供了测试用例,如需要引入测试程序,在OpenHarmony源码的vendor/hihope/rk3568/config.json文件,对应组件的features中打开编译选项: + +``` +{ + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "libmp3lame", + "features": [ "enable_mp3lame_test=true" ] + } + ] +} +``` + +## 编译工程 + +在OpenHarmony源码根目录下 + +``` +cd ~/openharmony +``` + +- 执行编译 + + ``` + ./build.sh --product-name rk3568 --ccache + ``` + +- 生成文件的路径 + + 可执行文件生成在out/rk3568/thirdparty/libmp3lame/lame,库文件生成在out/rk3568/obj/thirdparty/libmp3lame目录下 + +## 运行效果 + +将编译生成的库和测试文件放到板子上运行,为避免每次将文件推入设备都烧录整个镜像,我们使用hdc_std工具将文件推到开发板上 + +- 首先将hdc_std工具编译出来 工具编译出来所在路径out/sdk/ohos-sdk/windows/toolchains/hdc_std.exe + + ``` + hb set #源码根目录下使用hb set 选择产品ohos-sdk + hb build #然后编译 + ``` + +- 将工具拷贝到Windows,可以为工具目录配置环境变量,也可以在工具所在目录打开windows命令行 + +- 将编译生成的lame可执行文件及原生库下的测试文件testcase.wav准备好 + +- 将准备好的文件推送到开发板,在windows命令行进行如下操作 + + ``` + hdc_std shell mount -o remount,rw / #修改系统权限为可读写 + hdc_std file send lame /data #将可执行文件推入开发板data目录 + hdc_std file send testcase.wav /data #将测试文件推入开发板data目录 + hdc_std shell #进入开发板 + ./lame testcase.wav testcase.mp3 #执行可执行文件编码生成MP3文件 + #该组件不需要将库拷贝到/system/lib 或者/system/lib64目录下,因为可执行文件已经执行了编译生成的静态库 + ``` + +- 运行测试程序 效果如下图 + +- ![result](image/result.png) + +## 参考资料 + +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld) +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +- [如何为三方库组件中添加一个三方库](https://gitee.com/openharmony-sig/knowledge/blob/master/docs/openharmony_getstarted/port_thirdparty/README.md) +- [标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md) \ No newline at end of file