OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Linux specific implementation of VideoCaptureDevice. | 5 // Linux specific implementation of VideoCaptureDevice. |
6 // V4L2 is used for capturing. V4L2 does not provide its own thread for | 6 // V4L2 is used for capturing. V4L2 does not provide its own thread for |
7 // capturing so this implementation uses a Chromium thread for fetching frames | 7 // capturing so this implementation uses a Chromium thread for fetching frames |
8 // from V4L2. | 8 // from V4L2. |
9 | 9 |
10 #ifndef MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_ | 10 #ifndef MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_ |
(...skipping 21 matching lines...) Expand all Loading... |
32 static std::list<uint32_t> GetListOfUsableFourCCs(bool favour_mjpeg); | 32 static std::list<uint32_t> GetListOfUsableFourCCs(bool favour_mjpeg); |
33 | 33 |
34 explicit VideoCaptureDeviceLinux( | 34 explicit VideoCaptureDeviceLinux( |
35 const VideoCaptureDeviceDescriptor& device_descriptor); | 35 const VideoCaptureDeviceDescriptor& device_descriptor); |
36 ~VideoCaptureDeviceLinux() override; | 36 ~VideoCaptureDeviceLinux() override; |
37 | 37 |
38 // VideoCaptureDevice implementation. | 38 // VideoCaptureDevice implementation. |
39 void AllocateAndStart(const VideoCaptureParams& params, | 39 void AllocateAndStart(const VideoCaptureParams& params, |
40 std::unique_ptr<Client> client) override; | 40 std::unique_ptr<Client> client) override; |
41 void StopAndDeAllocate() override; | 41 void StopAndDeAllocate() override; |
| 42 void TakePhoto(TakePhotoCallback callback) override; |
42 | 43 |
43 protected: | 44 protected: |
44 void SetRotation(int rotation); | 45 void SetRotation(int rotation); |
45 | 46 |
46 private: | 47 private: |
47 static int TranslatePowerLineFrequencyToV4L2(PowerLineFrequency frequency); | 48 static int TranslatePowerLineFrequencyToV4L2(PowerLineFrequency frequency); |
48 | 49 |
49 // Internal delegate doing the actual capture setting, buffer allocation and | 50 // Internal delegate doing the actual capture setting, buffer allocation and |
50 // circulation with the V4L2 API. Created and deleted in the thread where | 51 // circulation with the V4L2 API. Created and deleted in the thread where |
51 // VideoCaptureDeviceLinux lives but otherwise operating on |v4l2_thread_|. | 52 // VideoCaptureDeviceLinux lives but otherwise operating on |v4l2_thread_|. |
52 scoped_refptr<V4L2CaptureDelegate> capture_impl_; | 53 scoped_refptr<V4L2CaptureDelegate> capture_impl_; |
53 | 54 |
54 base::Thread v4l2_thread_; // Thread used for reading data from the device. | 55 base::Thread v4l2_thread_; // Thread used for reading data from the device. |
55 | 56 |
56 const VideoCaptureDeviceDescriptor device_descriptor_; | 57 const VideoCaptureDeviceDescriptor device_descriptor_; |
57 | 58 |
58 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceLinux); | 59 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceLinux); |
59 }; | 60 }; |
60 | 61 |
61 } // namespace media | 62 } // namespace media |
62 | 63 |
63 #endif // MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_ | 64 #endif // MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_ |
OLD | NEW |