libdav1d_sys/
lib.rs

1//! These are raw FFI bindings for [libdav1d](https://code.videolan.org/videolan/dav1d), a fast software AV1 decoder.
2//! Refer to libdav1d's documentation for details.
3
4// build with --feature=generate, then copy target/.../bindings.rs to ffi.rs
5
6#![allow(bad_style)]
7#![allow(rustdoc::broken_intra_doc_links)]
8#![allow(clippy::all)]
9
10type __builtin_va_list = *mut std::ffi::c_void;
11type __va_list_tag = *mut std::ffi::c_void;
12
13#[cfg(feature = "generate")]
14include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
15
16#[cfg(not(feature = "generate"))]
17include!("../ffi.rs");
18
19#[allow(bad_style)]
20pub const fn DAV1D_ERR(errno: ::std::os::raw::c_int) -> ::std::os::raw::c_int {
21    (if libc::EPERM > 0 { -errno } else { errno }) as _
22}
23
24pub const DAV1D_ERR_AGAIN: ::std::os::raw::c_int = DAV1D_ERR(libc::EAGAIN);
25pub const DAV1D_ERR_INVAL: ::std::os::raw::c_int = DAV1D_ERR(libc::EINVAL);
26pub const DAV1D_ERR_NOMEM: ::std::os::raw::c_int = DAV1D_ERR(libc::ENOMEM);
27pub const DAV1D_ERR_NOPROTOOPT: ::std::os::raw::c_int = DAV1D_ERR(libc::ENOPROTOOPT);
28
29#[test]
30fn poke() {
31    unsafe {
32        let ver = std::ffi::CStr::from_ptr(dav1d_version()).to_str().unwrap();
33        assert!(!ver.is_empty());
34    }
35}