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 9bd80565b3
commit 43068facc4
3 changed files with 19 additions and 1 deletions

View File

@ -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) {

View File

@ -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)?;

View File

@ -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") {