mirror of
https://github.com/ValveSoftware/Proton.git
synced 2024-12-25 14:15:45 +03:00
media-converter: Create a tag file when placeholder media are used.
CW-Bug-Id: #21473
This commit is contained in:
parent
eca48bb93f
commit
6d138f5e96
79
media-converter/Cargo.lock
generated
79
media-converter/Cargo.lock
generated
@ -89,6 +89,18 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.24"
|
||||
@ -525,6 +537,7 @@ version = "7.0.0"
|
||||
dependencies = [
|
||||
"array-init",
|
||||
"crc32fast",
|
||||
"filetime",
|
||||
"glib",
|
||||
"gst-plugin-version-helper",
|
||||
"gstreamer",
|
||||
@ -543,6 +556,15 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.145"
|
||||
@ -710,3 +732,60 @@ name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
|
||||
|
@ -20,6 +20,7 @@ gstreamer-audio = "0.19.0"
|
||||
once_cell = "1.9"
|
||||
crc32fast = "1.3"
|
||||
array-init = "2.0"
|
||||
filetime = "0.2"
|
||||
|
||||
[lib]
|
||||
name = "protonmediaconverter"
|
||||
|
@ -31,6 +31,8 @@
|
||||
use crate::format_hash;
|
||||
use crate::HASH_SEED;
|
||||
use crate::discarding_disabled;
|
||||
use crate::steam_compat_shader_path;
|
||||
use crate::touch_file;
|
||||
|
||||
use gst::glib;
|
||||
use gst::prelude::*;
|
||||
@ -633,6 +635,14 @@ impl AudioConvState {
|
||||
|
||||
let buf = Box::new(*include_bytes!("../../blank.ptna"));
|
||||
|
||||
match steam_compat_shader_path() {
|
||||
None => gst::log!(CAT, "env STEAM_COMPAT_SHADER_PATH not set"),
|
||||
Some(mut path) => {
|
||||
path.push("placeholder-audio-used");
|
||||
if let Err(e) = touch_file(path) { gst::log!(CAT, "Failed to touch placeholder-audio-used file: {:?}", e) }
|
||||
},
|
||||
};
|
||||
|
||||
Ok(buf)
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,14 @@ extern crate gstreamer_video as gst_video;
|
||||
extern crate gstreamer_audio as gst_audio;
|
||||
extern crate once_cell;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use filetime::FileTime;
|
||||
use filetime::set_file_handle_times;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
mod murmur3_x86_128;
|
||||
@ -76,6 +82,24 @@ where
|
||||
a
|
||||
}
|
||||
|
||||
fn touch_file<P>(p: P) -> io::Result<()>
|
||||
where
|
||||
P: AsRef<Path> + std::fmt::Debug
|
||||
{
|
||||
let f = File::create(p)?;
|
||||
let now = FileTime::now();
|
||||
set_file_handle_times(&f, Some(now), Some(now))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn steam_compat_shader_path() -> Option<PathBuf>
|
||||
{
|
||||
match std::env::var("STEAM_COMPAT_SHADER_PATH") {
|
||||
Err(_) => None,
|
||||
Ok(c) => Some(Path::new(&c).to_path_buf()),
|
||||
}
|
||||
}
|
||||
|
||||
/* rust has a hard time with large heap allocations. below macro works around that.
|
||||
*
|
||||
* by @simias from https://github.com/rust-lang/rust/issues/53827 */
|
||||
|
@ -34,6 +34,8 @@ use crate::box_array;
|
||||
use crate::copy_into_array;
|
||||
use crate::BufferedReader;
|
||||
use crate::discarding_disabled;
|
||||
use crate::steam_compat_shader_path;
|
||||
use crate::touch_file;
|
||||
|
||||
use gst::glib;
|
||||
use gst::prelude::*;
|
||||
@ -346,6 +348,14 @@ impl VideoConvState {
|
||||
self.transcode_hash = None;
|
||||
self.our_duration = Some(include_bytes!("../../blank.mkv").len() as u64);
|
||||
|
||||
match steam_compat_shader_path() {
|
||||
None => gst::log!(CAT, "env STEAM_COMPAT_SHADER_PATH not set"),
|
||||
Some(mut path) => {
|
||||
path.push("placeholder-video-used");
|
||||
if let Err(e) = touch_file(path) { gst::log!(CAT, "Failed to touch placeholder-video-used file: {:?}", e) }
|
||||
},
|
||||
};
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user