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 class MEDIA_EXPORT ScreenCapturerFake : public ScreenCapturer { |
18 class VideoFrameCapturerFake : public VideoFrameCapturer { | |
19 public: | 19 public: |
20 // VideoFrameCapturerFake generates a picture of size kWidth x kHeight. | 20 // ScreenCapturerFake generates a picture of size kWidth x kHeight. |
21 static const int kWidth = 800; | 21 static const int kWidth = 800; |
22 static const int kHeight = 600; | 22 static const int kHeight = 600; |
23 | 23 |
24 VideoFrameCapturerFake(); | 24 ScreenCapturerFake(); |
25 virtual ~VideoFrameCapturerFake(); | 25 virtual ~ScreenCapturerFake(); |
26 | 26 |
27 // Overridden from VideoFrameCapturer: | 27 // Overridden from ScreenCapturer: |
28 virtual void Start(Delegate* delegate) OVERRIDE; | 28 virtual void Start(Delegate* delegate) OVERRIDE; |
29 virtual void Stop() OVERRIDE; | 29 virtual void Stop() OVERRIDE; |
30 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; | 30 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; |
31 virtual void CaptureFrame() OVERRIDE; | 31 virtual void CaptureFrame() OVERRIDE; |
32 | 32 |
33 private: | 33 private: |
34 // Generates an image in the front buffer. | 34 // Generates an image in the front buffer. |
35 void GenerateImage(); | 35 void GenerateImage(); |
36 | 36 |
37 // Called when the screen configuration is changed. | 37 // Called when the screen configuration is changed. |
38 void ScreenConfigurationChanged(); | 38 void ScreenConfigurationChanged(); |
39 | 39 |
40 Delegate* delegate_; | 40 Delegate* delegate_; |
41 | 41 |
42 SkISize size_; | 42 SkISize size_; |
43 int bytes_per_row_; | 43 int bytes_per_row_; |
44 int box_pos_x_; | 44 int box_pos_x_; |
45 int box_pos_y_; | 45 int box_pos_y_; |
46 int box_speed_x_; | 46 int box_speed_x_; |
47 int box_speed_y_; | 47 int box_speed_y_; |
48 | 48 |
49 VideoFrameCapturerHelper helper_; | 49 ScreenCapturerHelper helper_; |
50 | 50 |
51 // We have two buffers for the screen images as required by Capturer. | 51 // We have two buffers for the screen images as required by Capturer. |
52 static const int kNumBuffers = 2; | 52 static const int kNumBuffers = 2; |
53 scoped_array<uint8> buffers_[kNumBuffers]; | 53 scoped_array<uint8> buffers_[kNumBuffers]; |
54 | 54 |
55 // The current buffer with valid data for reading. | 55 // The current buffer with valid data for reading. |
56 int current_buffer_; | 56 int current_buffer_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(VideoFrameCapturerFake); | 58 DISALLOW_COPY_AND_ASSIGN(ScreenCapturerFake); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace remoting | 61 } // namespace media |
62 | 62 |
63 #endif // REMOTING_CAPTURER_VIDEO_FRAME_CAPTURER_FAKE_H_ | 63 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_FAKE_H_ |
OLD | NEW |