mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-13 22:22:31 +00:00
Update ogg_pager
This commit is contained in:
parent
1068d707b2
commit
f697e94fe6
4 changed files with 11 additions and 11 deletions
|
@ -17,7 +17,7 @@ flate2 = { version = "1.0.22", optional = true }
|
||||||
# Vorbis comments pictures
|
# Vorbis comments pictures
|
||||||
base64 = { version = "0.13.0", optional = true }
|
base64 = { version = "0.13.0", optional = true }
|
||||||
# OGG Vorbis/Opus
|
# OGG Vorbis/Opus
|
||||||
ogg_pager = "0.2.0"
|
ogg_pager = "0.3.0"
|
||||||
# Key maps
|
# Key maps
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
paste = "1.0.6"
|
paste = "1.0.6"
|
||||||
|
|
|
@ -32,9 +32,9 @@ pub(crate) fn write_to(
|
||||||
|
|
||||||
for mut p in pages.iter_mut() {
|
for mut p in pages.iter_mut() {
|
||||||
p.serial = ser;
|
p.serial = ser;
|
||||||
p.gen_crc();
|
p.gen_crc()?;
|
||||||
|
|
||||||
writer.write_all(&*p.as_bytes())?;
|
writer.write_all(&*p.as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.write_all(&*remaining)?;
|
writer.write_all(&*remaining)?;
|
||||||
|
|
|
@ -82,7 +82,7 @@ pub(crate) fn write_to(
|
||||||
|
|
||||||
if i == pages_len {
|
if i == pages_len {
|
||||||
// Add back the framing bit
|
// Add back the framing bit
|
||||||
p.extend(&[1]);
|
p.extend(&[1])?;
|
||||||
|
|
||||||
// The segment tables of current page and the setup header have to be combined
|
// The segment tables of current page and the setup header have to be combined
|
||||||
let mut seg_table = Vec::new();
|
let mut seg_table = Vec::new();
|
||||||
|
@ -98,9 +98,9 @@ pub(crate) fn write_to(
|
||||||
|
|
||||||
seg_table.insert(0, seg_table_len as u8);
|
seg_table.insert(0, seg_table_len as u8);
|
||||||
|
|
||||||
let page = p.extend(&*setup);
|
let page = p.extend(&*setup)?;
|
||||||
|
|
||||||
let mut p_bytes = p.as_bytes();
|
let mut p_bytes = p.as_bytes()?;
|
||||||
let seg_count = p_bytes[26] as usize;
|
let seg_count = p_bytes[26] as usize;
|
||||||
|
|
||||||
// Replace segment table and checksum
|
// Replace segment table and checksum
|
||||||
|
@ -111,16 +111,16 @@ pub(crate) fn write_to(
|
||||||
|
|
||||||
if let Some(mut page) = page {
|
if let Some(mut page) = page {
|
||||||
page.serial = ser;
|
page.serial = ser;
|
||||||
page.gen_crc();
|
page.gen_crc()?;
|
||||||
|
|
||||||
writer.write_all(&*page.as_bytes())?;
|
writer.write_all(&*page.as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.gen_crc();
|
p.gen_crc()?;
|
||||||
writer.write_all(&*p.as_bytes())?;
|
writer.write_all(&*p.as_bytes()?)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.write_all(&*remaining)?;
|
writer.write_all(&*remaining)?;
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub(super) fn write(data: &mut File, tag: &mut VorbisCommentsRef, sig: &[u8]) ->
|
||||||
let ser = first_page.serial;
|
let ser = first_page.serial;
|
||||||
|
|
||||||
let mut writer = Vec::new();
|
let mut writer = Vec::new();
|
||||||
writer.write_all(&*first_page.as_bytes())?;
|
writer.write_all(&*first_page.as_bytes()?)?;
|
||||||
|
|
||||||
let first_md_page = Page::read(data, false)?;
|
let first_md_page = Page::read(data, false)?;
|
||||||
verify_signature(&first_md_page, sig)?;
|
verify_signature(&first_md_page, sig)?;
|
||||||
|
|
Loading…
Reference in a new issue