OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 REMOTING_CAPTURER_VIDEO_FRAME_CAPTURER_FAKE_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_FAKE_H_ |
6 #define REMOTING_CAPTURER_VIDEO_FRAME_CAPTURER_FAKE_H_ | 6 #define MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_FAKE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "remoting/capturer/video_frame_capturer.h" | 9 #include "media/base/media_export.h" |
10 #include "remoting/capturer/video_frame_capturer_helper.h" | 10 #include "media/video/capture/screen/screen_capturer.h" |
| 11 #include "media/video/capture/screen/screen_capturer_helper.h" |
11 | 12 |
12 namespace remoting { | 13 namespace media { |
13 | 14 |
14 // A VideoFrameCapturerFake generates artificial image for testing purpose. | 15 // A ScreenCapturerFake generates artificial image for testing purpose. |
15 // | 16 // |
16 // VideoFrameCapturerFake is double-buffered as required by VideoFrameCapturer. | 17 // ScreenCapturerFake is double-buffered as required by ScreenCapturer. |
17 // See remoting/host/video_frame_capturer.h. | 18 // See remoting/host/screen_capturer.h. |
18 class VideoFrameCapturerFake : public VideoFrameCapturer { | 19 class MEDIA_EXPORT ScreenCapturerFake : public ScreenCapturer { |
19 public: | 20 public: |
20 // VideoFrameCapturerFake generates a picture of size kWidth x kHeight. | 21 // ScreenCapturerFake generates a picture of size kWidth x kHeight. |
21 static const int kWidth = 800; | 22 static const int kWidth = 800; |
22 static const int kHeight = 600; | 23 static const int kHeight = 600; |
23 | 24 |
24 VideoFrameCapturerFake(); | 25 ScreenCapturerFake(); |
25 virtual ~VideoFrameCapturerFake(); | 26 virtual ~ScreenCapturerFake(); |
26 | 27 |
27 // Overridden from VideoFrameCapturer: | 28 // Overridden from ScreenCapturer: |
28 virtual void Start(Delegate* delegate) OVERRIDE; | 29 virtual void Start(Delegate* delegate) OVERRIDE; |
29 virtual void Stop() OVERRIDE; | 30 virtual void Stop() OVERRIDE; |
30 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; | 31 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; |
31 virtual void CaptureFrame() OVERRIDE; | 32 virtual void CaptureFrame() OVERRIDE; |
32 | 33 |
33 private: | 34 private: |
34 // Generates an image in the front buffer. | 35 // Generates an image in the front buffer. |
35 void GenerateImage(); | 36 void GenerateImage(); |
36 | 37 |
37 // Called when the screen configuration is changed. | 38 // Called when the screen configuration is changed. |
38 void ScreenConfigurationChanged(); | 39 void ScreenConfigurationChanged(); |
39 | 40 |
40 Delegate* delegate_; | 41 Delegate* delegate_; |
41 | 42 |
42 SkISize size_; | 43 SkISize size_; |
43 int bytes_per_row_; | 44 int bytes_per_row_; |
44 int box_pos_x_; | 45 int box_pos_x_; |
45 int box_pos_y_; | 46 int box_pos_y_; |
46 int box_speed_x_; | 47 int box_speed_x_; |
47 int box_speed_y_; | 48 int box_speed_y_; |
48 | 49 |
49 VideoFrameCapturerHelper helper_; | 50 ScreenCapturerHelper helper_; |
50 | 51 |
51 // We have two buffers for the screen images as required by Capturer. | 52 // We have two buffers for the screen images as required by Capturer. |
52 static const int kNumBuffers = 2; | 53 static const int kNumBuffers = 2; |
53 scoped_array<uint8> buffers_[kNumBuffers]; | 54 scoped_array<uint8> buffers_[kNumBuffers]; |
54 | 55 |
55 // The current buffer with valid data for reading. | 56 // The current buffer with valid data for reading. |
56 int current_buffer_; | 57 int current_buffer_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(VideoFrameCapturerFake); | 59 DISALLOW_COPY_AND_ASSIGN(ScreenCapturerFake); |
59 }; | 60 }; |
60 | 61 |
61 } // namespace remoting | 62 } // namespace media |
62 | 63 |
63 #endif // REMOTING_CAPTURER_VIDEO_FRAME_CAPTURER_FAKE_H_ | 64 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_FAKE_H_ |
OLD | NEW |