Change v4l2_wrapper set control to accept null.

User does not need to pass a result pointer if they
don't care about the result.

BUG: 30140438

Change-Id: Ia98870f24df82464a3f00aad63a599063b98f03a
This commit is contained in:
Ari Hausman-Cohen 2016-08-02 10:47:07 -07:00
parent b1af4ff795
commit 99f3ea02d0
2 changed files with 10 additions and 2 deletions

View file

@ -231,12 +231,19 @@ int V4L2Wrapper::SetControl(uint32_t control_id, int32_t desired,
int32_t* result) {
HAL_LOG_ENTER();
// TODO(b/29334616): When async, this may need to check if the stream
// is on, and if so, lock it off while setting format. Need to look
// into if V4L2 supports adjusting controls while the stream is on.
v4l2_control control{control_id, desired};
if (IoctlLocked(VIDIOC_S_CTRL, &control) < 0) {
HAL_LOGE("S_CTRL fails: %s", strerror(errno));
return -ENODEV;
}
*result = control.value;
// If the caller wants to know the result, pass it back.
if (result != nullptr) {
*result = control.value;
}
return 0;
}

View file

@ -45,7 +45,8 @@ class V4L2Wrapper {
// Manage controls.
int QueryControl(uint32_t control_id, v4l2_query_ext_ctrl* result);
int GetControl(uint32_t control_id, int32_t* value);
int SetControl(uint32_t control_id, int32_t desired, int32_t* result);
int SetControl(uint32_t control_id, int32_t desired,
int32_t* result = nullptr);
// Manage format.
int SetFormat(const default_camera_hal::Stream& stream,
uint32_t* result_max_buffers);