Skip to main content

native/exmpeg_native/Cargo.toml

[package]
name = "exmpeg_native"
version = "0.1.0"
edition = "2024"
rust-version = "1.85"

[lib]
name = "exmpeg_native"
crate-type = ["cdylib"]

[dependencies]
rustler = "0.37.4"
# rsmpeg 0.18 binds against FFmpeg 8.x. The crate links against the system
# ffmpeg libraries via pkg-config; FFMPEG_PKG_CONFIG_PATH can override the
# discovery path when building against a non-default install.
#
# Pinned to a specific rsmpeg git revision because the released
# 0.18.0+ffmpeg.8.0 on crates.io fails to compile against FFmpeg 8.0.1:
# an `avio_alloc_context` const-correctness change tightened the second
# parameter of the write callback from `uint8_t *` to `const uint8_t *`;
# git has the matching cfg gate, crates.io does not.
#
# Pin to `rev` (not `branch`) so a rebase or branch deletion upstream
# cannot silently change what `cargo fetch` resolves on a fresh build.
rsmpeg = { git = "https://github.com/larksuite/rsmpeg", rev = "b21fcfde8bb1ffdc179504e370e330385baa9819", default-features = false, features = [
    "link_system_ffmpeg",
    "ffmpeg8",
] }

[features]
default = []

[lints.rust]
# `deny` rather than `forbid`: a handful of FFI helpers (reading C strings
# off `AVFormatContext` / `AVCodecParameters`, walking `AVDictionary` raw
# pointers) need explicit `unsafe`. Each such function carries a localized
# `#[allow(unsafe_code)]` so the crate-wide policy keeps everything else
# safe by default.
unsafe_code = "deny"
missing_docs = "warn"
unreachable_pub = "warn"

[lints.clippy]
pedantic = { level = "warn", priority = -1 }
module_name_repetitions = "allow"
missing_errors_doc = "allow"
missing_panics_doc = "allow"
doc_markdown = "allow"
doc_overindented_list_items = "allow"
# rsmpeg wrappers expose values as i32/u32; casting between integer widths
# is unavoidable and not actionable noise.
cast_possible_truncation = "allow"
cast_possible_wrap = "allow"
cast_sign_loss = "allow"
cast_precision_loss = "allow"
cast_lossless = "allow"

[profile.release]
opt-level = 3
lto = "thin"
codegen-units = 1