Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Side by Side Diff: media/capture/video/linux/video_capture_device_linux.cc

Issue 2344123002: ImageCapture: Implement TakePhoto() for Linux/CrOs (Closed)
Patch Set: v4l2_capture_delegate.cc l.152: Added back '&0xf0' Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_ = nullptr;
83 }
84
85 void VideoCaptureDeviceLinux::TakePhoto(TakePhotoCallback callback) {
86 DCHECK(capture_impl_);
87 if (!v4l2_thread_.IsRunning())
88 return;
89 v4l2_thread_.task_runner()->PostTask(
90 FROM_HERE, base::Bind(&V4L2CaptureDelegate::TakePhoto, capture_impl_,
91 base::Passed(&callback)));
83 } 92 }
84 93
85 void VideoCaptureDeviceLinux::SetRotation(int rotation) { 94 void VideoCaptureDeviceLinux::SetRotation(int rotation) {
86 if (v4l2_thread_.IsRunning()) { 95 if (v4l2_thread_.IsRunning()) {
87 v4l2_thread_.task_runner()->PostTask( 96 v4l2_thread_.task_runner()->PostTask(
88 FROM_HERE, 97 FROM_HERE,
89 base::Bind(&V4L2CaptureDelegate::SetRotation, capture_impl_, rotation)); 98 base::Bind(&V4L2CaptureDelegate::SetRotation, capture_impl_, rotation));
90 } 99 }
91 } 100 }
92 101
93 // static 102 // static
94 int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2( 103 int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2(
95 PowerLineFrequency frequency) { 104 PowerLineFrequency frequency) {
96 switch (frequency) { 105 switch (frequency) {
97 case media::PowerLineFrequency::FREQUENCY_50HZ: 106 case media::PowerLineFrequency::FREQUENCY_50HZ:
98 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; 107 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ;
99 case media::PowerLineFrequency::FREQUENCY_60HZ: 108 case media::PowerLineFrequency::FREQUENCY_60HZ:
100 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; 109 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ;
101 default: 110 default:
102 // If we have no idea of the frequency, at least try and set it to AUTO. 111 // If we have no idea of the frequency, at least try and set it to AUTO.
103 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; 112 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO;
104 } 113 }
105 } 114 }
106 115
107 } // namespace media 116 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/linux/video_capture_device_linux.h ('k') | media/capture/video/video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698