PrismCore / API reference / Probing and input
Type Alias
PrismCoreInputFactory
typealias PrismCoreInputFactory = @Sendable () throws -> any PrismCoreInputDeclared in Sources/PrismCore/Probe/PrismCoreInput.swift · PrismCore 3.5.4
How a host hands its bytes over: one call per open.
Deliberately a factory rather than an instance. A session opens the source more than once — the routing probe, the remuxer (when it did not adopt the probe's context), a SeekPreviewService running alongside playback — and those contexts read from completely different positions at the same time. One shared instance would have them fighting over a single cursor: the producer's sequential read and a scrub preview's seek would interleave into garbage, intermittently, on exactly the sources hardest to debug. A factory makes a shared cursor impossible to express by accident.
It can be called again in the middle of playback. A planned session whose read fails mid-film re-opens its source rather than ending (see PlaybackEvent.producerRecovered), and a re-open is an open: one more call, up to three a minute, for an instance that starts at byte zero. The previous instance is released first. So the factory must be callable at any time from any thread, must hand out an instance that reads the same bytes as the first one did, and should reconnect rather than return the broken transport the last instance was using — a factory that hands back the dead session turns every recovery into a failed one.
Generated from the public symbols of PrismCore 3.5.4. All types