crosvm/media/ffmpeg
Dennis Kempin acc162000f Add conditional compilation for unix-only crates
Instead of configuring which crates to --exclude in
test_config.py, we can use conditional compilation to
exclude code that is not supported on windows.

This allows more fine-grained control and also allows
us to use plain cargo for building without complicated
configuration and exclusions.

BUG=b:265829867
TEST=cargo test --lib --bins --workspace
	--target=x86_64-pc-windows-gnu
	--features=all-mingw64

Change-Id: I8422c3f08053bc27d9896b220876a56bd25543d6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4165868
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-01-19 21:21:59 +00:00
..
src Add conditional compilation for unix-only crates 2023-01-19 21:21:59 +00:00
bindgen.sh media/ffmpeg: only show VERSIONS notice on change 2022-09-14 18:01:56 +00:00
build.rs Add conditional compilation for unix-only crates 2023-01-19 21:21:59 +00:00
Cargo.toml Fix remaining Chrome/Chromium OS instances 2023-01-03 22:14:30 +00:00
README.md Fix remaining Chrome/Chromium OS instances 2023-01-03 22:14:30 +00:00
VERSIONS media: ffmpeg: upgrade to ffmpeg 5.0 libraries 2022-08-23 01:47:48 +00:00

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 ChromeOS 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 ChromeOS, 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.