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

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

Issue 2375543004: ImageCapture: wire |colorTemperature| set/get for Linux/Cros (Closed)
Patch Set: Created 4 years, 3 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
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 5e5398222a77cd13193c6e65b3fcc7fae02bf0a8..4090a5f5673b405e74c269d59e8f91947bbf9e67 100644
--- a/media/capture/video/linux/v4l2_capture_delegate.cc
+++ b/media/capture/video/linux/v4l2_capture_delegate.cc
@@ -386,6 +386,26 @@ void V4L2CaptureDelegate::GetPhotoCapabilities(
: mojom::MeteringMode::MANUAL;
}
+ photo_capabilities->color_temperature = mojom::Range::New();
+ v4l2_queryctrl color_temperature_range = {};
+ color_temperature_range.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
+ color_temperature_range.type = V4L2_CTRL_TYPE_INTEGER;
+ if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_QUERYCTRL,
+ &color_temperature_range)) >= 0) {
+ photo_capabilities->color_temperature->max =
+ color_temperature_range.maximum;
+ photo_capabilities->color_temperature->min =
+ color_temperature_range.minimum;
+ }
+
+ v4l2_control color_temperature_current = {};
+ color_temperature_current.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
+ if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_G_CTRL,
+ &color_temperature_current)) >= 0) {
+ photo_capabilities->color_temperature->current =
+ color_temperature_current.value;
chfremer 2016/09/27 21:46:39 nit: I am somewhat surprised that something called
mcasas 2016/09/27 21:57:38 Yeah heh, it comes straight from the W3C Spec: htt
+ }
+
photo_capabilities->iso = mojom::Range::New();
photo_capabilities->height = mojom::Range::New();
photo_capabilities->width = mojom::Range::New();
@@ -409,6 +429,31 @@ void V4L2CaptureDelegate::SetPhotoOptions(
if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_S_CTRL, &zoom_current)) < 0)
DPLOG(ERROR) << "setting zoom to " << settings->zoom / kZoomMultiplier;
}
+
+ if (settings->has_white_balance_mode &&
+ (settings->white_balance_mode == mojom::MeteringMode::CONTINUOUS ||
+ settings->white_balance_mode == mojom::MeteringMode::MANUAL)) {
+ v4l2_control white_balance_set = {};
+ white_balance_set.id = V4L2_CID_AUTO_WHITE_BALANCE;
+ white_balance_set.value =
+ settings->white_balance_mode == mojom::MeteringMode::CONTINUOUS;
+ HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_S_CTRL, &white_balance_set));
+ }
+
+ // Color temperature can only be applied if Auto White Balance is off.
chfremer 2016/09/27 21:46:39 If auto white balance is on, we just ignore the re
mcasas 2016/09/27 21:57:38 Yeah, hmm, the Spec says so: " This field is only
+ 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));
+ if (result >= 0 && !auto_white_balance_current.value) {
+ v4l2_control set_temperature = {};
+ set_temperature.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
+ set_temperature.value = settings->color_temperature;
+ HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_S_CTRL, &set_temperature));
+ }
+ }
+
callback.Run(true);
}
« no previous file with comments | « media/capture/video/fake_video_capture_device_unittest.cc ('k') | media/mojo/interfaces/image_capture.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698