crosvm/media/ffmpeg
Tatsuyuki Ishi 55d8d9b4eb media: ffmpeg: Add helpers for determining line and plane sizes.
These are wrappers of av_image_get_linesize and
av_image_fill_plane_sizes, and will be used for bounds checking and
mmap bounds calculation purposes.

It's kind of weird that one is singular and the other is plural, but
we should probably blame FFmpeg for not having a singular version of
av_image_fill_plane_sizes.

BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices

Change-Id: I34104f5062089377aeab0d4a4ab0534837e56d6f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868595
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-20 04:27:00 +00:00
..
src media: ffmpeg: Add helpers for determining line and plane sizes. 2022-09-20 04:27:00 +00:00
bindgen.sh media/ffmpeg: only show VERSIONS notice on change 2022-09-14 18:01:56 +00:00
build.rs health-check: enforce blank line after copyright 2022-09-13 22:24:35 +00:00
Cargo.toml virtio: video: decoder: add ffmpeg-based software decoder backend 2022-06-07 11:44:21 +00:00
README.md media: ffmpeg: upgrade to ffmpeg 5.0 libraries 2022-08-23 01:47:48 +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 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.