diff --git a/src/crosvm/cmdline.rs b/src/crosvm/cmdline.rs index e019f0d0a8..7eedee5bde 100644 --- a/src/crosvm/cmdline.rs +++ b/src/crosvm/cmdline.rs @@ -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, #[cfg(feature = "video-encoder")] #[argh( diff --git a/src/crosvm/config.rs b/src/crosvm/config.rs index 65183227c7..36db4e3c9c 100644 --- a/src/crosvm/config.rs +++ b/src/crosvm/config.rs @@ -703,6 +703,8 @@ pub fn parse_video_options(s: &str) -> Result { 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 { 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 { "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("|")),