OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ | 5 #ifndef MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ |
6 #define MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ | 6 #define MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "media/capture/capture_export.h" | 14 #include "media/base/media_export.h" |
15 #include "media/capture/content/thread_safe_capture_oracle.h" | 15 #include "media/capture/content/thread_safe_capture_oracle.h" |
16 #include "media/capture/video/video_capture_device.h" | 16 #include "media/capture/video/video_capture_device.h" |
17 | 17 |
18 namespace tracked_objects { | 18 namespace tracked_objects { |
19 class Location; | 19 class Location; |
20 } // namespace tracked_objects | 20 } // namespace tracked_objects |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 struct VideoCaptureParams; | 24 struct VideoCaptureParams; |
25 | 25 |
26 class ThreadSafeCaptureOracle; | 26 class ThreadSafeCaptureOracle; |
27 | 27 |
28 // Keeps track of the video capture source frames and executes copying. | 28 // Keeps track of the video capture source frames and executes copying. |
29 class CAPTURE_EXPORT VideoCaptureMachine { | 29 class MEDIA_EXPORT VideoCaptureMachine { |
30 public: | 30 public: |
31 VideoCaptureMachine(); | 31 VideoCaptureMachine(); |
32 virtual ~VideoCaptureMachine(); | 32 virtual ~VideoCaptureMachine(); |
33 | 33 |
34 // Starts capturing. | 34 // Starts capturing. |
35 // |callback| is invoked with true if succeeded. Otherwise, with false. | 35 // |callback| is invoked with true if succeeded. Otherwise, with false. |
36 virtual void Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, | 36 virtual void Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
37 const VideoCaptureParams& params, | 37 const VideoCaptureParams& params, |
38 const base::Callback<void(bool)> callback) = 0; | 38 const base::Callback<void(bool)> callback) = 0; |
39 | 39 |
(...skipping 25 matching lines...) Expand all Loading... |
65 // The "meat" of a content video capturer. | 65 // The "meat" of a content video capturer. |
66 // | 66 // |
67 // Separating this from the "shell classes" WebContentsVideoCaptureDevice and | 67 // Separating this from the "shell classes" WebContentsVideoCaptureDevice and |
68 // DesktopCaptureDeviceAura allows safe destruction without needing to block any | 68 // DesktopCaptureDeviceAura allows safe destruction without needing to block any |
69 // threads, as well as code sharing. | 69 // threads, as well as code sharing. |
70 // | 70 // |
71 // ScreenCaptureDeviceCore manages a simple state machine and the pipeline | 71 // ScreenCaptureDeviceCore manages a simple state machine and the pipeline |
72 // (see notes at top of this file). It times the start of successive captures | 72 // (see notes at top of this file). It times the start of successive captures |
73 // and facilitates the processing of each through the stages of the | 73 // and facilitates the processing of each through the stages of the |
74 // pipeline. | 74 // pipeline. |
75 class CAPTURE_EXPORT ScreenCaptureDeviceCore | 75 class MEDIA_EXPORT ScreenCaptureDeviceCore |
76 : public base::SupportsWeakPtr<ScreenCaptureDeviceCore> { | 76 : public base::SupportsWeakPtr<ScreenCaptureDeviceCore> { |
77 public: | 77 public: |
78 ScreenCaptureDeviceCore(std::unique_ptr<VideoCaptureMachine> capture_machine); | 78 ScreenCaptureDeviceCore(std::unique_ptr<VideoCaptureMachine> capture_machine); |
79 virtual ~ScreenCaptureDeviceCore(); | 79 virtual ~ScreenCaptureDeviceCore(); |
80 | 80 |
81 // Asynchronous requests to change ScreenCaptureDeviceCore state. | 81 // Asynchronous requests to change ScreenCaptureDeviceCore state. |
82 void AllocateAndStart(const VideoCaptureParams& params, | 82 void AllocateAndStart(const VideoCaptureParams& params, |
83 std::unique_ptr<VideoCaptureDevice::Client> client); | 83 std::unique_ptr<VideoCaptureDevice::Client> client); |
84 void RequestRefreshFrame(); | 84 void RequestRefreshFrame(); |
85 void StopAndDeAllocate(); | 85 void StopAndDeAllocate(); |
(...skipping 27 matching lines...) Expand all Loading... |
113 // capture pipeline. Besides the VideoCaptureDevice itself, it is the only | 113 // capture pipeline. Besides the VideoCaptureDevice itself, it is the only |
114 // component of the system with direct access to |client_|. | 114 // component of the system with direct access to |client_|. |
115 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; | 115 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDeviceCore); | 117 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDeviceCore); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace media | 120 } // namespace media |
121 | 121 |
122 #endif // MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ | 122 #endif // MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ |
OLD | NEW |