pub struct FeedConfigBuilder { /* private fields */ }Expand description
Builder for FeedConfig.
§Required fields
source— the video source specification.camera_mode—FixedorObserved(no default).stages— at least one perception stage.output_sink— where to send processed outputs.
§Validation
build() validates:
Observedmode requires aViewStateProvider.Fixedmode must not have aViewStateProvider.
Implementations§
Source§impl FeedConfigBuilder
impl FeedConfigBuilder
Sourcepub fn source(self, source: SourceSpec) -> Self
pub fn source(self, source: SourceSpec) -> Self
Set the video source.
Sourcepub fn camera_mode(self, mode: CameraMode) -> Self
pub fn camera_mode(self, mode: CameraMode) -> Self
Set the camera mode (Fixed or Observed). Required.
Sourcepub fn stages(self, stages: Vec<Box<dyn Stage>>) -> Self
pub fn stages(self, stages: Vec<Box<dyn Stage>>) -> Self
Set the ordered list of perception stages.
Mutually exclusive with feed_pipeline().
For pipelines with a shared batch point, use feed_pipeline().
Sourcepub fn pipeline(self, pipeline: StagePipeline) -> Self
pub fn pipeline(self, pipeline: StagePipeline) -> Self
Set the perception pipeline from a StagePipeline.
This is a convenience alternative to stages()
that accepts a pre-composed pipeline.
Mutually exclusive with feed_pipeline().
Sourcepub fn feed_pipeline(self, pipeline: FeedPipeline) -> Self
pub fn feed_pipeline(self, pipeline: FeedPipeline) -> Self
Set the feed pipeline, optionally including a shared batch point.
This is the recommended way to configure feeds that participate in
shared batch inference. Use FeedPipeline::builder() to compose
pre-batch stages, a batch point, and post-batch stages.
Mutually exclusive with stages() and
pipeline().
Sourcepub fn view_state_provider(self, provider: Box<dyn ViewStateProvider>) -> Self
pub fn view_state_provider(self, provider: Box<dyn ViewStateProvider>) -> Self
Set the view state provider (required for CameraMode::Observed).
Sourcepub fn epoch_policy(self, policy: Box<dyn EpochPolicy>) -> Self
pub fn epoch_policy(self, policy: Box<dyn EpochPolicy>) -> Self
Set the epoch policy (optional; defaults to DefaultEpochPolicy).
Sourcepub fn output_sink(self, sink: Box<dyn OutputSink>) -> Self
pub fn output_sink(self, sink: Box<dyn OutputSink>) -> Self
Set the output sink. Required.
Sourcepub fn sink_factory(self, factory: SinkFactory) -> Self
pub fn sink_factory(self, factory: SinkFactory) -> Self
Set an optional sink factory for reconstructing the sink after timeout or panic.
Without a factory, a sink that times out during shutdown is permanently replaced with a silent no-op. With a factory, the next feed restart constructs a fresh sink.
Sourcepub fn backpressure(self, policy: BackpressurePolicy) -> Self
pub fn backpressure(self, policy: BackpressurePolicy) -> Self
Set the backpressure policy. Default: DropOldest { queue_depth: 4 }.
Sourcepub fn temporal(self, policy: RetentionPolicy) -> Self
pub fn temporal(self, policy: RetentionPolicy) -> Self
Set the temporal retention policy.
Sourcepub fn reconnect(self, policy: ReconnectPolicy) -> Self
pub fn reconnect(self, policy: ReconnectPolicy) -> Self
Set the reconnection policy.
Sourcepub fn restart(self, policy: RestartPolicy) -> Self
pub fn restart(self, policy: RestartPolicy) -> Self
Set the restart policy.
Sourcepub fn ptz_provider(self, provider: Arc<dyn PtzProvider>) -> Self
pub fn ptz_provider(self, provider: Arc<dyn PtzProvider>) -> Self
Set an optional PTZ telemetry provider.
When provided, the media backend queries this on every decoded frame to attach PTZ telemetry to the frame metadata.
Sourcepub fn frame_inclusion(self, policy: FrameInclusion) -> Self
pub fn frame_inclusion(self, policy: FrameInclusion) -> Self
Set the frame inclusion policy.
FrameInclusion::Never(default) — no pixel data in outputs.FrameInclusion::Always— every output carries a frame.- [
FrameInclusion::Sampled { interval }] — a frame is included everyintervaloutputs, reducing host materialization and sink thread cost while keeping perception artifacts at full rate. - [
FrameInclusion::TargetFps { target, fallback_interval }] — resolve the sample interval dynamically from the observed source rate. During a warmup window (first ~30 frames),fallback_intervalis used. Once the source cadence is estimated from frame timestamps, the interval is computed asround(source_fps / target)and locked for the feed’s lifetime.
Use TargetFps when the source FPS
is unknown at config time or varies across feeds. Use
Sampled when the interval is known
statically.
Sourcepub fn validation_mode(self, mode: ValidationMode) -> Self
pub fn validation_mode(self, mode: ValidationMode) -> Self
Set the stage capability validation mode.
ValidationMode::Off(default) — no validation.ValidationMode::Warn— log warnings viatracing::warn!.ValidationMode::Error— any warning becomes a build error.
Sourcepub fn sink_queue_capacity(self, capacity: usize) -> Self
pub fn sink_queue_capacity(self, capacity: usize) -> Self
Set the per-feed output sink queue capacity.
This is the bounded channel between the feed worker thread and
the sink thread. Default: 16. Must be at least 1.
Sourcepub fn sink_shutdown_timeout(self, timeout: Duration) -> Self
pub fn sink_shutdown_timeout(self, timeout: Duration) -> Self
Set the timeout for joining the sink worker thread during shutdown or restart. Default: 5 seconds.
Sourcepub fn decode_preference(self, pref: DecodePreference) -> Self
pub fn decode_preference(self, pref: DecodePreference) -> Self
Set the decode preference for this feed.
Controls hardware vs. software decoder selection. Default is
DecodePreference::Auto, which preserves existing behavior.
See DecodePreference for variant semantics.
Sourcepub fn post_decode_hook(self, hook: PostDecodeHook) -> Self
pub fn post_decode_hook(self, hook: PostDecodeHook) -> Self
Set a post-decode hook that can inject a pipeline element between the decoder and the color-space converter.
Ignored when device_residency is Provider — the provider
controls the full decoder-to-tail path. Hooks are only evaluated
for Host and Cuda residency modes, so this can be set
unconditionally without conflicting with provider-managed feeds.
See PostDecodeHook for details and usage examples.
Sourcepub fn device_residency(self, residency: DeviceResidency) -> Self
pub fn device_residency(self, residency: DeviceResidency) -> Self
Set the device residency mode for decoded frames.
Controls the pipeline tail strategy:
DeviceResidency::Host(default) —videoconvert → appsinkDeviceResidency::Cuda—cudaupload → cudaconvert → appsink(memory:CUDAMemory)DeviceResidency::Provider(p)— delegates to the provider
See DeviceResidency for details.
Sourcepub fn add_stage(self, stage: impl Stage) -> Self
pub fn add_stage(self, stage: impl Stage) -> Self
Append a single stage to the pipeline.
Convenience alternative to stages() when
building one stage at a time.
Sourcepub fn add_boxed_stage(self, stage: Box<dyn Stage>) -> Self
pub fn add_boxed_stage(self, stage: Box<dyn Stage>) -> Self
Append a boxed stage to the pipeline.
Auto Trait Implementations§
impl Freeze for FeedConfigBuilder
impl !RefUnwindSafe for FeedConfigBuilder
impl Send for FeedConfigBuilder
impl !Sync for FeedConfigBuilder
impl Unpin for FeedConfigBuilder
impl UnsafeUnpin for FeedConfigBuilder
impl !UnwindSafe for FeedConfigBuilder
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