Skip to content

Commit cc8a08e

Browse files
committed
Configure CI workflows to use appropriate FFmpeg versions
- Linux CI: Uses FFmpeg 6 (via ffmpeg6 feature flag) - Windows CI: Uses FFmpeg 7 (via ffmpeg7 feature flag) - macOS: Uses FFmpeg 8 (default, via ffmpeg8 feature flag) - Updated build scripts to accept FFMPEG_VERSION environment variable - Updated rsmpeg_compat module to handle feature selection - Simplified configuration: defaults to FFmpeg 8, workflows override as needed
1 parent 9a48d7c commit cc8a08e

File tree

7 files changed

+29
-11
lines changed

7 files changed

+29
-11
lines changed

.github/workflows/build_linux.yml

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

.github/workflows/build_windows.yml

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

linux/build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ while [[ $# -gt 0 ]]; do
1313
;;
1414
-hardsubx)
1515
HARDSUBX=true
16-
RUST_FEATURES="--features hardsubx_ocr"
16+
# Allow overriding FFmpeg version via environment variable
17+
if [ -n "$FFMPEG_VERSION" ]; then
18+
RUST_FEATURES="--features hardsubx_ocr,$FFMPEG_VERSION"
19+
else
20+
RUST_FEATURES="--features hardsubx_ocr"
21+
fi
1722
BLD_FLAGS="$BLD_FLAGS -DENABLE_HARDSUBX"
1823
BLD_LINKER="$BLD_LINKER -lswscale -lavutil -pthread -lavformat -lavcodec -lavfilter -lxcb-shm -lxcb -lX11 -llzma -lswresample"
1924
shift

mac/build.command

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ while [[ $# -gt 0 ]]; do
2121
-hardsubx)
2222
HARDSUBX=true
2323
ENABLE_OCR=true
24-
RUST_FEATURES="--features hardsubx_ocr"
24+
# Allow overriding FFmpeg version via environment variable
25+
if [ -n "$FFMPEG_VERSION" ]; then
26+
RUST_FEATURES="--features hardsubx_ocr,$FFMPEG_VERSION"
27+
else
28+
RUST_FEATURES="--features hardsubx_ocr"
29+
fi
2530
shift
2631
;;
2732
-*)

src/rust/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ wtv_debug = []
4141
enable_ffmpeg = []
4242
with_libcurl = []
4343

44-
# FFmpeg version selection features (mutually exclusive, ffmpeg8 is default)
44+
# FFmpeg version selection features (for manual override)
4545
ffmpeg6 = ["rsmpeg_ffmpeg6"]
4646
ffmpeg7 = ["rsmpeg_ffmpeg7"]
4747
ffmpeg8 = ["rsmpeg_ffmpeg8"]
4848

49-
# hardsubx_ocr will use ffmpeg8 by default, override with --features "hardsubx_ocr,ffmpeg6"
50-
hardsubx_ocr = ["ffmpeg8", "tesseract-sys", "leptonica-sys"]
51-
hardsubx_ocr_ffmpeg6 = ["ffmpeg6", "tesseract-sys", "leptonica-sys"]
52-
hardsubx_ocr_ffmpeg7 = ["ffmpeg7", "tesseract-sys", "leptonica-sys"]
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"]
5352

5453
[profile.release-with-debug]
5554
inherits = "release"

src/rust/src/rsmpeg_compat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ pub use rsmpeg_ffmpeg7 as rsmpeg;
99
#[cfg(feature = "ffmpeg8")]
1010
pub use rsmpeg_ffmpeg8 as rsmpeg;
1111

12-
// Ensure at least one FFmpeg version is selected
12+
// Default to ffmpeg8 if no specific version is selected
1313
#[cfg(not(any(feature = "ffmpeg6", feature = "ffmpeg7", feature = "ffmpeg8")))]
14-
compile_error!("One of the FFmpeg version features must be enabled: ffmpeg6, ffmpeg7, or ffmpeg8");
14+
pub use rsmpeg_ffmpeg8 as rsmpeg;

windows/rust.bat

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
for /f "delims=" %%i in ('cd') do set output=%%i
22
set CARGO_TARGET_DIR=%output%
33
cd ..\src\rust
4-
cargo build %1 --features "hardsubx_ocr" --target x86_64-pc-windows-msvc
4+
REM Allow overriding FFmpeg version via environment variable
5+
IF "%FFMPEG_VERSION%"=="" (
6+
cargo build %1 --features "hardsubx_ocr" --target x86_64-pc-windows-msvc
7+
) ELSE (
8+
cargo build %1 --features "hardsubx_ocr,%FFMPEG_VERSION%" --target x86_64-pc-windows-msvc
9+
)
510
cd ..\..\windows
611
IF "%~1"=="-r" (
712
copy x86_64-pc-windows-msvc\release\ccx_rust.lib .\ccx_rust.lib

0 commit comments

Comments
 (0)