mirror of
https://github.com/ValveSoftware/Proton.git
synced 2024-12-27 07:05:46 +03:00
media-converter: Add MEDIACONV_DONT_DISCARD
This commit is contained in:
parent
9bd80565b3
commit
43068facc4
@ -34,6 +34,7 @@ use glib::subclass::prelude::*;
|
||||
|
||||
use crate::format_hash;
|
||||
use crate::HASH_SEED;
|
||||
use crate::discarding_disabled;
|
||||
|
||||
use gst;
|
||||
use gst::prelude::*;
|
||||
@ -233,6 +234,10 @@ impl AudioConverterDumpFozdb {
|
||||
if self.already_cleaned {
|
||||
return;
|
||||
}
|
||||
if discarding_disabled() {
|
||||
self.already_cleaned = true;
|
||||
return;
|
||||
}
|
||||
if let Some(fozdb) = &mut self.open(false).fozdb {
|
||||
if let Ok(read_fozdb_path) = std::env::var("MEDIACONV_AUDIO_TRANSCODED_FILE") {
|
||||
if let Ok(read_fozdb) = fossilize::StreamArchive::new(&read_fozdb_path, OpenOptions::new().read(true), true /* read-only? */, AUDIOCONV_FOZ_NUM_TAGS) {
|
||||
|
@ -141,6 +141,14 @@ impl<'a> Read for BufferedReader<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn discarding_disabled() -> bool {
|
||||
let v = match std::env::var("MEDIACONV_DONT_DISCARD") {
|
||||
Err(_) => { return false; },
|
||||
Ok(c) => c,
|
||||
};
|
||||
return v != "0";
|
||||
}
|
||||
|
||||
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
videoconv::register(plugin)?;
|
||||
audioconvbin::register(plugin)?;
|
||||
|
@ -37,6 +37,7 @@ use crate::HASH_SEED;
|
||||
use crate::box_array;
|
||||
use crate::copy_into_array;
|
||||
use crate::BufferedReader;
|
||||
use crate::discarding_disabled;
|
||||
|
||||
use gst;
|
||||
use gst::prelude::*;
|
||||
@ -157,7 +158,11 @@ impl VideoConverterDumpFozdb {
|
||||
|
||||
fn discard_transcoded(&mut self) {
|
||||
if self.already_cleaned {
|
||||
return
|
||||
return;
|
||||
}
|
||||
if discarding_disabled() {
|
||||
self.already_cleaned = true;
|
||||
return;
|
||||
}
|
||||
if let Some(fozdb) = &mut self.open(false).fozdb {
|
||||
if let Ok(read_fozdb_path) = std::env::var("MEDIACONV_VIDEO_TRANSCODED_FILE") {
|
||||
|
Loading…
Reference in New Issue
Block a user