edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBda2c24aTahinli3 months ago535 commits
| 1 | //! Minimal libva (VA-API) bindings and a safe layer over them. |
| 2 | //! |
| 3 | //! This is the hardware-video foundation of the `edith_codecs` family: `ec-hw` |
| 4 | //! builds stateless VA-API decoders and encoders on top of it, and nothing else |
| 5 | //! in the family talks to libva directly. |
| 6 | //! |
| 7 | //! # Shape |
| 8 | //! |
| 9 | //! * [`sys`] — the entire FFI surface, hand-written, one screenful per concern. |
| 10 | //! Every ABI assumption is stated there and checked by a `const` assertion |
| 11 | //! against numbers printed by `crates/ec-va/abi-probe.c`. |
| 12 | //! * Everything else is safe: [`Display`], [`Config`], [`Surface`], [`Context`] |
| 13 | //! and [`Buffer`] are RAII handles that destroy exactly what they created, in |
| 14 | //! the order libva requires (each child holds an `Arc` of its parent, so the |
| 15 | //! ordering is a borrow-checker fact rather than a review comment). |
| 16 | //! * [`Picture`] encodes the `begin -> render -> end -> sync` protocol as a |
| 17 | //! typestate machine, so submitting out of order does not compile. |
| 18 | //! |
| 19 | //! # Version policy |
| 20 | //! |
| 21 | //! Built against libva **1.23** headers and refuses older runtimes with |
| 22 | //! [`Error::Version`]. The alternative — assuming a struct layout and finding |
| 23 | //! out at runtime — is what broke the previous generation of VA-API bindings |
| 24 | //! when 1.23 shifted their generated definitions. |
| 25 | //! |
| 26 | //! # Example |
| 27 | //! |
| 28 | //! ```no_run |
| 29 | //! use ec_va::{CapReport, Display, Surface, SurfaceSpec}; |
| 30 | //! use ec_va::caps::{Entrypoint, Profile}; |
| 31 | //! |
| 32 | //! let display = Display::open()?; |
| 33 | //! let caps = CapReport::probe(&display)?; |
| 34 | //! assert!(caps.supports(Profile::H264Main, Entrypoint::VLD)); |
| 35 | //! |
| 36 | //! let surfaces = Surface::create_pool(&display, &SurfaceSpec::nv12(1920, 1088), 8)?; |
| 37 | //! # Ok::<(), ec_va::Error>(()) |
| 38 | //! ``` |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | pub use ; |
| 53 | pub use ; |
| 54 | pub use Display; |
| 55 | pub use ; |
| 56 | pub use |
| 57 | |
| 58 | ; |
| 59 | pub use |
| 60 | |
| 61 | ; |
| 62 | pub use Vpp; |
| 63 | |
| 64 | /// Major libva version this crate's ABI transcription targets. |
| 65 | pub const MIN_VA_MAJOR: i32 = 1; |
| 66 | /// Minimum libva minor version accepted at runtime. |
| 67 | pub const MIN_VA_MINOR: i32 = 23; |