pub struct StreamProfile { /* private fields */ }
Expand description
Type for holding the stream profile information.
This type exists as a high-level wrapper around an underlying rs2_stream_profile
pointer. On
construction, we cache a copy of the stream data and also cache whether or not this stream
profile is the default stream for a sensor.
§Lifetimes
Stream profiles are acquired one of three ways:
- The stream profile list via the
stream_profiles
) method on theSensor
type. - The stream profile list via the
streams
associated function on thePipelineProfile
type. - The frame-specific
frame_stream_profile
member via the Frame type.
Stream profiles from the sensor can outlive the parent object that you obtain them from. In cases two and three above we return references to a stream profile owned by that type, so they may not. In most cases you will probably want to grab the stream profile from the pipeline profile, which will give you all streams that are actively streaming from a given pipeline.
Implementations§
Source§impl StreamProfile
impl StreamProfile
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Predicate for whether or not the stream is a default stream.
Sourcepub fn kind(&self) -> Rs2StreamKind
pub fn kind(&self) -> Rs2StreamKind
Gets the stream kind from the stream data.
This can be e.g. Depth, Video, Accel, Gyro, etc.
Sourcepub fn format(&self) -> Rs2Format
pub fn format(&self) -> Rs2Format
Gets the format for the underlying data.
For video streams this will describe how the pixels are packed and padded, for motion, pose, and point frame streams this will describe how to deconstruct individual points or observations.
Sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
Gets the stream’s index.
This is useful if you want to enable / disable a particular stream according to its index.
Sourcepub fn framerate(&self) -> i32
pub fn framerate(&self) -> i32
Gets the framerate / data rate of frames generated by the stream.
Sourcepub fn extrinsics(
&self,
to_profile: &StreamProfile,
) -> Result<Rs2Extrinsics, DataError>
pub fn extrinsics( &self, to_profile: &StreamProfile, ) -> Result<Rs2Extrinsics, DataError>
Get extrinsics between the origin stream (self
) and target stream (to_profile
).
Returns the extrinsics between the origin and target streams from the underlying realsense driver iff both underlying stream pointers are valid and extrinsics exist. Otherwise returns an error.
§Errors
Returns DataError::CouldNotGetExtrinsics
if this call fails for whatever reason.
Sourcepub fn set_extrinsics(
&self,
to_profile: &StreamProfile,
extrinsics: Rs2Extrinsics,
) -> Result<(), DataError>
pub fn set_extrinsics( &self, to_profile: &StreamProfile, extrinsics: Rs2Extrinsics, ) -> Result<(), DataError>
Set extrinsics
between the origin stream (self
) and target stream (to_profile
).
Returns null tuple ()
iff the streams are valid and the extrinsics are successfully set.
Otherwise returns an error.
§Errors
Returns DataError::CouldNotSetExtrinsics
if this call fails for whatever reason.
Sourcepub fn intrinsics(&self) -> Result<Rs2Intrinsics, DataError>
pub fn intrinsics(&self) -> Result<Rs2Intrinsics, DataError>
Get video intrinsics from the stream.
Returns a set of video intrinsics for the stream iff the stream has video intrinsics and the stream pointer is valid. Otherwise returns an error.
§Errors
Returns DataError::StreamDoesNotHaveVideoIntrinsics
if the stream does not have video
intrinsics.
Returns DataError::CouldNotGetIntrinsics
if this call fails for any other reason.
Sourcepub fn motion_intrinsics(&self) -> Result<Rs2MotionDeviceIntrinsics, DataError>
pub fn motion_intrinsics(&self) -> Result<Rs2MotionDeviceIntrinsics, DataError>
Get motion intrinsics from the stream.
Returns a set of motion device intrinsics for the stream iff the stream has motion device intrinsics and the stream pointer is valid. Otherwise returns an error.
§Errors
Returns
DataError::StreamDoesNotHaveMotionIntrinsics
if the stream does not have motion intrinsics.
Returns DataError::CouldNotGetMotionIntrinsics
if this call fails for any other reason.
Trait Implementations§
Source§impl Debug for StreamProfile
impl Debug for StreamProfile
Source§impl Drop for StreamProfile
impl Drop for StreamProfile
Source§impl TryFrom<NonNull<rs2_stream_profile>> for StreamProfile
impl TryFrom<NonNull<rs2_stream_profile>> for StreamProfile
Source§fn try_from(
stream_profile_ptr: NonNull<rs2_stream_profile>,
) -> Result<Self, Self::Error>
fn try_from( stream_profile_ptr: NonNull<rs2_stream_profile>, ) -> Result<Self, Self::Error>
Attempt to create a stream profile from a pointer to an rs2_stream_profile
type.
§Errors
Returns StreamConstructionError::CouldNotRetrieveStreamData
if the stream data
associated with this stream profile cannot be retrieved.
Returns StreamConstructionError::CouldNotDetermineIsDefault
if it cannot be determined
whether or not this stream is a default stream. This usually will only happen if the stream
is invalidated (e.g. due to a device disconnect) when you try to construct it.