diff --git a/thirdparty/libsamplerate-0.2.2/HPKBUILD b/thirdparty/libsamplerate-0.2.2/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..c0861ddba7e7beb164945825d1130705355a7be5 --- /dev/null +++ b/thirdparty/libsamplerate-0.2.2/HPKBUILD @@ -0,0 +1,61 @@ +# Copyright (c) 2023 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. + +# Contributor: wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2471389@stu.neu.edu.cn>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +pkgname=libsamplerate-0.2.2 +pkgver=0.2.2 +pkgrel=0 +pkgdesc="libsamplerate is a library for performing sample rate conversion of audio data." +url="https://github.com/libsndfile/libsamplerate/tree/0.2.2" +archs=("armeabi-v7a" "arm64-v8a") +license=("BSD-2-Clause license") +depends=() +makedepends=() +source="https://github.com/libsndfile/libsamplerate/archive/refs/tags/0.2.2.zip" + +downloadpackage=true +autounpack=true +buildtools=cmake + +builddir=libsamplerate-0.2.2 +packagename=libsamplerate-0.2.2.zip + +# 为编译设置环境,如设置环境变量,创建编译目录等 +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument" \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument" -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} +package() { + cd $builddir + $MAKE -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" +} + +cleanbuild() { + rm -rf ${PWD}/$builddir +} \ No newline at end of file diff --git a/thirdparty/libsamplerate-0.2.2/HPKCHECK b/thirdparty/libsamplerate-0.2.2/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..45087f23bbfe1b9cac2c3352e606b765ef4a975f --- /dev/null +++ b/thirdparty/libsamplerate-0.2.2/HPKCHECK @@ -0,0 +1,33 @@ +# Copyright (c) 2023 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. + +# Contributor: wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangyihao<2471389@stu.neu.edu.cn>, wangying +# Maintainer: wangyihao<2471389@stu.neu.edu.cn>, wangjialun<2271411@stu.neu.edu.cn>, zhangqian<2371418@stu.neu.edu.cn>, wangying + +source HPKBUILD > /dev/null 2>&1 # 导入HPKBUILD文件 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${OHOS_SDK_VER}_test.log + + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build # 进入到测试目录 + ctest > $logfile 2>&1 + res=$? + if [ $res -ne 0 ];then + mkdir ${LYCIUM_FAULT_PATH}/${pkgname} + cp Testing/Temporary/LastTest.log ${LYCIUM_FAULT_PATH}/${pkgname}/ + fi + cd $OLDPWD + return $res +} \ No newline at end of file diff --git a/thirdparty/libsamplerate-0.2.2/README.OpenSource b/thirdparty/libsamplerate-0.2.2/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..ecd238a107317aa25db98470131f0c2a4ceecd75 --- /dev/null +++ b/thirdparty/libsamplerate-0.2.2/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libsamplerate-0.2.2", + "License": "BSD-2-Clause license", + "License File": "https://github.com/libsndfile/libsamplerate/blob/master/COPYING", + "Version Number": "0.2.2", + "Owner": "2942375747@qq.com", + "Upstream URL": "https://github.com/libsndfile/libsamplerate", + "Description": "libsamplerate is a library for performing sample rate conversion of audio data." + } +] \ No newline at end of file diff --git a/thirdparty/libsamplerate-0.2.2/README_zh.md b/thirdparty/libsamplerate-0.2.2/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec445a46d9a38e8b610e339291668d69d112675 --- /dev/null +++ b/thirdparty/libsamplerate-0.2.2/README_zh.md @@ -0,0 +1,9 @@ +# libsamplerate-0.2.2三方库说明 +## 功能简介 +libsamplerate是一个用于执行音频数据采样率转换的库。 +## 三方库版本: +- 0.2.2 +## 使用约束: +- [IDE和SDK版本](../../docs/constraint.md) +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) \ No newline at end of file diff --git a/thirdparty/libsamplerate-0.2.2/SHA512SUM b/thirdparty/libsamplerate-0.2.2/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..23457d286985fd591288ba02a4d78ab48d1b0528 --- /dev/null +++ b/thirdparty/libsamplerate-0.2.2/SHA512SUM @@ -0,0 +1 @@ +dedd072bc83ccebfe1a33e8a3fb3f72559bfd36282b958b1d5463b786f2325f684137580db38d91f0f4f5345a1da3e9e1c4a1695e303182e57d542c085db829f libsamplerate-0.2.2.zip \ No newline at end of file diff --git a/thirdparty/libsamplerate-0.2.2/docs/hap_integrate.md b/thirdparty/libsamplerate-0.2.2/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..ef939c2b5e813d9b554e70c42425c90bc5063a48 --- /dev/null +++ b/thirdparty/libsamplerate-0.2.2/docs/hap_integrate.md @@ -0,0 +1,79 @@ +# libsamplerate集成到应用hap + +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- [开发环境准备](../../../docs/hap_integrate_environment.md) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/libsamplerate-0.2.2 #三方库libsamplerate-0.2.2的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #测试脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #三方库简介 + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libsamplerate-0.2.2 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + libsamplerate-0.2.2/arm64-v8a libsamplerate-0.2.2/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件和静态库文件拷贝到该目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/libsamplerate_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libsamplerate/${OHOS_ARCH}/lib/libsamplerate.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libsamplerate/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +- 编译出可执行的文件,使用原库自带的测试用例来做测试 [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) +进入到构建目录运行测试用例(注意arm64-v8a为构建64位的目录,armeabi-v7a为构建32位的目录)。执行结果如图所示 + +```shell + cd /data/tpc_c_cplusplus/thirdparty/libsamplerate-0.2.2/libsamplerate-0.2.2/arm64-v8a-build/ + ctest +``` + ![libsamplerate_test](pic/libsamplerate_test.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) \ No newline at end of file diff --git a/thirdparty/libsamplerate-0.2.2/docs/pic/libsamplerate_install_dir.png b/thirdparty/libsamplerate-0.2.2/docs/pic/libsamplerate_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..aa39736eb36390daefe9f938ff1bbc0d526e4484 Binary files /dev/null and b/thirdparty/libsamplerate-0.2.2/docs/pic/libsamplerate_install_dir.png differ diff --git a/thirdparty/libsamplerate-0.2.2/docs/pic/libsamplerate_test.png b/thirdparty/libsamplerate-0.2.2/docs/pic/libsamplerate_test.png new file mode 100644 index 0000000000000000000000000000000000000000..3c29444a23a0c788f294192c54c2051c72c62b35 Binary files /dev/null and b/thirdparty/libsamplerate-0.2.2/docs/pic/libsamplerate_test.png differ