diff --git a/media-converter/src/audioconv.rs b/media-converter/src/audioconv.rs index 708bdd02..1129e1c5 100644 --- a/media-converter/src/audioconv.rs +++ b/media-converter/src/audioconv.rs @@ -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) { diff --git a/media-converter/src/lib.rs b/media-converter/src/lib.rs index e06eb587..ba0c95dd 100644 --- a/media-converter/src/lib.rs +++ b/media-converter/src/lib.rs @@ -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)?; diff --git a/media-converter/src/videoconv.rs b/media-converter/src/videoconv.rs index 88974975..5576830d 100644 --- a/media-converter/src/videoconv.rs +++ b/media-converter/src/videoconv.rs @@ -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") {