Skip to main content

FeedConfigBuilder

Struct FeedConfigBuilder 

Source
pub struct FeedConfigBuilder { /* private fields */ }
Expand description

Builder for FeedConfig.

§Required fields

  • source — the video source specification.
  • camera_modeFixed or Observed (no default).
  • stages — at least one perception stage.
  • output_sink — where to send processed outputs.

§Validation

build() validates:

  • Observed mode requires a ViewStateProvider.
  • Fixed mode must not have a ViewStateProvider.

Implementations§

Source§

impl FeedConfigBuilder

Source

pub fn source(self, source: SourceSpec) -> Self

Set the video source.

Source

pub fn camera_mode(self, mode: CameraMode) -> Self

Set the camera mode (Fixed or Observed). Required.

Source

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().

Source

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().

Source

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().

Source

pub fn view_state_provider(self, provider: Box<dyn ViewStateProvider>) -> Self

Set the view state provider (required for CameraMode::Observed).

Source

pub fn epoch_policy(self, policy: Box<dyn EpochPolicy>) -> Self

Set the epoch policy (optional; defaults to DefaultEpochPolicy).

Source

pub fn output_sink(self, sink: Box<dyn OutputSink>) -> Self

Set the output sink. Required.

Source

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.

Source

pub fn backpressure(self, policy: BackpressurePolicy) -> Self

Set the backpressure policy. Default: DropOldest { queue_depth: 4 }.

Source

pub fn temporal(self, policy: RetentionPolicy) -> Self

Set the temporal retention policy.

Source

pub fn reconnect(self, policy: ReconnectPolicy) -> Self

Set the reconnection policy.

Source

pub fn restart(self, policy: RestartPolicy) -> Self

Set the restart policy.

Source

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.

Source

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 every interval outputs, 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_interval is used. Once the source cadence is estimated from frame timestamps, the interval is computed as round(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.

Source

pub fn validation_mode(self, mode: ValidationMode) -> Self

Set the stage capability validation mode.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn device_residency(self, residency: DeviceResidency) -> Self

Set the device residency mode for decoded frames.

Controls the pipeline tail strategy:

See DeviceResidency for details.

Source

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.

Source

pub fn add_boxed_stage(self, stage: Box<dyn Stage>) -> Self

Append a boxed stage to the pipeline.

Source

pub fn build(self) -> Result<FeedConfig, NvError>

Build the feed configuration.

§Errors
  • MissingRequired if source, camera_mode, stages (or feed_pipeline), or output_sink are not set.
  • CameraModeConflict if Observed is set without a provider, or Fixed with a provider.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more