ff_sys/lib.rs
1//! # ff-sys
2//!
3//! Low-level FFmpeg FFI bindings for Rust.
4//!
5//! This crate provides raw FFI bindings to FFmpeg libraries, generated by
6//! [bindgen](https://github.com/rust-lang/rust-bindgen). It is intended as a
7//! building block for higher-level safe wrappers.
8//!
9//! ## Safety
10//!
11//! All functions in this crate are unsafe. Higher-level safe wrappers are provided
12//! by other ff-* crates:
13//! - `ff-probe` - Media metadata extraction
14//! - `ff-decode` - Decoding and seeking
15//! - `ff-encode` - Encoding and export
16//! - `ff-filter` - Filters and effects
17
18// Suppress warnings from auto-generated bindgen code
19#![allow(warnings)]
20#![allow(non_upper_case_globals)]
21#![allow(non_camel_case_types)]
22#![allow(non_snake_case)]
23#![allow(dead_code)]
24#![allow(clippy::all)]
25#![allow(clippy::pedantic)]
26#![allow(clippy::useless_transmute)]
27#![allow(clippy::unnecessary_cast)]
28#![allow(clippy::transmute_int_to_bool)]
29
30// On docs.rs (DOCS_RS=1) the build script emits an empty bindings.rs and sets
31// cfg(docsrs). We include the hand-written stubs instead so that all dependent
32// crates compile without any changes of their own.
33#[cfg(not(docsrs))]
34include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
35
36#[cfg(docsrs)]
37include!("docsrs_stubs.rs");
38
39// ── Wrapper modules (real bindings only) ─────────────────────────────────────
40#[cfg(not(docsrs))]
41pub mod avcodec;
42#[cfg(not(docsrs))]
43pub mod avformat;
44#[cfg(not(docsrs))]
45pub mod swresample;
46#[cfg(not(docsrs))]
47pub mod swscale;
48
49// ── Sub-modules ───────────────────────────────────────────────────────────────
50mod constants;
51pub mod error_codes;
52mod utils;
53
54// ── Re-exports ────────────────────────────────────────────────────────────────
55pub use constants::{AV_NOPTS_VALUE, AVFMT_TS_DISCONT, BUFFERSRC_FLAG_KEEP_REF};
56pub use utils::{av_error_string, ensure_initialized};
57// check_av_error! is re-exported at the crate root automatically via #[macro_export]