Skip to content

Commit

Permalink
Add set control by id
Browse files Browse the repository at this point in the history
  • Loading branch information
fishrockz committed Jan 22, 2025
1 parent 3a1f52c commit 75de92d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libcamera/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ impl ControlList {

Ok(())
}

pub fn set_id(&mut self, id: u32, ctrl_val: ControlValue) -> Result<(), ControlError> {
unsafe {
let val_ptr = NonNull::new(libcamera_control_value_create()).unwrap();
ctrl_val.write(val_ptr);
libcamera_control_list_set(self.ptr().cast_mut(), id, val_ptr.as_ptr());
libcamera_control_value_destroy(val_ptr.as_ptr());
}
Ok(())
}
}

impl<'d> IntoIterator for &'d ControlList {
Expand Down

0 comments on commit 75de92d

Please sign in to comment.