tests: Make H.264 videos work in visual tests

This commit is contained in:
TÖRÖK Attila 2024-02-22 23:30:02 +01:00 committed by Nathan Adams
parent 76da9621c9
commit b7a100337e
4 changed files with 26 additions and 5 deletions

1
Cargo.lock generated
View File

@ -4553,6 +4553,7 @@ dependencies = [
"ruffle_input_format", "ruffle_input_format",
"ruffle_render", "ruffle_render",
"ruffle_socket_format", "ruffle_socket_format",
"ruffle_video_external",
"ruffle_video_software", "ruffle_video_software",
"serde", "serde",
"toml", "toml",

View File

@ -14,7 +14,11 @@ workspace = true
# Enable running image comparison tests. This is off by default, # Enable running image comparison tests. This is off by default,
# since the images we compare against are generated on CI, and may # since the images we compare against are generated on CI, and may
# not match your local machine's Vulkan version / image output. # not match your local machine's Vulkan version / image output.
imgtests = ["ruffle_test_framework/ruffle_video_software", "ruffle_render_wgpu"] imgtests = [
"ruffle_render_wgpu",
"ruffle_test_framework/ruffle_video_software",
"ruffle_test_framework/ruffle_video_external",
]
jpegxr = ["ruffle_test_framework/jpegxr"] jpegxr = ["ruffle_test_framework/jpegxr"]
lzma = ["ruffle_test_framework/lzma"] lzma = ["ruffle_test_framework/lzma"]

View File

@ -16,6 +16,7 @@ ruffle_render = { path = "../../render" }
ruffle_input_format = { path = "../input-format" } ruffle_input_format = { path = "../input-format" }
ruffle_socket_format = { path = "../socket-format" } ruffle_socket_format = { path = "../socket-format" }
ruffle_video_software = { path = "../../video/software", optional = true } ruffle_video_software = { path = "../../video/software", optional = true }
ruffle_video_external = { path = "../../video/external", optional = true }
image = { workspace = true, features = ["png"] } image = { workspace = true, features = ["png"] }
regex = "1.10.4" regex = "1.10.4"
url = { workspace = true } url = { workspace = true }
@ -31,4 +32,4 @@ percent-encoding = "2.3.1"
[features] [features]
jpegxr = ["ruffle_core/jpegxr"] jpegxr = ["ruffle_core/jpegxr"]
lzma = ["ruffle_core/lzma"] lzma = ["ruffle_core/lzma"]

View File

@ -174,10 +174,25 @@ impl PlayerOptions {
player_builder = player_builder.with_player_runtime(self.runtime); player_builder = player_builder.with_player_runtime(self.runtime);
#[cfg(feature = "ruffle_video_software")]
if self.with_video { if self.with_video {
use ruffle_video_software::backend::SoftwareVideoBackend; #[cfg(feature = "ruffle_video_external")]
player_builder = player_builder.with_video(SoftwareVideoBackend::new()) {
use ruffle_video_external::backend::ExternalVideoBackend;
let openh264_path = ExternalVideoBackend::get_openh264()
.map_err(|e| anyhow!("Couldn't get OpenH264: {}", e))?;
player_builder =
player_builder.with_video(ExternalVideoBackend::new(Some(openh264_path)));
}
#[cfg(all(
not(feature = "ruffle_video_external"),
feature = "ruffle_video_software"
))]
{
player_builder = player_builder
.with_video(ruffle_video_software::backend::SoftwareVideoBackend::new());
}
} }
Ok(player_builder) Ok(player_builder)