diff --git a/ferretro_components/Cargo.toml b/ferretro_components/Cargo.toml index dd8bc64..36959d8 100644 --- a/ferretro_components/Cargo.toml +++ b/ferretro_components/Cargo.toml @@ -28,4 +28,4 @@ sdl2_comp = ["sdl2", "gl", "crossbeam-channel"] [[example]] name = "multifunction_emulator" -required-features = ["sdl2_comp", "ffmpeg_comp"] +required-features = ["sdl2_comp"] diff --git a/ferretro_components/examples/multifunction_emulator.rs b/ferretro_components/examples/multifunction_emulator.rs index 6d32786..5f4cd38 100644 --- a/ferretro_components/examples/multifunction_emulator.rs +++ b/ferretro_components/examples/multifunction_emulator.rs @@ -1,5 +1,6 @@ extern crate crossbeam_channel; extern crate ferretro_components; +#[cfg(feature = "ffmpeg_comp")] extern crate ffmpeg_next as ffmpeg; extern crate sdl2; @@ -7,14 +8,14 @@ use std::path::PathBuf; use sdl2::video::FullscreenType; use structopt::StructOpt; +use ferretro_components::base::ControlFlow; use ferretro_components::prelude::*; - use ferretro_components::provided::{ - ffmpeg::FfmpegComponent, sdl2::*, stdlib::*, }; -use ferretro_components::base::ControlFlow; +#[cfg(feature = "ffmpeg_comp")] +use ferretro_components::provided::ffmpeg::FfmpegComponent; #[derive(StructOpt)] struct Opt { @@ -31,8 +32,9 @@ struct Opt { #[structopt(short, long, parse(from_os_str))] system: Option, /// Recorded video to write. - #[structopt(short, long, parse(from_os_str))] - video: Option, + #[cfg(feature = "ffmpeg_comp")] + #[structopt(long, parse(from_os_str))] + record_video: Option, /// Disable OpenGL context creation. #[structopt(long)] no_opengl: bool, @@ -68,10 +70,11 @@ pub fn main() -> Result<(), Box> { // must register before opengl so it can have priority in queries about what N64 plugin to use // (only supports software-rendered 2D frames currently) - if let Some(video) = opt.video { + #[cfg(feature = "ffmpeg_comp")] + if let Some(video_path) = opt.record_video { ffmpeg::log::set_level(ffmpeg::log::Level::Info); ffmpeg::init()?; - let ffmpeg_comp = FfmpegComponent::new(emu.libretro_core(), video); + let ffmpeg_comp = FfmpegComponent::new(emu.libretro_core(), video_path); emu.register_component(ffmpeg_comp)?; }