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 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 } | 72 } |
73 | 73 |
74 void VideoCaptureDeviceLinux::StopAndDeAllocate() { | 74 void VideoCaptureDeviceLinux::StopAndDeAllocate() { |
75 if (!v4l2_thread_.IsRunning()) | 75 if (!v4l2_thread_.IsRunning()) |
76 return; // Wrong state. | 76 return; // Wrong state. |
77 v4l2_thread_.task_runner()->PostTask( | 77 v4l2_thread_.task_runner()->PostTask( |
78 FROM_HERE, | 78 FROM_HERE, |
79 base::Bind(&V4L2CaptureDelegate::StopAndDeAllocate, capture_impl_)); | 79 base::Bind(&V4L2CaptureDelegate::StopAndDeAllocate, capture_impl_)); |
80 v4l2_thread_.Stop(); | 80 v4l2_thread_.Stop(); |
81 | 81 |
82 capture_impl_ = NULL; | 82 capture_impl_ = NULL; |
mcasas
2016/09/16 03:50:37
nit: not your code, but can you s/NULL/nullptr/ pl
xianglu
2016/09/16 18:22:34
Done.
| |
83 } | 83 } |
84 | 84 |
85 void VideoCaptureDeviceLinux::TakePhoto(TakePhotoCallback callback) { | |
86 DCHECK(capture_impl_); | |
87 DCHECK(v4l2_thread_.IsRunning()); | |
mcasas
2016/09/16 03:50:37
This should be a
if (!v4l2_thread_.IsRunning())
xianglu
2016/09/16 18:22:34
Done.
| |
88 DVLOG(1) << "in VCDLinux: TakePhoto() is called"; | |
mcasas
2016/09/16 03:50:37
nit: Remove this. In any case, it should be
before
xianglu
2016/09/16 18:22:34
Done.
| |
89 | |
90 v4l2_thread_.task_runner()->PostTask( | |
91 FROM_HERE, base::Bind(&V4L2CaptureDelegate::TakePhoto, capture_impl_, | |
92 base::Passed(&callback))); | |
93 } | |
94 | |
85 void VideoCaptureDeviceLinux::SetRotation(int rotation) { | 95 void VideoCaptureDeviceLinux::SetRotation(int rotation) { |
86 if (v4l2_thread_.IsRunning()) { | 96 if (v4l2_thread_.IsRunning()) { |
87 v4l2_thread_.task_runner()->PostTask( | 97 v4l2_thread_.task_runner()->PostTask( |
88 FROM_HERE, | 98 FROM_HERE, |
89 base::Bind(&V4L2CaptureDelegate::SetRotation, capture_impl_, rotation)); | 99 base::Bind(&V4L2CaptureDelegate::SetRotation, capture_impl_, rotation)); |
90 } | 100 } |
91 } | 101 } |
92 | 102 |
93 // static | 103 // static |
94 int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2( | 104 int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2( |
95 PowerLineFrequency frequency) { | 105 PowerLineFrequency frequency) { |
96 switch (frequency) { | 106 switch (frequency) { |
97 case media::PowerLineFrequency::FREQUENCY_50HZ: | 107 case media::PowerLineFrequency::FREQUENCY_50HZ: |
98 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; | 108 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; |
99 case media::PowerLineFrequency::FREQUENCY_60HZ: | 109 case media::PowerLineFrequency::FREQUENCY_60HZ: |
100 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; | 110 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; |
101 default: | 111 default: |
102 // If we have no idea of the frequency, at least try and set it to AUTO. | 112 // If we have no idea of the frequency, at least try and set it to AUTO. |
103 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; | 113 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; |
104 } | 114 } |
105 } | 115 } |
106 | 116 |
107 } // namespace media | 117 } // namespace media |
OLD | NEW |