Skip to content

✨ use ffmpeg to encode raw pcm #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .cargo/config-windows.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[target.'cfg(target_env = "msvc")']
rustflags = ["-C", "target-feature=+crt-static"]

[env]
LIBCLANG_PATH = ""
FFMPEG_DIR = ""
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[target.'cfg(target_env = "msvc")']
rustflags = ["-C", "target-feature=+crt-static"]
[alias]
build-windows = "build --config .cargo/config-windows.toml"
47 changes: 26 additions & 21 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: ["main"]
branches: [main]
tags: ["*"]

env:
Expand All @@ -27,34 +27,39 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install nasm
uses: ilammy/setup-nasm@v1
- name: Install FFmpeg
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get update
sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libswresample-dev
elif [ "${{ runner.os }}" = "macOS" ]; then
sudo brew install ffmpeg
elif [ "${{ runner.os }}" = "Windows" ]; then
curl --location https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-win64-lgpl-shared-7.1.zip --output ffmpeg.zip
unzip ffmpeg.zip
fi
shell: bash

- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --release
run: |
export name=mltd-git-$(git describe --tags --dirty)-${{ runner.os }}

- name: Get version (Windows)
if: ${{ contains('Windows', runner.os) }}
id: version_windows
run: echo "version=$(git describe --tags --dirty)" >> $env:GITHUB_OUTPUT
if [ "${{ runner.os }}" = "Windows" ]; then
export FFMPEG_DIR=$PWD/ffmpeg-n7.1-latest-win64-lgpl-shared-7.1
cargo build-windows --release
export name=$name.exe
else
cargo build --release
fi

- name: Get version
if: ${{ !contains('Windows', runner.os) }}
id: version
run: echo "version=$(git describe --tags --dirty)" >> $GITHUB_OUTPUT
echo "name=$name" >> $GITHUB_OUTPUT

- name: Publish artifact (Windows)
if: ${{ contains('Windows', runner.os) }}
uses: actions/upload-artifact@v4
with:
name: mltd-git-${{ steps.version_windows.outputs.version }}-Windows.exe
path: target/release/mltd.exe
shell: bash

- name: Publish artifact
if: ${{ !contains('Windows', runner.os) }}
uses: actions/upload-artifact@v4
with:
name: mltd-git-${{ steps.version.outputs.version }}-${{ runner.os }}
path: target/release/mltd
name: ${{ steps.version.outputs.name }}
path: target/release/mltd-git-*
8 changes: 5 additions & 3 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ jobs:
with:
submodules: true

- name: Install FFmpeg
run: |
sudo apt-get update
sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libswresample-dev

- name: Install Rust
uses: dtolnay/rust-toolchain@nightly

- name: Install nasm
uses: ilammy/setup-nasm@v1

- uses: Swatinem/rust-cache@v2

- name: Install cargo-binstall
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/fmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ jobs:
with:
components: rustfmt

- name: Install nasm
uses: ilammy/setup-nasm@v1

- uses: Swatinem/rust-cache@v2

- name: Fmt
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ jobs:
with:
submodules: true

- name: Install FFmpeg
run: |
sudo apt-get update
sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libswresample-dev

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Install nasm
uses: ilammy/setup-nasm@v1

- uses: Swatinem/rust-cache@v2

- name: Lint
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ jobs:
with:
submodules: true

- name: Install FFmpeg
run: |
sudo apt-get update
sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libswresample-dev

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install nasm
uses: ilammy/setup-nasm@v1

- uses: Swatinem/rust-cache@v2

- name: Test
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ output/
build/

.vscode/

.cargo/config-windows.toml
Loading