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_render",
"ruffle_socket_format",
"ruffle_video_external",
"ruffle_video_software",
"serde",
"toml",

View File

@ -14,7 +14,11 @@ workspace = true
# Enable running image comparison tests. This is off by default,
# since the images we compare against are generated on CI, and may
# 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"]
lzma = ["ruffle_test_framework/lzma"]

View File

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

View File

@ -174,10 +174,25 @@ impl PlayerOptions {
player_builder = player_builder.with_player_runtime(self.runtime);
#[cfg(feature = "ruffle_video_software")]
if self.with_video {
use ruffle_video_software::backend::SoftwareVideoBackend;
player_builder = player_builder.with_video(SoftwareVideoBackend::new())
#[cfg(feature = "ruffle_video_external")]
{
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)