diff --git a/.github/workflows/OpusCompile.yml b/.github/workflows/OpusCompile.yml index e5d6215..6e96bb5 100644 --- a/.github/workflows/OpusCompile.yml +++ b/.github/workflows/OpusCompile.yml @@ -12,6 +12,11 @@ permissions: contents: write packages: write +env: + OPUS_REPOSITORY: https://gitlab.xiph.org/xiph/opus.git + OPUS_VERSION: 1.6.1 + OPUS_REF: v1.6.1 + jobs: Android: runs-on: ubuntu-latest @@ -22,8 +27,8 @@ jobs: arch: [x64, x86, arm64, arm32] fail-fast: false steps: - - uses: actions/checkout@v4 - - uses: nttld/setup-ndk@v1 + - uses: actions/checkout@v6.0.2 + - uses: nttld/setup-ndk@v1.6.0 id: setup-ndk with: ndk-version: r28c @@ -48,7 +53,7 @@ jobs: run: mkdir build - name: Clone Repository - run: git clone https://github.com/xiph/opus.git + run: git clone --branch ${{ env.OPUS_REF }} --depth 1 ${{ env.OPUS_REPOSITORY }} opus - name: Autogen run: ./opus/autogen.sh @@ -80,7 +85,7 @@ jobs: run: sudo apt install llvm && llvm-objdump -p libopus.so | grep LOAD - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: android-${{ matrix.arch }}-libopus.so path: ./build/libopus.so @@ -92,7 +97,7 @@ jobs: arch: [x64, x86, arm64, arm32] fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 # Not much I can do to reduce the bloat. - name: Setup Environment @@ -121,7 +126,7 @@ jobs: run: mkdir build - name: Clone Repository - run: git clone https://github.com/xiph/opus.git + run: git clone --branch ${{ env.OPUS_REF }} --depth 1 ${{ env.OPUS_REPOSITORY }} opus - name: Autogen run: ./opus/autogen.sh @@ -158,7 +163,7 @@ jobs: -lm - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: linux-${{ matrix.arch }}-opus.so path: ./build/opus.so @@ -170,7 +175,7 @@ jobs: arch: [x64, x86, arm64] # Disabled arm32 fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 # Not much I can do to reduce the bloat. - name: Setup Environment @@ -189,7 +194,7 @@ jobs: run: mkdir build - name: Clone Repository - run: git clone https://github.com/xiph/opus.git + run: git clone --branch ${{ env.OPUS_REF }} --depth 1 ${{ env.OPUS_REPOSITORY }} opus - name: Autogen run: ./opus/autogen.bat @@ -220,7 +225,7 @@ jobs: link /DLL /OUT:opus.dll /DEF:opus.def opus_shim.obj Release\opus.lib ucrt.lib vcruntime.lib msvcrt.lib - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: win-${{ matrix.arch }}-opus.dll path: ./build/opus.dll @@ -232,7 +237,7 @@ jobs: arch: [x64, arm64] fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 # Not much I can do to reduce the bloat. - name: Setup Environment @@ -248,7 +253,7 @@ jobs: run: mkdir build - name: Clone Repository - run: git clone https://github.com/xiph/opus.git + run: git clone --branch ${{ env.OPUS_REF }} --depth 1 ${{ env.OPUS_REPOSITORY }} opus - name: Autogen run: ./opus/autogen.sh @@ -271,7 +276,7 @@ jobs: -install_name @rpath/opus.dylib - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: macos-${{ matrix.arch }}-opus.dylib path: ./build/opus.dylib @@ -283,7 +288,7 @@ jobs: target: [device, simulator-arm64, simulator-x86_64] fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Setup Environment run: | @@ -306,15 +311,13 @@ jobs: run: mkdir build - name: Clone Repository - run: git clone https://github.com/xiph/opus.git + run: git clone --branch ${{ env.OPUS_REF }} --depth 1 ${{ env.OPUS_REPOSITORY }} opus - name: Generate Build Scripts run: | export PATH="/opt/homebrew/bin:/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" cd ./opus - git fetch --tags --force - OPUS_VERSION="$(git describe --tags --always --match 'v*' | sed 's/^v//')" - echo "PACKAGE_VERSION=\"$OPUS_VERSION\"" > package_version + echo "PACKAGE_VERSION=\"${{ env.OPUS_VERSION }}\"" > package_version autoreconf -isf - name: Build Static Library @@ -408,7 +411,7 @@ jobs: - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: ${{ env.OUTPUT_NAME }}-libopus.a path: ./build/.libs/libopus.a @@ -417,25 +420,25 @@ jobs: runs-on: macos-latest needs: iOS steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Clone opus for headers - run: git clone --depth 1 https://github.com/xiph/opus.git + run: git clone --branch ${{ env.OPUS_REF }} --depth 1 ${{ env.OPUS_REPOSITORY }} opus - name: Download device artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: ios-device-arm64-libopus.a path: device - name: Download simulator-arm64 artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: ios-simulator-arm64-libopus.a path: sim_arm64 - name: Download simulator-x86_64 artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: ios-simulator-x86_64-libopus.a path: sim_x86 @@ -471,7 +474,7 @@ jobs: ls -laR universal/ - name: Upload Universal Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: ios-universal-libopus path: universal/* @@ -479,14 +482,14 @@ jobs: Wasm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: mymindstorm/setup-emsdk@v14 + - uses: actions/checkout@v6.0.2 + - uses: mymindstorm/setup-emsdk@v16 - name: Create Build Dir run: mkdir build - name: Clone Repository - run: git clone https://github.com/xiph/opus.git + run: git clone --branch ${{ env.OPUS_REF }} --depth 1 ${{ env.OPUS_REPOSITORY }} opus - name: Autogen run: ./opus/autogen.sh @@ -506,7 +509,7 @@ jobs: emar rcs libopus.a opus_shim.o - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: wasm-libopus.a path: ./build/libopus.a @@ -515,99 +518,106 @@ jobs: runs-on: ubuntu-latest needs: [Android, iOS-universal, MacOS, Linux, Windows, Wasm] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 # Android - name: Download android-arm32-libopus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: android-arm32-libopus.so path: runtimes/android-arm/native - name: Download android-arm64-libopus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: android-arm64-libopus.so path: runtimes/android-arm64/native - name: Download android-x64-libopus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: android-x64-libopus.so path: runtimes/android-x64/native - name: Download android-x86-libopus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: android-x86-libopus.so path: runtimes/android-x86/native # iOS - name: Download ios-universal-libopus - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: ios-universal-libopus path: runtimes/ios/native # Linux - name: Download linux-arm32-opus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: linux-arm32-opus.so path: runtimes/linux-arm/native - name: Download linux-arm64-opus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: linux-arm64-opus.so path: runtimes/linux-arm64/native - name: Download linux-x64-opus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: linux-x64-opus.so path: runtimes/linux-x64/native - name: Download linux-x86-opus.so - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: linux-x86-opus.so path: runtimes/linux-x86/native # MacOS - name: Download macos-arm64-opus.dylib - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: macos-arm64-opus.dylib path: runtimes/osx-arm64/native - name: Download macos-x64-opus.dylib - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: macos-x64-opus.dylib path: runtimes/osx-x64/native # Windows - name: Download win-arm64-opus.dll - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: win-arm64-opus.dll path: runtimes/win-arm64/native - name: Download win-x64-opus.dll - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: win-x64-opus.dll path: runtimes/win-x64/native - name: Download win-x86-opus.dll - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.1 with: name: win-x86-opus.dll path: runtimes/win-x86/native + + # WASM + - name: Download wasm-libopus.a + uses: actions/download-artifact@v8.0.1 + with: + name: wasm-libopus.a + path: runtimes/browser-wasm/native - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.1 with: name: All-Runtimes - path: ./runtimes \ No newline at end of file + path: ./runtimes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d40f89..34da1d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,8 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4 + - uses: actions/checkout@v6.0.2 + - uses: actions/setup-dotnet@v5.2.0 with: dotnet-version: 9.0.x - name: Run core tests @@ -24,8 +24,8 @@ jobs: smoke-apple: runs-on: macos-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4 + - uses: actions/checkout@v6.0.2 + - uses: actions/setup-dotnet@v5.2.0 with: dotnet-version: 9.0.x - name: Install iOS workload diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 874c89a..b8b15f8 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -24,9 +24,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6.0.2 - name: Dotnet Setup - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v5.2.0 with: dotnet-version: 8.x @@ -34,10 +34,10 @@ jobs: - run: docfx ./docs/docfx.json - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v5.0.0 with: # Upload entire repository path: './docs/_site' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v5.0.0 diff --git a/OpusSharp.Core/NativeOpus.cs b/OpusSharp.Core/NativeOpus.cs index e73d163..f417524 100644 --- a/OpusSharp.Core/NativeOpus.cs +++ b/OpusSharp.Core/NativeOpus.cs @@ -130,13 +130,21 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl")] + [LibraryImport(DllName)] public static partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl", CallingConvention = CallingConvention.Cdecl)] + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] public static extern int opus_encoder_ctl(OpusEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_encoder_ctl_i(OpusEncoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_encoder_ctl_i(OpusEncoderSafeHandle st, int request, int data); +#endif /// /// Perform a CTL function on an . /// @@ -144,14 +152,16 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input. /// + public static int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data) => + opussharp_encoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_i")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_p(OpusEncoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_p(OpusEncoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on an . /// @@ -159,14 +169,16 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input/output. /// + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data) => + opussharp_encoder_ctl_p(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_p")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_pi(OpusEncoderSafeHandle st, int request, void* data, int data2); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_pi(OpusEncoderSafeHandle st, int request, void* data, int data2); #endif - /// /// Perform a CTL function on an Opus encoder. /// @@ -175,14 +187,16 @@ public static partial class NativeOpus /// The data to input/output. /// The second data to input. /// + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, int data2) => + opussharp_encoder_ctl_pi(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_pi")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, int data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_ip(OpusEncoderSafeHandle st, int request, int data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_pi", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, int data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_ip(OpusEncoderSafeHandle st, int request, int data, void* data2); #endif - /// /// Perform a CTL function on an Opus encoder. /// @@ -191,14 +205,16 @@ public static partial class NativeOpus /// The data to input. /// The second data to input/output. /// + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data, void* data2) => + opussharp_encoder_ctl_ip(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_ip")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data, void* data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_pp(OpusEncoderSafeHandle st, int request, void* data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_ip", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data, void* data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_pp(OpusEncoderSafeHandle st, int request, void* data, void* data2); #endif - /// /// Perform a CTL function on an Opus encoder. /// @@ -207,13 +223,8 @@ public static partial class NativeOpus /// The data to input/output. /// The second data to input/output. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_pp")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, void* data2); -#else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_pp", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, void* data2); -#endif + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, void* data2) => + opussharp_encoder_ctl_pp(st, request, data, data2); //Decoder /// @@ -320,13 +331,20 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_decoder_ctl")] + [LibraryImport(DllName)] public static partial int opus_decoder_ctl(OpusDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_decoder_ctl", CallingConvention = CallingConvention.Cdecl)] + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] public static extern int opus_decoder_ctl(OpusDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif - + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_decoder_ctl_i(OpusDecoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_decoder_ctl_i(OpusDecoderSafeHandle st, int request, int data); +#endif /// /// Perform a CTL function on an . /// @@ -334,14 +352,16 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input. /// + public static int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, int data) => + opussharp_decoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_decoder_ctl_i")] - public static unsafe partial int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_decoder_ctl_p(OpusDecoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_decoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_decoder_ctl_p(OpusDecoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on an . /// @@ -349,13 +369,8 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input or output. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_decoder_ctl_p")] - public static unsafe partial int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, void* data); -#else - [DllImport(DllName, EntryPoint = "opussharp_decoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, void* data); -#endif + public static unsafe int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, void* data) => + opussharp_decoder_ctl_p(st, request, data); /// /// Frees an allocated by . @@ -427,13 +442,20 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl")] + [LibraryImport(DllName)] public static partial int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl", CallingConvention = CallingConvention.Cdecl)] + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] public static extern int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif - + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static unsafe partial int opussharp_dred_decoder_ctl_p(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_dred_decoder_ctl_p(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); +#endif /// /// Perform a CTL function on an . /// @@ -441,13 +463,8 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input or output. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl_p")] - public static unsafe partial int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); -#else - [DllImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); -#endif + public static unsafe int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request, void* data) => + opussharp_dred_decoder_ctl_p(dred_dec, request, data); //Dred Packet? /// @@ -1052,13 +1069,20 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl")] - public static partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [LibraryImport(DllName)] + public static partial int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl", CallingConvention = CallingConvention.Cdecl)] - public static extern int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_ms_encoder_ctl_i(OpusMSEncoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_ms_encoder_ctl_i(OpusMSEncoderSafeHandle st, int request, int data); +#endif /// /// Perform a CTL function on a . /// @@ -1066,14 +1090,16 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input data. /// + public static int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data) => + opussharp_ms_encoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_i")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_p(OpusMSEncoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_p(OpusMSEncoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on a . /// @@ -1081,14 +1107,16 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input/output data. /// + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data) => + opussharp_ms_encoder_ctl_p(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_p")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_pi(OpusMSEncoderSafeHandle st, int request, void* data, int data2); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_pi(OpusMSEncoderSafeHandle st, int request, void* data, int data2); #endif - /// /// Perform a CTL function on a . /// @@ -1097,14 +1125,16 @@ public static partial class NativeOpus /// The input/output data. /// The input data. /// + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, int data2) => + opussharp_ms_encoder_ctl_pi(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pi")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, int data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_ip(OpusMSEncoderSafeHandle st, int request, int data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pi", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, int data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_ip(OpusMSEncoderSafeHandle st, int request, int data, void* data2); #endif - /// /// Perform a CTL function on a . /// @@ -1113,14 +1143,16 @@ public static partial class NativeOpus /// The input data. /// The input/output data. /// + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data, void* data2) => + opussharp_ms_encoder_ctl_ip(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_ip")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data, void* data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_pp(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_ip", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data, void* data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_pp(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); #endif - /// /// Perform a CTL function on a . /// @@ -1129,13 +1161,8 @@ public static partial class NativeOpus /// The input/output data. /// The input/output data. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pp")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); -#else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pp", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); -#endif + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, void* data2) => + opussharp_ms_encoder_ctl_pp(st, request, data, data2); //Multistream Decoder /// @@ -1249,13 +1276,20 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl")] - public static partial int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [LibraryImport(DllName)] + public static partial int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl", CallingConvention = CallingConvention.Cdecl)] - public static extern int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. +#endif + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_ms_decoder_ctl_i(OpusMSDecoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_ms_decoder_ctl_i(OpusMSDecoderSafeHandle st, int request, int data); #endif - /// /// Perform a CTL function on a . /// @@ -1263,14 +1297,16 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input data. /// + public static int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request, int data) => + opussharp_ms_decoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_i")] - public static unsafe partial int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_decoder_ctl_p(OpusMSDecoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_decoder_ctl_p(OpusMSDecoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on a . /// @@ -1278,13 +1314,8 @@ public static partial class NativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input/output data. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_p")] - public static unsafe partial int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, void* data); -#else - [DllImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, void* data); -#endif + public static unsafe int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request, void* data) => + opussharp_ms_decoder_ctl_p(st, request, data); /// /// Frees an allocated by . diff --git a/OpusSharp.Core/OpusRuntime.cs b/OpusSharp.Core/OpusRuntime.cs index 273b7ee..3fdc74d 100644 --- a/OpusSharp.Core/OpusRuntime.cs +++ b/OpusSharp.Core/OpusRuntime.cs @@ -11,7 +11,8 @@ public static bool ShouldUseStaticImports(bool? useStatic) private static bool IsStaticallyLinkedPlatform() { - return RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")); + return RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")) + || RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")); } } } diff --git a/OpusSharp.Core/StaticNativeOpus.cs b/OpusSharp.Core/StaticNativeOpus.cs index d5ccbef..29057f0 100644 --- a/OpusSharp.Core/StaticNativeOpus.cs +++ b/OpusSharp.Core/StaticNativeOpus.cs @@ -130,13 +130,21 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl")] + [LibraryImport(DllName)] public static partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl", CallingConvention = CallingConvention.Cdecl)] + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] public static extern int opus_encoder_ctl(OpusEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_encoder_ctl_i(OpusEncoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_encoder_ctl_i(OpusEncoderSafeHandle st, int request, int data); +#endif /// /// Perform a CTL function on an . /// @@ -144,14 +152,16 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input. /// + public static int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data) => + opussharp_encoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_i")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_p(OpusEncoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_p(OpusEncoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on an . /// @@ -159,14 +169,16 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input/output. /// + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data) => + opussharp_encoder_ctl_p(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_p")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_pi(OpusEncoderSafeHandle st, int request, void* data, int data2); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_pi(OpusEncoderSafeHandle st, int request, void* data, int data2); #endif - /// /// Perform a CTL function on an Opus encoder. /// @@ -175,14 +187,16 @@ public static partial class StaticNativeOpus /// The data to input/output. /// The second data to input. /// + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, int data2) => + opussharp_encoder_ctl_pi(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_pi")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, int data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_ip(OpusEncoderSafeHandle st, int request, int data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_pi", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, int data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_ip(OpusEncoderSafeHandle st, int request, int data, void* data2); #endif - /// /// Perform a CTL function on an Opus encoder. /// @@ -191,14 +205,16 @@ public static partial class StaticNativeOpus /// The data to input. /// The second data to input/output. /// + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data, void* data2) => + opussharp_encoder_ctl_ip(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_ip")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data, void* data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_encoder_ctl_pp(OpusEncoderSafeHandle st, int request, void* data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_ip", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, int data, void* data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_encoder_ctl_pp(OpusEncoderSafeHandle st, int request, void* data, void* data2); #endif - /// /// Perform a CTL function on an Opus encoder. /// @@ -207,13 +223,8 @@ public static partial class StaticNativeOpus /// The data to input/output. /// The second data to input/output. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_encoder_ctl_pp")] - public static unsafe partial int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, void* data2); -#else - [DllImport(DllName, EntryPoint = "opussharp_encoder_ctl_pp", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, void* data2); -#endif + public static unsafe int opus_encoder_ctl(OpusEncoderSafeHandle st, int request, void* data, void* data2) => + opussharp_encoder_ctl_pp(st, request, data, data2); //Decoder /// @@ -320,13 +331,20 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_decoder_ctl")] + [LibraryImport(DllName)] public static partial int opus_decoder_ctl(OpusDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_decoder_ctl", CallingConvention = CallingConvention.Cdecl)] + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] public static extern int opus_decoder_ctl(OpusDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif - + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_decoder_ctl_i(OpusDecoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_decoder_ctl_i(OpusDecoderSafeHandle st, int request, int data); +#endif /// /// Perform a CTL function on an . /// @@ -334,14 +352,16 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input. /// + public static int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, int data) => + opussharp_decoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_decoder_ctl_i")] - public static unsafe partial int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_decoder_ctl_p(OpusDecoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_decoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_decoder_ctl_p(OpusDecoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on an . /// @@ -349,13 +369,8 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input or output. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_decoder_ctl_p")] - public static unsafe partial int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, void* data); -#else - [DllImport(DllName, EntryPoint = "opussharp_decoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, void* data); -#endif + public static unsafe int opus_decoder_ctl(OpusDecoderSafeHandle st, int request, void* data) => + opussharp_decoder_ctl_p(st, request, data); /// /// Frees an allocated by . @@ -427,13 +442,20 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl")] + [LibraryImport(DllName)] public static partial int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl", CallingConvention = CallingConvention.Cdecl)] + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] public static extern int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif - + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static unsafe partial int opussharp_dred_decoder_ctl_p(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_dred_decoder_ctl_p(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); +#endif /// /// Perform a CTL function on an . /// @@ -441,13 +463,8 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in or . /// The data to input or output. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl_p")] - public static unsafe partial int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); -#else - [DllImport(DllName, EntryPoint = "opussharp_dred_decoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request, void* data); -#endif + public static unsafe int opus_dred_decoder_ctl(OpusDREDDecoderSafeHandle dred_dec, int request, void* data) => + opussharp_dred_decoder_ctl_p(dred_dec, request, data); //Dred Packet? /// @@ -1052,13 +1069,20 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl")] - public static partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [LibraryImport(DllName)] + public static partial int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl", CallingConvention = CallingConvention.Cdecl)] - public static extern int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #endif +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_ms_encoder_ctl_i(OpusMSEncoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_ms_encoder_ctl_i(OpusMSEncoderSafeHandle st, int request, int data); +#endif /// /// Perform a CTL function on a . /// @@ -1066,14 +1090,16 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input data. /// + public static int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data) => + opussharp_ms_encoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_i")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_p(OpusMSEncoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_p(OpusMSEncoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on a . /// @@ -1081,14 +1107,16 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input/output data. /// + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data) => + opussharp_ms_encoder_ctl_p(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_p")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_pi(OpusMSEncoderSafeHandle st, int request, void* data, int data2); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_pi(OpusMSEncoderSafeHandle st, int request, void* data, int data2); #endif - /// /// Perform a CTL function on a . /// @@ -1097,14 +1125,16 @@ public static partial class StaticNativeOpus /// The input/output data. /// The input data. /// + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, int data2) => + opussharp_ms_encoder_ctl_pi(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pi")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, int data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_ip(OpusMSEncoderSafeHandle st, int request, int data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pi", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, int data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_ip(OpusMSEncoderSafeHandle st, int request, int data, void* data2); #endif - /// /// Perform a CTL function on a . /// @@ -1113,14 +1143,16 @@ public static partial class StaticNativeOpus /// The input data. /// The input/output data. /// + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data, void* data2) => + opussharp_ms_encoder_ctl_ip(st, request, data, data2); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_ip")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data, void* data2); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_encoder_ctl_pp(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_ip", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, int data, void* data2); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_encoder_ctl_pp(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); #endif - /// /// Perform a CTL function on a . /// @@ -1129,13 +1161,8 @@ public static partial class StaticNativeOpus /// The input/output data. /// The input/output data. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pp")] - public static unsafe partial int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); -#else - [DllImport(DllName, EntryPoint = "opussharp_ms_encoder_ctl_pp", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, void* data2); -#endif + public static unsafe int opus_ms_encoder_ctl(OpusMSEncoderSafeHandle st, int request, void* data, void* data2) => + opussharp_ms_encoder_ctl_pp(st, request, data, data2); //Multistream Decoder /// @@ -1249,13 +1276,20 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl")] - public static partial int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [LibraryImport(DllName)] + public static partial int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. #else - [DllImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl", CallingConvention = CallingConvention.Cdecl)] - public static extern int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request); //Apparently GenericCTL.OPUS_RESET_STATE exists. +#endif + +#if NET8_0_OR_GREATER + [LibraryImport(DllName)] + private static partial int opussharp_ms_decoder_ctl_i(OpusMSDecoderSafeHandle st, int request, int data); +#else + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern int opussharp_ms_decoder_ctl_i(OpusMSDecoderSafeHandle st, int request, int data); #endif - /// /// Perform a CTL function on a . /// @@ -1263,14 +1297,16 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input data. /// + public static int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request, int data) => + opussharp_ms_decoder_ctl_i(st, request, data); + #if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_i")] - public static unsafe partial int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, int data); + [LibraryImport(DllName)] + private static unsafe partial int opussharp_ms_decoder_ctl_p(OpusMSDecoderSafeHandle st, int request, void* data); #else - [DllImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_i", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, int data); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + private static extern unsafe int opussharp_ms_decoder_ctl_p(OpusMSDecoderSafeHandle st, int request, void* data); #endif - /// /// Perform a CTL function on a . /// @@ -1278,13 +1314,8 @@ public static partial class StaticNativeOpus /// This and all remaining parameters should be replaced by one of the convenience macros in , , or specific encoder and decoder CTLs. /// The input/output data. /// -#if NET8_0_OR_GREATER - [LibraryImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_p")] - public static unsafe partial int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, void* data); -#else - [DllImport(DllName, EntryPoint = "opussharp_ms_decoder_ctl_p", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe int opus_multistream_decoder_ctl(OpusMSDecoderSafeHandle st, int request, void* data); -#endif + public static unsafe int opus_ms_decoder_ctl(OpusMSDecoderSafeHandle st, int request, void* data) => + opussharp_ms_decoder_ctl_p(st, request, data); /// /// Frees an allocated by . diff --git a/OpusSharp.Natives/OpusSharp.Natives.csproj b/OpusSharp.Natives/OpusSharp.Natives.csproj index 0b5ec6d..ae90f79 100644 --- a/OpusSharp.Natives/OpusSharp.Natives.csproj +++ b/OpusSharp.Natives/OpusSharp.Natives.csproj @@ -22,6 +22,6 @@ - + diff --git a/OpusSharp.Natives/README.md b/OpusSharp.Natives/README.md index 977977c..cba8006 100644 --- a/OpusSharp.Natives/README.md +++ b/OpusSharp.Natives/README.md @@ -10,6 +10,7 @@ - osx-arm64: osx-arm64/native/opus.dylib - osx-x64: osx-x64/native/opus.dylib - ios: ios/native/libopus.xcframework +- browser-wasm: browser-wasm/native/libopus.a - win-arm64: win-arm64/native/opus.dll - win-x64: win-x64/native/opus.dll - win-x86: win-x86/native/opus.dll @@ -17,12 +18,13 @@ # Statically Linked Runtimes > [!NOTE] -> iOS is included in the package as `libopus.xcframework` and linked automatically for .NET iOS projects. WASM still -> needs to be manually linked. +> iOS is included in the package as `libopus.xcframework` and linked automatically for .NET iOS projects. WASM is +> included as `libopus.a` and linked automatically for `browser-wasm` projects through `NativeFileReference`. -- wasm +- ios +- browser-wasm > [!NOTE] > - ARM32 is no longer supported by the windows OS and is no longer provided in this package. > - Android builds are 16kb aligned. -> - Binaries have been updated to commit [788cc89](https://github.com/xiph/opus/commit/788cc89ce4f2c42025d8c70ec1b4457dc89cd50f) +> - Binaries are built from the official Opus `v1.6.1` release tag at `https://gitlab.xiph.org/xiph/opus.git`. diff --git a/OpusSharp.Natives/buildTransitive/OpusSharp.Natives.props b/OpusSharp.Natives/buildTransitive/OpusSharp.Natives.props new file mode 100644 index 0000000..3b0685f --- /dev/null +++ b/OpusSharp.Natives/buildTransitive/OpusSharp.Natives.props @@ -0,0 +1,15 @@ + + + + <_OpusSharpNativesRoot>$(MSBuildThisFileDirectory)../ + <_OpusSharpWasmLibrary>$(_OpusSharpNativesRoot)runtimes/browser-wasm/native/libopus.a + + + + + + diff --git a/OpusSharp.Natives/opus_shim.c b/OpusSharp.Natives/opus_shim.c index 93c1e7f..25da323 100644 --- a/OpusSharp.Natives/opus_shim.c +++ b/OpusSharp.Natives/opus_shim.c @@ -26,11 +26,6 @@ /* === Encoder CTL === */ -SHIM_EXPORT SHIM_EXPORT int opussharp_encoder_ctl(OpusEncoder *st, int request) -{ - return opus_encoder_ctl(st, request); -} - SHIM_EXPORT int opussharp_encoder_ctl_i(OpusEncoder *st, int request, int value) { return opus_encoder_ctl(st, request, value); @@ -58,11 +53,6 @@ SHIM_EXPORT int opussharp_encoder_ctl_pp(OpusEncoder *st, int request, void *dat /* === Decoder CTL === */ -SHIM_EXPORT int opussharp_decoder_ctl(OpusDecoder *st, int request) -{ - return opus_decoder_ctl(st, request); -} - SHIM_EXPORT int opussharp_decoder_ctl_i(OpusDecoder *st, int request, int value) { return opus_decoder_ctl(st, request, value); @@ -75,11 +65,6 @@ SHIM_EXPORT int opussharp_decoder_ctl_p(OpusDecoder *st, int request, void *valu /* === DRED Decoder CTL === */ -SHIM_EXPORT int opussharp_dred_decoder_ctl(OpusDREDDecoder *dred_dec, int request) -{ - return opus_dred_decoder_ctl(dred_dec, request); -} - SHIM_EXPORT int opussharp_dred_decoder_ctl_p(OpusDREDDecoder *dred_dec, int request, void *value) { return opus_dred_decoder_ctl(dred_dec, request, value); @@ -87,11 +72,6 @@ SHIM_EXPORT int opussharp_dred_decoder_ctl_p(OpusDREDDecoder *dred_dec, int requ /* === Multistream Encoder CTL === */ -SHIM_EXPORT int opussharp_ms_encoder_ctl(OpusMSEncoder *st, int request) -{ - return opus_multistream_encoder_ctl(st, request); -} - SHIM_EXPORT int opussharp_ms_encoder_ctl_i(OpusMSEncoder *st, int request, int value) { return opus_multistream_encoder_ctl(st, request, value); @@ -119,11 +99,6 @@ SHIM_EXPORT int opussharp_ms_encoder_ctl_pp(OpusMSEncoder *st, int request, void /* === Multistream Decoder CTL === */ -SHIM_EXPORT int opussharp_ms_decoder_ctl(OpusMSDecoder *st, int request) -{ - return opus_multistream_decoder_ctl(st, request); -} - SHIM_EXPORT int opussharp_ms_decoder_ctl_i(OpusMSDecoder *st, int request, int value) { return opus_multistream_decoder_ctl(st, request, value); diff --git a/OpusSharp.Natives/runtimes/android-arm/native/libopus.so b/OpusSharp.Natives/runtimes/android-arm/native/libopus.so index 5518e47..a08dc28 100644 Binary files a/OpusSharp.Natives/runtimes/android-arm/native/libopus.so and b/OpusSharp.Natives/runtimes/android-arm/native/libopus.so differ diff --git a/OpusSharp.Natives/runtimes/android-arm64/native/libopus.so b/OpusSharp.Natives/runtimes/android-arm64/native/libopus.so index da54a69..d5535c8 100644 Binary files a/OpusSharp.Natives/runtimes/android-arm64/native/libopus.so and b/OpusSharp.Natives/runtimes/android-arm64/native/libopus.so differ diff --git a/OpusSharp.Natives/runtimes/android-x64/native/libopus.so b/OpusSharp.Natives/runtimes/android-x64/native/libopus.so index cc173cf..f7a16f6 100644 Binary files a/OpusSharp.Natives/runtimes/android-x64/native/libopus.so and b/OpusSharp.Natives/runtimes/android-x64/native/libopus.so differ diff --git a/OpusSharp.Natives/runtimes/android-x86/native/libopus.so b/OpusSharp.Natives/runtimes/android-x86/native/libopus.so index 6035e66..8e66dda 100644 Binary files a/OpusSharp.Natives/runtimes/android-x86/native/libopus.so and b/OpusSharp.Natives/runtimes/android-x86/native/libopus.so differ diff --git a/OpusSharp.Natives/runtimes/browser-wasm/native/libopus.a b/OpusSharp.Natives/runtimes/browser-wasm/native/libopus.a new file mode 100644 index 0000000..9b78a65 Binary files /dev/null and b/OpusSharp.Natives/runtimes/browser-wasm/native/libopus.a differ diff --git a/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/Info.plist b/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/Info.plist index e910abd..d978ed4 100644 --- a/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/Info.plist +++ b/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/Info.plist @@ -10,18 +10,15 @@ HeadersPath Headers LibraryIdentifier - ios-arm64_x86_64-simulator + ios-arm64 LibraryPath libopus.a SupportedArchitectures arm64 - x86_64 SupportedPlatform ios - SupportedPlatformVariant - simulator BinaryPath @@ -29,15 +26,18 @@ HeadersPath Headers LibraryIdentifier - ios-arm64 + ios-arm64_x86_64-simulator LibraryPath libopus.a SupportedArchitectures arm64 + x86_64 SupportedPlatform ios + SupportedPlatformVariant + simulator CFBundlePackageType diff --git a/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64/libopus.a b/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64/libopus.a index cc16319..5498241 100644 Binary files a/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64/libopus.a and b/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64/libopus.a differ diff --git a/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64_x86_64-simulator/libopus.a b/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64_x86_64-simulator/libopus.a index 1db2cfe..73e8340 100644 Binary files a/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64_x86_64-simulator/libopus.a and b/OpusSharp.Natives/runtimes/ios/native/libopus.xcframework/ios-arm64_x86_64-simulator/libopus.a differ diff --git a/OpusSharp.Natives/runtimes/linux-arm/native/opus.so b/OpusSharp.Natives/runtimes/linux-arm/native/opus.so index 2a5acd0..a953e74 100644 Binary files a/OpusSharp.Natives/runtimes/linux-arm/native/opus.so and b/OpusSharp.Natives/runtimes/linux-arm/native/opus.so differ diff --git a/OpusSharp.Natives/runtimes/linux-arm64/native/opus.so b/OpusSharp.Natives/runtimes/linux-arm64/native/opus.so index d1ce4b9..52e9f83 100644 Binary files a/OpusSharp.Natives/runtimes/linux-arm64/native/opus.so and b/OpusSharp.Natives/runtimes/linux-arm64/native/opus.so differ diff --git a/OpusSharp.Natives/runtimes/linux-x64/native/opus.so b/OpusSharp.Natives/runtimes/linux-x64/native/opus.so index 96af381..61a952a 100644 Binary files a/OpusSharp.Natives/runtimes/linux-x64/native/opus.so and b/OpusSharp.Natives/runtimes/linux-x64/native/opus.so differ diff --git a/OpusSharp.Natives/runtimes/linux-x86/native/opus.so b/OpusSharp.Natives/runtimes/linux-x86/native/opus.so index 3dec143..74de919 100644 Binary files a/OpusSharp.Natives/runtimes/linux-x86/native/opus.so and b/OpusSharp.Natives/runtimes/linux-x86/native/opus.so differ diff --git a/OpusSharp.Natives/runtimes/osx-arm64/native/opus.dylib b/OpusSharp.Natives/runtimes/osx-arm64/native/opus.dylib index ba7d18a..0434588 100644 Binary files a/OpusSharp.Natives/runtimes/osx-arm64/native/opus.dylib and b/OpusSharp.Natives/runtimes/osx-arm64/native/opus.dylib differ diff --git a/OpusSharp.Natives/runtimes/osx-x64/native/opus.dylib b/OpusSharp.Natives/runtimes/osx-x64/native/opus.dylib index 4e21c97..d2c3963 100644 Binary files a/OpusSharp.Natives/runtimes/osx-x64/native/opus.dylib and b/OpusSharp.Natives/runtimes/osx-x64/native/opus.dylib differ diff --git a/OpusSharp.Natives/runtimes/win-arm64/native/opus.dll b/OpusSharp.Natives/runtimes/win-arm64/native/opus.dll index 9d9f180..796a8de 100644 Binary files a/OpusSharp.Natives/runtimes/win-arm64/native/opus.dll and b/OpusSharp.Natives/runtimes/win-arm64/native/opus.dll differ diff --git a/OpusSharp.Natives/runtimes/win-x64/native/opus.dll b/OpusSharp.Natives/runtimes/win-x64/native/opus.dll index 27041eb..2f72e2c 100644 Binary files a/OpusSharp.Natives/runtimes/win-x64/native/opus.dll and b/OpusSharp.Natives/runtimes/win-x64/native/opus.dll differ diff --git a/OpusSharp.Natives/runtimes/win-x86/native/opus.dll b/OpusSharp.Natives/runtimes/win-x86/native/opus.dll index a5c9e2b..defe10c 100644 Binary files a/OpusSharp.Natives/runtimes/win-x86/native/opus.dll and b/OpusSharp.Natives/runtimes/win-x86/native/opus.dll differ diff --git a/README.md b/README.md index 79393e3..202f3f9 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ var decodedSamples = decoder.Decode(someEncodedAudio, someEncodedAudio.Length, d This example shows a forced usage of OpusSharp to use the statically linked opus binary. ```csharp -// On iOS OpusSharp switches to StaticNativeOpus automatically. +// On iOS and browser WASM OpusSharp switches to StaticNativeOpus automatically. // You can still force the same behavior manually with use_static: true. var encoder = new OpusEncoder(sampleRate, channels, OpusPredefinedValues.OPUS_APPLICATION_VOIP, use_static: true); var encoder = new OpusDecoder(sampleRate, channels, use_static: true); @@ -67,7 +67,7 @@ For unity integration, you may want to use `Static.OpusDecoder`, `Dynamic.OpusDe ```csharp using OpusSharp.Core; - + IOpusEncoder encoder; IOpusDecoder decoder; //Decoder @@ -153,15 +153,16 @@ encoder.Ctl(EncoderCTL.OPUS_SET_VBR, 1); //OpusSharp already checks if an e - ❎ Can be supported but no reason to. - ❗ Not yet available. - ❌ Not planned, Not supported. +- ➖ Not applicable for this platform. -| Device | x64 | x86 | arm32 | arm64 | -|---------|-----|-----|-------|-------| -| Linux | ✅ | ✅ | ✅ | ✅ | -| Android | ✅ | ✅ | ✅ | ✅ | -| Windows | ✅ | ✅ | ✅ | ✅ | -| iOS | ❌ | ❌ | ❌ | ✅ | -| MacOS | ✅ | ❌ | ❌ | ✅ | -| WASM | ✅ | ❗ | ❗ | ❗ | +| Device | x64 | x86 | arm32 | arm64 | browser-wasm | +| ------- | --- | --- | ----- | ----- | ------------ | +| Linux | ✅ | ✅ | ✅ | ✅ | ➖ | +| Android | ✅ | ✅ | ✅ | ✅ | ➖ | +| Windows | ✅ | ✅ | ✅ | ✅ | ➖ | +| iOS | ❌ | ❌ | ❌ | ✅ | ➖ | +| MacOS | ✅ | ❌ | ❌ | ✅ | ➖ | +| WASM | ➖ | ➖ | ➖ | ➖ | ✅ | ## Installation @@ -169,6 +170,8 @@ Please check [QuickStart](https://avionblock.github.io/OpusSharp/quick-start/ind OR [Nuget](https://www.nuget.org/packages/OpusSharp). For the default cross-platform experience, install [OpusSharp](https://www.nuget.org/packages/OpusSharp). It brings in both `OpusSharp.Core` and the prebuilt native assets, including automatic iOS linking through `OpusSharp.Natives`. +Browser WebAssembly apps also receive the packaged `browser-wasm/native/libopus.a` automatically as a +`NativeFileReference`. If you want to manage native binaries yourself, only install the `OpusSharp.Core` package. @@ -181,6 +184,7 @@ https://avionblock.github.io/OpusSharp/api/OpusSharp.Core.html https://opus-codec.org/license/ ## Support The Creator + Kofi Donations only go through to SineVector241. Sponsoring hasn't been setup yet... -[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Z8Z0MLA2P) \ No newline at end of file +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Z8Z0MLA2P) diff --git a/docs/quick-start/index.md b/docs/quick-start/index.md index f61f749..71aa68d 100644 --- a/docs/quick-start/index.md +++ b/docs/quick-start/index.md @@ -26,7 +26,7 @@ dotnet add package OpusSharp.Natives --version x.y.z ``` > [!NOTE] -> iOS binaries are shipped through `OpusSharp.Natives` as `libopus.xcframework` and linked automatically in .NET iOS projects. At runtime OpusSharp automatically switches to `StaticNativeOpus` on iOS, so manually passing `use_static: true` is optional. WASM still requires manual static linking. +> iOS binaries are shipped through `OpusSharp.Natives` as `libopus.xcframework` and linked automatically in .NET iOS projects. WASM binaries are shipped as `libopus.a` and linked automatically in `browser-wasm` projects through `NativeFileReference`. At runtime OpusSharp automatically switches to `StaticNativeOpus` on iOS and browser WASM, so manually passing `use_static: true` is optional. ## Step 3: Create Encoder and Decoder