Skip to main content

DiscStream

Struct DiscStream 

Source
pub struct DiscStream {
    pub errors: u64,
    pub skip_errors: bool,
    /* private fields */
}
Expand description

Disc stream. Reads sectors from any source → PES frames.

Sources: physical drive, ISO file, or any SectorSource. Decrypt, demux, and codec parsing happen internally.

Fields§

§errors: u64§skip_errors: bool

Implementations§

Source§

impl DiscStream

Source

pub fn new( reader: Box<dyn SectorSource>, title: DiscTitle, decrypt_keys: DecryptKeys, batch_sectors: u16, content_format: ContentFormat, ) -> Self

Create a disc stream from any sector reader.

Works with physical drives and ISO files — both implement SectorSource. The caller opens the source, scans for titles/keys, and passes them in. The stream handles demuxing, decryption, and codec parsing internally.

Source

pub fn on_event(&mut self, f: impl Fn(Event) + Send + 'static)

Set event handler for sector-level events (binary search, skip, recover).

Source

pub fn with_halt(self, halt: Halt) -> Self

Constructor-time builder: attach a Halt token so that when any clone is cancelled, the next read-retry boundary inside fill_extents returns Err(Halted). Required for Stop to work during dense bad-sector regions (where the outer PES read() loop can spend minutes inside fill_extents before emitting a frame).

Preferred over the post-hoc DiscStream::set_halt bridge — pass the same Halt clone you hand to sweep / patch / mux so every phase observes a single Stop signal.

Source

pub fn set_halt(&mut self, flag: Arc<AtomicBool>)

👎Deprecated since 0.18.0:

use DiscStream::with_halt(Halt) at construction instead

Bridge for callers that haven’t migrated to the DiscStream::with_halt constructor-time path yet. Wraps the supplied Arc<AtomicBool> as a Halt (Halt::from_arc) and stores it in the same internal slot, so a halt installed via either entry point goes through one halt-check inside fill_extents. Calling set_halt after with_halt (or vice versa) replaces the previous token with the new one.

Source

pub fn set_raw(&mut self)

Skip decryption — return raw encrypted bytes. Updates both the metadata-side key field and the wrapped reader’s keys so subsequent read_sectors calls become a pass-through.

Source

pub fn disc(&self) -> Option<&Disc>

Get the scanned Disc (for listing all titles).

Trait Implementations§

Source§

impl Stream for DiscStream

Source§

fn read(&mut self) -> Result<Option<PesFrame>>

Read the next frame, or Ok(None) at end of stream. Returns StreamWriteOnly on a stream opened for writing.
Source§

fn write(&mut self, _frame: &PesFrame) -> Result<()>

Write a frame to the sink. Returns StreamReadOnly on a stream opened for reading.
Source§

fn finish(&mut self) -> Result<()>

Finalize the stream: flush buffered frames, write any container index (MKV Cues), close the underlying file/socket. Idempotent for read-only streams (no-op).
Source§

fn info(&self) -> &DiscTitle

Stream metadata. Stable across reads — implementors must return a consistent reference for the lifetime of the stream.
Source§

fn codec_private(&self, track: usize) -> Option<Vec<u8>>

Codec initialization data for a track (SPS/PPS, AC-3 fscod, etc.). None for tracks that don’t need codec_private (raw passthrough).
Source§

fn headers_ready(&self) -> bool

True when codec_private is available for every video track — callers buffer input frames until this flips, since some output formats (MKV) can’t write frames without codec init data.
Source§

fn errors(&self) -> u64

Cumulative count of read errors the stream skipped past (e.g. zero-filled bad sectors on a live drive). Default 0 for streams that don’t have a notion of skip-on-error (file ISO, network, stdio, the pipeline highway, etc.); concrete impls with adaptive retry (DiscStream on the drive single-pass path) override.

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more