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

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

Issue 2169013002: Change class VideoCaptureDevice::Name to struct VideoCaptureDeviceDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build errors Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_ 5 #ifndef MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_
6 #define MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_ 6 #define MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 26 matching lines...) Expand all
37 static size_t GetNumPlanesForFourCc(uint32_t fourcc); 37 static size_t GetNumPlanesForFourCc(uint32_t fourcc);
38 // Returns the Chrome pixel format for |v4l2_fourcc| or PIXEL_FORMAT_UNKNOWN. 38 // Returns the Chrome pixel format for |v4l2_fourcc| or PIXEL_FORMAT_UNKNOWN.
39 static VideoPixelFormat V4l2FourCcToChromiumPixelFormat( 39 static VideoPixelFormat V4l2FourCcToChromiumPixelFormat(
40 uint32_t v4l2_fourcc); 40 uint32_t v4l2_fourcc);
41 41
42 // Composes a list of usable and supported pixel formats, in order of 42 // Composes a list of usable and supported pixel formats, in order of
43 // preference, with MJPEG prioritised depending on |prefer_mjpeg|. 43 // preference, with MJPEG prioritised depending on |prefer_mjpeg|.
44 static std::list<uint32_t> GetListOfUsableFourCcs(bool prefer_mjpeg); 44 static std::list<uint32_t> GetListOfUsableFourCcs(bool prefer_mjpeg);
45 45
46 V4L2CaptureDelegate( 46 V4L2CaptureDelegate(
47 const VideoCaptureDevice::Name& device_name, 47 const VideoCaptureDeviceDescriptor& device_descriptor,
48 const scoped_refptr<base::SingleThreadTaskRunner>& v4l2_task_runner, 48 const scoped_refptr<base::SingleThreadTaskRunner>& v4l2_task_runner,
49 int power_line_frequency); 49 int power_line_frequency);
50 50
51 // Forward-to versions of VideoCaptureDevice virtual methods. 51 // Forward-to versions of VideoCaptureDevice virtual methods.
52 void AllocateAndStart(int width, 52 void AllocateAndStart(int width,
53 int height, 53 int height,
54 float frame_rate, 54 float frame_rate,
55 std::unique_ptr<VideoCaptureDevice::Client> client); 55 std::unique_ptr<VideoCaptureDevice::Client> client);
56 void StopAndDeAllocate(); 56 void StopAndDeAllocate();
57 57
58 void SetRotation(int rotation); 58 void SetRotation(int rotation);
59 59
60 private: 60 private:
61 friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>; 61 friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>;
62 ~V4L2CaptureDelegate(); 62 ~V4L2CaptureDelegate();
63 63
64 // VIDIOC_QUERYBUFs a buffer from V4L2, creates a BufferTracker for it and 64 // VIDIOC_QUERYBUFs a buffer from V4L2, creates a BufferTracker for it and
65 // enqueues it (VIDIOC_QBUF) back into V4L2. 65 // enqueues it (VIDIOC_QBUF) back into V4L2.
66 bool MapAndQueueBuffer(int index); 66 bool MapAndQueueBuffer(int index);
67 67
68 void DoCapture(); 68 void DoCapture();
69 69
70 void SetErrorState(const tracked_objects::Location& from_here, 70 void SetErrorState(const tracked_objects::Location& from_here,
71 const std::string& reason); 71 const std::string& reason);
72 72
73 const scoped_refptr<base::SingleThreadTaskRunner> v4l2_task_runner_; 73 const scoped_refptr<base::SingleThreadTaskRunner> v4l2_task_runner_;
74 const VideoCaptureDevice::Name device_name_; 74 const VideoCaptureDeviceDescriptor device_descriptor_;
75 const int power_line_frequency_; 75 const int power_line_frequency_;
76 76
77 // The following members are only known on AllocateAndStart(). 77 // The following members are only known on AllocateAndStart().
78 VideoCaptureFormat capture_format_; 78 VideoCaptureFormat capture_format_;
79 v4l2_format video_fmt_; 79 v4l2_format video_fmt_;
80 std::unique_ptr<VideoCaptureDevice::Client> client_; 80 std::unique_ptr<VideoCaptureDevice::Client> client_;
81 base::ScopedFD device_fd_; 81 base::ScopedFD device_fd_;
82 82
83 // Vector of BufferTracker to keep track of mmap()ed pointers and their use. 83 // Vector of BufferTracker to keep track of mmap()ed pointers and their use.
84 class BufferTracker; 84 class BufferTracker;
85 std::vector<scoped_refptr<BufferTracker>> buffer_tracker_pool_; 85 std::vector<scoped_refptr<BufferTracker>> buffer_tracker_pool_;
86 86
87 bool is_capturing_; 87 bool is_capturing_;
88 int timeout_count_; 88 int timeout_count_;
89 89
90 // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270. 90 // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270.
91 int rotation_; 91 int rotation_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(V4L2CaptureDelegate); 93 DISALLOW_COPY_AND_ASSIGN(V4L2CaptureDelegate);
94 }; 94 };
95 95
96 } // namespace media 96 } // namespace media
97 97
98 #endif // MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_ 98 #endif // MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_
OLDNEW
« no previous file with comments | « media/capture/video/file_video_capture_device_factory.cc ('k') | media/capture/video/linux/v4l2_capture_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698