| 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/video/capture/linux/video_capture_device_linux.h" | 5 #include "media/video/capture/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const VideoCaptureParams& params, | 93 const VideoCaptureParams& params, |
| 94 scoped_ptr<VideoCaptureDevice::Client> client) { | 94 scoped_ptr<VideoCaptureDevice::Client> client) { |
| 95 DCHECK(!capture_impl_); | 95 DCHECK(!capture_impl_); |
| 96 if (v4l2_thread_.IsRunning()) | 96 if (v4l2_thread_.IsRunning()) |
| 97 return; // Wrong state. | 97 return; // Wrong state. |
| 98 v4l2_thread_.Start(); | 98 v4l2_thread_.Start(); |
| 99 | 99 |
| 100 const int line_frequency = | 100 const int line_frequency = |
| 101 TranslatePowerLineFrequencyToV4L2(GetPowerLineFrequencyForLocation()); | 101 TranslatePowerLineFrequencyToV4L2(GetPowerLineFrequencyForLocation()); |
| 102 capture_impl_ = V4L2CaptureDelegate::CreateV4L2CaptureDelegate( | 102 capture_impl_ = V4L2CaptureDelegate::CreateV4L2CaptureDelegate( |
| 103 device_name_, v4l2_thread_.message_loop_proxy(), line_frequency); | 103 device_name_, |
| 104 v4l2_thread_.message_loop_proxy(), |
| 105 client.get(), |
| 106 params.use_native_gpu_memory_buffers, |
| 107 line_frequency); |
| 104 if (!capture_impl_) { | 108 if (!capture_impl_) { |
| 105 client->OnError("Failed to create VideoCaptureDelegate"); | 109 client->OnError("Failed to create VideoCaptureDelegate"); |
| 106 return; | 110 return; |
| 107 } | 111 } |
| 108 v4l2_thread_.message_loop()->PostTask( | 112 v4l2_thread_.message_loop()->PostTask( |
| 109 FROM_HERE, | 113 FROM_HERE, |
| 110 base::Bind(&V4L2CaptureDelegate::AllocateAndStart, capture_impl_, | 114 base::Bind(&V4L2CaptureDelegate::AllocateAndStart, capture_impl_, |
| 111 params.requested_format.frame_size.width(), | 115 params.requested_format.frame_size.width(), |
| 112 params.requested_format.frame_size.height(), | 116 params.requested_format.frame_size.height(), |
| 113 params.requested_format.frame_rate, base::Passed(&client))); | 117 params.requested_format.frame_rate, base::Passed(&client))); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 139 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; | 143 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; |
| 140 case kPowerLine60Hz: | 144 case kPowerLine60Hz: |
| 141 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; | 145 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; |
| 142 default: | 146 default: |
| 143 // If we have no idea of the frequency, at least try and set it to AUTO. | 147 // If we have no idea of the frequency, at least try and set it to AUTO. |
| 144 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; | 148 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; |
| 145 } | 149 } |
| 146 } | 150 } |
| 147 | 151 |
| 148 } // namespace media | 152 } // namespace media |
| OLD | NEW |