Skip to content

Commit bd389ad

Browse files
committed
Use target-specific rsmpeg configurations for FFmpeg compatibility
- Configure rsmpeg to use FFmpeg 6 on Linux, FFmpeg 7 on Windows, FFmpeg 8 on macOS - Remove manual CI workflow modifications for FFmpeg compatibility - Simplify CI configuration by leveraging Cargo's target-specific dependencies
1 parent c4b8c32 commit bd389ad

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

.github/workflows/build_linux.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ jobs:
2828
- name: Install dependencies
2929
run: sudo apt update && sudo apt-get install libgpac-dev libtesseract-dev libavcodec-dev libavdevice-dev libx11-dev libxcb1-dev libxcb-shm0-dev
3030
- uses: actions/checkout@v4
31-
- name: Downgrade rsmpeg for FFmpeg 6.x compatibility
32-
run: |
33-
sed -i 's/rsmpeg = { version = "0.18.0+ffmpeg.8.0"/rsmpeg = { version = "0.14.2+ffmpeg.6.1"/' src/rust/Cargo.toml
3431
- name: build
3532
run: ./build -hardsubx
3633
working-directory: ./linux
@@ -82,9 +79,6 @@ jobs:
8279
- uses: actions/checkout@v4
8380
- name: Install dependencies
8481
run: sudo apt update && sudo apt install libgpac-dev libtesseract-dev libavformat-dev libavdevice-dev libswscale-dev yasm
85-
- name: Downgrade rsmpeg for FFmpeg 6.x compatibility
86-
run: |
87-
sed -i 's/rsmpeg = { version = "0.18.0+ffmpeg.8.0"/rsmpeg = { version = "0.14.2+ffmpeg.6.1"/' src/rust/Cargo.toml
8882
- name: cmake
8983
run: |
9084
mkdir build && cd build

.github/workflows/build_windows.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ jobs:
5858
override: true
5959
- name: Install Win 10 SDK
6060
uses: ilammy/msvc-dev-cmd@v1
61-
- name: Downgrade rsmpeg for FFmpeg 7.1.1 compatibility
62-
shell: powershell
63-
run: |
64-
(Get-Content src\rust\Cargo.toml) -replace 'rsmpeg = \{ version = "0.18.0\+ffmpeg.8.0"', 'rsmpeg = { version = "0.17.0+ffmpeg.7.1"' | Set-Content src\rust\Cargo.toml
6561
- name: build Release-Full
6662
env:
6763
LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib"
@@ -113,10 +109,6 @@ jobs:
113109
override: true
114110
- name: Install Win 10 SDK
115111
uses: ilammy/msvc-dev-cmd@v1
116-
- name: Downgrade rsmpeg for FFmpeg 7.1.1 compatibility
117-
shell: powershell
118-
run: |
119-
(Get-Content src\rust\Cargo.toml) -replace 'rsmpeg = \{ version = "0.18.0\+ffmpeg.8.0"', 'rsmpeg = { version = "0.17.0+ffmpeg.7.1"' | Set-Content src\rust\Cargo.toml
120112
- name: build Debug-Full
121113
env:
122114
LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib"

src/rust/Cargo.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ crate-type = ["staticlib"]
1414
log = "0.4.26"
1515
env_logger = "0.8.4"
1616
palette = "0.6.1"
17-
rsmpeg = { version = "0.18.0+ffmpeg.8.0", optional = true, features = [
18-
"link_system_ffmpeg",
19-
] }
17+
# Default rsmpeg for macOS and other platforms (FFmpeg 8.0)
18+
rsmpeg = { version = "=0.18.0", default-features = false, features = ["link_system_ffmpeg"], optional = true }
2019
tesseract-sys = { version = "0.5.15", optional = true, default-features = false }
2120
leptonica-sys = { version = "= 0.4.6", optional = true, default-features = false }
2221
clap = { version = "4.5.31", features = ["derive"] }
@@ -29,6 +28,14 @@ lib_ccxr = { path = "lib_ccxr" }
2928
url = "2.5.4"
3029
encoding_rs = "0.8.5"
3130

31+
# Platform-specific rsmpeg configurations (overrides default FFmpeg 8.0)
32+
# Linux uses FFmpeg 6.1, Windows uses FFmpeg 7.1
33+
[target.'cfg(target_os = "linux")'.dependencies]
34+
rsmpeg = { version = "=0.14.2", default-features = false, features = ["link_system_ffmpeg"], optional = true }
35+
36+
[target.'cfg(windows)'.dependencies]
37+
rsmpeg = { version = "=0.17.0", default-features = false, features = ["link_system_ffmpeg"], optional = true }
38+
3239
[build-dependencies]
3340
bindgen = "0.64.0"
3441
pkg-config = "0.3.32"

0 commit comments

Comments
 (0)