Fix batch overflow in Disc::copy(), DVD PGC parsing, demuxer flush at EOF
- Disc::copy() hardcoded batch=64 sectors, exceeding BU40N's 60-sector hw limit. Now accepts batch_sectors param, defaults to 60. - IFO PGC: playback time at offset 0x04 not 0x02, cell time at cell+4 - DiscStream: set demuxer from content_format (TS for BD, PS for DVD) - Flush TS/PS demuxers at EOF to avoid losing last PES frame - M2tsStream: flush demuxer at EOF - StdioStream: FMKV metadata header for roundtrip compatibility
This commit is contained in:
+3
-1
@@ -1113,6 +1113,7 @@ impl Disc {
|
||||
path: &std::path::Path,
|
||||
decrypt: bool,
|
||||
resume: bool,
|
||||
batch_sectors: Option<u16>,
|
||||
on_progress: Option<&dyn Fn(u64, u64)>,
|
||||
) -> Result<()> {
|
||||
use std::io::{Seek, SeekFrom, Write};
|
||||
@@ -1149,7 +1150,7 @@ impl Disc {
|
||||
};
|
||||
|
||||
let mut writer = std::io::BufWriter::with_capacity(4 * 1024 * 1024, file);
|
||||
let batch: u16 = 64; // 128 KB per read
|
||||
let batch: u16 = batch_sectors.unwrap_or(DEFAULT_BATCH_SECTORS);
|
||||
let mut lba = start_lba;
|
||||
let mut bytes_done = start_lba as u64 * 2048;
|
||||
let mut buf = vec![0u8; batch as usize * 2048];
|
||||
@@ -1159,6 +1160,7 @@ impl Disc {
|
||||
let count = remaining.min(batch as u32) as u16;
|
||||
let bytes = count as usize * 2048;
|
||||
|
||||
|
||||
reader
|
||||
.read_sectors(lba, count, &mut buf[..bytes])
|
||||
.map_err(|e| Error::IoError {
|
||||
|
||||
Reference in New Issue
Block a user