Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(872)

Unified Diff: media/capture/video/linux/v4l2_capture_delegate.cc

Issue 2890353003: Image Capture: wire |exposureCompensation| in Linux/CrOs (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/video/linux/v4l2_capture_delegate.cc
diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc
index a4677b31787666f17c96b710bb848fe097c5319c..6eec86272db0350ec8494f740704fc15cd8b0bda 100644
--- a/media/capture/video/linux/v4l2_capture_delegate.cc
+++ b/media/capture/video/linux/v4l2_capture_delegate.cc
@@ -594,6 +594,9 @@ void V4L2CaptureDelegate::GetPhotoCapabilities(
: MeteringMode::CONTINUOUS;
}
+ photo_capabilities->exposure_compensation =
+ RetrieveUserControlRange(device_fd_.get(), V4L2_CID_EXPOSURE_ABSOLUTE);
+
photo_capabilities->color_temperature = RetrieveUserControlRange(
device_fd_.get(), V4L2_CID_WHITE_BALANCE_TEMPERATURE);
if (photo_capabilities->color_temperature) {
@@ -625,7 +628,6 @@ void V4L2CaptureDelegate::GetPhotoCapabilities(
photo_capabilities->width = mojom::Range::New(
capture_format_.frame_size.width(), capture_format_.frame_size.width(),
capture_format_.frame_size.width(), 0 /* step */);
- photo_capabilities->exposure_compensation = mojom::Range::New();
photo_capabilities->red_eye_reduction = mojom::RedEyeReduction::NEVER;
photo_capabilities->torch = false;
@@ -666,12 +668,12 @@ void V4L2CaptureDelegate::SetPhotoOptions(
HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_S_CTRL, &white_balance_set));
}
- // Color temperature can only be applied if Auto White Balance is off.
if (settings->has_color_temperature) {
v4l2_control auto_white_balance_current = {};
auto_white_balance_current.id = V4L2_CID_AUTO_WHITE_BALANCE;
const int result = HANDLE_EINTR(
ioctl(device_fd_.get(), VIDIOC_G_CTRL, &auto_white_balance_current));
+ // Color temperature can only be applied if Auto White Balance is off.
if (result >= 0 && !auto_white_balance_current.value) {
v4l2_control set_temperature = {};
set_temperature.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
@@ -680,6 +682,32 @@ void V4L2CaptureDelegate::SetPhotoOptions(
}
}
+ if (settings->has_exposure_mode &&
+ (settings->exposure_mode == mojom::MeteringMode::CONTINUOUS ||
+ settings->exposure_mode == mojom::MeteringMode::MANUAL)) {
+ v4l2_control exposure_mode_set = {};
+ exposure_mode_set.id = V4L2_CID_EXPOSURE_AUTO;
+ exposure_mode_set.value =
+ settings->exposure_mode == mojom::MeteringMode::CONTINUOUS
+ ? V4L2_EXPOSURE_APERTURE_PRIORITY
+ : V4L2_EXPOSURE_MANUAL;
+ HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_S_CTRL, &exposure_mode_set));
+ }
+
+ if (settings->has_exposure_compensation) {
+ v4l2_control auto_exposure_current = {};
+ auto_exposure_current.id = V4L2_CID_EXPOSURE_AUTO;
+ const int result = HANDLE_EINTR(
+ ioctl(device_fd_.get(), VIDIOC_G_CTRL, &auto_exposure_current));
+ // Exposure Compensation can only be applied if Auto Exposure is off.
+ if (result >= 0 && auto_exposure_current.value == V4L2_EXPOSURE_MANUAL) {
+ v4l2_control set_exposure = {};
+ set_exposure.id = V4L2_CID_EXPOSURE_ABSOLUTE;
+ set_exposure.value = settings->exposure_compensation;
+ HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_S_CTRL, &set_exposure));
+ }
+ }
+
if (settings->has_brightness) {
v4l2_control current = {};
current.id = V4L2_CID_BRIGHTNESS;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698