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 #include "media/capture/video/linux/video_capture_device_linux.h" | 5 #include "media/capture/video/linux/video_capture_device_linux.h" |
6 | 6 |
7 #if defined(OS_OPENBSD) | 7 #if defined(OS_OPENBSD) |
8 #include <sys/videoio.h> | 8 #include <sys/videoio.h> |
9 #else | 9 #else |
10 #include <linux/videodev2.h> | 10 #include <linux/videodev2.h> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 DCHECK(!capture_impl_); | 94 DCHECK(!capture_impl_); |
95 if (v4l2_thread_.IsRunning()) | 95 if (v4l2_thread_.IsRunning()) |
96 return; // Wrong state. | 96 return; // Wrong state. |
97 v4l2_thread_.Start(); | 97 v4l2_thread_.Start(); |
98 | 98 |
99 const int line_frequency = | 99 const int line_frequency = |
100 TranslatePowerLineFrequencyToV4L2(GetPowerLineFrequency(params)); | 100 TranslatePowerLineFrequencyToV4L2(GetPowerLineFrequency(params)); |
101 capture_impl_ = V4L2CaptureDelegate::CreateV4L2CaptureDelegate( | 101 capture_impl_ = V4L2CaptureDelegate::CreateV4L2CaptureDelegate( |
102 device_name_, v4l2_thread_.task_runner(), line_frequency); | 102 device_name_, v4l2_thread_.task_runner(), line_frequency); |
103 if (!capture_impl_) { | 103 if (!capture_impl_) { |
104 client->OnError("Failed to create VideoCaptureDelegate"); | 104 client->OnError(FROM_HERE, "Failed to create VideoCaptureDelegate"); |
105 return; | 105 return; |
106 } | 106 } |
107 v4l2_thread_.message_loop()->PostTask( | 107 v4l2_thread_.message_loop()->PostTask( |
108 FROM_HERE, | 108 FROM_HERE, |
109 base::Bind(&V4L2CaptureDelegate::AllocateAndStart, capture_impl_, | 109 base::Bind(&V4L2CaptureDelegate::AllocateAndStart, capture_impl_, |
110 params.requested_format.frame_size.width(), | 110 params.requested_format.frame_size.width(), |
111 params.requested_format.frame_size.height(), | 111 params.requested_format.frame_size.height(), |
112 params.requested_format.frame_rate, base::Passed(&client))); | 112 params.requested_format.frame_rate, base::Passed(&client))); |
113 } | 113 } |
114 | 114 |
(...skipping 24 matching lines...) Expand all Loading... |
139 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; | 139 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; |
140 case media::PowerLineFrequency::FREQUENCY_60HZ: | 140 case media::PowerLineFrequency::FREQUENCY_60HZ: |
141 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; | 141 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; |
142 default: | 142 default: |
143 // If we have no idea of the frequency, at least try and set it to AUTO. | 143 // If we have no idea of the frequency, at least try and set it to AUTO. |
144 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; | 144 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 } // namespace media | 148 } // namespace media |
OLD | NEW |