Skip to main content

SourceSpec

Enum SourceSpec 

Source
pub enum SourceSpec {
    Rtsp {
        url: String,
        transport: RtspTransport,
        security: RtspSecurityPolicy,
    },
    File {
        path: PathBuf,
        loop_: bool,
    },
    V4l2 {
        device: String,
    },
    Custom {
        pipeline_fragment: String,
    },
}
Expand description

Specification of a video source.

Defined in nv-core (not nv-media) to prevent downstream crates from transitively depending on GStreamer.

Variants§

§

Rtsp

An RTSP stream.

The security field controls TLS enforcement. The default (PreferTls) promotes bare rtsp:// URLs to rtsps:// at pipeline construction time.

Fields

§transport: RtspTransport
§security: RtspSecurityPolicy

TLS security policy for this source. Default: PreferTls.

§

File

A local video file.

Fields

§path: PathBuf
§loop_: bool

Whether to loop the file when it reaches the end.

§

V4l2

A Video4Linux2 device (Linux only).

Fields

§device: String
§

Custom

Escape hatch: a raw pipeline launch-line fragment.

The library constructs the pipeline internally for all other variants. Use this only for exotic sources not covered above.

Security note: Custom pipelines are gated by CustomPipelinePolicy at the runtime layer. The default policy rejects custom pipelines; set CustomPipelinePolicy::AllowTrusted on the runtime builder to enable them.

Fields

§pipeline_fragment: String

Implementations§

Source§

impl SourceSpec

Source

pub fn rtsp(url: impl Into<String>) -> Self

Convenience constructor for an RTSP source with TCP transport.

The security policy is inferred from the URL scheme:

An explicit rtsp:// scheme is treated as a deliberate choice by the caller and is not promoted to rtsps://. Use rtsp_tls to force TLS promotion on a bare rtsp:// URL.

Source

pub fn rtsp_tls(url: impl Into<String>) -> Self

Convenience constructor that forces PreferTls.

Unlike rtsp(), this promotes bare rtsp:// URLs to rtsps:// at pipeline construction time. Use this when you know the camera supports TLS but the URL was provided without the rtsps:// scheme.

Source

pub fn rtsp_insecure(url: impl Into<String>) -> Self

Convenience constructor for an RTSP source with explicit insecure transport (AllowInsecure).

Equivalent to rtsp() for rtsp:// URLs. Useful when constructing a spec from a variable where you want to guarantee AllowInsecure regardless of the scheme.

Source

pub fn file(path: impl Into<PathBuf>) -> Self

Convenience constructor for a local video file (non-looping).

Source

pub fn file_looping(path: impl Into<PathBuf>) -> Self

Convenience constructor for a looping local video file.

The source seeks back to the start on EOS instead of stopping.

Source

pub fn is_file_nonloop(&self) -> bool

Returns true if this is a non-looping file source.

Non-looping file sources treat EOS as terminal (not an error): the feed stops with StopReason::EndOfStream rather than attempting a restart.

Trait Implementations§

Source§

impl Clone for SourceSpec

Source§

fn clone(&self) -> SourceSpec

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SourceSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.