| OLD | NEW | 
|---|
| 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  Loading... | 
| 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 CAPTURE_EXPORT V4L2CaptureDelegate final | 
| 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|. | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 58   void TakePhoto(VideoCaptureDevice::TakePhotoCallback callback); | 58   void TakePhoto(VideoCaptureDevice::TakePhotoCallback callback); | 
| 59 | 59 | 
| 60   void GetPhotoCapabilities( | 60   void GetPhotoCapabilities( | 
| 61       VideoCaptureDevice::GetPhotoCapabilitiesCallback callback); | 61       VideoCaptureDevice::GetPhotoCapabilitiesCallback callback); | 
| 62   void SetPhotoOptions(mojom::PhotoSettingsPtr settings, | 62   void SetPhotoOptions(mojom::PhotoSettingsPtr settings, | 
| 63                        VideoCaptureDevice::SetPhotoOptionsCallback callback); | 63                        VideoCaptureDevice::SetPhotoOptionsCallback callback); | 
| 64 | 64 | 
| 65   void SetRotation(int rotation); | 65   void SetRotation(int rotation); | 
| 66 | 66 | 
| 67  private: | 67  private: | 
|  | 68   friend class V4L2CaptureDelegateTest; | 
|  | 69 | 
| 68   friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>; | 70   friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>; | 
| 69   ~V4L2CaptureDelegate(); | 71   ~V4L2CaptureDelegate(); | 
| 70 | 72 | 
| 71   class BufferTracker; | 73   class BufferTracker; | 
| 72 | 74 | 
| 73   // VIDIOC_QUERYBUFs a buffer from V4L2, creates a BufferTracker for it and | 75   // VIDIOC_QUERYBUFs a buffer from V4L2, creates a BufferTracker for it and | 
| 74   // enqueues it (VIDIOC_QBUF) back into V4L2. | 76   // enqueues it (VIDIOC_QBUF) back into V4L2. | 
| 75   bool MapAndQueueBuffer(int index); | 77   bool MapAndQueueBuffer(int index); | 
| 76 | 78 | 
| 77   void DoCapture(); | 79   void DoCapture(); | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 101 | 103 | 
| 102   // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270. | 104   // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270. | 
| 103   int rotation_; | 105   int rotation_; | 
| 104 | 106 | 
| 105   DISALLOW_COPY_AND_ASSIGN(V4L2CaptureDelegate); | 107   DISALLOW_COPY_AND_ASSIGN(V4L2CaptureDelegate); | 
| 106 }; | 108 }; | 
| 107 | 109 | 
| 108 }  // namespace media | 110 }  // namespace media | 
| 109 | 111 | 
| 110 #endif  // MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_ | 112 #endif  // MEDIA_CAPTURE_VIDEO_LINUX_V4L2_CAPTURE_DELEGATE_H_ | 
| OLD | NEW | 
|---|