PrismCore / API reference / Probing and input
Enumeration
SourceProbe
enum SourceProbeDeclared in Sources/PrismCore/Probe/SourceProbe.swift · PrismCore 3.5.4
Opens a URL with libavformat and reports it. Read-only and one-shot: no muxer, no output, nothing left running — the router calls this before deciding which engine gets the source, so it must be cheap and total.
Type methods
static func probe(url: URL, httpHeaders: [String : String] = [:], input: PrismCoreInputFactory? = nil) throws -> SourceInfoNo documentation comment in the source.
static func openDetached(url: URL, httpHeaders: [String : String] = [:], budget: Duration = SourceOpenTuning.probeBudget, coordinatedHTTP: Bool = false, input: PrismCoreInputFactory? = nil, structure: SourceStructureExport = .none, hints: SourceOpenHints? = nil, hdr10Plus: HDR10PlusScan = .off) async throws -> ProbedSourceProbe a source and keep the open context, so a session over the same source can produce from it instead of opening again.
This is the routing entry point worth using: PrismCoreEngine.decide takes the info, and a source that routes to the remux path can be handed straight to PrismCoreSession(probed:display:), which adopts the context. A source that routes elsewhere simply releases it — see ProbedSource for why the context, and not merely its conclusions, is what has to travel.
- Parameter budget: wall-clock bound on the WHOLE probe — open, stream analysis, interlace verification. On expiry the blocked read aborts and this throws, which is the property the router depends on: a probe that answers nothing is a playback that falls back to nothing (five silent play attempts over four minutes in the 2026-08-14 field log, all blocked inside one open against a starved server).
open, run on a dedicated thread so the cooperative pool never blocks in it.
open is synchronous and blocks on the transport for the whole probe — up to budget (10 s) against a starved server. Called from an async context that is a cooperative-pool thread held hostage, and a host that probes several sources at once (a row of episodes, a fallback racing a transcode) can park enough of them to stall every other await in the process (#44 was the producer-side twin). This hops to a one-shot ProducerThread, hands the ProbedSource back through a continuation, and returns to the pool. The interrupt guard and the budget are open's own; nothing about the probe changes.
Task cancellation is observed at the boundary: a probe already in flight runs to its verdict or its budget (the thread is not killed; an FFmpeg read cannot be interrupted from outside except through the guard, which the budget already arms), and a cancelled caller gets CancellationError while the result is released.
static func open(_ url: URL, hints: SourceOpenHints?) throws -> ProbedSource- Parameter input: a host-supplied byte source (
PrismCoreInput) for a transport libavformat cannot open itself. One instance is taken for this open;urlis then only a naming hint for format probing, never fetched.nil(the default) keeps native FFmpeg I/O.
The hints:-first spelling of open, for callers that have a probe document in hand and nothing else to say.
hints: nil is open(url:) exactly — the same code, not a parallel one. That property is what keeps the hinted path an addition to the engine rather than a fork of it, and SourceProbeHintsTests pins it.
static func open(url: URL, httpHeaders: [String : String] = [:], budget: Duration = SourceOpenTuning.probeBudget, coordinatedHTTP: Bool = false, input inputFactory: PrismCoreInputFactory? = nil, structure structureExport: SourceStructureExport = .none, hints: SourceOpenHints? = nil, hdr10Plus hdr10PlusScan: HDR10PlusScan = .off) throws -> ProbedSource- Parameter structure: how much of a byte-layout and index export to pay for.
.none(the default) costs no I/O and reportsSourceStructure.unknown; seeSourceStructureExportfor why the other two are opt-in. - Parameter hints: what a caller already knows about this source. May make the open read less; may never make it read something else. A hint that turns out not to describe these bytes is recorded in
ProbedSource.hintsand otherwise ignored. - Parameter hdr10Plus: whether to read video packets looking for HDR10+ metadata.
.off(the default) reads nothing and leavesSourceInfo.hdr10Plusnil; seeHDR10PlusScanfor the cost.
Enumeration
SourceProbe.Failure
enum FailureNo documentation comment in the source.
Cases
Generated from the public symbols of PrismCore 3.5.4. All types