ffmpeg not mandatory
This commit is contained in:
parent
2dd8556fe2
commit
82217ff117
|
@ -28,4 +28,4 @@ sdl2_comp = ["sdl2", "gl", "crossbeam-channel"]
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "multifunction_emulator"
|
name = "multifunction_emulator"
|
||||||
required-features = ["sdl2_comp", "ffmpeg_comp"]
|
required-features = ["sdl2_comp"]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
extern crate crossbeam_channel;
|
extern crate crossbeam_channel;
|
||||||
extern crate ferretro_components;
|
extern crate ferretro_components;
|
||||||
|
#[cfg(feature = "ffmpeg_comp")]
|
||||||
extern crate ffmpeg_next as ffmpeg;
|
extern crate ffmpeg_next as ffmpeg;
|
||||||
extern crate sdl2;
|
extern crate sdl2;
|
||||||
|
|
||||||
|
@ -7,14 +8,14 @@ use std::path::PathBuf;
|
||||||
use sdl2::video::FullscreenType;
|
use sdl2::video::FullscreenType;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
|
use ferretro_components::base::ControlFlow;
|
||||||
use ferretro_components::prelude::*;
|
use ferretro_components::prelude::*;
|
||||||
|
|
||||||
use ferretro_components::provided::{
|
use ferretro_components::provided::{
|
||||||
ffmpeg::FfmpegComponent,
|
|
||||||
sdl2::*,
|
sdl2::*,
|
||||||
stdlib::*,
|
stdlib::*,
|
||||||
};
|
};
|
||||||
use ferretro_components::base::ControlFlow;
|
#[cfg(feature = "ffmpeg_comp")]
|
||||||
|
use ferretro_components::provided::ffmpeg::FfmpegComponent;
|
||||||
|
|
||||||
#[derive(StructOpt)]
|
#[derive(StructOpt)]
|
||||||
struct Opt {
|
struct Opt {
|
||||||
|
@ -31,8 +32,9 @@ struct Opt {
|
||||||
#[structopt(short, long, parse(from_os_str))]
|
#[structopt(short, long, parse(from_os_str))]
|
||||||
system: Option<PathBuf>,
|
system: Option<PathBuf>,
|
||||||
/// Recorded video to write.
|
/// Recorded video to write.
|
||||||
#[structopt(short, long, parse(from_os_str))]
|
#[cfg(feature = "ffmpeg_comp")]
|
||||||
video: Option<PathBuf>,
|
#[structopt(long, parse(from_os_str))]
|
||||||
|
record_video: Option<PathBuf>,
|
||||||
/// Disable OpenGL context creation.
|
/// Disable OpenGL context creation.
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
no_opengl: bool,
|
no_opengl: bool,
|
||||||
|
@ -68,10 +70,11 @@ pub fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
|
||||||
// must register before opengl so it can have priority in queries about what N64 plugin to use
|
// must register before opengl so it can have priority in queries about what N64 plugin to use
|
||||||
// (only supports software-rendered 2D frames currently)
|
// (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::log::set_level(ffmpeg::log::Level::Info);
|
||||||
ffmpeg::init()?;
|
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)?;
|
emu.register_component(ffmpeg_comp)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue