OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ |
| 6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "remoting/host/video_frame_capturer.h" |
| 10 #include "remoting/host/video_frame_capturer_helper.h" |
| 11 |
| 12 namespace remoting { |
| 13 |
| 14 // A VideoFrameCapturerFake generates artificial image for testing purpose. |
| 15 // |
| 16 // VideoFrameCapturerFake is double-buffered as required by VideoFrameCapturer. |
| 17 // See remoting/host/video_frame_capturer.h. |
| 18 class VideoFrameCapturerFake : public VideoFrameCapturer { |
| 19 public: |
| 20 VideoFrameCapturerFake(); |
| 21 virtual ~VideoFrameCapturerFake(); |
| 22 |
| 23 // Overridden from VideoFrameCapturer: |
| 24 virtual void Start( |
| 25 const CursorShapeChangedCallback& callback) OVERRIDE; |
| 26 virtual void Stop() OVERRIDE; |
| 27 virtual void ScreenConfigurationChanged() OVERRIDE; |
| 28 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; |
| 29 virtual void ClearInvalidRegion() OVERRIDE; |
| 30 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; |
| 31 virtual void InvalidateScreen(const SkISize& size) OVERRIDE; |
| 32 virtual void InvalidateFullScreen() OVERRIDE; |
| 33 virtual void CaptureInvalidRegion( |
| 34 const CaptureCompletedCallback& callback) OVERRIDE; |
| 35 virtual const SkISize& size_most_recent() const OVERRIDE; |
| 36 |
| 37 private: |
| 38 // Generates an image in the front buffer. |
| 39 void GenerateImage(); |
| 40 |
| 41 SkISize size_; |
| 42 int bytes_per_row_; |
| 43 int box_pos_x_; |
| 44 int box_pos_y_; |
| 45 int box_speed_x_; |
| 46 int box_speed_y_; |
| 47 |
| 48 VideoFrameCapturerHelper helper_; |
| 49 |
| 50 // We have two buffers for the screen images as required by Capturer. |
| 51 static const int kNumBuffers = 2; |
| 52 scoped_array<uint8> buffers_[kNumBuffers]; |
| 53 |
| 54 // The current buffer with valid data for reading. |
| 55 int current_buffer_; |
| 56 |
| 57 // Format of pixels returned in buffer. |
| 58 media::VideoFrame::Format pixel_format_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(VideoFrameCapturerFake); |
| 61 }; |
| 62 |
| 63 } // namespace remoting |
| 64 |
| 65 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ |
OLD | NEW |