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: RtspTransportsecurity: RtspSecurityPolicyTLS security policy for this source. Default: PreferTls.
File
A local video file.
V4l2
A Video4Linux2 device (Linux only).
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.
Implementations§
Source§impl SourceSpec
impl SourceSpec
Sourcepub fn rtsp(url: impl Into<String>) -> Self
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:
rtsps://or no recognized scheme →PreferTlsrtsp://→AllowInsecure
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.
Sourcepub fn rtsp_insecure(url: impl Into<String>) -> Self
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.
Sourcepub fn file(path: impl Into<PathBuf>) -> Self
pub fn file(path: impl Into<PathBuf>) -> Self
Convenience constructor for a local video file (non-looping).
Sourcepub fn file_looping(path: impl Into<PathBuf>) -> Self
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.
Sourcepub fn is_file_nonloop(&self) -> bool
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
impl Clone for SourceSpec
Source§fn clone(&self) -> SourceSpec
fn clone(&self) -> SourceSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more