OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/capture/video/linux/v4l2_capture_delegate.h" | 5 #include "media/capture/video/linux/v4l2_capture_delegate.h" |
6 | 6 |
7 #include <linux/version.h> | 7 #include <linux/version.h> |
8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
9 #include <poll.h> | 9 #include <poll.h> |
10 #include <sys/fcntl.h> | 10 #include <sys/fcntl.h> |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 v4l2_control white_balance_current = {}; | 613 v4l2_control white_balance_current = {}; |
614 white_balance_current.id = V4L2_CID_AUTO_WHITE_BALANCE; | 614 white_balance_current.id = V4L2_CID_AUTO_WHITE_BALANCE; |
615 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_G_CTRL, | 615 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_G_CTRL, |
616 &white_balance_current)) >= 0) { | 616 &white_balance_current)) >= 0) { |
617 photo_capabilities->current_white_balance_mode = | 617 photo_capabilities->current_white_balance_mode = |
618 white_balance_current.value ? MeteringMode::CONTINUOUS | 618 white_balance_current.value ? MeteringMode::CONTINUOUS |
619 : MeteringMode::MANUAL; | 619 : MeteringMode::MANUAL; |
620 } | 620 } |
621 | 621 |
622 photo_capabilities->iso = mojom::Range::New(); | 622 photo_capabilities->iso = mojom::Range::New(); |
623 photo_capabilities->height = mojom::Range::New(); | 623 photo_capabilities->height = mojom::Range::New( |
624 photo_capabilities->width = mojom::Range::New(); | 624 capture_format_.frame_size.height(), capture_format_.frame_size.height(), |
| 625 capture_format_.frame_size.height(), 0 /* step */); |
| 626 photo_capabilities->width = mojom::Range::New( |
| 627 capture_format_.frame_size.width(), capture_format_.frame_size.width(), |
| 628 capture_format_.frame_size.width(), 0 /* step */); |
625 photo_capabilities->exposure_compensation = mojom::Range::New(); | 629 photo_capabilities->exposure_compensation = mojom::Range::New(); |
626 photo_capabilities->red_eye_reduction = mojom::RedEyeReduction::NEVER; | 630 photo_capabilities->red_eye_reduction = mojom::RedEyeReduction::NEVER; |
627 photo_capabilities->torch = false; | 631 photo_capabilities->torch = false; |
628 | 632 |
629 photo_capabilities->brightness = | 633 photo_capabilities->brightness = |
630 RetrieveUserControlRange(device_fd_.get(), V4L2_CID_BRIGHTNESS); | 634 RetrieveUserControlRange(device_fd_.get(), V4L2_CID_BRIGHTNESS); |
631 photo_capabilities->contrast = | 635 photo_capabilities->contrast = |
632 RetrieveUserControlRange(device_fd_.get(), V4L2_CID_CONTRAST); | 636 RetrieveUserControlRange(device_fd_.get(), V4L2_CID_CONTRAST); |
633 photo_capabilities->saturation = | 637 photo_capabilities->saturation = |
634 RetrieveUserControlRange(device_fd_.get(), V4L2_CID_SATURATION); | 638 RetrieveUserControlRange(device_fd_.get(), V4L2_CID_SATURATION); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; | 859 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; |
856 return false; | 860 return false; |
857 } | 861 } |
858 start_ = static_cast<uint8_t*>(start); | 862 start_ = static_cast<uint8_t*>(start); |
859 length_ = buffer.length; | 863 length_ = buffer.length; |
860 payload_size_ = 0; | 864 payload_size_ = 0; |
861 return true; | 865 return true; |
862 } | 866 } |
863 | 867 |
864 } // namespace media | 868 } // namespace media |
OLD | NEW |