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: boolImplementations§
Source§impl DiscStream
impl DiscStream
Sourcepub fn new(
reader: Box<dyn SectorSource>,
title: DiscTitle,
decrypt_keys: DecryptKeys,
batch_sectors: u16,
content_format: ContentFormat,
) -> Self
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.
Sourcepub fn on_event(&mut self, f: impl Fn(Event) + Send + 'static)
pub fn on_event(&mut self, f: impl Fn(Event) + Send + 'static)
Set event handler for sector-level events (binary search, skip, recover).
Sourcepub fn with_halt(self, halt: Halt) -> Self
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.
Sourcepub fn set_halt(&mut self, flag: Arc<AtomicBool>)
👎Deprecated since 0.18.0: use DiscStream::with_halt(Halt) at construction instead
pub fn set_halt(&mut self, flag: Arc<AtomicBool>)
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.
Trait Implementations§
Source§impl Stream for DiscStream
impl Stream for DiscStream
Source§fn read(&mut self) -> Result<Option<PesFrame>>
fn read(&mut self) -> Result<Option<PesFrame>>
Ok(None) at end of stream. Returns
StreamWriteOnly on a stream opened for writing.Source§fn write(&mut self, _frame: &PesFrame) -> Result<()>
fn write(&mut self, _frame: &PesFrame) -> Result<()>
StreamReadOnly on a stream
opened for reading.Source§fn finish(&mut self) -> Result<()>
fn finish(&mut self) -> Result<()>
Cues), close the underlying file/socket. Idempotent
for read-only streams (no-op).Source§fn info(&self) -> &DiscTitle
fn info(&self) -> &DiscTitle
Source§fn codec_private(&self, track: usize) -> Option<Vec<u8>>
fn codec_private(&self, track: usize) -> Option<Vec<u8>>
None for tracks that don’t need codec_private (raw passthrough).Source§fn headers_ready(&self) -> bool
fn headers_ready(&self) -> bool
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
fn errors(&self) -> u64
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§
impl Freeze for DiscStream
impl !RefUnwindSafe for DiscStream
impl Send for DiscStream
impl !Sync for DiscStream
impl Unpin for DiscStream
impl UnsafeUnpin for DiscStream
impl !UnwindSafe for DiscStream
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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