media-converter: Add MEDIACONV_DONT_DISCARD

This commit is contained in:
Andrew Eikum 2022-01-12 15:33:06 -06:00 committed by Arkadiusz Hiler
parent 4070272852
commit bf8ee8e554
3 changed files with 19 additions and 1 deletions

View File

@ -30,6 +30,7 @@
use crate::format_hash;
use crate::HASH_SEED;
use crate::discarding_disabled;
use gst;
use gst::glib;
@ -230,6 +231,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), AUDIOCONV_FOZ_NUM_TAGS) {

View File

@ -139,6 +139,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)?;

View File

@ -33,6 +33,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::glib;
@ -155,7 +156,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") {