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

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

Issue 2362333002: Reland: Image Capture Linux/CrOs: wire some capabilities set/get (Closed)
Patch Set: Added more condition Checks and cleaned up unit tests thread-hopping Created 4 years, 2 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 12 matching lines...) Expand all
23 namespace tracked_objects { 23 namespace tracked_objects {
24 class Location; 24 class Location;
25 } // namespace tracked_objects 25 } // namespace tracked_objects
26 26
27 namespace media { 27 namespace media {
28 28
29 // Class doing the actual Linux capture using V4L2 API. V4L2 SPLANE/MPLANE 29 // Class doing the actual Linux capture using V4L2 API. V4L2 SPLANE/MPLANE
30 // capture specifics are implemented in derived classes. Created and destroyed 30 // capture specifics are implemented in derived classes. Created and destroyed
31 // on the owner's thread, otherwise living and operating on |v4l2_task_runner_|. 31 // on the owner's thread, otherwise living and operating on |v4l2_task_runner_|.
32 // TODO(mcasas): Make this class a non-ref-counted. 32 // TODO(mcasas): Make this class a non-ref-counted.
33 class V4L2CaptureDelegate final 33 class V4L2CaptureDelegate final
chfremer 2016/09/23 21:18:29 Question/suggestion unrelated to this CL: Why is t
mcasas 2016/09/23 22:10:57 History. It used to be inside VideoCaptureDeviceLi
34 : public base::RefCountedThreadSafe<V4L2CaptureDelegate> { 34 : public base::RefCountedThreadSafe<V4L2CaptureDelegate> {
35 public: 35 public:
36 // Retrieves the #planes for a given |fourcc|, or 0 if unknown. 36 // Retrieves the #planes for a given |fourcc|, or 0 if unknown.
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 VideoCaptureDeviceDescriptor& device_descriptor, 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 TakePhoto(VideoCaptureDevice::TakePhotoCallback callback); 58 void TakePhoto(VideoCaptureDevice::TakePhotoCallback callback);
59 59
60 void GetPhotoCapabilities(
61 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback);
62 void SetPhotoOptions(mojom::PhotoSettingsPtr settings,
chfremer 2016/09/23 21:18:29 nit: photo options vs. photo settings, could be ma
mcasas 2016/09/23 22:10:57 They follow the idl names, which in turn come from
63 VideoCaptureDevice::SetPhotoOptionsCallback callback);
64
60 void SetRotation(int rotation); 65 void SetRotation(int rotation);
61 66
62 private: 67 private:
63 friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>; 68 friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>;
64 ~V4L2CaptureDelegate(); 69 ~V4L2CaptureDelegate();
65 70
66 class BufferTracker; 71 class BufferTracker;
67 72
68 // VIDIOC_QUERYBUFs a buffer from V4L2, creates a BufferTracker for it and 73 // VIDIOC_QUERYBUFs a buffer from V4L2, creates a BufferTracker for it and
69 // enqueues it (VIDIOC_QBUF) back into V4L2. 74 // enqueues it (VIDIOC_QBUF) back into V4L2.
(...skipping 24 matching lines...) Expand all
94 99
95 // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270. 100 // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270.
96 int rotation_; 101 int rotation_;
97 102
98 DISALLOW_COPY_AND_ASSIGN(V4L2CaptureDelegate); 103 DISALLOW_COPY_AND_ASSIGN(V4L2CaptureDelegate);
99 }; 104 };
100 105
101 } // namespace media 106 } // namespace media
102 107
103 #endif // MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_ 108 #endif // MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | media/capture/video/linux/v4l2_capture_delegate.cc » ('j') | media/capture/video/linux/v4l2_capture_delegate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698