Support Auto LBAs for steaming files
This commit is contained in:
parent
7c39fbad37
commit
1699d45ae4
|
@ -273,6 +273,13 @@ impl File {
|
||||||
Self::new_from_content(file_name, FileType::XAAudio(content), highest_size*channel_count)
|
Self::new_from_content(file_name, FileType::XAAudio(content), highest_size*channel_count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_streaming_file(&self) -> bool {
|
||||||
|
match &self.content {
|
||||||
|
FileType::XAAudio(_) => true,
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_track_rel_lba(&self) -> usize {
|
pub fn get_track_rel_lba(&self) -> usize {
|
||||||
self.properties.lba.get_track_relative()
|
self.properties.lba.get_track_relative()
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,16 @@ fn for_each_lba_name<F: FnMut(usize, (usize, usize), bool) -> Result<(), Error>>
|
||||||
for lba_name in lba_names {
|
for lba_name in lba_names {
|
||||||
if let Some(file) = file_map.get(lba_name) {
|
if let Some(file) = file_map.get(lba_name) {
|
||||||
let file_ref = format_if_error_drop_cause!(file.try_borrow(), "Failed accessing file \"{}\" for writing LBA information.\nNote: You can not inject the LBA information of a file into itself.", lba_name)?;
|
let file_ref = format_if_error_drop_cause!(file.try_borrow(), "Failed accessing file \"{}\" for writing LBA information.\nNote: You can not inject the LBA information of a file into itself.", lba_name)?;
|
||||||
let (lba, bytes) = (file_ref.get_absolute_lba(), length_func(&Layout::File(file.clone())).bytes);
|
let (lba, bytes) = (file_ref.get_absolute_lba(), {
|
||||||
|
if file_ref.is_streaming_file() {
|
||||||
|
// Streaming files do not have a size restriction
|
||||||
|
Some(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
length_func(&Layout::File(file.clone())).bytes
|
||||||
|
}
|
||||||
|
});
|
||||||
let is_lz4 = file_ref.properties.is_lz4;
|
let is_lz4 = file_ref.properties.is_lz4;
|
||||||
|
|
||||||
functor(idx, (lba, bytes.ok_or(Error::from_text(format!("{} does not contain a size!", lba_name)))?), is_lz4)?;
|
functor(idx, (lba, bytes.ok_or(Error::from_text(format!("{} does not contain a size!", lba_name)))?), is_lz4)?;
|
||||||
|
|
Loading…
Reference in New Issue