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

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

Issue 270263008: Add a ChromeOS implementation of VideoCaptureDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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 | Annotate | Revision Log
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 // 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_VIDEO_CAPTURE_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_ 10 #ifndef MEDIA_VIDEO_CAPTURE_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_
(...skipping 17 matching lines...) Expand all
28 28
29 explicit VideoCaptureDeviceLinux(const Name& device_name); 29 explicit VideoCaptureDeviceLinux(const Name& device_name);
30 virtual ~VideoCaptureDeviceLinux(); 30 virtual ~VideoCaptureDeviceLinux();
31 31
32 // VideoCaptureDevice implementation. 32 // VideoCaptureDevice implementation.
33 virtual void AllocateAndStart(const VideoCaptureParams& params, 33 virtual void AllocateAndStart(const VideoCaptureParams& params,
34 scoped_ptr<Client> client) OVERRIDE; 34 scoped_ptr<Client> client) OVERRIDE;
35 35
36 virtual void StopAndDeAllocate() OVERRIDE; 36 virtual void StopAndDeAllocate() OVERRIDE;
37 37
38 protected:
39 void SetRotation(int rotation);
40
41 // Once |v4l2_thread_| is started, only called on that thread.
42 void SetRotationOnV4L2Thread(int rotation);
43
38 private: 44 private:
39 enum InternalState { 45 enum InternalState {
40 kIdle, // The device driver is opened but camera is not in use. 46 kIdle, // The device driver is opened but camera is not in use.
41 kCapturing, // Video is being captured. 47 kCapturing, // Video is being captured.
42 kError // Error accessing HW functions. 48 kError // Error accessing HW functions.
43 // User needs to recover by destroying the object. 49 // User needs to recover by destroying the object.
44 }; 50 };
45 51
46 // Buffers used to receive video frames from with v4l2. 52 // Buffers used to receive video frames from with v4l2.
47 struct Buffer { 53 struct Buffer {
(...skipping 17 matching lines...) Expand all
65 InternalState state_; 71 InternalState state_;
66 scoped_ptr<VideoCaptureDevice::Client> client_; 72 scoped_ptr<VideoCaptureDevice::Client> client_;
67 Name device_name_; 73 Name device_name_;
68 base::ScopedFD device_fd_; // File descriptor for the opened camera device. 74 base::ScopedFD device_fd_; // File descriptor for the opened camera device.
69 base::Thread v4l2_thread_; // Thread used for reading data from the device. 75 base::Thread v4l2_thread_; // Thread used for reading data from the device.
70 Buffer* buffer_pool_; 76 Buffer* buffer_pool_;
71 int buffer_pool_size_; // Number of allocated buffers. 77 int buffer_pool_size_; // Number of allocated buffers.
72 int timeout_count_; 78 int timeout_count_;
73 VideoCaptureFormat capture_format_; 79 VideoCaptureFormat capture_format_;
74 80
81 // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270.
82 // This is only used on |v4l2_thread_| when it is running, or the constructor
83 // thread otherwise.
84 int rotation_;
85
75 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceLinux); 86 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceLinux);
76 }; 87 };
77 88
78 } // namespace media 89 } // namespace media
79 90
80 #endif // MEDIA_VIDEO_CAPTURE_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_ 91 #endif // MEDIA_VIDEO_CAPTURE_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698