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

Side by Side Diff: media/capture/video/chromeos/video_capture_device_arc_chromeos.h

Issue 2837273004: media: add video capture device for ARC++ camera HAL v3 (Closed)
Patch Set: address wuchengli's and chfremer's comments Created 3 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_CHROMEOS_H_
6 #define MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_CHROMEOS_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11 #include <string>
12
13 #include "base/macros.h"
14 #include "base/threading/thread.h"
15 #include "media/capture/video/chromeos/mojo/arc_camera3.mojom.h"
16 #include "media/capture/video/video_capture_device.h"
17 #include "media/capture/video/video_capture_device_descriptor.h"
18 #include "media/capture/video_capture_types.h"
19
20 namespace display {
21
22 class Display;
23
24 } // namespace display
25
26 namespace media {
27
28 class CameraHalDelegate;
29 class CameraDeviceDelegate;
30
31 // Implementation of VideoCaptureDevice for ChromeOS with ARC++ camera HALv3.
32 class CAPTURE_EXPORT VideoCaptureDeviceArcChromeOS final
33 : public VideoCaptureDevice {
34 public:
35 VideoCaptureDeviceArcChromeOS(
36 scoped_refptr<base::SingleThreadTaskRunner>
37 task_runner_for_screen_observer,
38 const VideoCaptureDeviceDescriptor& device_descriptor,
39 scoped_refptr<CameraHalDelegate> camera_hal_delegate);
40
41 ~VideoCaptureDeviceArcChromeOS() final;
42
43 // VideoCaptureDevice implementation.
44 void AllocateAndStart(const VideoCaptureParams& params,
45 std::unique_ptr<Client> client) final;
46 void StopAndDeAllocate() final;
47 void TakePhoto(TakePhotoCallback callback) final;
48 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) final;
49 void SetPhotoOptions(mojom::PhotoSettingsPtr settings,
50 SetPhotoOptionsCallback callback) final;
51
52 private:
53 class ScreenObserverDelegate;
54
55 void SetRotation(int rotation);
56 void SetDisplayRotation(const display::Display& display);
57
58 const VideoCaptureDeviceDescriptor device_descriptor_;
59
60 // A reference to the CameraHalDelegate instance in the VCD factory. This is
61 // used by AllocateAndStart to query camera info and create the camera device.
62 const scoped_refptr<CameraHalDelegate> camera_hal_delegate_;
63
64 // A reference to the thread that all the VideoCaptureDevice interface methods
65 // are expected to be called on.
66 const scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
67
68 // The thread that all the Mojo operations of |camera_device_delegate_| take
69 // place. Started in AllocateAndStart and stopped in StopAndDeAllocate, where
70 // the access to the base::Thread methods are sequenced on
71 // |capture_task_runner_|.
72 base::Thread device_thread_;
73
74 // Internal delegate doing the actual capture setting, buffer allocation and
75 // circulation with the camera HAL. Created on |module_task_runner_| of
76 // |camera_hal_delegate_| in AllocateAndStart and deleted in StopAndDeAllocate
77 // on |capture_task_runner_|. The creation and deletion of
78 // |camera_device_delegate_| is serialized through a WaitableEvent.
79 // All methods of |camera_device_delegate_| operate on |device_thread_|.
80 scoped_refptr<CameraDeviceDelegate> camera_device_delegate_;
81
82 scoped_refptr<ScreenObserverDelegate> screen_observer_delegate_;
83 const VideoFacingMode lens_facing_;
84 const int camera_orientation_;
85 // Whether the incoming frames should rotate when the device rotates.
86 const bool rotates_with_device_;
87 int rotation_;
88
89 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceArcChromeOS);
90 };
91
92 } // namespace media
93
94 #endif // MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698