pub struct Camera<'d, D: Driver<'d>> { /* private fields */ }Expand description
Implementation of the USB Video Class 1.5, camera side.
Implementations§
Source§impl<'d, D: Driver<'d>> Camera<'d, D>
impl<'d, D: Driver<'d>> Camera<'d, D>
Sourcepub fn new(
builder: &mut Builder<'d, D>,
state: &'d mut State<'d>,
config: Config<'d>,
) -> Self
pub fn new( builder: &mut Builder<'d, D>, state: &'d mut State<'d>, config: Config<'d>, ) -> Self
Creates a new Camera device, and registers its control handler.
§Panics
If config has no format or more than 16, a format without a frame or with more than
255, a frame of zero size or without a frame interval or with more than 56, a zero frame
interval, invalid still image configuration, a packet size below 13 or above the speed’s
limit, or the control_buf of the builder is smaller than 48 bytes.
Sourcepub fn settings(&self) -> StreamSettings<'d>
pub fn settings(&self) -> StreamSettings<'d>
What the host selected for the stream, or the defaults before it selects anything.
Sourcepub fn control_values(&self) -> ControlValues
pub fn control_values(&self) -> ControlValues
Returns the current Processing Unit and Camera Terminal control values.
Sourcepub fn take_controls_changed(&self) -> Option<ControlValues>
pub fn take_controls_changed(&self) -> Option<ControlValues>
Returns updated control values if the host modified any since the last call.
Sourcepub fn take_still_trigger(&self) -> Option<StillSettings<'d>>
pub fn take_still_trigger(&self) -> Option<StillSettings<'d>>
Returns and clears the committed StillSettings if the host triggered a Method 2
still image capture via VS_STILL_IMAGE_TRIGGER_CONTROL.
Sourcepub async fn wait_streaming(&mut self) -> StreamSettings<'d>
pub async fn wait_streaming(&mut self) -> StreamSettings<'d>
Waits until the host starts the stream (selects alternate setting 1 for isochronous, or commits the stream for bulk), then returns what it selected.
Sourcepub fn start_frame(&mut self) -> FrameWriter<'_, 'd, D>
pub fn start_frame(&mut self) -> FrameWriter<'_, 'd, D>
Starts streaming a video frame chunk by chunk without holding the full frame in RAM.
Sourcepub fn start_frame_with_timestamp(
&mut self,
ts: PayloadTimestamp,
) -> FrameWriter<'_, 'd, D>
pub fn start_frame_with_timestamp( &mut self, ts: PayloadTimestamp, ) -> FrameWriter<'_, 'd, D>
Starts streaming a video frame with PTS (and optional SCR) timestamps.
Sourcepub fn start_still_frame(&mut self) -> FrameWriter<'_, 'd, D>
pub fn start_still_frame(&mut self) -> FrameWriter<'_, 'd, D>
Starts streaming a Method 2 still image frame chunk by chunk.
Sourcepub async fn write_frame(&mut self, frame: &[u8]) -> Result<(), EndpointError>
pub async fn write_frame(&mut self, frame: &[u8]) -> Result<(), EndpointError>
Sends one complete video frame with the minimal 2-byte payload header.
Sourcepub async fn write_frame_with_timestamp(
&mut self,
frame: &[u8],
ts: PayloadTimestamp,
) -> Result<(), EndpointError>
pub async fn write_frame_with_timestamp( &mut self, frame: &[u8], ts: PayloadTimestamp, ) -> Result<(), EndpointError>
Sends one complete video frame with UVC PTS (and optional SCR) timestamps.
Sourcepub async fn write_still_frame(
&mut self,
frame: &[u8],
) -> Result<(), EndpointError>
pub async fn write_still_frame( &mut self, frame: &[u8], ) -> Result<(), EndpointError>
Sends one complete Method 2 still image frame (sets the STI still-image bit).