Struct StreamProfile

Source
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:

  1. The stream profile list via the stream_profiles) method on the Sensor type.
  2. The stream profile list via the streams associated function on the PipelineProfile type.
  3. 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

Source

pub fn is_default(&self) -> bool

Predicate for whether or not the stream is a default stream.

Source

pub fn kind(&self) -> Rs2StreamKind

Gets the stream kind from the stream data.

This can be e.g. Depth, Video, Accel, Gyro, etc.

Source

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.

Source

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.

Source

pub fn unique_id(&self) -> i32

Gets the stream’s unique identifier.

Source

pub fn framerate(&self) -> i32

Gets the framerate / data rate of frames generated by the stream.

Source

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.

Source

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.

Source

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.

Source

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

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for StreamProfile

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl TryFrom<NonNull<rs2_stream_profile>> for StreamProfile

Source§

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.

Source§

type Error = StreamConstructionError

The type returned in the event of a conversion error.

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, 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, 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.