mux: PrefetchedSectorSource event_fn + delete DiscStream::new_pipeline
* `PrefetchedSectorSource::new_with_events` adds an optional `event_fn` callback that fires `BytesRead` after every successful batch from the producer thread. The original `new()` becomes a thin no-events wrapper. Lets autorip wire the highway and still get UI progress events without polling the consumer side. * `build_iso_pipeline` grows an `event_fn` arg so the autorip multipass mux can pipe BytesRead straight through to its progress UI. * Stream trait gains a default `errors() -> u64` method (= 0) so Box<dyn Stream> callers (autorip's mux loop) can read the skip-on-error counter without downcasting. `DiscStream` overrides to return its `errors` field. * Delete `DiscStream::new_pipeline` and the pipeline-mode fields (`demux_thread`, `demux_rx`) plus the `read_pipeline` helper. All pipeline construction now goes through `PipelinedPesStream` via `build_iso_pipeline`; `DiscStream` becomes the single-thread-only inline path used by the drive single-pass read. * `lib.rs` re-exports `build_iso_pipeline`.
This commit is contained in:
+4
-1
@@ -234,6 +234,7 @@ pub fn input(url: &str, opts: &InputOptions) -> io::Result<Box<dyn crate::pes::S
|
||||
ISO_MUX_BATCH_SECTORS,
|
||||
format,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
Ok(Box::new(stream))
|
||||
}
|
||||
@@ -357,15 +358,17 @@ pub fn build_iso_pipeline<S: SectorSource + Send + 'static>(
|
||||
batch_sectors: u16,
|
||||
format: ContentFormat,
|
||||
halt: Option<crate::halt::Halt>,
|
||||
event_fn: Option<crate::sector::prefetched::EventFn>,
|
||||
) -> PipelinedPesStream {
|
||||
let extents = title.extents.clone();
|
||||
let decrypting =
|
||||
crate::sector::DecryptingSectorSource::new(Box::new(reader) as Box<dyn SectorSource>, keys);
|
||||
let prefetched = crate::sector::PrefetchedSectorSource::new(
|
||||
let prefetched = crate::sector::PrefetchedSectorSource::new_with_events(
|
||||
decrypting,
|
||||
extents,
|
||||
batch_sectors,
|
||||
halt.clone(),
|
||||
event_fn,
|
||||
);
|
||||
let (rx, recycle_tx, shell) = prefetched.into_channels();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user