編譯 Android 版本的 Opus 音頻編解碼庫的方法,androidopus

來源:互聯網
上載者:User

編譯 Android 版本的 Opus 音頻編解碼庫的方法,androidopus

Opus 音頻編解碼庫是 Speex 音頻編解碼庫的下一代版本,從編解碼效能以及品質上來講都有了長足的進步。Opus 的編譯非常簡單,但是官方並未給出詳細的 Android 版本編譯指南,尋找了大量資料,經過多次實驗,總結了一套成功的方法,具體如下:

1. 確保你的機器上安裝有 android ndk,並下載最新的 opus 原始碼。

2. android ndk 因為包含了針對多個 android 系統版本(api level)的編譯器工具鏈檔案,但是並未直接提供一個具體可用的工具鏈,因此需要藉助 ndk 產生一套編譯器工具鏈,前提是你必須要指定該工具鏈所針對的具體 android 系統版本,這裡以 api level 14(對應 android 4.0)為例,產生針對它的編譯器工具鏈,使用如下命令:

~/android-ndk-r10e/build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir=/tmp/my_toolchain

3. 定義環境變數,用於臨時的編譯,使用如下命令:

export PATH=/tmp/my_toolchain/bin/:$PATH

export CC=arm-linux-androideabi-gcc

export CXX=arm-linux-androideabi-g++

4. 配置並建立 opus 原始碼的 Makefile 編譯設定檔,使用如下命令:

./configure --host=arm-linux-androideabi

5. 編譯 opus 原始碼並產生庫檔案,使用如下命令:

make

注意,make 命令將自動編譯原始碼並產生庫檔案(靜態庫及動態庫),庫檔案位於 opus 原始碼所在目錄中的某個子目錄內,可能該子目錄名字以“.”開頭,所以可以用 ls -a 命令來查看一下。因為這裡我們編譯的是 for android 的版本,所以我們不要再執行 make install 了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.