diff --git a/thirdparty/libdash/HPKBUILD b/thirdparty/libdash/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..d26197e03ddc61ac7c298b72e5f6be5d3594382d --- /dev/null +++ b/thirdparty/libdash/HPKBUILD @@ -0,0 +1,66 @@ +# Contributor: wupingyuan +# Maintainer: wupingyuan +pkgname=libdash +pkgver=v2.2 +pkgrel=0 +pkgdesc="libdash is the official reference software of the ISO/IEC MPEG-DASH standard and is an open-source library that provides an object orient (OO) interface to the MPEG-DASH standard, developed by Bitmovin." +url="https://github.com/bitmovin/libdash" +archs=("armeabi-v7a" "arm64-v8a") +license=("LGPLv2.1") +depends=("libxml2" "curl") +makedepends=() +install= +source="https://github.com/bitmovin/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +patchflag=true +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + if $patchflag + then + cd $builddir + # 由于找不到CURL的头文件,因此打补丁 + patch -p1 < `pwd`/../libdash_oh_pkg.patch + patchflag=false + cd $OLDPWD + fi + cd $builddir + # 由于原库的libcurl头文件和lycium下的curl的版本不一致导致编译有错误,因此做了拷贝处理,先清掉原库的头文件再拷贝 + rm -rf libdash/libcurl/* + cp -rf $LYCIUM_ROOT/usr/curl/$ARCH/include libdash/libcurl/include + cd $OLDPWD + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir/$pkgname + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B`pwd`/../$ARCH-build -S./ -L > `pwd`/../$ARCH-build/build.log 2>&1 + make -j4 -C `pwd`/../$ARCH-build >> `pwd`/../$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + # 由于脚本中没有install命令,需要手动拷贝到安装目录 + cd $builddir + mkdir -p $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + cp -rf $ARCH-build/bin/libdash.so $LYCIUM_ROOT/usr/$pkgname/$ARCH/lib/ + cp -rf libdash/libdash/include $LYCIUM_ROOT/usr/$pkgname/$ARCH + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例(注意需要联网) + # ./libdash_networkpart_test +} + +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/libdash/README.OpenSource b/thirdparty/libdash/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..a5ed8a1648a949608fb1f40c8d4d694c121afda6 --- /dev/null +++ b/thirdparty/libdash/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libdash", + "License": "LGPLv2.1", + "License File": "README.md", + "Version Number": "v2.2", + "Owner": "wupingyuan@huawei.com", + "Upstream URL": "https://github.com/bitmovin/libdash/archive/refs/tags/v2.2.tar.gz", + "Description": "libdash is the official reference software of the ISO/IEC MPEG-DASH standard and is an open-source library that provides an object orient (OO) interface to the MPEG-DASH standard, developed by Bitmovin." + } +] diff --git a/thirdparty/libdash/README_zh.md b/thirdparty/libdash/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..6e6f775e36cb87f493b08a53143612848e08de66 --- /dev/null +++ b/thirdparty/libdash/README_zh.md @@ -0,0 +1,12 @@ +# libdash三方库说明 +## 功能简介 +libdash是ISO/IEC MPEG-DASH标准的官方参考软件,为Bitmovin开发的MPEG-DASH提供面向对象(OO)接口。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:v2.2 +- 当前适配的功能:支持MPEG-DASH编码 +- [LGPLv2.1](https://github.com/bitmovin/libdash) + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/libdash/SHA512SUM b/thirdparty/libdash/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..8f72c567aaec09d54563bb0610e2cabe92495725 --- /dev/null +++ b/thirdparty/libdash/SHA512SUM @@ -0,0 +1,2 @@ +9dd03ff8796495c0959c3967fe58d6d2c1aa2eef3d46c90117adcc783e7c624d6be9070a37bd59d7a35fe5a5f48e39488417c7eeb7e4158da67747e5be52c1d2 libdash-2.2.tar.gz +b1f44a886490e7806b5ab1bfae719bfc4b68126eafc8ca0a0ee8caa1c1868925a0728630c15a259f09241ba18f6f20a688df5fc62c65b9d2dc01e7b427876eb2 libdash_oh_pkg.patch diff --git a/thirdparty/libdash/docs/hap_integrate.md b/thirdparty/libdash/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..366cf03f536274351b83aa843cbdfce5f3619e02 --- /dev/null +++ b/thirdparty/libdash/docs/hap_integrate.md @@ -0,0 +1,121 @@ +# libdash集成到应用hap +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +## 开发环境 +- ubuntu20.04 +- [OpenHarmony3.2Release镜像](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fdayu200_standard_arm32.tar.gz) +- [ohos_sdk_public 3.2.11.9 (API Version 9 Release)](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fohos-sdk-windows_linux-public.tar.gz) +- [DevEco Studio 3.1 Beta2](https://gitee.com/link?target=https%3A%2F%2Fcontentcenter-vali-drcn.dbankcdn.cn%2Fpvt_2%2FDeveloperAlliance_package_901_9%2Ff3%2Fv3%2FuJyuq3syQ2ak4hE1QZmAug%2Fdevecostudio-windows-3.1.0.400.zip%3FHW-CC-KV%3DV1%26HW-CC-Date%3D20230408T013335Z%26HW-CC-Expire%3D315360000%26HW-CC-Sign%3D96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70) +- [准备三方库构建环境](../../../tools/README.md#编译环境准备) +- [准备三方库测试环境](../../../tools/README.md#ci环境准备) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/libdash #三方库libdash的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── libdash_oh_pkg.patch #补丁 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将libdash拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/libdash tools/main -rf + cp thirdparty/libxml2 tools/main -rf + cp thirdparty/curl tools/main -rf + cp thirdparty/openssl tools/main -rf + cp thirdparty/zstd tools/main -rf + cp thirdparty/nghttp2 tools/main -rf + cp thirdparty/CUnit tools/main -rf + cp thirdparty/xz tools/main -rf + cp thirdparty/openssl_quic tools/main -rf + cp thirdparty/nghttp3 tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh CUnit openssl_quic nghttp3 openssl zstd nghttp2 xz libxml2 curl libdash + ``` +- 三方库头文件及生成的库 + 在tools目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + libdash/arm64-v8a libdash/armeabi-v7a + libxml2/arm64-v8a libxml2/armeabi-v7a + curl/arm64-v8a curl/armeabi-v7a + openssl/arm64-v8a openssl/armeabi-v7a + zstd/arm64-v8a zstd/armeabi-v7a + nghttp2/arm64-v8a nghttp2/armeabi-v7a + CUnit/arm64-v8a CUnit/armeabi-v7a + nghttp3/arm64-v8a nghttp3/armeabi-v7a + xz/arm64-v8a xz/armeabi-v7a + openssl_quic/arm64-v8a openssl_quic/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 拷贝动态库到`\\entry\libs\${OHOS_ARCH}\`目录: + 动态库需要在`\\entry\libs\${OHOS_ARCH}\`目录,才能集成到hap包中,所以需要将对应的so文件拷贝到对应CPU架构的目录 + +  ![thirdparty_install_dir](pic/libdash_install_dir_1.jpg) +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库拷贝到该目录下,如下图所示 + +  ![thirdparty_install_dir](pic/libdash_install_dir_2.jpg) +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ``` + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libdash.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libcurl.so) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libcrypto.so.1.1) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libnghttp2.so.14) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libssl.so.1.1) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libxml2.so.2) + target_link_libraries(entry PRIVATE ${CMAKE_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libzstd.so.1) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libdash/${OHOS_ARCH}/include) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/curl/${OHOS_ARCH}/include) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libxml2/${OHOS_ARCH}/include) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nghttp2/${OHOS_ARCH}/include) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/include) + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zstd/${OHOS_ARCH}/include) + ``` + ![libdash_usage](pic/libdash_usage.jpg) +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +- 将编译生成的libdash_networkpart_test可执行文件准备好(注意:需要联网) + +- 将准备好的文件推送到开发板,在windows命令行进行如下操作 + + ``` + hdc_std shell mount -o remount,rw / #修改系统权限为可读写 + hdc_std file send libdash_networkpart_test /data #将可执行文件推入开发板data目录 + hdc_std file send libc++_shared.so /system/lib64 #将动态库推送开发板 + hdc_std file send libdash.so /system/lib64 + hdc_std file send libcurl.so /system/lib64 + hdc_std file send libcrypto.so.1.1 /system/lib64 + hdc_std file send libnghttp2.so.14 /system/lib64 + hdc_std file send libssl.so.1.1 /system/lib64 + hdc_std file send libxml2.so.2 /system/lib64 + hdc_std file send libzstd.so.1 /system/lib64 + + hdc_std shell #进入开发板 + chmod 777 libdash_networkpart_test #添加权限 + ./libdash_networkpart_test #执行测试用例 + ``` + + ![libdash_test](pic/libdash_test.jpg) + +## 参考资料 +- [润和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) +- [通过DevEco Studio开发一个NAPI工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) diff --git a/thirdparty/libdash/docs/pic/libdash_install_dir_1.jpg b/thirdparty/libdash/docs/pic/libdash_install_dir_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..14b0a64e4f2e4d397a89a57ae05f1d4bf82ce329 Binary files /dev/null and b/thirdparty/libdash/docs/pic/libdash_install_dir_1.jpg differ diff --git a/thirdparty/libdash/docs/pic/libdash_install_dir_2.jpg b/thirdparty/libdash/docs/pic/libdash_install_dir_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5df86f7744b09ce654f1ec4ba926530188868ae3 Binary files /dev/null and b/thirdparty/libdash/docs/pic/libdash_install_dir_2.jpg differ diff --git a/thirdparty/libdash/docs/pic/libdash_test.jpg b/thirdparty/libdash/docs/pic/libdash_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ddef9130a60a193090cc7c4357199c61e9af9bd7 Binary files /dev/null and b/thirdparty/libdash/docs/pic/libdash_test.jpg differ diff --git a/thirdparty/libdash/docs/pic/libdash_usage.jpg b/thirdparty/libdash/docs/pic/libdash_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cce4ef38f70011f4879b53e58fbff8f0c426a956 Binary files /dev/null and b/thirdparty/libdash/docs/pic/libdash_usage.jpg differ diff --git a/thirdparty/libdash/libdash_oh_pkg.patch b/thirdparty/libdash/libdash_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..bf225c3c7574183337459d72dda46eef0a26878a --- /dev/null +++ b/thirdparty/libdash/libdash_oh_pkg.patch @@ -0,0 +1,17 @@ +diff -Naur libdash-2.2/libdash/CMakeLists.txt libdash-2.2-patch/libdash/CMakeLists.txt +--- libdash-2.2/libdash/CMakeLists.txt 2013-04-03 17:40:41.000000000 +0800 ++++ libdash-2.2-patch/libdash/CMakeLists.txt 2023-04-20 19:53:54.739473466 +0800 +@@ -5,10 +5,10 @@ + include_directories(sdl/include) + include_directories(zlib/include) + include_directories(iconv/include) +- ++include_directories(libcurl/include) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + + add_subdirectory(libdash) +-add_subdirectory(libdash_networkpart_test) +\ No newline at end of file ++add_subdirectory(libdash_networkpart_test)