exporter: Use rayon to export files in parallel
This commit is contained in:
parent
4499a11c61
commit
42e23a48d7
|
@ -1224,6 +1224,7 @@ dependencies = [
|
|||
"image",
|
||||
"indicatif",
|
||||
"log",
|
||||
"rayon",
|
||||
"ruffle_core",
|
||||
"ruffle_render_wgpu",
|
||||
"walkdir",
|
||||
|
|
|
@ -15,6 +15,7 @@ log = "0.4"
|
|||
walkdir = "2.3.2"
|
||||
indicatif = "0.17"
|
||||
anyhow = "1.0"
|
||||
rayon = "1.5.3"
|
||||
|
||||
[features]
|
||||
avm_debug = ["ruffle_core/avm_debug"]
|
||||
|
|
|
@ -2,6 +2,7 @@ use anyhow::{anyhow, Result};
|
|||
use clap::Parser;
|
||||
use image::RgbaImage;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use rayon::prelude::*;
|
||||
use ruffle_core::tag_utils::SwfMovie;
|
||||
use ruffle_core::PlayerBuilder;
|
||||
use ruffle_render_wgpu::clap::{GraphicsBackend, PowerPreference};
|
||||
|
@ -272,7 +273,7 @@ fn capture_multiple_swfs(descriptors: Arc<Descriptors>, opt: &Opt) -> Result<()>
|
|||
None
|
||||
};
|
||||
|
||||
for file in &files {
|
||||
files.par_iter().try_for_each(|file| -> Result<()> {
|
||||
let frames = take_screenshot(
|
||||
descriptors.clone(),
|
||||
file.path(),
|
||||
|
@ -317,7 +318,9 @@ fn capture_multiple_swfs(descriptors: Arc<Descriptors>, opt: &Opt) -> Result<()>
|
|||
image.save(&destination)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
let message = if opt.frames == 1 {
|
||||
format!(
|
||||
|
|
Loading…
Reference in New Issue