Skip to content
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
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SPlayer-Next 是基于 **Electron + Vue 3 + TypeScript** 的桌面音乐播放

### 原生模块(`native/`)

- `audio-engine`:FFmpeg 解码 + rodio 播放 + FFT + 封面提取
- `audio-engine`:`ffmpeg_audio` 解码(静态编 FFmpeg,零环境依赖)+ rodio 播放 + FFT + 封面提取;URL 通过 `HttpRangeSource`(ureq + rustls)包成 Read+Seek 流喂给 ffmpeg_audio
- `media-ctrl`:跨平台系统媒体控件(Windows SMTC / Linux MPRIS / macOS MPNowPlaying)+ Discord RPC
- `taskbar-lyric`:Windows 专属,把窗口嵌入任务栏 + RegistryWatcher / UiaWatcher / TrayWatcher 四路监听

Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/claude-code-review.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/claude.yml

This file was deleted.

48 changes: 1 addition & 47 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ on:

env:
NODE_VERSION: 22.x
BUILDER_REPO: apoint123/ffmpeg-builder
FFMPEG_VERSION_TAG: "8.0.1"

jobs:
build:
Expand Down Expand Up @@ -76,57 +74,13 @@ jobs:
with:
workspaces: "native/audio-engine -> target\nnative/media-ctrl -> target"

# 下载预编译的 FFmpeg 静态库 (Windows)
- name: 下载预编译的 FFmpeg 库 (Windows)
if: runner.os == 'Windows'
run: |
$packageName = "ffmpeg-${{ env.FFMPEG_VERSION_TAG }}-${{ matrix.artifact_name_suffix }}.${{ matrix.package_extension }}"
$downloadUrl = "https://github.com/${{ env.BUILDER_REPO }}/releases/latest/download/$packageName"
Write-Host "Downloading $packageName from $downloadUrl ..."
Invoke-WebRequest -Uri $downloadUrl -OutFile $packageName

mkdir -p vendor/ffmpeg
Expand-Archive -Path $packageName -DestinationPath vendor/ffmpeg_temp -Force
Move-Item -Path vendor/ffmpeg_temp/include -Destination vendor/ffmpeg/include
Move-Item -Path vendor/ffmpeg_temp/lib -Destination vendor/ffmpeg/lib
Remove-Item -Recurse -Force vendor/ffmpeg_temp
Remove-Item $packageName

echo "FFMPEG_DIR=${{ github.workspace }}/vendor/ffmpeg" >> $env:GITHUB_ENV
shell: powershell

# 下载预编译的 FFmpeg 静态库 (macOS/Linux)
- name: 下载预编译的 FFmpeg 库 (macOS/Linux)
if: runner.os != 'Windows'
run: |
PACKAGE_NAME="ffmpeg-${{ env.FFMPEG_VERSION_TAG }}-${{ matrix.artifact_name_suffix }}.${{ matrix.package_extension }}"
DOWNLOAD_URL="https://github.com/${{ env.BUILDER_REPO }}/releases/latest/download/${PACKAGE_NAME}"
echo "Downloading $PACKAGE_NAME from $DOWNLOAD_URL ..."
curl -f -sL $DOWNLOAD_URL -o $PACKAGE_NAME

mkdir -p vendor/ffmpeg
tar -xzf $PACKAGE_NAME -C vendor/ffmpeg
rm $PACKAGE_NAME

echo "FFMPEG_DIR=${{ github.workspace }}/vendor/ffmpeg" >> $GITHUB_ENV
shell: bash

# 设置 FFmpeg 环境变量
- name: 设置 FFmpeg 环境变量
run: |
echo "PKG_CONFIG_PATH=${{ github.workspace }}/vendor/ffmpeg/lib/pkgconfig" >> $GITHUB_ENV
if [[ "$RUNNER_OS" != "Windows" ]]; then
echo "CFLAGS=-I${{ github.workspace }}/vendor/ffmpeg/include" >> $GITHUB_ENV
fi
shell: bash

# Linux: 安装系统构建/打包依赖
- name: 安装系统依赖 (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
libasound2-dev libdbus-1-dev pkg-config clang nasm \
libasound2-dev libdbus-1-dev pkg-config clang \
rpm libarchive-tools

# 清理旧构建产物
Expand Down
18 changes: 2 additions & 16 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,7 @@ pnpm build:native # Rust only; add `-- --dev` for debug

`SKIP_NATIVE_BUILD=true` skips Rust during dev.

### FFmpeg Setup (first-time native build)

`audio-engine` static-links FFmpeg. Before first `pnpm dev` / `pnpm build:native`, download FFmpeg static libs (with `include` and `lib`) and set:

```bash
# macOS / Linux
export FFMPEG_DIR=/path/to/ffmpeg
export PKG_CONFIG_PATH="$FFMPEG_DIR/lib/pkgconfig"
```

```powershell
# Windows
$env:FFMPEG_DIR="D:\ffmpeg"
$env:PKG_CONFIG_PATH="$env:FFMPEG_DIR\lib\pkgconfig"
```
`audio-engine` static-links FFmpeg via the `ffmpeg_audio` crate (vendor zip + cc-built at compile time). Zero environment dependency — no `FFMPEG_DIR` / `PKG_CONFIG_PATH`, no system FFmpeg required.

## Architecture

Expand All @@ -49,7 +35,7 @@ $env:PKG_CONFIG_PATH="$env:FFMPEG_DIR\lib\pkgconfig"

Three `.node` modules in `native/`, built via `scripts/build-native.ts`, lazy-loaded by `electron/main/utils/nativeLoader.ts`. NAPI-RS auto-generates `index.d.ts`, imported via path aliases `@splayer/audio-engine`, `@splayer/media-ctrl`, `@splayer/taskbar-lyric`.

- `audio-engine` — FFmpeg decode + rodio playback + FFT + cover extraction. Pushes events (state/position/ended/outputStalled) via ThreadsafeFunction. Has load_token race protection and `AVIOInterruptCB` for instant stop on blocking IO.
- `audio-engine` — `ffmpeg_audio` decode (static FFmpeg) + rodio playback + FFT + cover extraction. URLs wrapped as `Read + Seek` via `HttpRangeSource` (ureq + rustls) — TLS handled in Rust, cross-platform with no system deps. Pushes events (state/position/ended/outputStalled) via ThreadsafeFunction. Has load_token race protection and a cancel flag (injected into `HttpRangeSource`) for instant stop on blocking IO.
- `media-ctrl` — Cross-platform system media controls (Windows SMTC / Linux MPRIS / macOS MPNowPlaying) + Discord RPC.
- `taskbar-lyric` — Windows taskbar lyric text rendering with RegistryWatcher / UiaWatcher / TrayWatcher.

Expand Down
Loading
Loading