Skip to content

Commit 5834596

Browse files
authored
CI: Avoid docker containers in favor of prebuilt binaries (shssoichiro#83)
* CI: Use wang-bin/avbuild binaries for Linux * Add fix for broken .pc files * Update some tests to be more flexible re: FFmpeg
1 parent f1c6b44 commit 5834596

File tree

2 files changed

+59
-26
lines changed

2 files changed

+59
-26
lines changed

.github/workflows/build.yml

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,54 @@ env:
2323

2424
jobs:
2525
build-test-lint-linux:
26-
name: Linux - FFmpeg ${{ matrix.ffmpeg_version }} - build, test and lint
26+
name: Linux - FFmpeg ${{ matrix.ffmpeg.version }} - build, test and lint
2727
runs-on: ubuntu-22.04
28-
container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu
2928

3029
strategy:
3130
matrix:
32-
ffmpeg_version:
33-
- "4.2"
34-
- "4.3"
35-
- "4.4"
36-
- "5.0"
37-
- "5.1"
38-
- "6.0"
39-
- "6.1"
40-
- "7.0"
41-
- "7.1"
31+
ffmpeg:
32+
- version: "4.2"
33+
file: "ffmpeg-4.2-linux-gcc.tar.xz"
34+
- version: "4.3"
35+
file: "ffmpeg-4.3-linux-gcc.tar.xz"
36+
- version: "4.4"
37+
file: "ffmpeg-4.4-linux-clang-default.tar.xz"
38+
lib_subdir: "amd64"
39+
- version: "5.1"
40+
file: "ffmpeg-5.1-linux-clang-default.tar.xz"
41+
lib_subdir: "amd64"
42+
- version: "6.1"
43+
file: "ffmpeg-6.1-linux-clang-default.tar.xz"
44+
lib_subdir: "amd64"
45+
- version: "7.0"
46+
file: "ffmpeg-7.0-linux-clang-default.tar.xz"
47+
lib_subdir: "amd64"
48+
- version: "7.1"
49+
file: "ffmpeg-7.1-linux-clang-default.tar.xz"
50+
lib_subdir: "amd64"
4251
fail-fast: false
4352

4453
steps:
4554
- uses: actions/checkout@v4
4655
- name: Install dependencies
4756
run: |
48-
apt-get update
49-
apt-get install -y --no-install-recommends clang curl pkg-config
57+
sudo apt-get update
58+
sudo apt-get install -y --no-install-recommends \
59+
libva2 libva-drm2 libva-x11-2 libvdpau1 libxv1
60+
- name: Download FFmpeg
61+
shell: bash
62+
run: |
63+
mkdir ffmpeg-libs
64+
curl -L "https://sourceforge.net/projects/avbuild/files/linux/${{ matrix.ffmpeg.file }}/download" \
65+
| tar xJf - --strip 1 -C ffmpeg-libs
66+
67+
# https://github.com/wang-bin/avbuild/issues/76
68+
PC_FILES=(ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}/pkgconfig/*.pc)
69+
sed -i 's/^prefix=.*$/prefix=${pcfiledir}\/..\/..\/../g' $PC_FILES
70+
sed -i 's/^libdir=.*$/libdir=${prefix}\/lib\/${{ matrix.ffmpeg.lib_subdir }}/g' $PC_FILES
71+
72+
echo "PKG_CONFIG_PATH=$PWD/ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}/pkgconfig" >> "$GITHUB_ENV"
73+
echo "LD_LIBRARY_PATH=$PWD/ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}" >> "$GITHUB_ENV"
5074
- name: Install Rust stable with clippy and rustfmt
5175
uses: dtolnay/rust-toolchain@stable
5276
with:
@@ -55,7 +79,7 @@ jobs:
5579
with:
5680
prefix-key: "v3-rust"
5781
# Only save cache for one FFmpeg version
58-
save-if: ${{ matrix.ffmpeg_version == '7.1' }}
82+
save-if: ${{ matrix.ffmpeg.version == '7.1' }}
5983

6084
- name: Check format
6185
run: cargo fmt -- --check
@@ -166,14 +190,23 @@ jobs:
166190

167191
msrv:
168192
runs-on: ubuntu-22.04
169-
container: jrottenberg/ffmpeg:7.0-ubuntu
170193

171194
steps:
172195
- uses: actions/checkout@v4
173-
- name: Install dependencies
196+
- name: Download FFmpeg
197+
shell: bash
174198
run: |
175-
apt-get update
176-
apt-get install -y --no-install-recommends clang curl pkg-config
199+
mkdir ffmpeg-libs
200+
curl -L "https://sourceforge.net/projects/avbuild/files/linux/ffmpeg-7.1-linux-clang-lite.tar.xz/download" \
201+
| tar xJf - --strip 1 -C ffmpeg-libs
202+
203+
# https://github.com/wang-bin/avbuild/issues/76
204+
PC_FILES=(ffmpeg-libs/lib/amd64/pkgconfig/*.pc)
205+
sed -i 's/^prefix=.*$/prefix=${pcfiledir}\/..\/..\/../g' $PC_FILES
206+
sed -i 's/^libdir=.*$/libdir=${prefix}\/lib\/amd64/g' $PC_FILES
207+
208+
echo "PKG_CONFIG_PATH=$PWD/ffmpeg-libs/lib/amd64/pkgconfig" >> "$GITHUB_ENV"
209+
echo "LD_LIBRARY_PATH=$PWD/ffmpeg-libs" >> "$GITHUB_ENV"
177210
# rust-version from Cargo.toml
178211
- name: Install Rust 1.65.0
179212
uses: dtolnay/rust-toolchain@1.65.0

src/codec/config.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ where
4646
/// # Example
4747
///
4848
/// ```
49-
/// use ffmpeg_the_third::codec::{encoder, Id};
49+
/// use ffmpeg_the_third::codec::{decoder, Id};
5050
/// use ffmpeg_the_third::format::sample::{Sample, Type};
5151
///
52-
/// let codec = encoder::find(Id::MP3)
53-
/// .expect("Can find an MP3 encoder")
52+
/// let codec = decoder::find(Id::MP3)
53+
/// .expect("Can find an MP3 decoder")
5454
/// .audio()
5555
/// .unwrap();
5656
///
@@ -297,7 +297,7 @@ mod test {
297297

298298
#[test]
299299
fn audio_encoder() {
300-
let codec = encoder::find(Id::MP3).expect("can find mp3 encoder");
300+
let codec = encoder::find(Id::OPUS).expect("can find opus encoder");
301301

302302
// looks like every codec returns Supported::All for color space.
303303
// might change in a future FFmpeg release
@@ -352,15 +352,15 @@ mod test {
352352

353353
#[test]
354354
fn supports() {
355-
let codec = encoder::find(Id::VP9).expect("can find VP9 encoder");
355+
let codec = encoder::find(Id::FFV1).expect("can find FFV1 encoder");
356356

357357
assert!(supported_color_ranges(codec, None)
358358
.expect("can check color range support")
359-
.supports(Range::JPEG));
359+
.supports(Range::MPEG));
360360

361361
assert!(!supported_pixel_formats(codec, None)
362362
.expect("can check color range support")
363-
.supports(Pixel::BGR8));
363+
.supports(Pixel::GRAY16));
364364

365365
assert!(supported_frame_rates(codec, None)
366366
.expect("can check frame rate support")

0 commit comments

Comments
 (0)