pub struct ContentReader<'a> {
pub errors: u32,
/* private fields */
}Expand description
A reader that reads m2ts content, decrypting transparently if needed.
Adaptive read strategy:
- Starts at max batch size (510 sectors ≈ 1MB) and full disc speed
- On read error: halves batch size, brief pause for drive recovery
- On repeated errors: reduces disc spin speed (scratched region)
- On success streak: ramps batch back up, then restores disc speed
- At minimum batch + still failing: retries once, then skips + zero-fills
Fields§
§errors: u32Current speed tier index (0 = max, higher = slower) Last time maintain_speed was called Total read errors encountered
Implementations§
Source§impl<'a> ContentReader<'a>
impl<'a> ContentReader<'a>
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Total bytes across all extents (for progress display).
Sourcepub fn read_unit(&mut self) -> Result<Option<Vec<u8>>>
pub fn read_unit(&mut self) -> Result<Option<Vec<u8>>>
Read the next aligned unit (6144 bytes). Automatically decrypted if AACS keys are available. Returns None when all extents are exhausted.
Sourcepub fn read_batch(&mut self) -> Result<Option<&[u8]>>
pub fn read_batch(&mut self) -> Result<Option<&[u8]>>
Read the next batch of aligned units, decrypted in-place. Returns the decrypted data as a single contiguous slice. More efficient than read_unit() – one write_all() per batch instead of per unit. Returns None when all extents are exhausted.
Auto Trait Implementations§
impl<'a> Freeze for ContentReader<'a>
impl<'a> !RefUnwindSafe for ContentReader<'a>
impl<'a> Send for ContentReader<'a>
impl<'a> !Sync for ContentReader<'a>
impl<'a> Unpin for ContentReader<'a>
impl<'a> UnsafeUnpin for ContentReader<'a>
impl<'a> !UnwindSafe for ContentReader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more