Skip to main content

ContentReader

Struct ContentReader 

Source
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: u32

Current speed tier index (0 = max, higher = slower) Last time maintain_speed was called Total read errors encountered

Implementations§

Source§

impl<'a> ContentReader<'a>

Source

pub fn total_bytes(&self) -> u64

Total bytes across all extents (for progress display).

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V