aboutsummaryrefslogtreecommitdiff
path: root/remuxer/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'remuxer/src/lib.rs')
-rw-r--r--remuxer/src/lib.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/remuxer/src/lib.rs b/remuxer/src/lib.rs
index be1ecc0..2c2e6d0 100644
--- a/remuxer/src/lib.rs
+++ b/remuxer/src/lib.rs
@@ -3,15 +3,14 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
-pub mod format;
pub mod import;
-use anyhow::{anyhow, Result};
-use jellycommon::{ItemInfo, SourceTrack, SourceTrackKind};
+use anyhow::{anyhow, Context, Result};
+use jellycommon::{ItemInfo, SeekIndex, SourceTrack, SourceTrackKind};
use jellymatroska::{
block::Block,
read::EbmlReader,
- unflatten::{Unflat, Unflatten},
+ unflatten::{IterWithPos, Unflat, Unflatten},
write::EbmlWriter,
Master, MatroskaTag,
};
@@ -42,6 +41,7 @@ impl RemuxerContext {
info: SourceTrack,
reader: EbmlReader,
mapped: u64,
+ index: SeekIndex,
}
let mut inputs = selection
@@ -60,9 +60,16 @@ impl RemuxerContext {
info.track_number
);
info!("\t {}", info);
- let file = File::open(source_path)?;
+ let file = File::open(&source_path).context("opening source file")?;
+ let mut index = File::open(source_path.with_extension(&format!("si.{}", info.track_number)))
+ .context("opening seek index file")?;
+ let index = bincode::decode_from_std_read::<SeekIndex, _, _>(
+ &mut index,
+ bincode::config::standard(),
+ )?;
let reader = EbmlReader::new(file);
Ok(ReaderC {
+ index,
reader,
info,
mapped,