From 6af18556466ae958b262ef253bb782a241bd1cf9 Mon Sep 17 00:00:00 2001 From: skdhg <46562212+skdhg@users.noreply.github.com> Date: Sun, 6 Aug 2023 20:49:41 +0545 Subject: [PATCH] rewrite --- .gitmodules | 3 + Cargo.toml | 4 +- .../results/opus-decoder-benchmark.chart.html | 14 +- .../results/opus-encoder-benchmark.chart.html | 14 +- build.rs | 119 +++ js-binding.d.ts | 92 +++ js-binding.js | 5 +- libopus | 1 + package.json | 1 + src/lib.rs | 2 +- src/opus/lib.rs | 755 ++++++++++++++++++ src/opus/libopus.h | 1 + src/opus/mod.rs | 323 +++++--- src/probe/mod.rs | 1 + yarn.lock | 8 + 15 files changed, 1221 insertions(+), 122 deletions(-) create mode 100644 .gitmodules create mode 160000 libopus create mode 100644 src/opus/lib.rs create mode 100644 src/opus/libopus.h diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e27d10f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libopus"] + path = libopus + url = https://github.com/xiph/opus diff --git a/Cargo.toml b/Cargo.toml index fa08c9b..ecfae42 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,6 @@ version = "0.0.0" crate-type = ["cdylib"] [dependencies] -audiopus = { version = "0.2.0", features = ["decoder", "encoder"] } -byteorder = "1.4.3" dasp = { version = "0.11.0" } # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix napi = { version = "2.12.2", default-features = false, features = ["napi4"] } @@ -17,6 +15,8 @@ symphonia = { version = "0.5.3", features = ["all"] } [build-dependencies] napi-build = "2.0.1" +cmake = "0.1" +bindgen = "0.59.1" [profile.release] lto = true diff --git a/benchmark/results/opus-decoder-benchmark.chart.html b/benchmark/results/opus-decoder-benchmark.chart.html index 33a1d7b..0464b47 100644 --- a/benchmark/results/opus-decoder-benchmark.chart.html +++ b/benchmark/results/opus-decoder-benchmark.chart.html @@ -28,7 +28,7 @@
- +