fix: fail build for older versions

This commit is contained in:
kieran 2024-11-21 11:35:50 +00:00
parent 94658cd808
commit a2c0e3374b
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
4 changed files with 39 additions and 2 deletions

34
Dockerfile Normal file
View File

@ -0,0 +1,34 @@
FROM rust:bookworm
WORKDIR /src
RUN apt update && \
apt install -y \
build-essential \
libx264-dev \
libx265-dev \
libwebp-dev \
libvpx-dev \
libopus-dev \
libdav1d-dev \
nasm \
libclang-dev && \
rm -rf /var/lib/apt/lists/*
RUN git clone --single-branch --branch release/7.1 https://git.v0l.io/ffmpeg/FFmpeg.git && \
cd FFmpeg && \
./configure \
--prefix=${FFMPEG_DIR} \
--disable-programs \
--disable-doc \
--disable-network \
--enable-gpl \
--enable-libx264 \
--enable-libx265 \
--enable-libwebp \
--enable-libvpx \
--enable-libopus \
--enable-libdav1d \
--disable-static \
--disable-postproc \
--enable-shared && \
make -j$(nproc) install
COPY . .
RUN cargo build --release

View File

@ -6,7 +6,6 @@ fn main() {
for (name, _value) in env::vars() { for (name, _value) in env::vars() {
if name.starts_with("DEP_FFMPEG_") && !name.starts_with("DEP_FFMPEG_CHECK_") { if name.starts_with("DEP_FFMPEG_") && !name.starts_with("DEP_FFMPEG_CHECK_") {
let feature_name = name["DEP_FFMPEG_".len()..name.len()].to_lowercase(); let feature_name = name["DEP_FFMPEG_".len()..name.len()].to_lowercase();
println!(r#"cargo::rustc-check-cfg=cfg(feature, values("{feature_name}"))"#);
println!(r#"cargo::rustc-cfg=feature="{feature_name}""#); println!(r#"cargo::rustc-cfg=feature="{feature_name}""#);
} }
} }

View File

@ -265,7 +265,6 @@ impl Encoder {
mod tests { mod tests {
use super::*; use super::*;
use crate::generate_test_frame; use crate::generate_test_frame;
use ffmpeg_sys_the_third::AVPixelFormat::AV_PIX_FMT_YUV420P;
#[test] #[test]
fn test_encode_png() -> Result<(), Error> { fn test_encode_png() -> Result<(), Error> {

View File

@ -18,6 +18,11 @@ mod scale;
mod stream_info; mod stream_info;
mod transcode; mod transcode;
#[cfg(not(feature = "avcodec_version_greater_than_59_24"))]
compile_error!("avcodec version too old, < 59.24");
#[cfg(not(feature = "avutil_version_greater_than_57_24"))]
compile_error!("avutil version too old, <57.24");
#[macro_export] #[macro_export]
macro_rules! bail_ffmpeg { macro_rules! bail_ffmpeg {
($x:expr) => { ($x:expr) => {