编译、测试

sudo apt update
sudo apt-get install git autoconf automake libtool gcc make
git clone https://gitlab.xiph.org/xiph/opus.git
./autogen.sh
./configure
make

wget https://download.samplelib.com/mp3/sample-3s.mp3
./opus_demo -e voip 16000 1 16000 sample-3s.mp3 sample-3s.opus

交叉编译

cd opus
mkdir build
./configure --prefix=$(pwd)/build --build=x86-64-linux-gnu --host=aarch64-linux-gnu
make -j 20
make install
ls build/

添加到项目

在项目中添加 opus 子模块

git submodule add https://gitlab.xiph.org/xiph/opus.git opus/opus

并创建 opus/CMakeLists.txt 文件,内容参见:https://gist.github.com/wshon/eae0d3c6be46545feac8384e5226c078#file-cmakelists-txt

发表评论