40ba620f0a
Similar to the decoder builder, add an encoder context builder. The encoder requires a few more parameters to be set before calling avcodec2_open, and the respective setters are provided here. As for checking for the required fields, it looks like FFmpeg will check it and error on avcodec2_open if any are missing anyway, so we'll avoid duplicating that on the binding side. BUG=b:239897269 TEST=cargo build --features ffmpeg -p ffmpeg Change-Id: I448b56ba9bae9b38ce5c2fb540e9577a2dfcd83c Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3856043 Reviewed-by: Alexandre Courbot <acourbot@chromium.org> |
||
---|---|---|
.. | ||
src | ||
bindgen.sh | ||
build.rs | ||
Cargo.toml | ||
README.md | ||
VERSIONS |
FFmpeg wrapper
This is a minimal FFmpeg 5.0 wrapper for use with the virtio-video device, allowing to run a virtual video device backed by software decoding or encoding. This is useful for development and testing in situations where no supported video acceleration is available on the host.
Although several FFmpeg binding crates exist, most of them are not able to link against the system FFmpeg, and the only one that does is released under a software license that makes our lawyers nervous. Also they all run bindgen at build time, which is not possible to do under the Chrome OS build system and would require to patch the crate with fully generated bindings.
So taking this in consideration, as well as the extra work that it is to depend on external Rust crates in Chrome OS, it is preferable to add our own simple bindings here that cover just the parts of FFmpeg that we need.
This crate has minimal dependencies ; on the FFmpeg side, it just uses libavcodec
, libavutil
and
libswscale
.
The bindings can be updated using the bindgen.sh
script. A few elements that bindgen cannot
generate because they are behind C macros are re-defined in avutil.rs
and error.rs
, as well as
tests to ensure their correctness.
And that's about it.