Skip to content

Commit

Permalink
Refactor decoder API to not need a .begin() call (#79)
Browse files Browse the repository at this point in the history
Now our Symphonia and FFmpeg decoder APIs directly
implement the `Source` trait, instead of being
separate structs that create a `Source` with a
call to `.begin()`.

We need to upgrade from a minimum of Rust 1.56 to
Rust 1.58 because this PR uses the
`Option::unwrap_unchecked()` method.
Since we are breaking compatibility, we will
take the opportunity to bump our minimum Rust version
all the way to 1.61.
  • Loading branch information
jamesmishra authored Jun 3, 2022
1 parent e311f9c commit 1abf9b9
Show file tree
Hide file tree
Showing 29 changed files with 871 additions and 1,036 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true

- name: Check out Babycat code from GitHub
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-sphinx-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true
target: wasm32-unknown-unknown

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-sphinx-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true
target: wasm32-unknown-unknown

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fmt-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true
components: rustfmt, clippy
target: wasm32-unknown-unknown
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true

- uses: actions/setup-python@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true

- name: Check out Babycat code from GitHub
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true
target: wasm32-unknown-unknown

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true

- name: Check out Babycat code from GitHub
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-ffmpeg-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true

- name: Check out Babycat code from GitHub
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true

- name: Install Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true

- name: Check out Babycat code from GitHub
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: "1.56.0"
toolchain: "1.61.0"
override: true
target: wasm32-unknown-unknown

Expand Down
4 changes: 2 additions & 2 deletions docker/maturin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ RUN mkdir /.cache && chmod --recursive 777 /.cache


# Install Rust so we can build the wheel.
COPY --from=rust:1.56.0-slim /usr/local/cargo /usr/local/cargo
COPY --from=rust:1.56.0-slim /usr/local/rustup /usr/local/rustup
COPY --from=rust:1.61.0-slim /usr/local/cargo /usr/local/cargo
COPY --from=rust:1.61.0-slim /usr/local/rustup /usr/local/rustup
RUN chmod --recursive 777 /usr/local/cargo /usr/local/rustup


Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorials/development-requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ However, in order to compile Babycat and run tests, there are some software pack
Requirements for compiling Babycat
----------------------------------

Rust 1.56 or newer
Rust 1.61 or newer
^^^^^^^^^^^^^^^^^^
Babycat is written for stable Rust, targeting 1.56.0 or newer. You can install Rust with `rustup <https://www.rust-lang.org/tools/install>`_.
Babycat is written for stable Rust, targeting 1.61.0 or newer. You can install Rust with `rustup <https://www.rust-lang.org/tools/install>`_.

cbindgen
^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions src/backend/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ pub const RESAMPLE_MODE_BABYCAT_LANCZOS: u32 = 2;
/// Use this value to resample audio with Babycat's sinc resampler.
pub const RESAMPLE_MODE_BABYCAT_SINC: u32 = 3;

/// Sets the decoding backend as [`SymphoniaDecoder`](crate::symphonia::SymphoniaDecoder).
/// Sets the decoding backend as [`SymphoniaDecoder`](crate::decoder::SymphoniaDecoder).
pub const DECODING_BACKEND_SYMPHONIA: u32 = 1;

/// Sets the decoding backend as [`FFmpegDecoder`](crate::ffmpeg::FFmpegDecoder).
/// Sets the decoding backend as [`FFmpegDecoder`](crate::decoder::FFmpegDecoder).
#[allow(dead_code)]
pub const DECODING_BACKEND_FFMPEG: u32 = 2;

Expand Down
Loading

0 comments on commit 1abf9b9

Please sign in to comment.