crosvm: config: re-enable ffmpeg feature

The ffmpeg feature flag handling code has been inadvertedly removed by
http://crrev.com/c/3684144. Restore it.

BUG=b:169295147
BUG=b:179756087
TEST=`cargo build --features "video-decoder,ffmpeg"` and decode a video
     from a guest.

Change-Id: Id0d0f8c380353648e53602c6fa56ae9a0115cb8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3706480
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
Alexandre Courbot 2022-06-15 15:06:24 +09:00 committed by Chromeos LUCI
parent eb83ee79b6
commit 9b8ef9d65b
2 changed files with 11 additions and 1 deletions

View file

@ -1049,7 +1049,7 @@ pub struct RunCommand {
from_str_fn(parse_video_options)
)]
/// (EXPERIMENTAL) enable virtio-video decoder device
// Possible backend values: libvda
// Possible backend values: libvda, ffmpeg
pub video_dec: Option<VideoBackendType>,
#[cfg(feature = "video-encoder")]
#[argh(

View file

@ -703,6 +703,8 @@ pub fn parse_video_options(s: &str) -> Result<VideoBackendType, String> {
const VALID_VIDEO_BACKENDS: &[&str] = &[
#[cfg(feature = "libvda")]
"libvda",
#[cfg(feature = "ffmpeg")]
"ffmpeg",
];
match s {
@ -710,6 +712,12 @@ pub fn parse_video_options(s: &str) -> Result<VideoBackendType, String> {
cfg_if::cfg_if! {
if #[cfg(feature = "libvda")] {
Ok(VideoBackendType::Libvda)
} else if #[cfg(feature = "ffmpeg")] {
Ok(VideoBackendType::Ffmpeg)
} else {
// Cannot be reached because at least one video backend needs to be enabled for
// the decoder to be compiled.
unreachable!()
}
}
}
@ -717,6 +725,8 @@ pub fn parse_video_options(s: &str) -> Result<VideoBackendType, String> {
"libvda" => Ok(VideoBackendType::Libvda),
#[cfg(feature = "libvda")]
"libvda-vd" => Ok(VideoBackendType::LibvdaVd),
#[cfg(feature = "ffmpeg")]
"ffmpeg" => Ok(VideoBackendType::Ffmpeg),
_ => Err(invalid_value_err(
s,
format!("should be one of ({})", VALID_VIDEO_BACKENDS.join("|")),