Skip to content

Commit 5444c7d

Browse files
committed
Add platform-specific FFmpeg defaults
- Linux automatically uses FFmpeg 6 (no env var needed) - Windows automatically uses FFmpeg 7 (no env var needed) - macOS and others automatically use FFmpeg 8 - Removed FFMPEG_VERSION from CI workflows - no longer needed - Platform defaults work automatically, but can still override with feature flags - Build scripts still support FFMPEG_VERSION env var for manual override
1 parent cc8a08e commit 5444c7d

File tree

4 files changed

+35
-13
lines changed

4 files changed

+35
-13
lines changed

.github/workflows/build_linux.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ jobs:
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
3131
- name: build
32-
run: |
33-
# Use FFmpeg 6 for Linux CI
34-
export FFMPEG_VERSION=ffmpeg6
35-
./build -hardsubx
32+
run: ./build -hardsubx
3633
working-directory: ./linux
3734
- name: Display version information
3835
run: ./ccextractor --version

.github/workflows/build_windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ jobs:
116116
CARGO_TARGET_DIR: "..\\..\\windows"
117117
BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0
118118
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
119-
FFMPEG_VERSION: ffmpeg7
120119
run: msbuild ccextractor.sln /p:Configuration=Debug-Full /p:Platform=x64
121120
working-directory: ./windows
122121
- name: Display version information

src/rust/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ ffmpeg6 = ["rsmpeg_ffmpeg6"]
4646
ffmpeg7 = ["rsmpeg_ffmpeg7"]
4747
ffmpeg8 = ["rsmpeg_ffmpeg8"]
4848

49-
# hardsubx_ocr defaults to FFmpeg 8, override with --features "hardsubx_ocr,ffmpeg6" or "hardsubx_ocr,ffmpeg7"
50-
# CI workflows should specify: Linux uses ffmpeg6, Windows uses ffmpeg7, macOS uses ffmpeg8
51-
hardsubx_ocr = ["rsmpeg_ffmpeg8", "tesseract-sys", "leptonica-sys"]
49+
# hardsubx_ocr includes all FFmpeg versions, platform defaults: Linux=6, Windows=7, macOS/others=8
50+
# Override with --features "hardsubx_ocr,ffmpeg8" to force a specific version
51+
hardsubx_ocr = ["rsmpeg_ffmpeg6", "rsmpeg_ffmpeg7", "rsmpeg_ffmpeg8", "tesseract-sys", "leptonica-sys"]
5252

5353
[profile.release-with-debug]
5454
inherits = "release"

src/rust/src/rsmpeg_compat.rs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
1-
// Re-export rsmpeg based on selected FFmpeg version feature
1+
// Re-export rsmpeg based on selected FFmpeg version feature or platform defaults
22

3+
// Explicit feature flags take precedence
34
#[cfg(feature = "ffmpeg6")]
45
pub use rsmpeg_ffmpeg6 as rsmpeg;
56

6-
#[cfg(feature = "ffmpeg7")]
7+
#[cfg(all(feature = "ffmpeg7", not(feature = "ffmpeg6")))]
78
pub use rsmpeg_ffmpeg7 as rsmpeg;
89

9-
#[cfg(feature = "ffmpeg8")]
10+
#[cfg(all(feature = "ffmpeg8", not(feature = "ffmpeg6"), not(feature = "ffmpeg7")))]
1011
pub use rsmpeg_ffmpeg8 as rsmpeg;
1112

12-
// Default to ffmpeg8 if no specific version is selected
13-
#[cfg(not(any(feature = "ffmpeg6", feature = "ffmpeg7", feature = "ffmpeg8")))]
13+
// Platform-specific defaults when no explicit feature is selected
14+
// Linux defaults to FFmpeg 6
15+
#[cfg(all(
16+
target_os = "linux",
17+
not(feature = "ffmpeg6"),
18+
not(feature = "ffmpeg7"),
19+
not(feature = "ffmpeg8")
20+
))]
21+
pub use rsmpeg_ffmpeg6 as rsmpeg;
22+
23+
// Windows defaults to FFmpeg 7
24+
#[cfg(all(
25+
target_os = "windows",
26+
not(feature = "ffmpeg6"),
27+
not(feature = "ffmpeg7"),
28+
not(feature = "ffmpeg8")
29+
))]
30+
pub use rsmpeg_ffmpeg7 as rsmpeg;
31+
32+
// macOS and other platforms default to FFmpeg 8
33+
#[cfg(all(
34+
not(target_os = "linux"),
35+
not(target_os = "windows"),
36+
not(feature = "ffmpeg6"),
37+
not(feature = "ffmpeg7"),
38+
not(feature = "ffmpeg8")
39+
))]
1440
pub use rsmpeg_ffmpeg8 as rsmpeg;

0 commit comments

Comments
 (0)